From 2ca42af4bc84a7e6d1b1e0119baf95eb3fa0ca7e Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Wed, 21 Feb 2024 11:27:25 -0500 Subject: [PATCH 01/48] common: setting up GraphQL using Yoga and Codegen preset --- packages/indexer-common/codegen.ts | 14 + packages/indexer-common/package.json | 6 +- .../src/indexer-management/client.ts | 11 +- .../src/indexer-management/context.ts | 15 + .../indexer-management/resolvers/actions.ts | 2 +- .../resolvers/cost-models.ts | 2 +- .../resolvers/indexer-status.ts | 2 +- .../resolvers/indexing-rules.ts | 3 +- .../resolvers/poi-disputes.ts | 2 +- .../src/indexer-management/schema.graphql | 408 ++ .../src/indexer-management/yoga.ts | 9 + .../indexer-management/resolvers/Action.ts | 4 + .../resolvers/ActionResult.ts | 4 + .../resolvers/Allocation.ts | 4 + .../indexer-management/resolvers/BigInt.ts | 14 + .../resolvers/BlockPointer.ts | 4 + .../resolvers/ChainIndexingStatus.ts | 4 + .../resolvers/CloseAllocationResult.ts | 4 + .../indexer-management/resolvers/CostModel.ts | 4 + .../resolvers/CreateAllocationResult.ts | 4 + .../resolvers/GeoLocation.ts | 4 + .../resolvers/IndexerAllocation.ts | 4 + .../resolvers/IndexerDeployment.ts | 4 + .../resolvers/IndexerEndpoint.ts | 4 + .../resolvers/IndexerEndpointTest.ts | 4 + .../resolvers/IndexerEndpoints.ts | 4 + .../resolvers/IndexerRegistration.ts | 4 + .../resolvers/IndexingError.ts | 4 + .../resolvers/IndexingRule.ts | 4 + .../resolvers/Mutation/approveActions.ts | 8 + .../resolvers/Mutation/cancelActions.ts | 8 + .../resolvers/Mutation/closeAllocation.ts | 8 + .../resolvers/Mutation/createAllocation.ts | 6 + .../resolvers/Mutation/deleteActions.ts | 8 + .../resolvers/Mutation/deleteCostModels.ts | 6 + .../resolvers/Mutation/deleteDisputes.ts | 8 + .../resolvers/Mutation/deleteIndexingRule.ts | 6 + .../resolvers/Mutation/deleteIndexingRules.ts | 6 + .../Mutation/executeApprovedActions.ts | 6 + .../resolvers/Mutation/queueActions.ts | 8 + .../Mutation/reallocateAllocation.ts | 6 + .../resolvers/Mutation/setCostModel.ts | 8 + .../resolvers/Mutation/setIndexingRule.ts | 8 + .../resolvers/Mutation/storeDisputes.ts | 8 + .../resolvers/Mutation/updateAction.ts | 8 + .../resolvers/Mutation/updateActions.ts | 8 + .../resolvers/POIDispute.ts | 4 + .../resolvers/Query/action.ts | 8 + .../resolvers/Query/actions.ts | 8 + .../resolvers/Query/allocations.ts | 8 + .../resolvers/Query/costModel.ts | 8 + .../resolvers/Query/costModels.ts | 8 + .../resolvers/Query/dispute.ts | 8 + .../resolvers/Query/disputes.ts | 8 + .../resolvers/Query/disputesClosedAfter.ts | 6 + .../resolvers/Query/indexerAllocations.ts | 6 + .../resolvers/Query/indexerDeployments.ts | 6 + .../resolvers/Query/indexerEndpoints.ts | 8 + .../resolvers/Query/indexerRegistration.ts | 6 + .../resolvers/Query/indexingRule.ts | 8 + .../resolvers/Query/indexingRules.ts | 8 + .../resolvers/ReallocateAllocationResult.ts | 4 + .../src/schema/resolvers.generated.ts | 111 + .../src/schema/typeDefs.generated.ts | 5358 +++++++++++++++++ .../src/schema/types.generated.ts | 1246 ++++ packages/indexer-common/tsconfig.json | 2 +- yarn.lock | 1871 +++++- 67 files changed, 9322 insertions(+), 58 deletions(-) create mode 100644 packages/indexer-common/codegen.ts create mode 100644 packages/indexer-common/src/indexer-management/context.ts create mode 100644 packages/indexer-common/src/indexer-management/schema.graphql create mode 100644 packages/indexer-common/src/indexer-management/yoga.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Action.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/ActionResult.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Allocation.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/BigInt.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/BlockPointer.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/ChainIndexingStatus.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/CloseAllocationResult.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/CostModel.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/CreateAllocationResult.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/GeoLocation.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/IndexerAllocation.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/IndexerDeployment.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/IndexerEndpoint.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/IndexerEndpointTest.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/IndexerEndpoints.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/IndexerRegistration.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/IndexingError.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/IndexingRule.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/approveActions.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/cancelActions.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/closeAllocation.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/createAllocation.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteActions.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteCostModels.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteDisputes.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRule.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRules.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/executeApprovedActions.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/queueActions.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/reallocateAllocation.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setCostModel.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setIndexingRule.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/storeDisputes.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/updateAction.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/updateActions.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/POIDispute.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Query/action.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Query/actions.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Query/allocations.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Query/costModel.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Query/costModels.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Query/dispute.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Query/disputes.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Query/disputesClosedAfter.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerAllocations.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerDeployments.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerEndpoints.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerRegistration.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRule.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRules.ts create mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/ReallocateAllocationResult.ts create mode 100644 packages/indexer-common/src/schema/resolvers.generated.ts create mode 100644 packages/indexer-common/src/schema/typeDefs.generated.ts create mode 100644 packages/indexer-common/src/schema/types.generated.ts diff --git a/packages/indexer-common/codegen.ts b/packages/indexer-common/codegen.ts new file mode 100644 index 000000000..dec76e0ce --- /dev/null +++ b/packages/indexer-common/codegen.ts @@ -0,0 +1,14 @@ +import type { CodegenConfig } from '@graphql-codegen/cli' +import { defineConfig } from '@eddeee888/gcg-typescript-resolver-files' + +const config: CodegenConfig = { + schema: 'src/indexer-management/schema.graphql', + generates: { + 'src/schema': defineConfig({ + typesPluginsConfig: { + contextType: '@graphprotocol/indexer-common#IndexerManagementResolverContext', + }, + }), + }, +} +export default config diff --git a/packages/indexer-common/package.json b/packages/indexer-common/package.json index e5d8b3135..7f43a280d 100644 --- a/packages/indexer-common/package.json +++ b/packages/indexer-common/package.json @@ -19,7 +19,8 @@ "test:ci": "LOG_LEVEL=info jest --verbose --maxWorkers=1 --ci", "test:debug": "LOG_LEVEL=debug jest --runInBand --detectOpenHandles --verbose", "test:watch": "jest --runInBand --detectOpenHandles --watch --passWithNoTests --verbose", - "clean": "rm -rf ./node_modules ./dist ./tsconfig.tsbuildinfo" + "clean": "rm -rf ./node_modules ./dist ./tsconfig.tsbuildinfo", + "codegen": "graphql-codegen --config codegen.ts" }, "dependencies": { "@graphprotocol/common-ts": "2.0.9", @@ -39,6 +40,7 @@ "fastify": "3.25.0", "graphql": "16.8.0", "graphql-tag": "2.12.6", + "graphql-yoga": "^5.1.1", "jayson": "3.6.6", "lodash.clonedeep": "^4.5.0", "lodash.groupby": "^4.6.0", @@ -58,6 +60,8 @@ }, "devDependencies": { "@babel/plugin-transform-modules-commonjs": "^7.23.3", + "@eddeee888/gcg-typescript-resolver-files": "^0.7.2", + "@graphql-codegen/cli": "^5.0.2", "@types/cors": "2.8.14", "@types/express": "4.17.17", "@types/jest": "29.5.4", diff --git a/packages/indexer-common/src/indexer-management/client.ts b/packages/indexer-common/src/indexer-management/client.ts index 648dea8cc..2b839bfd8 100644 --- a/packages/indexer-common/src/indexer-management/client.ts +++ b/packages/indexer-common/src/indexer-management/client.ts @@ -16,16 +16,7 @@ import { BigNumber } from 'ethers' import { Op, Sequelize } from 'sequelize' import { GraphNode } from '../graph-node' import { ActionManager, MultiNetworks, Network } from '@graphprotocol/indexer-common' - -export interface IndexerManagementResolverContext { - models: IndexerManagementModels - graphNode: GraphNode - logger: Logger - defaults: IndexerManagementDefaults - actionManager: ActionManager | undefined - multiNetworks: MultiNetworks | undefined - dai: WritableEventual -} +import { IndexerManagementResolverContext } from './context' const SCHEMA_SDL = gql` scalar BigInt diff --git a/packages/indexer-common/src/indexer-management/context.ts b/packages/indexer-common/src/indexer-management/context.ts new file mode 100644 index 000000000..61cafd507 --- /dev/null +++ b/packages/indexer-common/src/indexer-management/context.ts @@ -0,0 +1,15 @@ +import { Logger, WritableEventual } from '@graphprotocol/common-ts' +import { IndexerManagementModels } from './models' +import { GraphNode } from '../graph-node' +import { ActionManager, MultiNetworks, Network } from '@graphprotocol/indexer-common' +import { IndexerManagementDefaults } from './client' + +export interface IndexerManagementResolverContext { + models: IndexerManagementModels + graphNode: GraphNode + logger: Logger + defaults: IndexerManagementDefaults + actionManager: ActionManager | undefined + multiNetworks: MultiNetworks | undefined + dai: WritableEventual +} diff --git a/packages/indexer-common/src/indexer-management/resolvers/actions.ts b/packages/indexer-common/src/indexer-management/resolvers/actions.ts index d82b70800..08518e20e 100644 --- a/packages/indexer-common/src/indexer-management/resolvers/actions.ts +++ b/packages/indexer-common/src/indexer-management/resolvers/actions.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/ban-types */ -import { IndexerManagementResolverContext } from '../client' +import { IndexerManagementResolverContext } from '../context' import { Logger } from '@graphprotocol/common-ts' import { Action, diff --git a/packages/indexer-common/src/indexer-management/resolvers/cost-models.ts b/packages/indexer-common/src/indexer-management/resolvers/cost-models.ts index 102ad4991..67cfdd367 100644 --- a/packages/indexer-common/src/indexer-management/resolvers/cost-models.ts +++ b/packages/indexer-common/src/indexer-management/resolvers/cost-models.ts @@ -7,7 +7,7 @@ import { GraphQLCostModel, parseGraphQLCostModel, } from '../models' -import { IndexerManagementResolverContext } from '../client' +import { IndexerManagementResolverContext } from '../context' import { compileAsync } from '@graphprotocol/cost-model' // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/packages/indexer-common/src/indexer-management/resolvers/indexer-status.ts b/packages/indexer-common/src/indexer-management/resolvers/indexer-status.ts index dad36df87..76be9f894 100644 --- a/packages/indexer-common/src/indexer-management/resolvers/indexer-status.ts +++ b/packages/indexer-common/src/indexer-management/resolvers/indexer-status.ts @@ -2,7 +2,7 @@ import geohash from 'ngeohash' import gql from 'graphql-tag' -import { IndexerManagementResolverContext } from '../client' +import { IndexerManagementResolverContext } from '../context' import { SubgraphDeploymentID } from '@graphprotocol/common-ts' import { indexerError, diff --git a/packages/indexer-common/src/indexer-management/resolvers/indexing-rules.ts b/packages/indexer-common/src/indexer-management/resolvers/indexing-rules.ts index b9a4c32d1..954ef42ca 100644 --- a/packages/indexer-common/src/indexer-management/resolvers/indexing-rules.ts +++ b/packages/indexer-common/src/indexer-management/resolvers/indexing-rules.ts @@ -6,7 +6,8 @@ import { IndexingRuleIdentifier, IndexingRuleCreationAttributes, } from '../models' -import { IndexerManagementDefaults, IndexerManagementResolverContext } from '../client' +import { IndexerManagementDefaults } from '../client' +import { IndexerManagementResolverContext } from '../context' import { Transaction } from 'sequelize/types' import { fetchIndexingRules } from '../rules' import { processIdentifier } from '../../' diff --git a/packages/indexer-common/src/indexer-management/resolvers/poi-disputes.ts b/packages/indexer-common/src/indexer-management/resolvers/poi-disputes.ts index faf200fcd..0ec6eaabb 100644 --- a/packages/indexer-common/src/indexer-management/resolvers/poi-disputes.ts +++ b/packages/indexer-common/src/indexer-management/resolvers/poi-disputes.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/ban-types */ import { POIDispute, POIDisputeIdentifier, POIDisputeCreationAttributes } from '../models' -import { IndexerManagementResolverContext } from '../client' +import { IndexerManagementResolverContext } from '../context' import { validateNetworkIdentifier } from '../../parsers' import { Op, WhereOptions } from 'sequelize' import groupBy from 'lodash.groupby' diff --git a/packages/indexer-common/src/indexer-management/schema.graphql b/packages/indexer-common/src/indexer-management/schema.graphql new file mode 100644 index 000000000..9fa32dae9 --- /dev/null +++ b/packages/indexer-common/src/indexer-management/schema.graphql @@ -0,0 +1,408 @@ +scalar BigInt + +enum OrderDirection { + asc + desc +} + +enum IndexingDecisionBasis { + rules + never + always + offchain +} + +enum IdentifierType { + deployment + subgraph + group +} + +input AllocationFilter { + status: String + allocation: String + subgraphDeployment: String + protocolNetwork: String +} + +enum AllocationStatus { + Null # == indexer == address(0) + Active # == not Null && tokens > 0 # + Closed # == Active && closedAtEpoch != 0. Still can collect, while you are waiting to be finalized. a.k.a settling + Finalized # == Closing && closedAtEpoch + channelDisputeEpochs > now(). Note, the subgraph has no way to return this value. it is implied + Claimed # == not Null && tokens == 0 - i.e. finalized, and all tokens withdrawn +} + +type Allocation { + id: String! + indexer: String! + subgraphDeployment: String! + allocatedTokens: String! + createdAtEpoch: Int! + closedAtEpoch: Int + ageInEpochs: Int! + indexingRewards: String! + queryFeesCollected: String! + signalledTokens: BigInt! + stakedTokens: BigInt! + status: AllocationStatus! + protocolNetwork: String! +} + +type CreateAllocationResult { + allocation: String! + deployment: String! + allocatedTokens: String! + protocolNetwork: String! +} + +type CloseAllocationResult { + allocation: String! + allocatedTokens: String! + indexingRewards: String! + receiptsWorthCollecting: Boolean! + protocolNetwork: String! +} + +type ReallocateAllocationResult { + closedAllocation: String! + indexingRewardsCollected: String! + receiptsWorthCollecting: Boolean! + createdAllocation: String! + createdAllocationStake: String! + protocolNetwork: String! +} + +enum ActionStatus { + queued + approved + pending + success + failed + canceled +} + +enum ActionType { + allocate + unallocate + reallocate +} + +type Action { + id: Int! + status: ActionStatus! + type: ActionType! + deploymentID: String + allocationID: String + amount: String + poi: String + force: Boolean + priority: Int! + source: String! + reason: String! + transaction: String + failureReason: String + createdAt: BigInt! + updatedAt: BigInt + protocolNetwork: String! +} + +input ActionInput { + status: ActionStatus! + type: ActionType! + deploymentID: String + allocationID: String + amount: String + poi: String + force: Boolean + source: String! + reason: String! + priority: Int! + protocolNetwork: String! +} + +input ActionUpdateInput { + id: Int + deploymentID: String + allocationID: String + amount: Int + poi: String + force: Boolean + type: ActionType + status: ActionStatus + reason: String +} + +enum ActionParams { + id + status + type + deploymentID + allocationID + transaction + amount + poi + force + source + reason + priority + createdAt + updatedAt + protocolNetwork +} + +type ActionResult { + id: Int! + type: ActionType! + deploymentID: String + allocationID: String + amount: String + poi: String + force: Boolean + source: String! + reason: String! + status: String! + transaction: String + failureReason: String + priority: Int + protocolNetwork: String! +} + +input ActionFilter { + id: Int + protocolNetwork: String + type: ActionType + status: String + source: String + reason: String +} + +input POIDisputeIdentifier { + allocationID: String! + protocolNetwork: String! +} + +type POIDispute { + allocationID: String! + subgraphDeploymentID: String! + allocationIndexer: String! + allocationAmount: BigInt! + allocationProof: String! + closedEpoch: Int! + closedEpochStartBlockHash: String! + closedEpochStartBlockNumber: Int! + closedEpochReferenceProof: String + previousEpochStartBlockHash: String! + previousEpochStartBlockNumber: Int! + previousEpochReferenceProof: String + status: String! + protocolNetwork: String! +} + +input POIDisputeInput { + allocationID: String! + subgraphDeploymentID: String! + allocationIndexer: String! + allocationAmount: BigInt! + allocationProof: String! + closedEpoch: Int! + closedEpochStartBlockHash: String! + closedEpochStartBlockNumber: Int! + closedEpochReferenceProof: String + previousEpochStartBlockHash: String! + previousEpochStartBlockNumber: Int! + previousEpochReferenceProof: String + status: String! + protocolNetwork: String! +} + +type IndexingRule { + identifier: String! + identifierType: IdentifierType! + allocationAmount: BigInt + allocationLifetime: Int + autoRenewal: Boolean! + parallelAllocations: Int + maxAllocationPercentage: Float + minSignal: BigInt + maxSignal: BigInt + minStake: BigInt + minAverageQueryFees: BigInt + custom: String + decisionBasis: IndexingDecisionBasis! + requireSupported: Boolean! + safety: Boolean! + protocolNetwork: String! +} + +input IndexingRuleInput { + identifier: String! + identifierType: IdentifierType! + allocationAmount: BigInt + allocationLifetime: Int + autoRenewal: Boolean + parallelAllocations: Int + maxAllocationPercentage: Float + minSignal: BigInt + maxSignal: BigInt + minStake: BigInt + minAverageQueryFees: BigInt + custom: String + decisionBasis: IndexingDecisionBasis + requireSupported: Boolean + safety: Boolean + protocolNetwork: String! +} + +input IndexingRuleIdentifier { + identifier: String! + protocolNetwork: String! +} + +type GeoLocation { + latitude: String! + longitude: String! +} + +type IndexerRegistration { + url: String + protocolNetwork: String! + address: String + registered: Boolean! + location: GeoLocation +} + +type IndexingError { + handler: String + message: String! +} + +type BlockPointer { + number: Int! + hash: String! +} + +type ChainIndexingStatus { + network: String! + latestBlock: BlockPointer + chainHeadBlock: BlockPointer + earliestBlock: BlockPointer +} + +type IndexerDeployment { + subgraphDeployment: String! + synced: Boolean! + health: String! + fatalError: IndexingError + node: String + chains: [ChainIndexingStatus] +} + +type IndexerAllocation { + id: String! + allocatedTokens: BigInt! + createdAtEpoch: Int! + closedAtEpoch: Int + subgraphDeployment: String! + signalledTokens: BigInt! + stakedTokens: BigInt! +} + +type IndexerEndpointTest { + test: String! + error: String + possibleActions: [String]! +} + +type IndexerEndpoint { + url: String + healthy: Boolean! + protocolNetwork: String! + tests: [IndexerEndpointTest!]! +} + +type IndexerEndpoints { + service: IndexerEndpoint! + status: IndexerEndpoint! +} + +type CostModel { + deployment: String! + model: String + variables: String +} + +input CostModelInput { + deployment: String! + model: String + variables: String +} + +type Query { + indexingRule( + identifier: IndexingRuleIdentifier! + merged: Boolean! = false + ): IndexingRule + indexingRules(merged: Boolean! = false, protocolNetwork: String): [IndexingRule!]! + indexerRegistration(protocolNetwork: String!): IndexerRegistration! + indexerDeployments: [IndexerDeployment]! + indexerAllocations(protocolNetwork: String!): [IndexerAllocation]! + indexerEndpoints(protocolNetwork: String): [IndexerEndpoints!]! + + costModels(deployments: [String!]): [CostModel!]! + costModel(deployment: String!): CostModel + + dispute(identifier: POIDisputeIdentifier!): POIDispute + disputes(status: String!, minClosedEpoch: Int!, protocolNetwork: String): [POIDispute]! + disputesClosedAfter(closedAfterBlock: BigInt!, protocolNetwork: String): [POIDispute]! + + allocations(filter: AllocationFilter!): [Allocation!]! + + action(actionID: String!): Action + actions( + filter: ActionFilter + orderBy: ActionParams + orderDirection: OrderDirection + first: Int + ): [Action]! +} + +type Mutation { + setIndexingRule(rule: IndexingRuleInput!): IndexingRule! + deleteIndexingRule(identifier: IndexingRuleIdentifier!): Boolean! + deleteIndexingRules(identifiers: [IndexingRuleIdentifier!]!): Boolean! + + setCostModel(costModel: CostModelInput!): CostModel! + deleteCostModels(deployments: [String!]!): Int! + + storeDisputes(disputes: [POIDisputeInput!]!): [POIDispute!] + deleteDisputes(identifiers: [POIDisputeIdentifier!]!): Int! + + createAllocation( + deployment: String! + amount: String! + indexNode: String + protocolNetwork: String! + ): CreateAllocationResult! + closeAllocation( + allocation: String! + poi: String + force: Boolean + protocolNetwork: String! + ): CloseAllocationResult! + reallocateAllocation( + allocation: String! + poi: String + amount: String! + force: Boolean + protocolNetwork: String! + ): ReallocateAllocationResult! + + updateAction(action: ActionInput!): Action! + updateActions(filter: ActionFilter!, action: ActionUpdateInput!): [Action]! + queueActions(actions: [ActionInput!]!): [Action]! + cancelActions(actionIDs: [String!]!): [Action]! + deleteActions(actionIDs: [String!]!): Int! + approveActions(actionIDs: [String!]!): [Action]! + executeApprovedActions: [ActionResult!]! +} diff --git a/packages/indexer-common/src/indexer-management/yoga.ts b/packages/indexer-common/src/indexer-management/yoga.ts new file mode 100644 index 000000000..b069784c8 --- /dev/null +++ b/packages/indexer-common/src/indexer-management/yoga.ts @@ -0,0 +1,9 @@ +import { createYoga, createSchema } from 'graphql-yoga' +import { typeDefs } from '../schema/typeDefs.generated' +import { resolvers } from '../schema/resolvers.generated' +import { IndexerManagementResolverContext } from './context' + +const yoga = createYoga({ + schema: createSchema({ typeDefs, resolvers }), + context: (req) => {}, +}) diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Action.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Action.ts new file mode 100644 index 000000000..5c27ab6ea --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Action.ts @@ -0,0 +1,4 @@ +import type { ActionResolvers } from './../../types.generated' +export const Action: ActionResolvers = { + /* Implement Action resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/ActionResult.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/ActionResult.ts new file mode 100644 index 000000000..d762c6591 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/ActionResult.ts @@ -0,0 +1,4 @@ +import type { ActionResultResolvers } from './../../types.generated' +export const ActionResult: ActionResultResolvers = { + /* Implement ActionResult resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Allocation.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Allocation.ts new file mode 100644 index 000000000..9a602c8d0 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Allocation.ts @@ -0,0 +1,4 @@ +import type { AllocationResolvers } from './../../types.generated' +export const Allocation: AllocationResolvers = { + /* Implement Allocation resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/BigInt.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/BigInt.ts new file mode 100644 index 000000000..7515eca21 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/BigInt.ts @@ -0,0 +1,14 @@ +import { GraphQLScalarType } from 'graphql' +export const BigInt = new GraphQLScalarType({ + name: 'BigInt', + description: 'BigInt description', + serialize: (value) => { + /* Implement logic to turn the returned value from resolvers to a value that can be sent to clients */ + }, + parseValue: (value) => { + /* Implement logic to parse input that was sent to the server as variables */ + }, + parseLiteral: (ast) => { + /* Implement logic to parse input that was sent to the server as literal values (string, number, or boolean) */ + }, +}) diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/BlockPointer.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/BlockPointer.ts new file mode 100644 index 000000000..49e2ce4d3 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/BlockPointer.ts @@ -0,0 +1,4 @@ +import type { BlockPointerResolvers } from './../../types.generated' +export const BlockPointer: BlockPointerResolvers = { + /* Implement BlockPointer resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/ChainIndexingStatus.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/ChainIndexingStatus.ts new file mode 100644 index 000000000..9dfce06ea --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/ChainIndexingStatus.ts @@ -0,0 +1,4 @@ +import type { ChainIndexingStatusResolvers } from './../../types.generated' +export const ChainIndexingStatus: ChainIndexingStatusResolvers = { + /* Implement ChainIndexingStatus resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/CloseAllocationResult.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/CloseAllocationResult.ts new file mode 100644 index 000000000..38f028aaf --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/CloseAllocationResult.ts @@ -0,0 +1,4 @@ +import type { CloseAllocationResultResolvers } from './../../types.generated' +export const CloseAllocationResult: CloseAllocationResultResolvers = { + /* Implement CloseAllocationResult resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/CostModel.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/CostModel.ts new file mode 100644 index 000000000..826067081 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/CostModel.ts @@ -0,0 +1,4 @@ +import type { CostModelResolvers } from './../../types.generated' +export const CostModel: CostModelResolvers = { + /* Implement CostModel resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/CreateAllocationResult.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/CreateAllocationResult.ts new file mode 100644 index 000000000..3400c6f16 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/CreateAllocationResult.ts @@ -0,0 +1,4 @@ +import type { CreateAllocationResultResolvers } from './../../types.generated' +export const CreateAllocationResult: CreateAllocationResultResolvers = { + /* Implement CreateAllocationResult resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/GeoLocation.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/GeoLocation.ts new file mode 100644 index 000000000..1f58baee8 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/GeoLocation.ts @@ -0,0 +1,4 @@ +import type { GeoLocationResolvers } from './../../types.generated' +export const GeoLocation: GeoLocationResolvers = { + /* Implement GeoLocation resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/IndexerAllocation.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/IndexerAllocation.ts new file mode 100644 index 000000000..a6ac46472 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/IndexerAllocation.ts @@ -0,0 +1,4 @@ +import type { IndexerAllocationResolvers } from './../../types.generated' +export const IndexerAllocation: IndexerAllocationResolvers = { + /* Implement IndexerAllocation resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/IndexerDeployment.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/IndexerDeployment.ts new file mode 100644 index 000000000..9d426ff46 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/IndexerDeployment.ts @@ -0,0 +1,4 @@ +import type { IndexerDeploymentResolvers } from './../../types.generated' +export const IndexerDeployment: IndexerDeploymentResolvers = { + /* Implement IndexerDeployment resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/IndexerEndpoint.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/IndexerEndpoint.ts new file mode 100644 index 000000000..c9e2bb963 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/IndexerEndpoint.ts @@ -0,0 +1,4 @@ +import type { IndexerEndpointResolvers } from './../../types.generated' +export const IndexerEndpoint: IndexerEndpointResolvers = { + /* Implement IndexerEndpoint resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/IndexerEndpointTest.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/IndexerEndpointTest.ts new file mode 100644 index 000000000..f33ac8f93 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/IndexerEndpointTest.ts @@ -0,0 +1,4 @@ +import type { IndexerEndpointTestResolvers } from './../../types.generated' +export const IndexerEndpointTest: IndexerEndpointTestResolvers = { + /* Implement IndexerEndpointTest resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/IndexerEndpoints.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/IndexerEndpoints.ts new file mode 100644 index 000000000..df96b5391 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/IndexerEndpoints.ts @@ -0,0 +1,4 @@ +import type { IndexerEndpointsResolvers } from './../../types.generated' +export const IndexerEndpoints: IndexerEndpointsResolvers = { + /* Implement IndexerEndpoints resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/IndexerRegistration.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/IndexerRegistration.ts new file mode 100644 index 000000000..e4ede2e34 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/IndexerRegistration.ts @@ -0,0 +1,4 @@ +import type { IndexerRegistrationResolvers } from './../../types.generated' +export const IndexerRegistration: IndexerRegistrationResolvers = { + /* Implement IndexerRegistration resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/IndexingError.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/IndexingError.ts new file mode 100644 index 000000000..3a4916c17 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/IndexingError.ts @@ -0,0 +1,4 @@ +import type { IndexingErrorResolvers } from './../../types.generated' +export const IndexingError: IndexingErrorResolvers = { + /* Implement IndexingError resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/IndexingRule.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/IndexingRule.ts new file mode 100644 index 000000000..4ec62a436 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/IndexingRule.ts @@ -0,0 +1,4 @@ +import type { IndexingRuleResolvers } from './../../types.generated' +export const IndexingRule: IndexingRuleResolvers = { + /* Implement IndexingRule resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/approveActions.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/approveActions.ts new file mode 100644 index 000000000..948912c2e --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/approveActions.ts @@ -0,0 +1,8 @@ +import type { MutationResolvers } from './../../../types.generated' +export const approveActions: NonNullable = async ( + _parent, + _arg, + _ctx, +) => { + /* Implement Mutation.approveActions resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/cancelActions.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/cancelActions.ts new file mode 100644 index 000000000..7d7275d75 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/cancelActions.ts @@ -0,0 +1,8 @@ +import type { MutationResolvers } from './../../../types.generated' +export const cancelActions: NonNullable = async ( + _parent, + _arg, + _ctx, +) => { + /* Implement Mutation.cancelActions resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/closeAllocation.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/closeAllocation.ts new file mode 100644 index 000000000..abb239735 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/closeAllocation.ts @@ -0,0 +1,8 @@ +import type { MutationResolvers } from './../../../types.generated' +export const closeAllocation: NonNullable = async ( + _parent, + _arg, + _ctx, +) => { + /* Implement Mutation.closeAllocation resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/createAllocation.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/createAllocation.ts new file mode 100644 index 000000000..89e72e568 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/createAllocation.ts @@ -0,0 +1,6 @@ +import type { MutationResolvers } from './../../../types.generated' +export const createAllocation: NonNullable< + MutationResolvers['createAllocation'] +> = async (_parent, _arg, _ctx) => { + /* Implement Mutation.createAllocation resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteActions.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteActions.ts new file mode 100644 index 000000000..cce54de91 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteActions.ts @@ -0,0 +1,8 @@ +import type { MutationResolvers } from './../../../types.generated' +export const deleteActions: NonNullable = async ( + _parent, + _arg, + _ctx, +) => { + /* Implement Mutation.deleteActions resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteCostModels.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteCostModels.ts new file mode 100644 index 000000000..0ca368f69 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteCostModels.ts @@ -0,0 +1,6 @@ +import type { MutationResolvers } from './../../../types.generated' +export const deleteCostModels: NonNullable< + MutationResolvers['deleteCostModels'] +> = async (_parent, _arg, _ctx) => { + /* Implement Mutation.deleteCostModels resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteDisputes.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteDisputes.ts new file mode 100644 index 000000000..a56313892 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteDisputes.ts @@ -0,0 +1,8 @@ +import type { MutationResolvers } from './../../../types.generated' +export const deleteDisputes: NonNullable = async ( + _parent, + _arg, + _ctx, +) => { + /* Implement Mutation.deleteDisputes resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRule.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRule.ts new file mode 100644 index 000000000..83316c93a --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRule.ts @@ -0,0 +1,6 @@ +import type { MutationResolvers } from './../../../types.generated' +export const deleteIndexingRule: NonNullable< + MutationResolvers['deleteIndexingRule'] +> = async (_parent, _arg, _ctx) => { + /* Implement Mutation.deleteIndexingRule resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRules.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRules.ts new file mode 100644 index 000000000..67c4eaa55 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRules.ts @@ -0,0 +1,6 @@ +import type { MutationResolvers } from './../../../types.generated' +export const deleteIndexingRules: NonNullable< + MutationResolvers['deleteIndexingRules'] +> = async (_parent, _arg, _ctx) => { + /* Implement Mutation.deleteIndexingRules resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/executeApprovedActions.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/executeApprovedActions.ts new file mode 100644 index 000000000..d3c1824eb --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/executeApprovedActions.ts @@ -0,0 +1,6 @@ +import type { MutationResolvers } from './../../../types.generated' +export const executeApprovedActions: NonNullable< + MutationResolvers['executeApprovedActions'] +> = async (_parent, _arg, _ctx) => { + /* Implement Mutation.executeApprovedActions resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/queueActions.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/queueActions.ts new file mode 100644 index 000000000..3b0bb9bf5 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/queueActions.ts @@ -0,0 +1,8 @@ +import type { MutationResolvers } from './../../../types.generated' +export const queueActions: NonNullable = async ( + _parent, + _arg, + _ctx, +) => { + /* Implement Mutation.queueActions resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/reallocateAllocation.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/reallocateAllocation.ts new file mode 100644 index 000000000..832af329a --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/reallocateAllocation.ts @@ -0,0 +1,6 @@ +import type { MutationResolvers } from './../../../types.generated' +export const reallocateAllocation: NonNullable< + MutationResolvers['reallocateAllocation'] +> = async (_parent, _arg, _ctx) => { + /* Implement Mutation.reallocateAllocation resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setCostModel.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setCostModel.ts new file mode 100644 index 000000000..32a56e436 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setCostModel.ts @@ -0,0 +1,8 @@ +import type { MutationResolvers } from './../../../types.generated' +export const setCostModel: NonNullable = async ( + _parent, + _arg, + _ctx, +) => { + /* Implement Mutation.setCostModel resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setIndexingRule.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setIndexingRule.ts new file mode 100644 index 000000000..b02d5bc83 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setIndexingRule.ts @@ -0,0 +1,8 @@ +import type { MutationResolvers } from './../../../types.generated' +export const setIndexingRule: NonNullable = async ( + _parent, + _arg, + _ctx, +) => { + /* Implement Mutation.setIndexingRule resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/storeDisputes.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/storeDisputes.ts new file mode 100644 index 000000000..94d57e92a --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/storeDisputes.ts @@ -0,0 +1,8 @@ +import type { MutationResolvers } from './../../../types.generated' +export const storeDisputes: NonNullable = async ( + _parent, + _arg, + _ctx, +) => { + /* Implement Mutation.storeDisputes resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/updateAction.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/updateAction.ts new file mode 100644 index 000000000..61e32ccd6 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/updateAction.ts @@ -0,0 +1,8 @@ +import type { MutationResolvers } from './../../../types.generated' +export const updateAction: NonNullable = async ( + _parent, + _arg, + _ctx, +) => { + /* Implement Mutation.updateAction resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/updateActions.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/updateActions.ts new file mode 100644 index 000000000..dd510dcc9 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/updateActions.ts @@ -0,0 +1,8 @@ +import type { MutationResolvers } from './../../../types.generated' +export const updateActions: NonNullable = async ( + _parent, + _arg, + _ctx, +) => { + /* Implement Mutation.updateActions resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/POIDispute.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/POIDispute.ts new file mode 100644 index 000000000..7120915a1 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/POIDispute.ts @@ -0,0 +1,4 @@ +import type { POIDisputeResolvers } from './../../types.generated' +export const POIDispute: POIDisputeResolvers = { + /* Implement POIDispute resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/action.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/action.ts new file mode 100644 index 000000000..38fed08f6 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/action.ts @@ -0,0 +1,8 @@ +import type { QueryResolvers } from './../../../types.generated' +export const action: NonNullable = async ( + _parent, + _arg, + _ctx, +) => { + /* Implement Query.action resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/actions.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/actions.ts new file mode 100644 index 000000000..6e580e46c --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/actions.ts @@ -0,0 +1,8 @@ +import type { QueryResolvers } from './../../../types.generated' +export const actions: NonNullable = async ( + _parent, + _arg, + _ctx, +) => { + /* Implement Query.actions resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/allocations.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/allocations.ts new file mode 100644 index 000000000..8982edb93 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/allocations.ts @@ -0,0 +1,8 @@ +import type { QueryResolvers } from './../../../types.generated' +export const allocations: NonNullable = async ( + _parent, + _arg, + _ctx, +) => { + /* Implement Query.allocations resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/costModel.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/costModel.ts new file mode 100644 index 000000000..a8d5441c6 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/costModel.ts @@ -0,0 +1,8 @@ +import type { QueryResolvers } from './../../../types.generated' +export const costModel: NonNullable = async ( + _parent, + _arg, + _ctx, +) => { + /* Implement Query.costModel resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/costModels.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/costModels.ts new file mode 100644 index 000000000..f4c2f4891 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/costModels.ts @@ -0,0 +1,8 @@ +import type { QueryResolvers } from './../../../types.generated' +export const costModels: NonNullable = async ( + _parent, + _arg, + _ctx, +) => { + /* Implement Query.costModels resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/dispute.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/dispute.ts new file mode 100644 index 000000000..cf96327d3 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/dispute.ts @@ -0,0 +1,8 @@ +import type { QueryResolvers } from './../../../types.generated' +export const dispute: NonNullable = async ( + _parent, + _arg, + _ctx, +) => { + /* Implement Query.dispute resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/disputes.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/disputes.ts new file mode 100644 index 000000000..5921cf202 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/disputes.ts @@ -0,0 +1,8 @@ +import type { QueryResolvers } from './../../../types.generated' +export const disputes: NonNullable = async ( + _parent, + _arg, + _ctx, +) => { + /* Implement Query.disputes resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/disputesClosedAfter.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/disputesClosedAfter.ts new file mode 100644 index 000000000..160943cd5 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/disputesClosedAfter.ts @@ -0,0 +1,6 @@ +import type { QueryResolvers } from './../../../types.generated' +export const disputesClosedAfter: NonNullable< + QueryResolvers['disputesClosedAfter'] +> = async (_parent, _arg, _ctx) => { + /* Implement Query.disputesClosedAfter resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerAllocations.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerAllocations.ts new file mode 100644 index 000000000..c54ec8c68 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerAllocations.ts @@ -0,0 +1,6 @@ +import type { QueryResolvers } from './../../../types.generated' +export const indexerAllocations: NonNullable< + QueryResolvers['indexerAllocations'] +> = async (_parent, _arg, _ctx) => { + /* Implement Query.indexerAllocations resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerDeployments.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerDeployments.ts new file mode 100644 index 000000000..ec9132198 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerDeployments.ts @@ -0,0 +1,6 @@ +import type { QueryResolvers } from './../../../types.generated' +export const indexerDeployments: NonNullable< + QueryResolvers['indexerDeployments'] +> = async (_parent, _arg, _ctx) => { + /* Implement Query.indexerDeployments resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerEndpoints.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerEndpoints.ts new file mode 100644 index 000000000..da52dec6a --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerEndpoints.ts @@ -0,0 +1,8 @@ +import type { QueryResolvers } from './../../../types.generated' +export const indexerEndpoints: NonNullable = async ( + _parent, + _arg, + _ctx, +) => { + /* Implement Query.indexerEndpoints resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerRegistration.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerRegistration.ts new file mode 100644 index 000000000..9b6e2d49b --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerRegistration.ts @@ -0,0 +1,6 @@ +import type { QueryResolvers } from './../../../types.generated' +export const indexerRegistration: NonNullable< + QueryResolvers['indexerRegistration'] +> = async (_parent, _arg, _ctx) => { + /* Implement Query.indexerRegistration resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRule.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRule.ts new file mode 100644 index 000000000..7f4b38a15 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRule.ts @@ -0,0 +1,8 @@ +import type { QueryResolvers } from './../../../types.generated' +export const indexingRule: NonNullable = async ( + _parent, + _arg, + _ctx, +) => { + /* Implement Query.indexingRule resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRules.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRules.ts new file mode 100644 index 000000000..c0bad7029 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRules.ts @@ -0,0 +1,8 @@ +import type { QueryResolvers } from './../../../types.generated' +export const indexingRules: NonNullable = async ( + _parent, + _arg, + _ctx, +) => { + /* Implement Query.indexingRules resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/ReallocateAllocationResult.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/ReallocateAllocationResult.ts new file mode 100644 index 000000000..5671e7f63 --- /dev/null +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/ReallocateAllocationResult.ts @@ -0,0 +1,4 @@ +import type { ReallocateAllocationResultResolvers } from './../../types.generated' +export const ReallocateAllocationResult: ReallocateAllocationResultResolvers = { + /* Implement ReallocateAllocationResult resolver logic here */ +} diff --git a/packages/indexer-common/src/schema/resolvers.generated.ts b/packages/indexer-common/src/schema/resolvers.generated.ts new file mode 100644 index 000000000..9b54215f4 --- /dev/null +++ b/packages/indexer-common/src/schema/resolvers.generated.ts @@ -0,0 +1,111 @@ +/* This file was automatically generated. DO NOT UPDATE MANUALLY. */ +import type { Resolvers } from './types.generated' +import { Action } from './indexer-management/resolvers/Action' +import { ActionResult } from './indexer-management/resolvers/ActionResult' +import { Allocation } from './indexer-management/resolvers/Allocation' +import { BigInt } from './indexer-management/resolvers/BigInt' +import { BlockPointer } from './indexer-management/resolvers/BlockPointer' +import { ChainIndexingStatus } from './indexer-management/resolvers/ChainIndexingStatus' +import { CloseAllocationResult } from './indexer-management/resolvers/CloseAllocationResult' +import { CostModel } from './indexer-management/resolvers/CostModel' +import { CreateAllocationResult } from './indexer-management/resolvers/CreateAllocationResult' +import { GeoLocation } from './indexer-management/resolvers/GeoLocation' +import { IndexerAllocation } from './indexer-management/resolvers/IndexerAllocation' +import { IndexerDeployment } from './indexer-management/resolvers/IndexerDeployment' +import { IndexerEndpoint } from './indexer-management/resolvers/IndexerEndpoint' +import { IndexerEndpointTest } from './indexer-management/resolvers/IndexerEndpointTest' +import { IndexerEndpoints } from './indexer-management/resolvers/IndexerEndpoints' +import { IndexerRegistration } from './indexer-management/resolvers/IndexerRegistration' +import { IndexingError } from './indexer-management/resolvers/IndexingError' +import { IndexingRule } from './indexer-management/resolvers/IndexingRule' +import { approveActions as Mutation_approveActions } from './indexer-management/resolvers/Mutation/approveActions' +import { cancelActions as Mutation_cancelActions } from './indexer-management/resolvers/Mutation/cancelActions' +import { closeAllocation as Mutation_closeAllocation } from './indexer-management/resolvers/Mutation/closeAllocation' +import { createAllocation as Mutation_createAllocation } from './indexer-management/resolvers/Mutation/createAllocation' +import { deleteActions as Mutation_deleteActions } from './indexer-management/resolvers/Mutation/deleteActions' +import { deleteCostModels as Mutation_deleteCostModels } from './indexer-management/resolvers/Mutation/deleteCostModels' +import { deleteDisputes as Mutation_deleteDisputes } from './indexer-management/resolvers/Mutation/deleteDisputes' +import { deleteIndexingRule as Mutation_deleteIndexingRule } from './indexer-management/resolvers/Mutation/deleteIndexingRule' +import { deleteIndexingRules as Mutation_deleteIndexingRules } from './indexer-management/resolvers/Mutation/deleteIndexingRules' +import { executeApprovedActions as Mutation_executeApprovedActions } from './indexer-management/resolvers/Mutation/executeApprovedActions' +import { queueActions as Mutation_queueActions } from './indexer-management/resolvers/Mutation/queueActions' +import { reallocateAllocation as Mutation_reallocateAllocation } from './indexer-management/resolvers/Mutation/reallocateAllocation' +import { setCostModel as Mutation_setCostModel } from './indexer-management/resolvers/Mutation/setCostModel' +import { setIndexingRule as Mutation_setIndexingRule } from './indexer-management/resolvers/Mutation/setIndexingRule' +import { storeDisputes as Mutation_storeDisputes } from './indexer-management/resolvers/Mutation/storeDisputes' +import { updateAction as Mutation_updateAction } from './indexer-management/resolvers/Mutation/updateAction' +import { updateActions as Mutation_updateActions } from './indexer-management/resolvers/Mutation/updateActions' +import { POIDispute } from './indexer-management/resolvers/POIDispute' +import { action as Query_action } from './indexer-management/resolvers/Query/action' +import { actions as Query_actions } from './indexer-management/resolvers/Query/actions' +import { allocations as Query_allocations } from './indexer-management/resolvers/Query/allocations' +import { costModel as Query_costModel } from './indexer-management/resolvers/Query/costModel' +import { costModels as Query_costModels } from './indexer-management/resolvers/Query/costModels' +import { dispute as Query_dispute } from './indexer-management/resolvers/Query/dispute' +import { disputes as Query_disputes } from './indexer-management/resolvers/Query/disputes' +import { disputesClosedAfter as Query_disputesClosedAfter } from './indexer-management/resolvers/Query/disputesClosedAfter' +import { indexerAllocations as Query_indexerAllocations } from './indexer-management/resolvers/Query/indexerAllocations' +import { indexerDeployments as Query_indexerDeployments } from './indexer-management/resolvers/Query/indexerDeployments' +import { indexerEndpoints as Query_indexerEndpoints } from './indexer-management/resolvers/Query/indexerEndpoints' +import { indexerRegistration as Query_indexerRegistration } from './indexer-management/resolvers/Query/indexerRegistration' +import { indexingRule as Query_indexingRule } from './indexer-management/resolvers/Query/indexingRule' +import { indexingRules as Query_indexingRules } from './indexer-management/resolvers/Query/indexingRules' +import { ReallocateAllocationResult } from './indexer-management/resolvers/ReallocateAllocationResult' +export const resolvers: Resolvers = { + Query: { + action: Query_action, + actions: Query_actions, + allocations: Query_allocations, + costModel: Query_costModel, + costModels: Query_costModels, + dispute: Query_dispute, + disputes: Query_disputes, + disputesClosedAfter: Query_disputesClosedAfter, + indexerAllocations: Query_indexerAllocations, + indexerDeployments: Query_indexerDeployments, + indexerEndpoints: Query_indexerEndpoints, + indexerRegistration: Query_indexerRegistration, + indexingRule: Query_indexingRule, + indexingRules: Query_indexingRules, + }, + Mutation: { + approveActions: Mutation_approveActions, + cancelActions: Mutation_cancelActions, + closeAllocation: Mutation_closeAllocation, + createAllocation: Mutation_createAllocation, + deleteActions: Mutation_deleteActions, + deleteCostModels: Mutation_deleteCostModels, + deleteDisputes: Mutation_deleteDisputes, + deleteIndexingRule: Mutation_deleteIndexingRule, + deleteIndexingRules: Mutation_deleteIndexingRules, + executeApprovedActions: Mutation_executeApprovedActions, + queueActions: Mutation_queueActions, + reallocateAllocation: Mutation_reallocateAllocation, + setCostModel: Mutation_setCostModel, + setIndexingRule: Mutation_setIndexingRule, + storeDisputes: Mutation_storeDisputes, + updateAction: Mutation_updateAction, + updateActions: Mutation_updateActions, + }, + + Action: Action, + ActionResult: ActionResult, + Allocation: Allocation, + BigInt: BigInt, + BlockPointer: BlockPointer, + ChainIndexingStatus: ChainIndexingStatus, + CloseAllocationResult: CloseAllocationResult, + CostModel: CostModel, + CreateAllocationResult: CreateAllocationResult, + GeoLocation: GeoLocation, + IndexerAllocation: IndexerAllocation, + IndexerDeployment: IndexerDeployment, + IndexerEndpoint: IndexerEndpoint, + IndexerEndpointTest: IndexerEndpointTest, + IndexerEndpoints: IndexerEndpoints, + IndexerRegistration: IndexerRegistration, + IndexingError: IndexingError, + IndexingRule: IndexingRule, + POIDispute: POIDispute, + ReallocateAllocationResult: ReallocateAllocationResult, +} diff --git a/packages/indexer-common/src/schema/typeDefs.generated.ts b/packages/indexer-common/src/schema/typeDefs.generated.ts new file mode 100644 index 000000000..770cd39f1 --- /dev/null +++ b/packages/indexer-common/src/schema/typeDefs.generated.ts @@ -0,0 +1,5358 @@ +import type { DocumentNode } from 'graphql' +export const typeDefs = { + kind: 'Document', + definitions: [ + { + kind: 'ScalarTypeDefinition', + name: { kind: 'Name', value: 'BigInt', loc: { start: 7, end: 13 } }, + directives: [], + loc: { start: 0, end: 13 }, + }, + { + kind: 'EnumTypeDefinition', + name: { kind: 'Name', value: 'OrderDirection', loc: { start: 20, end: 34 } }, + directives: [], + values: [ + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'asc', loc: { start: 39, end: 42 } }, + directives: [], + loc: { start: 39, end: 42 }, + }, + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'desc', loc: { start: 45, end: 49 } }, + directives: [], + loc: { start: 45, end: 49 }, + }, + ], + loc: { start: 15, end: 51 }, + }, + { + kind: 'EnumTypeDefinition', + name: { kind: 'Name', value: 'IndexingDecisionBasis', loc: { start: 58, end: 79 } }, + directives: [], + values: [ + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'rules', loc: { start: 84, end: 89 } }, + directives: [], + loc: { start: 84, end: 89 }, + }, + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'never', loc: { start: 92, end: 97 } }, + directives: [], + loc: { start: 92, end: 97 }, + }, + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'always', loc: { start: 100, end: 106 } }, + directives: [], + loc: { start: 100, end: 106 }, + }, + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'offchain', loc: { start: 109, end: 117 } }, + directives: [], + loc: { start: 109, end: 117 }, + }, + ], + loc: { start: 53, end: 119 }, + }, + { + kind: 'EnumTypeDefinition', + name: { kind: 'Name', value: 'IdentifierType', loc: { start: 126, end: 140 } }, + directives: [], + values: [ + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'deployment', loc: { start: 145, end: 155 } }, + directives: [], + loc: { start: 145, end: 155 }, + }, + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'subgraph', loc: { start: 158, end: 166 } }, + directives: [], + loc: { start: 158, end: 166 }, + }, + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'group', loc: { start: 169, end: 174 } }, + directives: [], + loc: { start: 169, end: 174 }, + }, + ], + loc: { start: 121, end: 176 }, + }, + { + kind: 'InputObjectTypeDefinition', + name: { kind: 'Name', value: 'AllocationFilter', loc: { start: 184, end: 200 } }, + directives: [], + fields: [ + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'status', loc: { start: 205, end: 211 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 213, end: 219 } }, + loc: { start: 213, end: 219 }, + }, + directives: [], + loc: { start: 205, end: 219 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'allocation', loc: { start: 222, end: 232 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 234, end: 240 } }, + loc: { start: 234, end: 240 }, + }, + directives: [], + loc: { start: 222, end: 240 }, + }, + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'subgraphDeployment', + loc: { start: 243, end: 261 }, + }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 263, end: 269 } }, + loc: { start: 263, end: 269 }, + }, + directives: [], + loc: { start: 243, end: 269 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'protocolNetwork', loc: { start: 272, end: 287 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 289, end: 295 } }, + loc: { start: 289, end: 295 }, + }, + directives: [], + loc: { start: 272, end: 295 }, + }, + ], + loc: { start: 178, end: 297 }, + }, + { + kind: 'EnumTypeDefinition', + name: { kind: 'Name', value: 'AllocationStatus', loc: { start: 304, end: 320 } }, + directives: [], + values: [ + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'Null', loc: { start: 325, end: 329 } }, + directives: [], + loc: { start: 325, end: 329 }, + }, + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'Active', loc: { start: 332, end: 338 } }, + directives: [], + loc: { start: 332, end: 338 }, + }, + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'Closed', loc: { start: 341, end: 347 } }, + directives: [], + loc: { start: 341, end: 347 }, + }, + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'Finalized', loc: { start: 350, end: 359 } }, + directives: [], + loc: { start: 350, end: 359 }, + }, + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'Claimed', loc: { start: 362, end: 369 } }, + directives: [], + loc: { start: 362, end: 369 }, + }, + ], + loc: { start: 299, end: 371 }, + }, + { + kind: 'ObjectTypeDefinition', + name: { kind: 'Name', value: 'Allocation', loc: { start: 378, end: 388 } }, + interfaces: [], + directives: [], + fields: [ + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'id', loc: { start: 393, end: 395 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 397, end: 403 } }, + loc: { start: 397, end: 403 }, + }, + loc: { start: 397, end: 404 }, + }, + directives: [], + loc: { start: 393, end: 404 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'indexer', loc: { start: 407, end: 414 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 416, end: 422 } }, + loc: { start: 416, end: 422 }, + }, + loc: { start: 416, end: 423 }, + }, + directives: [], + loc: { start: 407, end: 423 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'subgraphDeployment', + loc: { start: 426, end: 444 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 446, end: 452 } }, + loc: { start: 446, end: 452 }, + }, + loc: { start: 446, end: 453 }, + }, + directives: [], + loc: { start: 426, end: 453 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'allocatedTokens', loc: { start: 456, end: 471 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 473, end: 479 } }, + loc: { start: 473, end: 479 }, + }, + loc: { start: 473, end: 480 }, + }, + directives: [], + loc: { start: 456, end: 480 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'createdAtEpoch', loc: { start: 483, end: 497 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Int', loc: { start: 499, end: 502 } }, + loc: { start: 499, end: 502 }, + }, + loc: { start: 499, end: 503 }, + }, + directives: [], + loc: { start: 483, end: 503 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'closedAtEpoch', loc: { start: 506, end: 519 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Int', loc: { start: 521, end: 524 } }, + loc: { start: 521, end: 524 }, + }, + directives: [], + loc: { start: 506, end: 524 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'ageInEpochs', loc: { start: 527, end: 538 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Int', loc: { start: 540, end: 543 } }, + loc: { start: 540, end: 543 }, + }, + loc: { start: 540, end: 544 }, + }, + directives: [], + loc: { start: 527, end: 544 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'indexingRewards', loc: { start: 547, end: 562 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 564, end: 570 } }, + loc: { start: 564, end: 570 }, + }, + loc: { start: 564, end: 571 }, + }, + directives: [], + loc: { start: 547, end: 571 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'queryFeesCollected', + loc: { start: 574, end: 592 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 594, end: 600 } }, + loc: { start: 594, end: 600 }, + }, + loc: { start: 594, end: 601 }, + }, + directives: [], + loc: { start: 574, end: 601 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'signalledTokens', loc: { start: 604, end: 619 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'BigInt', loc: { start: 621, end: 627 } }, + loc: { start: 621, end: 627 }, + }, + loc: { start: 621, end: 628 }, + }, + directives: [], + loc: { start: 604, end: 628 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'stakedTokens', loc: { start: 631, end: 643 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'BigInt', loc: { start: 645, end: 651 } }, + loc: { start: 645, end: 651 }, + }, + loc: { start: 645, end: 652 }, + }, + directives: [], + loc: { start: 631, end: 652 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'status', loc: { start: 655, end: 661 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'AllocationStatus', + loc: { start: 663, end: 679 }, + }, + loc: { start: 663, end: 679 }, + }, + loc: { start: 663, end: 680 }, + }, + directives: [], + loc: { start: 655, end: 680 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'protocolNetwork', loc: { start: 683, end: 698 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 700, end: 706 } }, + loc: { start: 700, end: 706 }, + }, + loc: { start: 700, end: 707 }, + }, + directives: [], + loc: { start: 683, end: 707 }, + }, + ], + loc: { start: 373, end: 709 }, + }, + { + kind: 'ObjectTypeDefinition', + name: { + kind: 'Name', + value: 'CreateAllocationResult', + loc: { start: 716, end: 738 }, + }, + interfaces: [], + directives: [], + fields: [ + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'allocation', loc: { start: 743, end: 753 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 755, end: 761 } }, + loc: { start: 755, end: 761 }, + }, + loc: { start: 755, end: 762 }, + }, + directives: [], + loc: { start: 743, end: 762 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'deployment', loc: { start: 765, end: 775 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 777, end: 783 } }, + loc: { start: 777, end: 783 }, + }, + loc: { start: 777, end: 784 }, + }, + directives: [], + loc: { start: 765, end: 784 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'allocatedTokens', loc: { start: 787, end: 802 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 804, end: 810 } }, + loc: { start: 804, end: 810 }, + }, + loc: { start: 804, end: 811 }, + }, + directives: [], + loc: { start: 787, end: 811 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'protocolNetwork', loc: { start: 814, end: 829 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 831, end: 837 } }, + loc: { start: 831, end: 837 }, + }, + loc: { start: 831, end: 838 }, + }, + directives: [], + loc: { start: 814, end: 838 }, + }, + ], + loc: { start: 711, end: 840 }, + }, + { + kind: 'ObjectTypeDefinition', + name: { + kind: 'Name', + value: 'CloseAllocationResult', + loc: { start: 847, end: 868 }, + }, + interfaces: [], + directives: [], + fields: [ + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'allocation', loc: { start: 873, end: 883 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 885, end: 891 } }, + loc: { start: 885, end: 891 }, + }, + loc: { start: 885, end: 892 }, + }, + directives: [], + loc: { start: 873, end: 892 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'allocatedTokens', loc: { start: 895, end: 910 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 912, end: 918 } }, + loc: { start: 912, end: 918 }, + }, + loc: { start: 912, end: 919 }, + }, + directives: [], + loc: { start: 895, end: 919 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'indexingRewards', loc: { start: 922, end: 937 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 939, end: 945 } }, + loc: { start: 939, end: 945 }, + }, + loc: { start: 939, end: 946 }, + }, + directives: [], + loc: { start: 922, end: 946 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'receiptsWorthCollecting', + loc: { start: 949, end: 972 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Boolean', loc: { start: 974, end: 981 } }, + loc: { start: 974, end: 981 }, + }, + loc: { start: 974, end: 982 }, + }, + directives: [], + loc: { start: 949, end: 982 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'protocolNetwork', + loc: { start: 985, end: 1000 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 1002, end: 1008 } }, + loc: { start: 1002, end: 1008 }, + }, + loc: { start: 1002, end: 1009 }, + }, + directives: [], + loc: { start: 985, end: 1009 }, + }, + ], + loc: { start: 842, end: 1011 }, + }, + { + kind: 'ObjectTypeDefinition', + name: { + kind: 'Name', + value: 'ReallocateAllocationResult', + loc: { start: 1018, end: 1044 }, + }, + interfaces: [], + directives: [], + fields: [ + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'closedAllocation', + loc: { start: 1049, end: 1065 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 1067, end: 1073 } }, + loc: { start: 1067, end: 1073 }, + }, + loc: { start: 1067, end: 1074 }, + }, + directives: [], + loc: { start: 1049, end: 1074 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'indexingRewardsCollected', + loc: { start: 1077, end: 1101 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 1103, end: 1109 } }, + loc: { start: 1103, end: 1109 }, + }, + loc: { start: 1103, end: 1110 }, + }, + directives: [], + loc: { start: 1077, end: 1110 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'receiptsWorthCollecting', + loc: { start: 1113, end: 1136 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Boolean', loc: { start: 1138, end: 1145 } }, + loc: { start: 1138, end: 1145 }, + }, + loc: { start: 1138, end: 1146 }, + }, + directives: [], + loc: { start: 1113, end: 1146 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'createdAllocation', + loc: { start: 1149, end: 1166 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 1168, end: 1174 } }, + loc: { start: 1168, end: 1174 }, + }, + loc: { start: 1168, end: 1175 }, + }, + directives: [], + loc: { start: 1149, end: 1175 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'createdAllocationStake', + loc: { start: 1178, end: 1200 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 1202, end: 1208 } }, + loc: { start: 1202, end: 1208 }, + }, + loc: { start: 1202, end: 1209 }, + }, + directives: [], + loc: { start: 1178, end: 1209 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'protocolNetwork', + loc: { start: 1212, end: 1227 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 1229, end: 1235 } }, + loc: { start: 1229, end: 1235 }, + }, + loc: { start: 1229, end: 1236 }, + }, + directives: [], + loc: { start: 1212, end: 1236 }, + }, + ], + loc: { start: 1013, end: 1238 }, + }, + { + kind: 'EnumTypeDefinition', + name: { kind: 'Name', value: 'ActionStatus', loc: { start: 1245, end: 1257 } }, + directives: [], + values: [ + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'queued', loc: { start: 1262, end: 1268 } }, + directives: [], + loc: { start: 1262, end: 1268 }, + }, + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'approved', loc: { start: 1271, end: 1279 } }, + directives: [], + loc: { start: 1271, end: 1279 }, + }, + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'pending', loc: { start: 1282, end: 1289 } }, + directives: [], + loc: { start: 1282, end: 1289 }, + }, + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'success', loc: { start: 1292, end: 1299 } }, + directives: [], + loc: { start: 1292, end: 1299 }, + }, + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'failed', loc: { start: 1302, end: 1308 } }, + directives: [], + loc: { start: 1302, end: 1308 }, + }, + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'canceled', loc: { start: 1311, end: 1319 } }, + directives: [], + loc: { start: 1311, end: 1319 }, + }, + ], + loc: { start: 1240, end: 1321 }, + }, + { + kind: 'EnumTypeDefinition', + name: { kind: 'Name', value: 'ActionType', loc: { start: 1328, end: 1338 } }, + directives: [], + values: [ + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'allocate', loc: { start: 1343, end: 1351 } }, + directives: [], + loc: { start: 1343, end: 1351 }, + }, + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'unallocate', loc: { start: 1354, end: 1364 } }, + directives: [], + loc: { start: 1354, end: 1364 }, + }, + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'reallocate', loc: { start: 1367, end: 1377 } }, + directives: [], + loc: { start: 1367, end: 1377 }, + }, + ], + loc: { start: 1323, end: 1379 }, + }, + { + kind: 'ObjectTypeDefinition', + name: { kind: 'Name', value: 'Action', loc: { start: 1386, end: 1392 } }, + interfaces: [], + directives: [], + fields: [ + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'id', loc: { start: 1397, end: 1399 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Int', loc: { start: 1401, end: 1404 } }, + loc: { start: 1401, end: 1404 }, + }, + loc: { start: 1401, end: 1405 }, + }, + directives: [], + loc: { start: 1397, end: 1405 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'status', loc: { start: 1408, end: 1414 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'ActionStatus', + loc: { start: 1416, end: 1428 }, + }, + loc: { start: 1416, end: 1428 }, + }, + loc: { start: 1416, end: 1429 }, + }, + directives: [], + loc: { start: 1408, end: 1429 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'type', loc: { start: 1432, end: 1436 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'ActionType', + loc: { start: 1438, end: 1448 }, + }, + loc: { start: 1438, end: 1448 }, + }, + loc: { start: 1438, end: 1449 }, + }, + directives: [], + loc: { start: 1432, end: 1449 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'deploymentID', loc: { start: 1452, end: 1464 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 1466, end: 1472 } }, + loc: { start: 1466, end: 1472 }, + }, + directives: [], + loc: { start: 1452, end: 1472 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'allocationID', loc: { start: 1475, end: 1487 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 1489, end: 1495 } }, + loc: { start: 1489, end: 1495 }, + }, + directives: [], + loc: { start: 1475, end: 1495 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'amount', loc: { start: 1498, end: 1504 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 1506, end: 1512 } }, + loc: { start: 1506, end: 1512 }, + }, + directives: [], + loc: { start: 1498, end: 1512 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'poi', loc: { start: 1515, end: 1518 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 1520, end: 1526 } }, + loc: { start: 1520, end: 1526 }, + }, + directives: [], + loc: { start: 1515, end: 1526 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'force', loc: { start: 1529, end: 1534 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Boolean', loc: { start: 1536, end: 1543 } }, + loc: { start: 1536, end: 1543 }, + }, + directives: [], + loc: { start: 1529, end: 1543 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'priority', loc: { start: 1546, end: 1554 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Int', loc: { start: 1556, end: 1559 } }, + loc: { start: 1556, end: 1559 }, + }, + loc: { start: 1556, end: 1560 }, + }, + directives: [], + loc: { start: 1546, end: 1560 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'source', loc: { start: 1563, end: 1569 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 1571, end: 1577 } }, + loc: { start: 1571, end: 1577 }, + }, + loc: { start: 1571, end: 1578 }, + }, + directives: [], + loc: { start: 1563, end: 1578 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'reason', loc: { start: 1581, end: 1587 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 1589, end: 1595 } }, + loc: { start: 1589, end: 1595 }, + }, + loc: { start: 1589, end: 1596 }, + }, + directives: [], + loc: { start: 1581, end: 1596 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'transaction', loc: { start: 1599, end: 1610 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 1612, end: 1618 } }, + loc: { start: 1612, end: 1618 }, + }, + directives: [], + loc: { start: 1599, end: 1618 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'failureReason', loc: { start: 1621, end: 1634 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 1636, end: 1642 } }, + loc: { start: 1636, end: 1642 }, + }, + directives: [], + loc: { start: 1621, end: 1642 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'createdAt', loc: { start: 1645, end: 1654 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'BigInt', loc: { start: 1656, end: 1662 } }, + loc: { start: 1656, end: 1662 }, + }, + loc: { start: 1656, end: 1663 }, + }, + directives: [], + loc: { start: 1645, end: 1663 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'updatedAt', loc: { start: 1666, end: 1675 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'BigInt', loc: { start: 1677, end: 1683 } }, + loc: { start: 1677, end: 1683 }, + }, + directives: [], + loc: { start: 1666, end: 1683 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'protocolNetwork', + loc: { start: 1686, end: 1701 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 1703, end: 1709 } }, + loc: { start: 1703, end: 1709 }, + }, + loc: { start: 1703, end: 1710 }, + }, + directives: [], + loc: { start: 1686, end: 1710 }, + }, + ], + loc: { start: 1381, end: 1712 }, + }, + { + kind: 'InputObjectTypeDefinition', + name: { kind: 'Name', value: 'ActionInput', loc: { start: 1720, end: 1731 } }, + directives: [], + fields: [ + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'status', loc: { start: 1736, end: 1742 } }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'ActionStatus', + loc: { start: 1744, end: 1756 }, + }, + loc: { start: 1744, end: 1756 }, + }, + loc: { start: 1744, end: 1757 }, + }, + directives: [], + loc: { start: 1736, end: 1757 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'type', loc: { start: 1760, end: 1764 } }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'ActionType', + loc: { start: 1766, end: 1776 }, + }, + loc: { start: 1766, end: 1776 }, + }, + loc: { start: 1766, end: 1777 }, + }, + directives: [], + loc: { start: 1760, end: 1777 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'deploymentID', loc: { start: 1780, end: 1792 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 1794, end: 1800 } }, + loc: { start: 1794, end: 1800 }, + }, + directives: [], + loc: { start: 1780, end: 1800 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'allocationID', loc: { start: 1803, end: 1815 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 1817, end: 1823 } }, + loc: { start: 1817, end: 1823 }, + }, + directives: [], + loc: { start: 1803, end: 1823 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'amount', loc: { start: 1826, end: 1832 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 1834, end: 1840 } }, + loc: { start: 1834, end: 1840 }, + }, + directives: [], + loc: { start: 1826, end: 1840 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'poi', loc: { start: 1843, end: 1846 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 1848, end: 1854 } }, + loc: { start: 1848, end: 1854 }, + }, + directives: [], + loc: { start: 1843, end: 1854 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'force', loc: { start: 1857, end: 1862 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Boolean', loc: { start: 1864, end: 1871 } }, + loc: { start: 1864, end: 1871 }, + }, + directives: [], + loc: { start: 1857, end: 1871 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'source', loc: { start: 1874, end: 1880 } }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 1882, end: 1888 } }, + loc: { start: 1882, end: 1888 }, + }, + loc: { start: 1882, end: 1889 }, + }, + directives: [], + loc: { start: 1874, end: 1889 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'reason', loc: { start: 1892, end: 1898 } }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 1900, end: 1906 } }, + loc: { start: 1900, end: 1906 }, + }, + loc: { start: 1900, end: 1907 }, + }, + directives: [], + loc: { start: 1892, end: 1907 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'priority', loc: { start: 1910, end: 1918 } }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Int', loc: { start: 1920, end: 1923 } }, + loc: { start: 1920, end: 1923 }, + }, + loc: { start: 1920, end: 1924 }, + }, + directives: [], + loc: { start: 1910, end: 1924 }, + }, + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'protocolNetwork', + loc: { start: 1927, end: 1942 }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 1944, end: 1950 } }, + loc: { start: 1944, end: 1950 }, + }, + loc: { start: 1944, end: 1951 }, + }, + directives: [], + loc: { start: 1927, end: 1951 }, + }, + ], + loc: { start: 1714, end: 1953 }, + }, + { + kind: 'InputObjectTypeDefinition', + name: { kind: 'Name', value: 'ActionUpdateInput', loc: { start: 1961, end: 1978 } }, + directives: [], + fields: [ + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'id', loc: { start: 1983, end: 1985 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Int', loc: { start: 1987, end: 1990 } }, + loc: { start: 1987, end: 1990 }, + }, + directives: [], + loc: { start: 1983, end: 1990 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'deploymentID', loc: { start: 1993, end: 2005 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 2007, end: 2013 } }, + loc: { start: 2007, end: 2013 }, + }, + directives: [], + loc: { start: 1993, end: 2013 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'allocationID', loc: { start: 2016, end: 2028 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 2030, end: 2036 } }, + loc: { start: 2030, end: 2036 }, + }, + directives: [], + loc: { start: 2016, end: 2036 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'amount', loc: { start: 2039, end: 2045 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Int', loc: { start: 2047, end: 2050 } }, + loc: { start: 2047, end: 2050 }, + }, + directives: [], + loc: { start: 2039, end: 2050 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'poi', loc: { start: 2053, end: 2056 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 2058, end: 2064 } }, + loc: { start: 2058, end: 2064 }, + }, + directives: [], + loc: { start: 2053, end: 2064 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'force', loc: { start: 2067, end: 2072 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Boolean', loc: { start: 2074, end: 2081 } }, + loc: { start: 2074, end: 2081 }, + }, + directives: [], + loc: { start: 2067, end: 2081 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'type', loc: { start: 2084, end: 2088 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'ActionType', loc: { start: 2090, end: 2100 } }, + loc: { start: 2090, end: 2100 }, + }, + directives: [], + loc: { start: 2084, end: 2100 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'status', loc: { start: 2103, end: 2109 } }, + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'ActionStatus', + loc: { start: 2111, end: 2123 }, + }, + loc: { start: 2111, end: 2123 }, + }, + directives: [], + loc: { start: 2103, end: 2123 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'reason', loc: { start: 2126, end: 2132 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 2134, end: 2140 } }, + loc: { start: 2134, end: 2140 }, + }, + directives: [], + loc: { start: 2126, end: 2140 }, + }, + ], + loc: { start: 1955, end: 2142 }, + }, + { + kind: 'EnumTypeDefinition', + name: { kind: 'Name', value: 'ActionParams', loc: { start: 2149, end: 2161 } }, + directives: [], + values: [ + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'id', loc: { start: 2166, end: 2168 } }, + directives: [], + loc: { start: 2166, end: 2168 }, + }, + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'status', loc: { start: 2171, end: 2177 } }, + directives: [], + loc: { start: 2171, end: 2177 }, + }, + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'type', loc: { start: 2180, end: 2184 } }, + directives: [], + loc: { start: 2180, end: 2184 }, + }, + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'deploymentID', loc: { start: 2187, end: 2199 } }, + directives: [], + loc: { start: 2187, end: 2199 }, + }, + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'allocationID', loc: { start: 2202, end: 2214 } }, + directives: [], + loc: { start: 2202, end: 2214 }, + }, + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'transaction', loc: { start: 2217, end: 2228 } }, + directives: [], + loc: { start: 2217, end: 2228 }, + }, + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'amount', loc: { start: 2231, end: 2237 } }, + directives: [], + loc: { start: 2231, end: 2237 }, + }, + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'poi', loc: { start: 2240, end: 2243 } }, + directives: [], + loc: { start: 2240, end: 2243 }, + }, + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'force', loc: { start: 2246, end: 2251 } }, + directives: [], + loc: { start: 2246, end: 2251 }, + }, + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'source', loc: { start: 2254, end: 2260 } }, + directives: [], + loc: { start: 2254, end: 2260 }, + }, + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'reason', loc: { start: 2263, end: 2269 } }, + directives: [], + loc: { start: 2263, end: 2269 }, + }, + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'priority', loc: { start: 2272, end: 2280 } }, + directives: [], + loc: { start: 2272, end: 2280 }, + }, + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'createdAt', loc: { start: 2283, end: 2292 } }, + directives: [], + loc: { start: 2283, end: 2292 }, + }, + { + kind: 'EnumValueDefinition', + name: { kind: 'Name', value: 'updatedAt', loc: { start: 2295, end: 2304 } }, + directives: [], + loc: { start: 2295, end: 2304 }, + }, + { + kind: 'EnumValueDefinition', + name: { + kind: 'Name', + value: 'protocolNetwork', + loc: { start: 2307, end: 2322 }, + }, + directives: [], + loc: { start: 2307, end: 2322 }, + }, + ], + loc: { start: 2144, end: 2324 }, + }, + { + kind: 'ObjectTypeDefinition', + name: { kind: 'Name', value: 'ActionResult', loc: { start: 2331, end: 2343 } }, + interfaces: [], + directives: [], + fields: [ + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'id', loc: { start: 2348, end: 2350 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Int', loc: { start: 2352, end: 2355 } }, + loc: { start: 2352, end: 2355 }, + }, + loc: { start: 2352, end: 2356 }, + }, + directives: [], + loc: { start: 2348, end: 2356 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'type', loc: { start: 2359, end: 2363 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'ActionType', + loc: { start: 2365, end: 2375 }, + }, + loc: { start: 2365, end: 2375 }, + }, + loc: { start: 2365, end: 2376 }, + }, + directives: [], + loc: { start: 2359, end: 2376 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'deploymentID', loc: { start: 2379, end: 2391 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 2393, end: 2399 } }, + loc: { start: 2393, end: 2399 }, + }, + directives: [], + loc: { start: 2379, end: 2399 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'allocationID', loc: { start: 2402, end: 2414 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 2416, end: 2422 } }, + loc: { start: 2416, end: 2422 }, + }, + directives: [], + loc: { start: 2402, end: 2422 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'amount', loc: { start: 2425, end: 2431 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 2433, end: 2439 } }, + loc: { start: 2433, end: 2439 }, + }, + directives: [], + loc: { start: 2425, end: 2439 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'poi', loc: { start: 2442, end: 2445 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 2447, end: 2453 } }, + loc: { start: 2447, end: 2453 }, + }, + directives: [], + loc: { start: 2442, end: 2453 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'force', loc: { start: 2456, end: 2461 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Boolean', loc: { start: 2463, end: 2470 } }, + loc: { start: 2463, end: 2470 }, + }, + directives: [], + loc: { start: 2456, end: 2470 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'source', loc: { start: 2473, end: 2479 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 2481, end: 2487 } }, + loc: { start: 2481, end: 2487 }, + }, + loc: { start: 2481, end: 2488 }, + }, + directives: [], + loc: { start: 2473, end: 2488 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'reason', loc: { start: 2491, end: 2497 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 2499, end: 2505 } }, + loc: { start: 2499, end: 2505 }, + }, + loc: { start: 2499, end: 2506 }, + }, + directives: [], + loc: { start: 2491, end: 2506 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'status', loc: { start: 2509, end: 2515 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 2517, end: 2523 } }, + loc: { start: 2517, end: 2523 }, + }, + loc: { start: 2517, end: 2524 }, + }, + directives: [], + loc: { start: 2509, end: 2524 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'transaction', loc: { start: 2527, end: 2538 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 2540, end: 2546 } }, + loc: { start: 2540, end: 2546 }, + }, + directives: [], + loc: { start: 2527, end: 2546 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'failureReason', loc: { start: 2549, end: 2562 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 2564, end: 2570 } }, + loc: { start: 2564, end: 2570 }, + }, + directives: [], + loc: { start: 2549, end: 2570 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'priority', loc: { start: 2573, end: 2581 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Int', loc: { start: 2583, end: 2586 } }, + loc: { start: 2583, end: 2586 }, + }, + directives: [], + loc: { start: 2573, end: 2586 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'protocolNetwork', + loc: { start: 2589, end: 2604 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 2606, end: 2612 } }, + loc: { start: 2606, end: 2612 }, + }, + loc: { start: 2606, end: 2613 }, + }, + directives: [], + loc: { start: 2589, end: 2613 }, + }, + ], + loc: { start: 2326, end: 2615 }, + }, + { + kind: 'InputObjectTypeDefinition', + name: { kind: 'Name', value: 'ActionFilter', loc: { start: 2623, end: 2635 } }, + directives: [], + fields: [ + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'id', loc: { start: 2640, end: 2642 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Int', loc: { start: 2644, end: 2647 } }, + loc: { start: 2644, end: 2647 }, + }, + directives: [], + loc: { start: 2640, end: 2647 }, + }, + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'protocolNetwork', + loc: { start: 2650, end: 2665 }, + }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 2667, end: 2673 } }, + loc: { start: 2667, end: 2673 }, + }, + directives: [], + loc: { start: 2650, end: 2673 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'type', loc: { start: 2676, end: 2680 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'ActionType', loc: { start: 2682, end: 2692 } }, + loc: { start: 2682, end: 2692 }, + }, + directives: [], + loc: { start: 2676, end: 2692 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'status', loc: { start: 2695, end: 2701 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 2703, end: 2709 } }, + loc: { start: 2703, end: 2709 }, + }, + directives: [], + loc: { start: 2695, end: 2709 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'source', loc: { start: 2712, end: 2718 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 2720, end: 2726 } }, + loc: { start: 2720, end: 2726 }, + }, + directives: [], + loc: { start: 2712, end: 2726 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'reason', loc: { start: 2729, end: 2735 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 2737, end: 2743 } }, + loc: { start: 2737, end: 2743 }, + }, + directives: [], + loc: { start: 2729, end: 2743 }, + }, + ], + loc: { start: 2617, end: 2745 }, + }, + { + kind: 'InputObjectTypeDefinition', + name: { + kind: 'Name', + value: 'POIDisputeIdentifier', + loc: { start: 2753, end: 2773 }, + }, + directives: [], + fields: [ + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'allocationID', loc: { start: 2778, end: 2790 } }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 2792, end: 2798 } }, + loc: { start: 2792, end: 2798 }, + }, + loc: { start: 2792, end: 2799 }, + }, + directives: [], + loc: { start: 2778, end: 2799 }, + }, + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'protocolNetwork', + loc: { start: 2802, end: 2817 }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 2819, end: 2825 } }, + loc: { start: 2819, end: 2825 }, + }, + loc: { start: 2819, end: 2826 }, + }, + directives: [], + loc: { start: 2802, end: 2826 }, + }, + ], + loc: { start: 2747, end: 2828 }, + }, + { + kind: 'ObjectTypeDefinition', + name: { kind: 'Name', value: 'POIDispute', loc: { start: 2835, end: 2845 } }, + interfaces: [], + directives: [], + fields: [ + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'allocationID', loc: { start: 2850, end: 2862 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 2864, end: 2870 } }, + loc: { start: 2864, end: 2870 }, + }, + loc: { start: 2864, end: 2871 }, + }, + directives: [], + loc: { start: 2850, end: 2871 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'subgraphDeploymentID', + loc: { start: 2874, end: 2894 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 2896, end: 2902 } }, + loc: { start: 2896, end: 2902 }, + }, + loc: { start: 2896, end: 2903 }, + }, + directives: [], + loc: { start: 2874, end: 2903 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'allocationIndexer', + loc: { start: 2906, end: 2923 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 2925, end: 2931 } }, + loc: { start: 2925, end: 2931 }, + }, + loc: { start: 2925, end: 2932 }, + }, + directives: [], + loc: { start: 2906, end: 2932 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'allocationAmount', + loc: { start: 2935, end: 2951 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'BigInt', loc: { start: 2953, end: 2959 } }, + loc: { start: 2953, end: 2959 }, + }, + loc: { start: 2953, end: 2960 }, + }, + directives: [], + loc: { start: 2935, end: 2960 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'allocationProof', + loc: { start: 2963, end: 2978 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 2980, end: 2986 } }, + loc: { start: 2980, end: 2986 }, + }, + loc: { start: 2980, end: 2987 }, + }, + directives: [], + loc: { start: 2963, end: 2987 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'closedEpoch', loc: { start: 2990, end: 3001 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Int', loc: { start: 3003, end: 3006 } }, + loc: { start: 3003, end: 3006 }, + }, + loc: { start: 3003, end: 3007 }, + }, + directives: [], + loc: { start: 2990, end: 3007 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'closedEpochStartBlockHash', + loc: { start: 3010, end: 3035 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 3037, end: 3043 } }, + loc: { start: 3037, end: 3043 }, + }, + loc: { start: 3037, end: 3044 }, + }, + directives: [], + loc: { start: 3010, end: 3044 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'closedEpochStartBlockNumber', + loc: { start: 3047, end: 3074 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Int', loc: { start: 3076, end: 3079 } }, + loc: { start: 3076, end: 3079 }, + }, + loc: { start: 3076, end: 3080 }, + }, + directives: [], + loc: { start: 3047, end: 3080 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'closedEpochReferenceProof', + loc: { start: 3083, end: 3108 }, + }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 3110, end: 3116 } }, + loc: { start: 3110, end: 3116 }, + }, + directives: [], + loc: { start: 3083, end: 3116 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'previousEpochStartBlockHash', + loc: { start: 3119, end: 3146 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 3148, end: 3154 } }, + loc: { start: 3148, end: 3154 }, + }, + loc: { start: 3148, end: 3155 }, + }, + directives: [], + loc: { start: 3119, end: 3155 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'previousEpochStartBlockNumber', + loc: { start: 3158, end: 3187 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Int', loc: { start: 3189, end: 3192 } }, + loc: { start: 3189, end: 3192 }, + }, + loc: { start: 3189, end: 3193 }, + }, + directives: [], + loc: { start: 3158, end: 3193 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'previousEpochReferenceProof', + loc: { start: 3196, end: 3223 }, + }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 3225, end: 3231 } }, + loc: { start: 3225, end: 3231 }, + }, + directives: [], + loc: { start: 3196, end: 3231 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'status', loc: { start: 3234, end: 3240 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 3242, end: 3248 } }, + loc: { start: 3242, end: 3248 }, + }, + loc: { start: 3242, end: 3249 }, + }, + directives: [], + loc: { start: 3234, end: 3249 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'protocolNetwork', + loc: { start: 3252, end: 3267 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 3269, end: 3275 } }, + loc: { start: 3269, end: 3275 }, + }, + loc: { start: 3269, end: 3276 }, + }, + directives: [], + loc: { start: 3252, end: 3276 }, + }, + ], + loc: { start: 2830, end: 3278 }, + }, + { + kind: 'InputObjectTypeDefinition', + name: { kind: 'Name', value: 'POIDisputeInput', loc: { start: 3286, end: 3301 } }, + directives: [], + fields: [ + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'allocationID', loc: { start: 3306, end: 3318 } }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 3320, end: 3326 } }, + loc: { start: 3320, end: 3326 }, + }, + loc: { start: 3320, end: 3327 }, + }, + directives: [], + loc: { start: 3306, end: 3327 }, + }, + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'subgraphDeploymentID', + loc: { start: 3330, end: 3350 }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 3352, end: 3358 } }, + loc: { start: 3352, end: 3358 }, + }, + loc: { start: 3352, end: 3359 }, + }, + directives: [], + loc: { start: 3330, end: 3359 }, + }, + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'allocationIndexer', + loc: { start: 3362, end: 3379 }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 3381, end: 3387 } }, + loc: { start: 3381, end: 3387 }, + }, + loc: { start: 3381, end: 3388 }, + }, + directives: [], + loc: { start: 3362, end: 3388 }, + }, + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'allocationAmount', + loc: { start: 3391, end: 3407 }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'BigInt', loc: { start: 3409, end: 3415 } }, + loc: { start: 3409, end: 3415 }, + }, + loc: { start: 3409, end: 3416 }, + }, + directives: [], + loc: { start: 3391, end: 3416 }, + }, + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'allocationProof', + loc: { start: 3419, end: 3434 }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 3436, end: 3442 } }, + loc: { start: 3436, end: 3442 }, + }, + loc: { start: 3436, end: 3443 }, + }, + directives: [], + loc: { start: 3419, end: 3443 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'closedEpoch', loc: { start: 3446, end: 3457 } }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Int', loc: { start: 3459, end: 3462 } }, + loc: { start: 3459, end: 3462 }, + }, + loc: { start: 3459, end: 3463 }, + }, + directives: [], + loc: { start: 3446, end: 3463 }, + }, + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'closedEpochStartBlockHash', + loc: { start: 3466, end: 3491 }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 3493, end: 3499 } }, + loc: { start: 3493, end: 3499 }, + }, + loc: { start: 3493, end: 3500 }, + }, + directives: [], + loc: { start: 3466, end: 3500 }, + }, + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'closedEpochStartBlockNumber', + loc: { start: 3503, end: 3530 }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Int', loc: { start: 3532, end: 3535 } }, + loc: { start: 3532, end: 3535 }, + }, + loc: { start: 3532, end: 3536 }, + }, + directives: [], + loc: { start: 3503, end: 3536 }, + }, + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'closedEpochReferenceProof', + loc: { start: 3539, end: 3564 }, + }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 3566, end: 3572 } }, + loc: { start: 3566, end: 3572 }, + }, + directives: [], + loc: { start: 3539, end: 3572 }, + }, + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'previousEpochStartBlockHash', + loc: { start: 3575, end: 3602 }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 3604, end: 3610 } }, + loc: { start: 3604, end: 3610 }, + }, + loc: { start: 3604, end: 3611 }, + }, + directives: [], + loc: { start: 3575, end: 3611 }, + }, + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'previousEpochStartBlockNumber', + loc: { start: 3614, end: 3643 }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Int', loc: { start: 3645, end: 3648 } }, + loc: { start: 3645, end: 3648 }, + }, + loc: { start: 3645, end: 3649 }, + }, + directives: [], + loc: { start: 3614, end: 3649 }, + }, + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'previousEpochReferenceProof', + loc: { start: 3652, end: 3679 }, + }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 3681, end: 3687 } }, + loc: { start: 3681, end: 3687 }, + }, + directives: [], + loc: { start: 3652, end: 3687 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'status', loc: { start: 3690, end: 3696 } }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 3698, end: 3704 } }, + loc: { start: 3698, end: 3704 }, + }, + loc: { start: 3698, end: 3705 }, + }, + directives: [], + loc: { start: 3690, end: 3705 }, + }, + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'protocolNetwork', + loc: { start: 3708, end: 3723 }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 3725, end: 3731 } }, + loc: { start: 3725, end: 3731 }, + }, + loc: { start: 3725, end: 3732 }, + }, + directives: [], + loc: { start: 3708, end: 3732 }, + }, + ], + loc: { start: 3280, end: 3734 }, + }, + { + kind: 'ObjectTypeDefinition', + name: { kind: 'Name', value: 'IndexingRule', loc: { start: 3741, end: 3753 } }, + interfaces: [], + directives: [], + fields: [ + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'identifier', loc: { start: 3758, end: 3768 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 3770, end: 3776 } }, + loc: { start: 3770, end: 3776 }, + }, + loc: { start: 3770, end: 3777 }, + }, + directives: [], + loc: { start: 3758, end: 3777 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'identifierType', + loc: { start: 3780, end: 3794 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'IdentifierType', + loc: { start: 3796, end: 3810 }, + }, + loc: { start: 3796, end: 3810 }, + }, + loc: { start: 3796, end: 3811 }, + }, + directives: [], + loc: { start: 3780, end: 3811 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'allocationAmount', + loc: { start: 3814, end: 3830 }, + }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'BigInt', loc: { start: 3832, end: 3838 } }, + loc: { start: 3832, end: 3838 }, + }, + directives: [], + loc: { start: 3814, end: 3838 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'allocationLifetime', + loc: { start: 3841, end: 3859 }, + }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Int', loc: { start: 3861, end: 3864 } }, + loc: { start: 3861, end: 3864 }, + }, + directives: [], + loc: { start: 3841, end: 3864 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'autoRenewal', loc: { start: 3867, end: 3878 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Boolean', loc: { start: 3880, end: 3887 } }, + loc: { start: 3880, end: 3887 }, + }, + loc: { start: 3880, end: 3888 }, + }, + directives: [], + loc: { start: 3867, end: 3888 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'parallelAllocations', + loc: { start: 3891, end: 3910 }, + }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Int', loc: { start: 3912, end: 3915 } }, + loc: { start: 3912, end: 3915 }, + }, + directives: [], + loc: { start: 3891, end: 3915 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'maxAllocationPercentage', + loc: { start: 3918, end: 3941 }, + }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Float', loc: { start: 3943, end: 3948 } }, + loc: { start: 3943, end: 3948 }, + }, + directives: [], + loc: { start: 3918, end: 3948 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'minSignal', loc: { start: 3951, end: 3960 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'BigInt', loc: { start: 3962, end: 3968 } }, + loc: { start: 3962, end: 3968 }, + }, + directives: [], + loc: { start: 3951, end: 3968 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'maxSignal', loc: { start: 3971, end: 3980 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'BigInt', loc: { start: 3982, end: 3988 } }, + loc: { start: 3982, end: 3988 }, + }, + directives: [], + loc: { start: 3971, end: 3988 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'minStake', loc: { start: 3991, end: 3999 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'BigInt', loc: { start: 4001, end: 4007 } }, + loc: { start: 4001, end: 4007 }, + }, + directives: [], + loc: { start: 3991, end: 4007 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'minAverageQueryFees', + loc: { start: 4010, end: 4029 }, + }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'BigInt', loc: { start: 4031, end: 4037 } }, + loc: { start: 4031, end: 4037 }, + }, + directives: [], + loc: { start: 4010, end: 4037 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'custom', loc: { start: 4040, end: 4046 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 4048, end: 4054 } }, + loc: { start: 4048, end: 4054 }, + }, + directives: [], + loc: { start: 4040, end: 4054 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'decisionBasis', loc: { start: 4057, end: 4070 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'IndexingDecisionBasis', + loc: { start: 4072, end: 4093 }, + }, + loc: { start: 4072, end: 4093 }, + }, + loc: { start: 4072, end: 4094 }, + }, + directives: [], + loc: { start: 4057, end: 4094 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'requireSupported', + loc: { start: 4097, end: 4113 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Boolean', loc: { start: 4115, end: 4122 } }, + loc: { start: 4115, end: 4122 }, + }, + loc: { start: 4115, end: 4123 }, + }, + directives: [], + loc: { start: 4097, end: 4123 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'safety', loc: { start: 4126, end: 4132 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Boolean', loc: { start: 4134, end: 4141 } }, + loc: { start: 4134, end: 4141 }, + }, + loc: { start: 4134, end: 4142 }, + }, + directives: [], + loc: { start: 4126, end: 4142 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'protocolNetwork', + loc: { start: 4145, end: 4160 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 4162, end: 4168 } }, + loc: { start: 4162, end: 4168 }, + }, + loc: { start: 4162, end: 4169 }, + }, + directives: [], + loc: { start: 4145, end: 4169 }, + }, + ], + loc: { start: 3736, end: 4171 }, + }, + { + kind: 'InputObjectTypeDefinition', + name: { kind: 'Name', value: 'IndexingRuleInput', loc: { start: 4179, end: 4196 } }, + directives: [], + fields: [ + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'identifier', loc: { start: 4201, end: 4211 } }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 4213, end: 4219 } }, + loc: { start: 4213, end: 4219 }, + }, + loc: { start: 4213, end: 4220 }, + }, + directives: [], + loc: { start: 4201, end: 4220 }, + }, + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'identifierType', + loc: { start: 4223, end: 4237 }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'IdentifierType', + loc: { start: 4239, end: 4253 }, + }, + loc: { start: 4239, end: 4253 }, + }, + loc: { start: 4239, end: 4254 }, + }, + directives: [], + loc: { start: 4223, end: 4254 }, + }, + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'allocationAmount', + loc: { start: 4257, end: 4273 }, + }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'BigInt', loc: { start: 4275, end: 4281 } }, + loc: { start: 4275, end: 4281 }, + }, + directives: [], + loc: { start: 4257, end: 4281 }, + }, + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'allocationLifetime', + loc: { start: 4284, end: 4302 }, + }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Int', loc: { start: 4304, end: 4307 } }, + loc: { start: 4304, end: 4307 }, + }, + directives: [], + loc: { start: 4284, end: 4307 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'autoRenewal', loc: { start: 4310, end: 4321 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Boolean', loc: { start: 4323, end: 4330 } }, + loc: { start: 4323, end: 4330 }, + }, + directives: [], + loc: { start: 4310, end: 4330 }, + }, + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'parallelAllocations', + loc: { start: 4333, end: 4352 }, + }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Int', loc: { start: 4354, end: 4357 } }, + loc: { start: 4354, end: 4357 }, + }, + directives: [], + loc: { start: 4333, end: 4357 }, + }, + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'maxAllocationPercentage', + loc: { start: 4360, end: 4383 }, + }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Float', loc: { start: 4385, end: 4390 } }, + loc: { start: 4385, end: 4390 }, + }, + directives: [], + loc: { start: 4360, end: 4390 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'minSignal', loc: { start: 4393, end: 4402 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'BigInt', loc: { start: 4404, end: 4410 } }, + loc: { start: 4404, end: 4410 }, + }, + directives: [], + loc: { start: 4393, end: 4410 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'maxSignal', loc: { start: 4413, end: 4422 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'BigInt', loc: { start: 4424, end: 4430 } }, + loc: { start: 4424, end: 4430 }, + }, + directives: [], + loc: { start: 4413, end: 4430 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'minStake', loc: { start: 4433, end: 4441 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'BigInt', loc: { start: 4443, end: 4449 } }, + loc: { start: 4443, end: 4449 }, + }, + directives: [], + loc: { start: 4433, end: 4449 }, + }, + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'minAverageQueryFees', + loc: { start: 4452, end: 4471 }, + }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'BigInt', loc: { start: 4473, end: 4479 } }, + loc: { start: 4473, end: 4479 }, + }, + directives: [], + loc: { start: 4452, end: 4479 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'custom', loc: { start: 4482, end: 4488 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 4490, end: 4496 } }, + loc: { start: 4490, end: 4496 }, + }, + directives: [], + loc: { start: 4482, end: 4496 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'decisionBasis', loc: { start: 4499, end: 4512 } }, + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'IndexingDecisionBasis', + loc: { start: 4514, end: 4535 }, + }, + loc: { start: 4514, end: 4535 }, + }, + directives: [], + loc: { start: 4499, end: 4535 }, + }, + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'requireSupported', + loc: { start: 4538, end: 4554 }, + }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Boolean', loc: { start: 4556, end: 4563 } }, + loc: { start: 4556, end: 4563 }, + }, + directives: [], + loc: { start: 4538, end: 4563 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'safety', loc: { start: 4566, end: 4572 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Boolean', loc: { start: 4574, end: 4581 } }, + loc: { start: 4574, end: 4581 }, + }, + directives: [], + loc: { start: 4566, end: 4581 }, + }, + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'protocolNetwork', + loc: { start: 4584, end: 4599 }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 4601, end: 4607 } }, + loc: { start: 4601, end: 4607 }, + }, + loc: { start: 4601, end: 4608 }, + }, + directives: [], + loc: { start: 4584, end: 4608 }, + }, + ], + loc: { start: 4173, end: 4610 }, + }, + { + kind: 'InputObjectTypeDefinition', + name: { + kind: 'Name', + value: 'IndexingRuleIdentifier', + loc: { start: 4618, end: 4640 }, + }, + directives: [], + fields: [ + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'identifier', loc: { start: 4645, end: 4655 } }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 4657, end: 4663 } }, + loc: { start: 4657, end: 4663 }, + }, + loc: { start: 4657, end: 4664 }, + }, + directives: [], + loc: { start: 4645, end: 4664 }, + }, + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'protocolNetwork', + loc: { start: 4667, end: 4682 }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 4684, end: 4690 } }, + loc: { start: 4684, end: 4690 }, + }, + loc: { start: 4684, end: 4691 }, + }, + directives: [], + loc: { start: 4667, end: 4691 }, + }, + ], + loc: { start: 4612, end: 4693 }, + }, + { + kind: 'ObjectTypeDefinition', + name: { kind: 'Name', value: 'GeoLocation', loc: { start: 4700, end: 4711 } }, + interfaces: [], + directives: [], + fields: [ + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'latitude', loc: { start: 4716, end: 4724 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 4726, end: 4732 } }, + loc: { start: 4726, end: 4732 }, + }, + loc: { start: 4726, end: 4733 }, + }, + directives: [], + loc: { start: 4716, end: 4733 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'longitude', loc: { start: 4736, end: 4745 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 4747, end: 4753 } }, + loc: { start: 4747, end: 4753 }, + }, + loc: { start: 4747, end: 4754 }, + }, + directives: [], + loc: { start: 4736, end: 4754 }, + }, + ], + loc: { start: 4695, end: 4756 }, + }, + { + kind: 'ObjectTypeDefinition', + name: { + kind: 'Name', + value: 'IndexerRegistration', + loc: { start: 4763, end: 4782 }, + }, + interfaces: [], + directives: [], + fields: [ + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'url', loc: { start: 4787, end: 4790 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 4792, end: 4798 } }, + loc: { start: 4792, end: 4798 }, + }, + directives: [], + loc: { start: 4787, end: 4798 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'protocolNetwork', + loc: { start: 4801, end: 4816 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 4818, end: 4824 } }, + loc: { start: 4818, end: 4824 }, + }, + loc: { start: 4818, end: 4825 }, + }, + directives: [], + loc: { start: 4801, end: 4825 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'address', loc: { start: 4828, end: 4835 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 4837, end: 4843 } }, + loc: { start: 4837, end: 4843 }, + }, + directives: [], + loc: { start: 4828, end: 4843 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'registered', loc: { start: 4846, end: 4856 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Boolean', loc: { start: 4858, end: 4865 } }, + loc: { start: 4858, end: 4865 }, + }, + loc: { start: 4858, end: 4866 }, + }, + directives: [], + loc: { start: 4846, end: 4866 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'location', loc: { start: 4869, end: 4877 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'GeoLocation', loc: { start: 4879, end: 4890 } }, + loc: { start: 4879, end: 4890 }, + }, + directives: [], + loc: { start: 4869, end: 4890 }, + }, + ], + loc: { start: 4758, end: 4892 }, + }, + { + kind: 'ObjectTypeDefinition', + name: { kind: 'Name', value: 'IndexingError', loc: { start: 4899, end: 4912 } }, + interfaces: [], + directives: [], + fields: [ + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'handler', loc: { start: 4917, end: 4924 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 4926, end: 4932 } }, + loc: { start: 4926, end: 4932 }, + }, + directives: [], + loc: { start: 4917, end: 4932 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'message', loc: { start: 4935, end: 4942 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 4944, end: 4950 } }, + loc: { start: 4944, end: 4950 }, + }, + loc: { start: 4944, end: 4951 }, + }, + directives: [], + loc: { start: 4935, end: 4951 }, + }, + ], + loc: { start: 4894, end: 4953 }, + }, + { + kind: 'ObjectTypeDefinition', + name: { kind: 'Name', value: 'BlockPointer', loc: { start: 4960, end: 4972 } }, + interfaces: [], + directives: [], + fields: [ + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'number', loc: { start: 4977, end: 4983 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Int', loc: { start: 4985, end: 4988 } }, + loc: { start: 4985, end: 4988 }, + }, + loc: { start: 4985, end: 4989 }, + }, + directives: [], + loc: { start: 4977, end: 4989 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'hash', loc: { start: 4992, end: 4996 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 4998, end: 5004 } }, + loc: { start: 4998, end: 5004 }, + }, + loc: { start: 4998, end: 5005 }, + }, + directives: [], + loc: { start: 4992, end: 5005 }, + }, + ], + loc: { start: 4955, end: 5007 }, + }, + { + kind: 'ObjectTypeDefinition', + name: { + kind: 'Name', + value: 'ChainIndexingStatus', + loc: { start: 5014, end: 5033 }, + }, + interfaces: [], + directives: [], + fields: [ + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'network', loc: { start: 5038, end: 5045 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 5047, end: 5053 } }, + loc: { start: 5047, end: 5053 }, + }, + loc: { start: 5047, end: 5054 }, + }, + directives: [], + loc: { start: 5038, end: 5054 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'latestBlock', loc: { start: 5057, end: 5068 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'BlockPointer', + loc: { start: 5070, end: 5082 }, + }, + loc: { start: 5070, end: 5082 }, + }, + directives: [], + loc: { start: 5057, end: 5082 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'chainHeadBlock', + loc: { start: 5085, end: 5099 }, + }, + arguments: [], + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'BlockPointer', + loc: { start: 5101, end: 5113 }, + }, + loc: { start: 5101, end: 5113 }, + }, + directives: [], + loc: { start: 5085, end: 5113 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'earliestBlock', loc: { start: 5116, end: 5129 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'BlockPointer', + loc: { start: 5131, end: 5143 }, + }, + loc: { start: 5131, end: 5143 }, + }, + directives: [], + loc: { start: 5116, end: 5143 }, + }, + ], + loc: { start: 5009, end: 5145 }, + }, + { + kind: 'ObjectTypeDefinition', + name: { kind: 'Name', value: 'IndexerDeployment', loc: { start: 5152, end: 5169 } }, + interfaces: [], + directives: [], + fields: [ + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'subgraphDeployment', + loc: { start: 5174, end: 5192 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 5194, end: 5200 } }, + loc: { start: 5194, end: 5200 }, + }, + loc: { start: 5194, end: 5201 }, + }, + directives: [], + loc: { start: 5174, end: 5201 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'synced', loc: { start: 5204, end: 5210 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Boolean', loc: { start: 5212, end: 5219 } }, + loc: { start: 5212, end: 5219 }, + }, + loc: { start: 5212, end: 5220 }, + }, + directives: [], + loc: { start: 5204, end: 5220 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'health', loc: { start: 5223, end: 5229 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 5231, end: 5237 } }, + loc: { start: 5231, end: 5237 }, + }, + loc: { start: 5231, end: 5238 }, + }, + directives: [], + loc: { start: 5223, end: 5238 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'fatalError', loc: { start: 5241, end: 5251 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'IndexingError', + loc: { start: 5253, end: 5266 }, + }, + loc: { start: 5253, end: 5266 }, + }, + directives: [], + loc: { start: 5241, end: 5266 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'node', loc: { start: 5269, end: 5273 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 5275, end: 5281 } }, + loc: { start: 5275, end: 5281 }, + }, + directives: [], + loc: { start: 5269, end: 5281 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'chains', loc: { start: 5284, end: 5290 } }, + arguments: [], + type: { + kind: 'ListType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'ChainIndexingStatus', + loc: { start: 5293, end: 5312 }, + }, + loc: { start: 5293, end: 5312 }, + }, + loc: { start: 5292, end: 5313 }, + }, + directives: [], + loc: { start: 5284, end: 5313 }, + }, + ], + loc: { start: 5147, end: 5315 }, + }, + { + kind: 'ObjectTypeDefinition', + name: { kind: 'Name', value: 'IndexerAllocation', loc: { start: 5322, end: 5339 } }, + interfaces: [], + directives: [], + fields: [ + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'id', loc: { start: 5344, end: 5346 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 5348, end: 5354 } }, + loc: { start: 5348, end: 5354 }, + }, + loc: { start: 5348, end: 5355 }, + }, + directives: [], + loc: { start: 5344, end: 5355 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'allocatedTokens', + loc: { start: 5358, end: 5373 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'BigInt', loc: { start: 5375, end: 5381 } }, + loc: { start: 5375, end: 5381 }, + }, + loc: { start: 5375, end: 5382 }, + }, + directives: [], + loc: { start: 5358, end: 5382 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'createdAtEpoch', + loc: { start: 5385, end: 5399 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Int', loc: { start: 5401, end: 5404 } }, + loc: { start: 5401, end: 5404 }, + }, + loc: { start: 5401, end: 5405 }, + }, + directives: [], + loc: { start: 5385, end: 5405 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'closedAtEpoch', loc: { start: 5408, end: 5421 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Int', loc: { start: 5423, end: 5426 } }, + loc: { start: 5423, end: 5426 }, + }, + directives: [], + loc: { start: 5408, end: 5426 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'subgraphDeployment', + loc: { start: 5429, end: 5447 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 5449, end: 5455 } }, + loc: { start: 5449, end: 5455 }, + }, + loc: { start: 5449, end: 5456 }, + }, + directives: [], + loc: { start: 5429, end: 5456 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'signalledTokens', + loc: { start: 5459, end: 5474 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'BigInt', loc: { start: 5476, end: 5482 } }, + loc: { start: 5476, end: 5482 }, + }, + loc: { start: 5476, end: 5483 }, + }, + directives: [], + loc: { start: 5459, end: 5483 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'stakedTokens', loc: { start: 5486, end: 5498 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'BigInt', loc: { start: 5500, end: 5506 } }, + loc: { start: 5500, end: 5506 }, + }, + loc: { start: 5500, end: 5507 }, + }, + directives: [], + loc: { start: 5486, end: 5507 }, + }, + ], + loc: { start: 5317, end: 5509 }, + }, + { + kind: 'ObjectTypeDefinition', + name: { + kind: 'Name', + value: 'IndexerEndpointTest', + loc: { start: 5516, end: 5535 }, + }, + interfaces: [], + directives: [], + fields: [ + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'test', loc: { start: 5540, end: 5544 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 5546, end: 5552 } }, + loc: { start: 5546, end: 5552 }, + }, + loc: { start: 5546, end: 5553 }, + }, + directives: [], + loc: { start: 5540, end: 5553 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'error', loc: { start: 5556, end: 5561 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 5563, end: 5569 } }, + loc: { start: 5563, end: 5569 }, + }, + directives: [], + loc: { start: 5556, end: 5569 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'possibleActions', + loc: { start: 5572, end: 5587 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'ListType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 5590, end: 5596 } }, + loc: { start: 5590, end: 5596 }, + }, + loc: { start: 5589, end: 5597 }, + }, + loc: { start: 5589, end: 5598 }, + }, + directives: [], + loc: { start: 5572, end: 5598 }, + }, + ], + loc: { start: 5511, end: 5600 }, + }, + { + kind: 'ObjectTypeDefinition', + name: { kind: 'Name', value: 'IndexerEndpoint', loc: { start: 5607, end: 5622 } }, + interfaces: [], + directives: [], + fields: [ + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'url', loc: { start: 5627, end: 5630 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 5632, end: 5638 } }, + loc: { start: 5632, end: 5638 }, + }, + directives: [], + loc: { start: 5627, end: 5638 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'healthy', loc: { start: 5641, end: 5648 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Boolean', loc: { start: 5650, end: 5657 } }, + loc: { start: 5650, end: 5657 }, + }, + loc: { start: 5650, end: 5658 }, + }, + directives: [], + loc: { start: 5641, end: 5658 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'protocolNetwork', + loc: { start: 5661, end: 5676 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 5678, end: 5684 } }, + loc: { start: 5678, end: 5684 }, + }, + loc: { start: 5678, end: 5685 }, + }, + directives: [], + loc: { start: 5661, end: 5685 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'tests', loc: { start: 5688, end: 5693 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'ListType', + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'IndexerEndpointTest', + loc: { start: 5696, end: 5715 }, + }, + loc: { start: 5696, end: 5715 }, + }, + loc: { start: 5696, end: 5716 }, + }, + loc: { start: 5695, end: 5717 }, + }, + loc: { start: 5695, end: 5718 }, + }, + directives: [], + loc: { start: 5688, end: 5718 }, + }, + ], + loc: { start: 5602, end: 5720 }, + }, + { + kind: 'ObjectTypeDefinition', + name: { kind: 'Name', value: 'IndexerEndpoints', loc: { start: 5727, end: 5743 } }, + interfaces: [], + directives: [], + fields: [ + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'service', loc: { start: 5748, end: 5755 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'IndexerEndpoint', + loc: { start: 5757, end: 5772 }, + }, + loc: { start: 5757, end: 5772 }, + }, + loc: { start: 5757, end: 5773 }, + }, + directives: [], + loc: { start: 5748, end: 5773 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'status', loc: { start: 5776, end: 5782 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'IndexerEndpoint', + loc: { start: 5784, end: 5799 }, + }, + loc: { start: 5784, end: 5799 }, + }, + loc: { start: 5784, end: 5800 }, + }, + directives: [], + loc: { start: 5776, end: 5800 }, + }, + ], + loc: { start: 5722, end: 5802 }, + }, + { + kind: 'ObjectTypeDefinition', + name: { kind: 'Name', value: 'CostModel', loc: { start: 5809, end: 5818 } }, + interfaces: [], + directives: [], + fields: [ + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'deployment', loc: { start: 5823, end: 5833 } }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 5835, end: 5841 } }, + loc: { start: 5835, end: 5841 }, + }, + loc: { start: 5835, end: 5842 }, + }, + directives: [], + loc: { start: 5823, end: 5842 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'model', loc: { start: 5845, end: 5850 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 5852, end: 5858 } }, + loc: { start: 5852, end: 5858 }, + }, + directives: [], + loc: { start: 5845, end: 5858 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'variables', loc: { start: 5861, end: 5870 } }, + arguments: [], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 5872, end: 5878 } }, + loc: { start: 5872, end: 5878 }, + }, + directives: [], + loc: { start: 5861, end: 5878 }, + }, + ], + loc: { start: 5804, end: 5880 }, + }, + { + kind: 'InputObjectTypeDefinition', + name: { kind: 'Name', value: 'CostModelInput', loc: { start: 5888, end: 5902 } }, + directives: [], + fields: [ + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'deployment', loc: { start: 5907, end: 5917 } }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 5919, end: 5925 } }, + loc: { start: 5919, end: 5925 }, + }, + loc: { start: 5919, end: 5926 }, + }, + directives: [], + loc: { start: 5907, end: 5926 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'model', loc: { start: 5929, end: 5934 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 5936, end: 5942 } }, + loc: { start: 5936, end: 5942 }, + }, + directives: [], + loc: { start: 5929, end: 5942 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'variables', loc: { start: 5945, end: 5954 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 5956, end: 5962 } }, + loc: { start: 5956, end: 5962 }, + }, + directives: [], + loc: { start: 5945, end: 5962 }, + }, + ], + loc: { start: 5882, end: 5964 }, + }, + { + kind: 'ObjectTypeDefinition', + name: { kind: 'Name', value: 'Query', loc: { start: 5971, end: 5976 } }, + interfaces: [], + directives: [], + fields: [ + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'indexingRule', loc: { start: 5981, end: 5993 } }, + arguments: [ + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'identifier', + loc: { start: 5994, end: 6004 }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'IndexingRuleIdentifier', + loc: { start: 6006, end: 6028 }, + }, + loc: { start: 6006, end: 6028 }, + }, + loc: { start: 6006, end: 6029 }, + }, + directives: [], + loc: { start: 5994, end: 6029 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'merged', loc: { start: 6031, end: 6037 } }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'Boolean', + loc: { start: 6039, end: 6046 }, + }, + loc: { start: 6039, end: 6046 }, + }, + loc: { start: 6039, end: 6047 }, + }, + defaultValue: { + kind: 'BooleanValue', + value: false, + loc: { start: 6050, end: 6055 }, + }, + directives: [], + loc: { start: 6031, end: 6055 }, + }, + ], + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'IndexingRule', + loc: { start: 6058, end: 6070 }, + }, + loc: { start: 6058, end: 6070 }, + }, + directives: [], + loc: { start: 5981, end: 6070 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'indexingRules', loc: { start: 6073, end: 6086 } }, + arguments: [ + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'merged', loc: { start: 6087, end: 6093 } }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'Boolean', + loc: { start: 6095, end: 6102 }, + }, + loc: { start: 6095, end: 6102 }, + }, + loc: { start: 6095, end: 6103 }, + }, + defaultValue: { + kind: 'BooleanValue', + value: false, + loc: { start: 6106, end: 6111 }, + }, + directives: [], + loc: { start: 6087, end: 6111 }, + }, + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'protocolNetwork', + loc: { start: 6113, end: 6128 }, + }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 6130, end: 6136 } }, + loc: { start: 6130, end: 6136 }, + }, + directives: [], + loc: { start: 6113, end: 6136 }, + }, + ], + type: { + kind: 'NonNullType', + type: { + kind: 'ListType', + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'IndexingRule', + loc: { start: 6140, end: 6152 }, + }, + loc: { start: 6140, end: 6152 }, + }, + loc: { start: 6140, end: 6153 }, + }, + loc: { start: 6139, end: 6154 }, + }, + loc: { start: 6139, end: 6155 }, + }, + directives: [], + loc: { start: 6073, end: 6155 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'indexerRegistration', + loc: { start: 6158, end: 6177 }, + }, + arguments: [ + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'protocolNetwork', + loc: { start: 6178, end: 6193 }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'String', + loc: { start: 6195, end: 6201 }, + }, + loc: { start: 6195, end: 6201 }, + }, + loc: { start: 6195, end: 6202 }, + }, + directives: [], + loc: { start: 6178, end: 6202 }, + }, + ], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'IndexerRegistration', + loc: { start: 6205, end: 6224 }, + }, + loc: { start: 6205, end: 6224 }, + }, + loc: { start: 6205, end: 6225 }, + }, + directives: [], + loc: { start: 6158, end: 6225 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'indexerDeployments', + loc: { start: 6228, end: 6246 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'ListType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'IndexerDeployment', + loc: { start: 6249, end: 6266 }, + }, + loc: { start: 6249, end: 6266 }, + }, + loc: { start: 6248, end: 6267 }, + }, + loc: { start: 6248, end: 6268 }, + }, + directives: [], + loc: { start: 6228, end: 6268 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'indexerAllocations', + loc: { start: 6271, end: 6289 }, + }, + arguments: [ + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'protocolNetwork', + loc: { start: 6290, end: 6305 }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'String', + loc: { start: 6307, end: 6313 }, + }, + loc: { start: 6307, end: 6313 }, + }, + loc: { start: 6307, end: 6314 }, + }, + directives: [], + loc: { start: 6290, end: 6314 }, + }, + ], + type: { + kind: 'NonNullType', + type: { + kind: 'ListType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'IndexerAllocation', + loc: { start: 6318, end: 6335 }, + }, + loc: { start: 6318, end: 6335 }, + }, + loc: { start: 6317, end: 6336 }, + }, + loc: { start: 6317, end: 6337 }, + }, + directives: [], + loc: { start: 6271, end: 6337 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'indexerEndpoints', + loc: { start: 6340, end: 6356 }, + }, + arguments: [ + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'protocolNetwork', + loc: { start: 6357, end: 6372 }, + }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 6374, end: 6380 } }, + loc: { start: 6374, end: 6380 }, + }, + directives: [], + loc: { start: 6357, end: 6380 }, + }, + ], + type: { + kind: 'NonNullType', + type: { + kind: 'ListType', + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'IndexerEndpoints', + loc: { start: 6384, end: 6400 }, + }, + loc: { start: 6384, end: 6400 }, + }, + loc: { start: 6384, end: 6401 }, + }, + loc: { start: 6383, end: 6402 }, + }, + loc: { start: 6383, end: 6403 }, + }, + directives: [], + loc: { start: 6340, end: 6403 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'costModels', loc: { start: 6406, end: 6416 } }, + arguments: [ + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'deployments', + loc: { start: 6417, end: 6428 }, + }, + type: { + kind: 'ListType', + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'String', + loc: { start: 6431, end: 6437 }, + }, + loc: { start: 6431, end: 6437 }, + }, + loc: { start: 6431, end: 6438 }, + }, + loc: { start: 6430, end: 6439 }, + }, + directives: [], + loc: { start: 6417, end: 6439 }, + }, + ], + type: { + kind: 'NonNullType', + type: { + kind: 'ListType', + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'CostModel', + loc: { start: 6443, end: 6452 }, + }, + loc: { start: 6443, end: 6452 }, + }, + loc: { start: 6443, end: 6453 }, + }, + loc: { start: 6442, end: 6454 }, + }, + loc: { start: 6442, end: 6455 }, + }, + directives: [], + loc: { start: 6406, end: 6455 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'costModel', loc: { start: 6458, end: 6467 } }, + arguments: [ + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'deployment', + loc: { start: 6468, end: 6478 }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'String', + loc: { start: 6480, end: 6486 }, + }, + loc: { start: 6480, end: 6486 }, + }, + loc: { start: 6480, end: 6487 }, + }, + directives: [], + loc: { start: 6468, end: 6487 }, + }, + ], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'CostModel', loc: { start: 6490, end: 6499 } }, + loc: { start: 6490, end: 6499 }, + }, + directives: [], + loc: { start: 6458, end: 6499 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'dispute', loc: { start: 6502, end: 6509 } }, + arguments: [ + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'identifier', + loc: { start: 6510, end: 6520 }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'POIDisputeIdentifier', + loc: { start: 6522, end: 6542 }, + }, + loc: { start: 6522, end: 6542 }, + }, + loc: { start: 6522, end: 6543 }, + }, + directives: [], + loc: { start: 6510, end: 6543 }, + }, + ], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'POIDispute', loc: { start: 6546, end: 6556 } }, + loc: { start: 6546, end: 6556 }, + }, + directives: [], + loc: { start: 6502, end: 6556 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'disputes', loc: { start: 6559, end: 6567 } }, + arguments: [ + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'status', loc: { start: 6568, end: 6574 } }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'String', + loc: { start: 6576, end: 6582 }, + }, + loc: { start: 6576, end: 6582 }, + }, + loc: { start: 6576, end: 6583 }, + }, + directives: [], + loc: { start: 6568, end: 6583 }, + }, + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'minClosedEpoch', + loc: { start: 6585, end: 6599 }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Int', loc: { start: 6601, end: 6604 } }, + loc: { start: 6601, end: 6604 }, + }, + loc: { start: 6601, end: 6605 }, + }, + directives: [], + loc: { start: 6585, end: 6605 }, + }, + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'protocolNetwork', + loc: { start: 6607, end: 6622 }, + }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 6624, end: 6630 } }, + loc: { start: 6624, end: 6630 }, + }, + directives: [], + loc: { start: 6607, end: 6630 }, + }, + ], + type: { + kind: 'NonNullType', + type: { + kind: 'ListType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'POIDispute', + loc: { start: 6634, end: 6644 }, + }, + loc: { start: 6634, end: 6644 }, + }, + loc: { start: 6633, end: 6645 }, + }, + loc: { start: 6633, end: 6646 }, + }, + directives: [], + loc: { start: 6559, end: 6646 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'disputesClosedAfter', + loc: { start: 6649, end: 6668 }, + }, + arguments: [ + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'closedAfterBlock', + loc: { start: 6669, end: 6685 }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'BigInt', + loc: { start: 6687, end: 6693 }, + }, + loc: { start: 6687, end: 6693 }, + }, + loc: { start: 6687, end: 6694 }, + }, + directives: [], + loc: { start: 6669, end: 6694 }, + }, + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'protocolNetwork', + loc: { start: 6696, end: 6711 }, + }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 6713, end: 6719 } }, + loc: { start: 6713, end: 6719 }, + }, + directives: [], + loc: { start: 6696, end: 6719 }, + }, + ], + type: { + kind: 'NonNullType', + type: { + kind: 'ListType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'POIDispute', + loc: { start: 6723, end: 6733 }, + }, + loc: { start: 6723, end: 6733 }, + }, + loc: { start: 6722, end: 6734 }, + }, + loc: { start: 6722, end: 6735 }, + }, + directives: [], + loc: { start: 6649, end: 6735 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'allocations', loc: { start: 6738, end: 6749 } }, + arguments: [ + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'filter', loc: { start: 6750, end: 6756 } }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'AllocationFilter', + loc: { start: 6758, end: 6774 }, + }, + loc: { start: 6758, end: 6774 }, + }, + loc: { start: 6758, end: 6775 }, + }, + directives: [], + loc: { start: 6750, end: 6775 }, + }, + ], + type: { + kind: 'NonNullType', + type: { + kind: 'ListType', + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'Allocation', + loc: { start: 6779, end: 6789 }, + }, + loc: { start: 6779, end: 6789 }, + }, + loc: { start: 6779, end: 6790 }, + }, + loc: { start: 6778, end: 6791 }, + }, + loc: { start: 6778, end: 6792 }, + }, + directives: [], + loc: { start: 6738, end: 6792 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'action', loc: { start: 6795, end: 6801 } }, + arguments: [ + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'actionID', loc: { start: 6802, end: 6810 } }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'String', + loc: { start: 6812, end: 6818 }, + }, + loc: { start: 6812, end: 6818 }, + }, + loc: { start: 6812, end: 6819 }, + }, + directives: [], + loc: { start: 6802, end: 6819 }, + }, + ], + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Action', loc: { start: 6822, end: 6828 } }, + loc: { start: 6822, end: 6828 }, + }, + directives: [], + loc: { start: 6795, end: 6828 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'actions', loc: { start: 6831, end: 6838 } }, + arguments: [ + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'filter', loc: { start: 6839, end: 6845 } }, + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'ActionFilter', + loc: { start: 6847, end: 6859 }, + }, + loc: { start: 6847, end: 6859 }, + }, + directives: [], + loc: { start: 6839, end: 6859 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'orderBy', loc: { start: 6861, end: 6868 } }, + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'ActionParams', + loc: { start: 6870, end: 6882 }, + }, + loc: { start: 6870, end: 6882 }, + }, + directives: [], + loc: { start: 6861, end: 6882 }, + }, + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'orderDirection', + loc: { start: 6884, end: 6898 }, + }, + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'OrderDirection', + loc: { start: 6900, end: 6914 }, + }, + loc: { start: 6900, end: 6914 }, + }, + directives: [], + loc: { start: 6884, end: 6914 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'first', loc: { start: 6916, end: 6921 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Int', loc: { start: 6923, end: 6926 } }, + loc: { start: 6923, end: 6926 }, + }, + directives: [], + loc: { start: 6916, end: 6926 }, + }, + ], + type: { + kind: 'NonNullType', + type: { + kind: 'ListType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Action', loc: { start: 6930, end: 6936 } }, + loc: { start: 6930, end: 6936 }, + }, + loc: { start: 6929, end: 6937 }, + }, + loc: { start: 6929, end: 6938 }, + }, + directives: [], + loc: { start: 6831, end: 6938 }, + }, + ], + loc: { start: 5966, end: 6940 }, + }, + { + kind: 'ObjectTypeDefinition', + name: { kind: 'Name', value: 'Mutation', loc: { start: 6947, end: 6955 } }, + interfaces: [], + directives: [], + fields: [ + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'setIndexingRule', + loc: { start: 6960, end: 6975 }, + }, + arguments: [ + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'rule', loc: { start: 6976, end: 6980 } }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'IndexingRuleInput', + loc: { start: 6982, end: 6999 }, + }, + loc: { start: 6982, end: 6999 }, + }, + loc: { start: 6982, end: 7000 }, + }, + directives: [], + loc: { start: 6976, end: 7000 }, + }, + ], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'IndexingRule', + loc: { start: 7003, end: 7015 }, + }, + loc: { start: 7003, end: 7015 }, + }, + loc: { start: 7003, end: 7016 }, + }, + directives: [], + loc: { start: 6960, end: 7016 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'deleteIndexingRule', + loc: { start: 7019, end: 7037 }, + }, + arguments: [ + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'identifier', + loc: { start: 7038, end: 7048 }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'IndexingRuleIdentifier', + loc: { start: 7050, end: 7072 }, + }, + loc: { start: 7050, end: 7072 }, + }, + loc: { start: 7050, end: 7073 }, + }, + directives: [], + loc: { start: 7038, end: 7073 }, + }, + ], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Boolean', loc: { start: 7076, end: 7083 } }, + loc: { start: 7076, end: 7083 }, + }, + loc: { start: 7076, end: 7084 }, + }, + directives: [], + loc: { start: 7019, end: 7084 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'deleteIndexingRules', + loc: { start: 7087, end: 7106 }, + }, + arguments: [ + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'identifiers', + loc: { start: 7107, end: 7118 }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'ListType', + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'IndexingRuleIdentifier', + loc: { start: 7121, end: 7143 }, + }, + loc: { start: 7121, end: 7143 }, + }, + loc: { start: 7121, end: 7144 }, + }, + loc: { start: 7120, end: 7145 }, + }, + loc: { start: 7120, end: 7146 }, + }, + directives: [], + loc: { start: 7107, end: 7146 }, + }, + ], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Boolean', loc: { start: 7149, end: 7156 } }, + loc: { start: 7149, end: 7156 }, + }, + loc: { start: 7149, end: 7157 }, + }, + directives: [], + loc: { start: 7087, end: 7157 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'setCostModel', loc: { start: 7160, end: 7172 } }, + arguments: [ + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'costModel', loc: { start: 7173, end: 7182 } }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'CostModelInput', + loc: { start: 7184, end: 7198 }, + }, + loc: { start: 7184, end: 7198 }, + }, + loc: { start: 7184, end: 7199 }, + }, + directives: [], + loc: { start: 7173, end: 7199 }, + }, + ], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'CostModel', loc: { start: 7202, end: 7211 } }, + loc: { start: 7202, end: 7211 }, + }, + loc: { start: 7202, end: 7212 }, + }, + directives: [], + loc: { start: 7160, end: 7212 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'deleteCostModels', + loc: { start: 7215, end: 7231 }, + }, + arguments: [ + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'deployments', + loc: { start: 7232, end: 7243 }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'ListType', + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'String', + loc: { start: 7246, end: 7252 }, + }, + loc: { start: 7246, end: 7252 }, + }, + loc: { start: 7246, end: 7253 }, + }, + loc: { start: 7245, end: 7254 }, + }, + loc: { start: 7245, end: 7255 }, + }, + directives: [], + loc: { start: 7232, end: 7255 }, + }, + ], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Int', loc: { start: 7258, end: 7261 } }, + loc: { start: 7258, end: 7261 }, + }, + loc: { start: 7258, end: 7262 }, + }, + directives: [], + loc: { start: 7215, end: 7262 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'storeDisputes', loc: { start: 7265, end: 7278 } }, + arguments: [ + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'disputes', loc: { start: 7279, end: 7287 } }, + type: { + kind: 'NonNullType', + type: { + kind: 'ListType', + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'POIDisputeInput', + loc: { start: 7290, end: 7305 }, + }, + loc: { start: 7290, end: 7305 }, + }, + loc: { start: 7290, end: 7306 }, + }, + loc: { start: 7289, end: 7307 }, + }, + loc: { start: 7289, end: 7308 }, + }, + directives: [], + loc: { start: 7279, end: 7308 }, + }, + ], + type: { + kind: 'ListType', + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'POIDispute', + loc: { start: 7312, end: 7322 }, + }, + loc: { start: 7312, end: 7322 }, + }, + loc: { start: 7312, end: 7323 }, + }, + loc: { start: 7311, end: 7324 }, + }, + directives: [], + loc: { start: 7265, end: 7324 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'deleteDisputes', + loc: { start: 7327, end: 7341 }, + }, + arguments: [ + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'identifiers', + loc: { start: 7342, end: 7353 }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'ListType', + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'POIDisputeIdentifier', + loc: { start: 7356, end: 7376 }, + }, + loc: { start: 7356, end: 7376 }, + }, + loc: { start: 7356, end: 7377 }, + }, + loc: { start: 7355, end: 7378 }, + }, + loc: { start: 7355, end: 7379 }, + }, + directives: [], + loc: { start: 7342, end: 7379 }, + }, + ], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Int', loc: { start: 7382, end: 7385 } }, + loc: { start: 7382, end: 7385 }, + }, + loc: { start: 7382, end: 7386 }, + }, + directives: [], + loc: { start: 7327, end: 7386 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'createAllocation', + loc: { start: 7389, end: 7405 }, + }, + arguments: [ + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'deployment', + loc: { start: 7406, end: 7416 }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'String', + loc: { start: 7418, end: 7424 }, + }, + loc: { start: 7418, end: 7424 }, + }, + loc: { start: 7418, end: 7425 }, + }, + directives: [], + loc: { start: 7406, end: 7425 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'amount', loc: { start: 7427, end: 7433 } }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'String', + loc: { start: 7435, end: 7441 }, + }, + loc: { start: 7435, end: 7441 }, + }, + loc: { start: 7435, end: 7442 }, + }, + directives: [], + loc: { start: 7427, end: 7442 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'indexNode', loc: { start: 7444, end: 7453 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 7455, end: 7461 } }, + loc: { start: 7455, end: 7461 }, + }, + directives: [], + loc: { start: 7444, end: 7461 }, + }, + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'protocolNetwork', + loc: { start: 7463, end: 7478 }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'String', + loc: { start: 7480, end: 7486 }, + }, + loc: { start: 7480, end: 7486 }, + }, + loc: { start: 7480, end: 7487 }, + }, + directives: [], + loc: { start: 7463, end: 7487 }, + }, + ], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'CreateAllocationResult', + loc: { start: 7490, end: 7512 }, + }, + loc: { start: 7490, end: 7512 }, + }, + loc: { start: 7490, end: 7513 }, + }, + directives: [], + loc: { start: 7389, end: 7513 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'closeAllocation', + loc: { start: 7516, end: 7531 }, + }, + arguments: [ + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'allocation', + loc: { start: 7532, end: 7542 }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'String', + loc: { start: 7544, end: 7550 }, + }, + loc: { start: 7544, end: 7550 }, + }, + loc: { start: 7544, end: 7551 }, + }, + directives: [], + loc: { start: 7532, end: 7551 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'poi', loc: { start: 7553, end: 7556 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 7558, end: 7564 } }, + loc: { start: 7558, end: 7564 }, + }, + directives: [], + loc: { start: 7553, end: 7564 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'force', loc: { start: 7566, end: 7571 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Boolean', loc: { start: 7573, end: 7580 } }, + loc: { start: 7573, end: 7580 }, + }, + directives: [], + loc: { start: 7566, end: 7580 }, + }, + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'protocolNetwork', + loc: { start: 7582, end: 7597 }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'String', + loc: { start: 7599, end: 7605 }, + }, + loc: { start: 7599, end: 7605 }, + }, + loc: { start: 7599, end: 7606 }, + }, + directives: [], + loc: { start: 7582, end: 7606 }, + }, + ], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'CloseAllocationResult', + loc: { start: 7609, end: 7630 }, + }, + loc: { start: 7609, end: 7630 }, + }, + loc: { start: 7609, end: 7631 }, + }, + directives: [], + loc: { start: 7516, end: 7631 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'reallocateAllocation', + loc: { start: 7634, end: 7654 }, + }, + arguments: [ + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'allocation', + loc: { start: 7655, end: 7665 }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'String', + loc: { start: 7667, end: 7673 }, + }, + loc: { start: 7667, end: 7673 }, + }, + loc: { start: 7667, end: 7674 }, + }, + directives: [], + loc: { start: 7655, end: 7674 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'poi', loc: { start: 7676, end: 7679 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'String', loc: { start: 7681, end: 7687 } }, + loc: { start: 7681, end: 7687 }, + }, + directives: [], + loc: { start: 7676, end: 7687 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'amount', loc: { start: 7689, end: 7695 } }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'String', + loc: { start: 7697, end: 7703 }, + }, + loc: { start: 7697, end: 7703 }, + }, + loc: { start: 7697, end: 7704 }, + }, + directives: [], + loc: { start: 7689, end: 7704 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'force', loc: { start: 7706, end: 7711 } }, + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Boolean', loc: { start: 7713, end: 7720 } }, + loc: { start: 7713, end: 7720 }, + }, + directives: [], + loc: { start: 7706, end: 7720 }, + }, + { + kind: 'InputValueDefinition', + name: { + kind: 'Name', + value: 'protocolNetwork', + loc: { start: 7722, end: 7737 }, + }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'String', + loc: { start: 7739, end: 7745 }, + }, + loc: { start: 7739, end: 7745 }, + }, + loc: { start: 7739, end: 7746 }, + }, + directives: [], + loc: { start: 7722, end: 7746 }, + }, + ], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'ReallocateAllocationResult', + loc: { start: 7749, end: 7775 }, + }, + loc: { start: 7749, end: 7775 }, + }, + loc: { start: 7749, end: 7776 }, + }, + directives: [], + loc: { start: 7634, end: 7776 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'updateAction', loc: { start: 7779, end: 7791 } }, + arguments: [ + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'action', loc: { start: 7792, end: 7798 } }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'ActionInput', + loc: { start: 7800, end: 7811 }, + }, + loc: { start: 7800, end: 7811 }, + }, + loc: { start: 7800, end: 7812 }, + }, + directives: [], + loc: { start: 7792, end: 7812 }, + }, + ], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Action', loc: { start: 7815, end: 7821 } }, + loc: { start: 7815, end: 7821 }, + }, + loc: { start: 7815, end: 7822 }, + }, + directives: [], + loc: { start: 7779, end: 7822 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'updateActions', loc: { start: 7825, end: 7838 } }, + arguments: [ + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'filter', loc: { start: 7839, end: 7845 } }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'ActionFilter', + loc: { start: 7847, end: 7859 }, + }, + loc: { start: 7847, end: 7859 }, + }, + loc: { start: 7847, end: 7860 }, + }, + directives: [], + loc: { start: 7839, end: 7860 }, + }, + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'action', loc: { start: 7862, end: 7868 } }, + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'ActionUpdateInput', + loc: { start: 7870, end: 7887 }, + }, + loc: { start: 7870, end: 7887 }, + }, + loc: { start: 7870, end: 7888 }, + }, + directives: [], + loc: { start: 7862, end: 7888 }, + }, + ], + type: { + kind: 'NonNullType', + type: { + kind: 'ListType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Action', loc: { start: 7892, end: 7898 } }, + loc: { start: 7892, end: 7898 }, + }, + loc: { start: 7891, end: 7899 }, + }, + loc: { start: 7891, end: 7900 }, + }, + directives: [], + loc: { start: 7825, end: 7900 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'queueActions', loc: { start: 7903, end: 7915 } }, + arguments: [ + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'actions', loc: { start: 7916, end: 7923 } }, + type: { + kind: 'NonNullType', + type: { + kind: 'ListType', + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'ActionInput', + loc: { start: 7926, end: 7937 }, + }, + loc: { start: 7926, end: 7937 }, + }, + loc: { start: 7926, end: 7938 }, + }, + loc: { start: 7925, end: 7939 }, + }, + loc: { start: 7925, end: 7940 }, + }, + directives: [], + loc: { start: 7916, end: 7940 }, + }, + ], + type: { + kind: 'NonNullType', + type: { + kind: 'ListType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Action', loc: { start: 7944, end: 7950 } }, + loc: { start: 7944, end: 7950 }, + }, + loc: { start: 7943, end: 7951 }, + }, + loc: { start: 7943, end: 7952 }, + }, + directives: [], + loc: { start: 7903, end: 7952 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'cancelActions', loc: { start: 7955, end: 7968 } }, + arguments: [ + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'actionIDs', loc: { start: 7969, end: 7978 } }, + type: { + kind: 'NonNullType', + type: { + kind: 'ListType', + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'String', + loc: { start: 7981, end: 7987 }, + }, + loc: { start: 7981, end: 7987 }, + }, + loc: { start: 7981, end: 7988 }, + }, + loc: { start: 7980, end: 7989 }, + }, + loc: { start: 7980, end: 7990 }, + }, + directives: [], + loc: { start: 7969, end: 7990 }, + }, + ], + type: { + kind: 'NonNullType', + type: { + kind: 'ListType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Action', loc: { start: 7994, end: 8000 } }, + loc: { start: 7994, end: 8000 }, + }, + loc: { start: 7993, end: 8001 }, + }, + loc: { start: 7993, end: 8002 }, + }, + directives: [], + loc: { start: 7955, end: 8002 }, + }, + { + kind: 'FieldDefinition', + name: { kind: 'Name', value: 'deleteActions', loc: { start: 8005, end: 8018 } }, + arguments: [ + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'actionIDs', loc: { start: 8019, end: 8028 } }, + type: { + kind: 'NonNullType', + type: { + kind: 'ListType', + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'String', + loc: { start: 8031, end: 8037 }, + }, + loc: { start: 8031, end: 8037 }, + }, + loc: { start: 8031, end: 8038 }, + }, + loc: { start: 8030, end: 8039 }, + }, + loc: { start: 8030, end: 8040 }, + }, + directives: [], + loc: { start: 8019, end: 8040 }, + }, + ], + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Int', loc: { start: 8043, end: 8046 } }, + loc: { start: 8043, end: 8046 }, + }, + loc: { start: 8043, end: 8047 }, + }, + directives: [], + loc: { start: 8005, end: 8047 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'approveActions', + loc: { start: 8050, end: 8064 }, + }, + arguments: [ + { + kind: 'InputValueDefinition', + name: { kind: 'Name', value: 'actionIDs', loc: { start: 8065, end: 8074 } }, + type: { + kind: 'NonNullType', + type: { + kind: 'ListType', + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'String', + loc: { start: 8077, end: 8083 }, + }, + loc: { start: 8077, end: 8083 }, + }, + loc: { start: 8077, end: 8084 }, + }, + loc: { start: 8076, end: 8085 }, + }, + loc: { start: 8076, end: 8086 }, + }, + directives: [], + loc: { start: 8065, end: 8086 }, + }, + ], + type: { + kind: 'NonNullType', + type: { + kind: 'ListType', + type: { + kind: 'NamedType', + name: { kind: 'Name', value: 'Action', loc: { start: 8090, end: 8096 } }, + loc: { start: 8090, end: 8096 }, + }, + loc: { start: 8089, end: 8097 }, + }, + loc: { start: 8089, end: 8098 }, + }, + directives: [], + loc: { start: 8050, end: 8098 }, + }, + { + kind: 'FieldDefinition', + name: { + kind: 'Name', + value: 'executeApprovedActions', + loc: { start: 8101, end: 8123 }, + }, + arguments: [], + type: { + kind: 'NonNullType', + type: { + kind: 'ListType', + type: { + kind: 'NonNullType', + type: { + kind: 'NamedType', + name: { + kind: 'Name', + value: 'ActionResult', + loc: { start: 8126, end: 8138 }, + }, + loc: { start: 8126, end: 8138 }, + }, + loc: { start: 8126, end: 8139 }, + }, + loc: { start: 8125, end: 8140 }, + }, + loc: { start: 8125, end: 8141 }, + }, + directives: [], + loc: { start: 8101, end: 8141 }, + }, + ], + loc: { start: 6942, end: 8143 }, + }, + ], + loc: { start: 0, end: 8144 }, +} as unknown as DocumentNode diff --git a/packages/indexer-common/src/schema/types.generated.ts b/packages/indexer-common/src/schema/types.generated.ts new file mode 100644 index 000000000..ecd74215f --- /dev/null +++ b/packages/indexer-common/src/schema/types.generated.ts @@ -0,0 +1,1246 @@ +import { GraphQLResolveInfo, GraphQLScalarType, GraphQLScalarTypeConfig } from 'graphql' +import { IndexerManagementResolverContext } from '@graphprotocol/indexer-common' +export type Maybe = T | null | undefined +export type InputMaybe = T | null | undefined +export type Exact = { [K in keyof T]: T[K] } +export type MakeOptional = Omit & { + [SubKey in K]?: Maybe +} +export type MakeMaybe = Omit & { + [SubKey in K]: Maybe +} +export type MakeEmpty = { + [_ in K]?: never +} +export type Incremental = + | T + | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never } +export type RequireFields = Omit & { + [P in K]-?: NonNullable +} +/** All built-in and custom scalars, mapped to their actual values */ +export type Scalars = { + ID: { input: string; output: string } + String: { input: string; output: string } + Boolean: { input: boolean; output: boolean } + Int: { input: number; output: number } + Float: { input: number; output: number } + BigInt: { input: any; output: any } +} + +export type Action = { + __typename?: 'Action' + allocationID?: Maybe + amount?: Maybe + createdAt: Scalars['BigInt']['output'] + deploymentID?: Maybe + failureReason?: Maybe + force?: Maybe + id: Scalars['Int']['output'] + poi?: Maybe + priority: Scalars['Int']['output'] + protocolNetwork: Scalars['String']['output'] + reason: Scalars['String']['output'] + source: Scalars['String']['output'] + status: ActionStatus + transaction?: Maybe + type: ActionType + updatedAt?: Maybe +} + +export type ActionFilter = { + id?: InputMaybe + protocolNetwork?: InputMaybe + reason?: InputMaybe + source?: InputMaybe + status?: InputMaybe + type?: InputMaybe +} + +export type ActionInput = { + allocationID?: InputMaybe + amount?: InputMaybe + deploymentID?: InputMaybe + force?: InputMaybe + poi?: InputMaybe + priority: Scalars['Int']['input'] + protocolNetwork: Scalars['String']['input'] + reason: Scalars['String']['input'] + source: Scalars['String']['input'] + status: ActionStatus + type: ActionType +} + +export type ActionParams = + | 'allocationID' + | 'amount' + | 'createdAt' + | 'deploymentID' + | 'force' + | 'id' + | 'poi' + | 'priority' + | 'protocolNetwork' + | 'reason' + | 'source' + | 'status' + | 'transaction' + | 'type' + | 'updatedAt' + +export type ActionResult = { + __typename?: 'ActionResult' + allocationID?: Maybe + amount?: Maybe + deploymentID?: Maybe + failureReason?: Maybe + force?: Maybe + id: Scalars['Int']['output'] + poi?: Maybe + priority?: Maybe + protocolNetwork: Scalars['String']['output'] + reason: Scalars['String']['output'] + source: Scalars['String']['output'] + status: Scalars['String']['output'] + transaction?: Maybe + type: ActionType +} + +export type ActionStatus = + | 'approved' + | 'canceled' + | 'failed' + | 'pending' + | 'queued' + | 'success' + +export type ActionType = 'allocate' | 'reallocate' | 'unallocate' + +export type ActionUpdateInput = { + allocationID?: InputMaybe + amount?: InputMaybe + deploymentID?: InputMaybe + force?: InputMaybe + id?: InputMaybe + poi?: InputMaybe + reason?: InputMaybe + status?: InputMaybe + type?: InputMaybe +} + +export type Allocation = { + __typename?: 'Allocation' + ageInEpochs: Scalars['Int']['output'] + allocatedTokens: Scalars['String']['output'] + closedAtEpoch?: Maybe + createdAtEpoch: Scalars['Int']['output'] + id: Scalars['String']['output'] + indexer: Scalars['String']['output'] + indexingRewards: Scalars['String']['output'] + protocolNetwork: Scalars['String']['output'] + queryFeesCollected: Scalars['String']['output'] + signalledTokens: Scalars['BigInt']['output'] + stakedTokens: Scalars['BigInt']['output'] + status: AllocationStatus + subgraphDeployment: Scalars['String']['output'] +} + +export type AllocationFilter = { + allocation?: InputMaybe + protocolNetwork?: InputMaybe + status?: InputMaybe + subgraphDeployment?: InputMaybe +} + +export type AllocationStatus = 'Active' | 'Claimed' | 'Closed' | 'Finalized' | 'Null' + +export type BlockPointer = { + __typename?: 'BlockPointer' + hash: Scalars['String']['output'] + number: Scalars['Int']['output'] +} + +export type ChainIndexingStatus = { + __typename?: 'ChainIndexingStatus' + chainHeadBlock?: Maybe + earliestBlock?: Maybe + latestBlock?: Maybe + network: Scalars['String']['output'] +} + +export type CloseAllocationResult = { + __typename?: 'CloseAllocationResult' + allocatedTokens: Scalars['String']['output'] + allocation: Scalars['String']['output'] + indexingRewards: Scalars['String']['output'] + protocolNetwork: Scalars['String']['output'] + receiptsWorthCollecting: Scalars['Boolean']['output'] +} + +export type CostModel = { + __typename?: 'CostModel' + deployment: Scalars['String']['output'] + model?: Maybe + variables?: Maybe +} + +export type CostModelInput = { + deployment: Scalars['String']['input'] + model?: InputMaybe + variables?: InputMaybe +} + +export type CreateAllocationResult = { + __typename?: 'CreateAllocationResult' + allocatedTokens: Scalars['String']['output'] + allocation: Scalars['String']['output'] + deployment: Scalars['String']['output'] + protocolNetwork: Scalars['String']['output'] +} + +export type GeoLocation = { + __typename?: 'GeoLocation' + latitude: Scalars['String']['output'] + longitude: Scalars['String']['output'] +} + +export type IdentifierType = 'deployment' | 'group' | 'subgraph' + +export type IndexerAllocation = { + __typename?: 'IndexerAllocation' + allocatedTokens: Scalars['BigInt']['output'] + closedAtEpoch?: Maybe + createdAtEpoch: Scalars['Int']['output'] + id: Scalars['String']['output'] + signalledTokens: Scalars['BigInt']['output'] + stakedTokens: Scalars['BigInt']['output'] + subgraphDeployment: Scalars['String']['output'] +} + +export type IndexerDeployment = { + __typename?: 'IndexerDeployment' + chains?: Maybe>> + fatalError?: Maybe + health: Scalars['String']['output'] + node?: Maybe + subgraphDeployment: Scalars['String']['output'] + synced: Scalars['Boolean']['output'] +} + +export type IndexerEndpoint = { + __typename?: 'IndexerEndpoint' + healthy: Scalars['Boolean']['output'] + protocolNetwork: Scalars['String']['output'] + tests: Array + url?: Maybe +} + +export type IndexerEndpointTest = { + __typename?: 'IndexerEndpointTest' + error?: Maybe + possibleActions: Array> + test: Scalars['String']['output'] +} + +export type IndexerEndpoints = { + __typename?: 'IndexerEndpoints' + service: IndexerEndpoint + status: IndexerEndpoint +} + +export type IndexerRegistration = { + __typename?: 'IndexerRegistration' + address?: Maybe + location?: Maybe + protocolNetwork: Scalars['String']['output'] + registered: Scalars['Boolean']['output'] + url?: Maybe +} + +export type IndexingDecisionBasis = 'always' | 'never' | 'offchain' | 'rules' + +export type IndexingError = { + __typename?: 'IndexingError' + handler?: Maybe + message: Scalars['String']['output'] +} + +export type IndexingRule = { + __typename?: 'IndexingRule' + allocationAmount?: Maybe + allocationLifetime?: Maybe + autoRenewal: Scalars['Boolean']['output'] + custom?: Maybe + decisionBasis: IndexingDecisionBasis + identifier: Scalars['String']['output'] + identifierType: IdentifierType + maxAllocationPercentage?: Maybe + maxSignal?: Maybe + minAverageQueryFees?: Maybe + minSignal?: Maybe + minStake?: Maybe + parallelAllocations?: Maybe + protocolNetwork: Scalars['String']['output'] + requireSupported: Scalars['Boolean']['output'] + safety: Scalars['Boolean']['output'] +} + +export type IndexingRuleIdentifier = { + identifier: Scalars['String']['input'] + protocolNetwork: Scalars['String']['input'] +} + +export type IndexingRuleInput = { + allocationAmount?: InputMaybe + allocationLifetime?: InputMaybe + autoRenewal?: InputMaybe + custom?: InputMaybe + decisionBasis?: InputMaybe + identifier: Scalars['String']['input'] + identifierType: IdentifierType + maxAllocationPercentage?: InputMaybe + maxSignal?: InputMaybe + minAverageQueryFees?: InputMaybe + minSignal?: InputMaybe + minStake?: InputMaybe + parallelAllocations?: InputMaybe + protocolNetwork: Scalars['String']['input'] + requireSupported?: InputMaybe + safety?: InputMaybe +} + +export type Mutation = { + __typename?: 'Mutation' + approveActions: Array> + cancelActions: Array> + closeAllocation: CloseAllocationResult + createAllocation: CreateAllocationResult + deleteActions: Scalars['Int']['output'] + deleteCostModels: Scalars['Int']['output'] + deleteDisputes: Scalars['Int']['output'] + deleteIndexingRule: Scalars['Boolean']['output'] + deleteIndexingRules: Scalars['Boolean']['output'] + executeApprovedActions: Array + queueActions: Array> + reallocateAllocation: ReallocateAllocationResult + setCostModel: CostModel + setIndexingRule: IndexingRule + storeDisputes?: Maybe> + updateAction: Action + updateActions: Array> +} + +export type MutationapproveActionsArgs = { + actionIDs: Array +} + +export type MutationcancelActionsArgs = { + actionIDs: Array +} + +export type MutationcloseAllocationArgs = { + allocation: Scalars['String']['input'] + force?: InputMaybe + poi?: InputMaybe + protocolNetwork: Scalars['String']['input'] +} + +export type MutationcreateAllocationArgs = { + amount: Scalars['String']['input'] + deployment: Scalars['String']['input'] + indexNode?: InputMaybe + protocolNetwork: Scalars['String']['input'] +} + +export type MutationdeleteActionsArgs = { + actionIDs: Array +} + +export type MutationdeleteCostModelsArgs = { + deployments: Array +} + +export type MutationdeleteDisputesArgs = { + identifiers: Array +} + +export type MutationdeleteIndexingRuleArgs = { + identifier: IndexingRuleIdentifier +} + +export type MutationdeleteIndexingRulesArgs = { + identifiers: Array +} + +export type MutationqueueActionsArgs = { + actions: Array +} + +export type MutationreallocateAllocationArgs = { + allocation: Scalars['String']['input'] + amount: Scalars['String']['input'] + force?: InputMaybe + poi?: InputMaybe + protocolNetwork: Scalars['String']['input'] +} + +export type MutationsetCostModelArgs = { + costModel: CostModelInput +} + +export type MutationsetIndexingRuleArgs = { + rule: IndexingRuleInput +} + +export type MutationstoreDisputesArgs = { + disputes: Array +} + +export type MutationupdateActionArgs = { + action: ActionInput +} + +export type MutationupdateActionsArgs = { + action: ActionUpdateInput + filter: ActionFilter +} + +export type OrderDirection = 'asc' | 'desc' + +export type POIDispute = { + __typename?: 'POIDispute' + allocationAmount: Scalars['BigInt']['output'] + allocationID: Scalars['String']['output'] + allocationIndexer: Scalars['String']['output'] + allocationProof: Scalars['String']['output'] + closedEpoch: Scalars['Int']['output'] + closedEpochReferenceProof?: Maybe + closedEpochStartBlockHash: Scalars['String']['output'] + closedEpochStartBlockNumber: Scalars['Int']['output'] + previousEpochReferenceProof?: Maybe + previousEpochStartBlockHash: Scalars['String']['output'] + previousEpochStartBlockNumber: Scalars['Int']['output'] + protocolNetwork: Scalars['String']['output'] + status: Scalars['String']['output'] + subgraphDeploymentID: Scalars['String']['output'] +} + +export type POIDisputeIdentifier = { + allocationID: Scalars['String']['input'] + protocolNetwork: Scalars['String']['input'] +} + +export type POIDisputeInput = { + allocationAmount: Scalars['BigInt']['input'] + allocationID: Scalars['String']['input'] + allocationIndexer: Scalars['String']['input'] + allocationProof: Scalars['String']['input'] + closedEpoch: Scalars['Int']['input'] + closedEpochReferenceProof?: InputMaybe + closedEpochStartBlockHash: Scalars['String']['input'] + closedEpochStartBlockNumber: Scalars['Int']['input'] + previousEpochReferenceProof?: InputMaybe + previousEpochStartBlockHash: Scalars['String']['input'] + previousEpochStartBlockNumber: Scalars['Int']['input'] + protocolNetwork: Scalars['String']['input'] + status: Scalars['String']['input'] + subgraphDeploymentID: Scalars['String']['input'] +} + +export type Query = { + __typename?: 'Query' + action?: Maybe + actions: Array> + allocations: Array + costModel?: Maybe + costModels: Array + dispute?: Maybe + disputes: Array> + disputesClosedAfter: Array> + indexerAllocations: Array> + indexerDeployments: Array> + indexerEndpoints: Array + indexerRegistration: IndexerRegistration + indexingRule?: Maybe + indexingRules: Array +} + +export type QueryactionArgs = { + actionID: Scalars['String']['input'] +} + +export type QueryactionsArgs = { + filter?: InputMaybe + first?: InputMaybe + orderBy?: InputMaybe + orderDirection?: InputMaybe +} + +export type QueryallocationsArgs = { + filter: AllocationFilter +} + +export type QuerycostModelArgs = { + deployment: Scalars['String']['input'] +} + +export type QuerycostModelsArgs = { + deployments?: InputMaybe> +} + +export type QuerydisputeArgs = { + identifier: POIDisputeIdentifier +} + +export type QuerydisputesArgs = { + minClosedEpoch: Scalars['Int']['input'] + protocolNetwork?: InputMaybe + status: Scalars['String']['input'] +} + +export type QuerydisputesClosedAfterArgs = { + closedAfterBlock: Scalars['BigInt']['input'] + protocolNetwork?: InputMaybe +} + +export type QueryindexerAllocationsArgs = { + protocolNetwork: Scalars['String']['input'] +} + +export type QueryindexerEndpointsArgs = { + protocolNetwork?: InputMaybe +} + +export type QueryindexerRegistrationArgs = { + protocolNetwork: Scalars['String']['input'] +} + +export type QueryindexingRuleArgs = { + identifier: IndexingRuleIdentifier + merged?: Scalars['Boolean']['input'] +} + +export type QueryindexingRulesArgs = { + merged?: Scalars['Boolean']['input'] + protocolNetwork?: InputMaybe +} + +export type ReallocateAllocationResult = { + __typename?: 'ReallocateAllocationResult' + closedAllocation: Scalars['String']['output'] + createdAllocation: Scalars['String']['output'] + createdAllocationStake: Scalars['String']['output'] + indexingRewardsCollected: Scalars['String']['output'] + protocolNetwork: Scalars['String']['output'] + receiptsWorthCollecting: Scalars['Boolean']['output'] +} + +export type ResolverTypeWrapper = Promise | T + +export type ResolverWithResolve = { + resolve: ResolverFn +} +export type Resolver = + | ResolverFn + | ResolverWithResolve + +export type ResolverFn = ( + parent: TParent, + args: TArgs, + context: TContext, + info: GraphQLResolveInfo, +) => Promise | TResult + +export type SubscriptionSubscribeFn = ( + parent: TParent, + args: TArgs, + context: TContext, + info: GraphQLResolveInfo, +) => AsyncIterable | Promise> + +export type SubscriptionResolveFn = ( + parent: TParent, + args: TArgs, + context: TContext, + info: GraphQLResolveInfo, +) => TResult | Promise + +export interface SubscriptionSubscriberObject< + TResult, + TKey extends string, + TParent, + TContext, + TArgs, +> { + subscribe: SubscriptionSubscribeFn<{ [key in TKey]: TResult }, TParent, TContext, TArgs> + resolve?: SubscriptionResolveFn +} + +export interface SubscriptionResolverObject { + subscribe: SubscriptionSubscribeFn + resolve: SubscriptionResolveFn +} + +export type SubscriptionObject = + | SubscriptionSubscriberObject + | SubscriptionResolverObject + +export type SubscriptionResolver< + TResult, + TKey extends string, + TParent = {}, + TContext = {}, + TArgs = {}, +> = + | ((...args: any[]) => SubscriptionObject) + | SubscriptionObject + +export type TypeResolveFn = ( + parent: TParent, + context: TContext, + info: GraphQLResolveInfo, +) => Maybe | Promise> + +export type IsTypeOfResolverFn = ( + obj: T, + context: TContext, + info: GraphQLResolveInfo, +) => boolean | Promise + +export type NextResolverFn = () => Promise + +export type DirectiveResolverFn = ( + next: NextResolverFn, + parent: TParent, + args: TArgs, + context: TContext, + info: GraphQLResolveInfo, +) => TResult | Promise + +/** Mapping between all available schema types and the resolvers types */ +export type ResolversTypes = { + Action: ResolverTypeWrapper + String: ResolverTypeWrapper + Boolean: ResolverTypeWrapper + Int: ResolverTypeWrapper + ActionFilter: ActionFilter + ActionInput: ActionInput + ActionParams: ActionParams + ActionResult: ResolverTypeWrapper + ActionStatus: ActionStatus + ActionType: ActionType + ActionUpdateInput: ActionUpdateInput + Allocation: ResolverTypeWrapper + AllocationFilter: AllocationFilter + AllocationStatus: AllocationStatus + BigInt: ResolverTypeWrapper + BlockPointer: ResolverTypeWrapper + ChainIndexingStatus: ResolverTypeWrapper + CloseAllocationResult: ResolverTypeWrapper + CostModel: ResolverTypeWrapper + CostModelInput: CostModelInput + CreateAllocationResult: ResolverTypeWrapper + GeoLocation: ResolverTypeWrapper + IdentifierType: IdentifierType + IndexerAllocation: ResolverTypeWrapper + IndexerDeployment: ResolverTypeWrapper + IndexerEndpoint: ResolverTypeWrapper + IndexerEndpointTest: ResolverTypeWrapper + IndexerEndpoints: ResolverTypeWrapper + IndexerRegistration: ResolverTypeWrapper + IndexingDecisionBasis: IndexingDecisionBasis + IndexingError: ResolverTypeWrapper + IndexingRule: ResolverTypeWrapper + Float: ResolverTypeWrapper + IndexingRuleIdentifier: IndexingRuleIdentifier + IndexingRuleInput: IndexingRuleInput + Mutation: ResolverTypeWrapper<{}> + OrderDirection: OrderDirection + POIDispute: ResolverTypeWrapper + POIDisputeIdentifier: POIDisputeIdentifier + POIDisputeInput: POIDisputeInput + Query: ResolverTypeWrapper<{}> + ReallocateAllocationResult: ResolverTypeWrapper +} + +/** Mapping between all available schema types and the resolvers parents */ +export type ResolversParentTypes = { + Action: Action + String: Scalars['String']['output'] + Boolean: Scalars['Boolean']['output'] + Int: Scalars['Int']['output'] + ActionFilter: ActionFilter + ActionInput: ActionInput + ActionResult: ActionResult + ActionUpdateInput: ActionUpdateInput + Allocation: Allocation + AllocationFilter: AllocationFilter + BigInt: Scalars['BigInt']['output'] + BlockPointer: BlockPointer + ChainIndexingStatus: ChainIndexingStatus + CloseAllocationResult: CloseAllocationResult + CostModel: CostModel + CostModelInput: CostModelInput + CreateAllocationResult: CreateAllocationResult + GeoLocation: GeoLocation + IndexerAllocation: IndexerAllocation + IndexerDeployment: IndexerDeployment + IndexerEndpoint: IndexerEndpoint + IndexerEndpointTest: IndexerEndpointTest + IndexerEndpoints: IndexerEndpoints + IndexerRegistration: IndexerRegistration + IndexingError: IndexingError + IndexingRule: IndexingRule + Float: Scalars['Float']['output'] + IndexingRuleIdentifier: IndexingRuleIdentifier + IndexingRuleInput: IndexingRuleInput + Mutation: {} + POIDispute: POIDispute + POIDisputeIdentifier: POIDisputeIdentifier + POIDisputeInput: POIDisputeInput + Query: {} + ReallocateAllocationResult: ReallocateAllocationResult +} + +export type ActionResolvers< + ContextType = IndexerManagementResolverContext, + ParentType extends ResolversParentTypes['Action'] = ResolversParentTypes['Action'], +> = { + allocationID?: Resolver, ParentType, ContextType> + amount?: Resolver, ParentType, ContextType> + createdAt?: Resolver + deploymentID?: Resolver, ParentType, ContextType> + failureReason?: Resolver, ParentType, ContextType> + force?: Resolver, ParentType, ContextType> + id?: Resolver + poi?: Resolver, ParentType, ContextType> + priority?: Resolver + protocolNetwork?: Resolver + reason?: Resolver + source?: Resolver + status?: Resolver + transaction?: Resolver, ParentType, ContextType> + type?: Resolver + updatedAt?: Resolver, ParentType, ContextType> + __isTypeOf?: IsTypeOfResolverFn +} + +export type ActionResultResolvers< + ContextType = IndexerManagementResolverContext, + ParentType extends + ResolversParentTypes['ActionResult'] = ResolversParentTypes['ActionResult'], +> = { + allocationID?: Resolver, ParentType, ContextType> + amount?: Resolver, ParentType, ContextType> + deploymentID?: Resolver, ParentType, ContextType> + failureReason?: Resolver, ParentType, ContextType> + force?: Resolver, ParentType, ContextType> + id?: Resolver + poi?: Resolver, ParentType, ContextType> + priority?: Resolver, ParentType, ContextType> + protocolNetwork?: Resolver + reason?: Resolver + source?: Resolver + status?: Resolver + transaction?: Resolver, ParentType, ContextType> + type?: Resolver + __isTypeOf?: IsTypeOfResolverFn +} + +export type AllocationResolvers< + ContextType = IndexerManagementResolverContext, + ParentType extends + ResolversParentTypes['Allocation'] = ResolversParentTypes['Allocation'], +> = { + ageInEpochs?: Resolver + allocatedTokens?: Resolver + closedAtEpoch?: Resolver, ParentType, ContextType> + createdAtEpoch?: Resolver + id?: Resolver + indexer?: Resolver + indexingRewards?: Resolver + protocolNetwork?: Resolver + queryFeesCollected?: Resolver + signalledTokens?: Resolver + stakedTokens?: Resolver + status?: Resolver + subgraphDeployment?: Resolver + __isTypeOf?: IsTypeOfResolverFn +} + +export interface BigIntScalarConfig + extends GraphQLScalarTypeConfig { + name: 'BigInt' +} + +export type BlockPointerResolvers< + ContextType = IndexerManagementResolverContext, + ParentType extends + ResolversParentTypes['BlockPointer'] = ResolversParentTypes['BlockPointer'], +> = { + hash?: Resolver + number?: Resolver + __isTypeOf?: IsTypeOfResolverFn +} + +export type ChainIndexingStatusResolvers< + ContextType = IndexerManagementResolverContext, + ParentType extends + ResolversParentTypes['ChainIndexingStatus'] = ResolversParentTypes['ChainIndexingStatus'], +> = { + chainHeadBlock?: Resolver< + Maybe, + ParentType, + ContextType + > + earliestBlock?: Resolver, ParentType, ContextType> + latestBlock?: Resolver, ParentType, ContextType> + network?: Resolver + __isTypeOf?: IsTypeOfResolverFn +} + +export type CloseAllocationResultResolvers< + ContextType = IndexerManagementResolverContext, + ParentType extends + ResolversParentTypes['CloseAllocationResult'] = ResolversParentTypes['CloseAllocationResult'], +> = { + allocatedTokens?: Resolver + allocation?: Resolver + indexingRewards?: Resolver + protocolNetwork?: Resolver + receiptsWorthCollecting?: Resolver + __isTypeOf?: IsTypeOfResolverFn +} + +export type CostModelResolvers< + ContextType = IndexerManagementResolverContext, + ParentType extends + ResolversParentTypes['CostModel'] = ResolversParentTypes['CostModel'], +> = { + deployment?: Resolver + model?: Resolver, ParentType, ContextType> + variables?: Resolver, ParentType, ContextType> + __isTypeOf?: IsTypeOfResolverFn +} + +export type CreateAllocationResultResolvers< + ContextType = IndexerManagementResolverContext, + ParentType extends + ResolversParentTypes['CreateAllocationResult'] = ResolversParentTypes['CreateAllocationResult'], +> = { + allocatedTokens?: Resolver + allocation?: Resolver + deployment?: Resolver + protocolNetwork?: Resolver + __isTypeOf?: IsTypeOfResolverFn +} + +export type GeoLocationResolvers< + ContextType = IndexerManagementResolverContext, + ParentType extends + ResolversParentTypes['GeoLocation'] = ResolversParentTypes['GeoLocation'], +> = { + latitude?: Resolver + longitude?: Resolver + __isTypeOf?: IsTypeOfResolverFn +} + +export type IndexerAllocationResolvers< + ContextType = IndexerManagementResolverContext, + ParentType extends + ResolversParentTypes['IndexerAllocation'] = ResolversParentTypes['IndexerAllocation'], +> = { + allocatedTokens?: Resolver + closedAtEpoch?: Resolver, ParentType, ContextType> + createdAtEpoch?: Resolver + id?: Resolver + signalledTokens?: Resolver + stakedTokens?: Resolver + subgraphDeployment?: Resolver + __isTypeOf?: IsTypeOfResolverFn +} + +export type IndexerDeploymentResolvers< + ContextType = IndexerManagementResolverContext, + ParentType extends + ResolversParentTypes['IndexerDeployment'] = ResolversParentTypes['IndexerDeployment'], +> = { + chains?: Resolver< + Maybe>>, + ParentType, + ContextType + > + fatalError?: Resolver, ParentType, ContextType> + health?: Resolver + node?: Resolver, ParentType, ContextType> + subgraphDeployment?: Resolver + synced?: Resolver + __isTypeOf?: IsTypeOfResolverFn +} + +export type IndexerEndpointResolvers< + ContextType = IndexerManagementResolverContext, + ParentType extends + ResolversParentTypes['IndexerEndpoint'] = ResolversParentTypes['IndexerEndpoint'], +> = { + healthy?: Resolver + protocolNetwork?: Resolver + tests?: Resolver, ParentType, ContextType> + url?: Resolver, ParentType, ContextType> + __isTypeOf?: IsTypeOfResolverFn +} + +export type IndexerEndpointTestResolvers< + ContextType = IndexerManagementResolverContext, + ParentType extends + ResolversParentTypes['IndexerEndpointTest'] = ResolversParentTypes['IndexerEndpointTest'], +> = { + error?: Resolver, ParentType, ContextType> + possibleActions?: Resolver< + Array>, + ParentType, + ContextType + > + test?: Resolver + __isTypeOf?: IsTypeOfResolverFn +} + +export type IndexerEndpointsResolvers< + ContextType = IndexerManagementResolverContext, + ParentType extends + ResolversParentTypes['IndexerEndpoints'] = ResolversParentTypes['IndexerEndpoints'], +> = { + service?: Resolver + status?: Resolver + __isTypeOf?: IsTypeOfResolverFn +} + +export type IndexerRegistrationResolvers< + ContextType = IndexerManagementResolverContext, + ParentType extends + ResolversParentTypes['IndexerRegistration'] = ResolversParentTypes['IndexerRegistration'], +> = { + address?: Resolver, ParentType, ContextType> + location?: Resolver, ParentType, ContextType> + protocolNetwork?: Resolver + registered?: Resolver + url?: Resolver, ParentType, ContextType> + __isTypeOf?: IsTypeOfResolverFn +} + +export type IndexingErrorResolvers< + ContextType = IndexerManagementResolverContext, + ParentType extends + ResolversParentTypes['IndexingError'] = ResolversParentTypes['IndexingError'], +> = { + handler?: Resolver, ParentType, ContextType> + message?: Resolver + __isTypeOf?: IsTypeOfResolverFn +} + +export type IndexingRuleResolvers< + ContextType = IndexerManagementResolverContext, + ParentType extends + ResolversParentTypes['IndexingRule'] = ResolversParentTypes['IndexingRule'], +> = { + allocationAmount?: Resolver, ParentType, ContextType> + allocationLifetime?: Resolver, ParentType, ContextType> + autoRenewal?: Resolver + custom?: Resolver, ParentType, ContextType> + decisionBasis?: Resolver< + ResolversTypes['IndexingDecisionBasis'], + ParentType, + ContextType + > + identifier?: Resolver + identifierType?: Resolver + maxAllocationPercentage?: Resolver< + Maybe, + ParentType, + ContextType + > + maxSignal?: Resolver, ParentType, ContextType> + minAverageQueryFees?: Resolver, ParentType, ContextType> + minSignal?: Resolver, ParentType, ContextType> + minStake?: Resolver, ParentType, ContextType> + parallelAllocations?: Resolver, ParentType, ContextType> + protocolNetwork?: Resolver + requireSupported?: Resolver + safety?: Resolver + __isTypeOf?: IsTypeOfResolverFn +} + +export type MutationResolvers< + ContextType = IndexerManagementResolverContext, + ParentType extends ResolversParentTypes['Mutation'] = ResolversParentTypes['Mutation'], +> = { + approveActions?: Resolver< + Array>, + ParentType, + ContextType, + RequireFields + > + cancelActions?: Resolver< + Array>, + ParentType, + ContextType, + RequireFields + > + closeAllocation?: Resolver< + ResolversTypes['CloseAllocationResult'], + ParentType, + ContextType, + RequireFields + > + createAllocation?: Resolver< + ResolversTypes['CreateAllocationResult'], + ParentType, + ContextType, + RequireFields< + MutationcreateAllocationArgs, + 'amount' | 'deployment' | 'protocolNetwork' + > + > + deleteActions?: Resolver< + ResolversTypes['Int'], + ParentType, + ContextType, + RequireFields + > + deleteCostModels?: Resolver< + ResolversTypes['Int'], + ParentType, + ContextType, + RequireFields + > + deleteDisputes?: Resolver< + ResolversTypes['Int'], + ParentType, + ContextType, + RequireFields + > + deleteIndexingRule?: Resolver< + ResolversTypes['Boolean'], + ParentType, + ContextType, + RequireFields + > + deleteIndexingRules?: Resolver< + ResolversTypes['Boolean'], + ParentType, + ContextType, + RequireFields + > + executeApprovedActions?: Resolver< + Array, + ParentType, + ContextType + > + queueActions?: Resolver< + Array>, + ParentType, + ContextType, + RequireFields + > + reallocateAllocation?: Resolver< + ResolversTypes['ReallocateAllocationResult'], + ParentType, + ContextType, + RequireFields< + MutationreallocateAllocationArgs, + 'allocation' | 'amount' | 'protocolNetwork' + > + > + setCostModel?: Resolver< + ResolversTypes['CostModel'], + ParentType, + ContextType, + RequireFields + > + setIndexingRule?: Resolver< + ResolversTypes['IndexingRule'], + ParentType, + ContextType, + RequireFields + > + storeDisputes?: Resolver< + Maybe>, + ParentType, + ContextType, + RequireFields + > + updateAction?: Resolver< + ResolversTypes['Action'], + ParentType, + ContextType, + RequireFields + > + updateActions?: Resolver< + Array>, + ParentType, + ContextType, + RequireFields + > +} + +export type POIDisputeResolvers< + ContextType = IndexerManagementResolverContext, + ParentType extends + ResolversParentTypes['POIDispute'] = ResolversParentTypes['POIDispute'], +> = { + allocationAmount?: Resolver + allocationID?: Resolver + allocationIndexer?: Resolver + allocationProof?: Resolver + closedEpoch?: Resolver + closedEpochReferenceProof?: Resolver< + Maybe, + ParentType, + ContextType + > + closedEpochStartBlockHash?: Resolver + closedEpochStartBlockNumber?: Resolver + previousEpochReferenceProof?: Resolver< + Maybe, + ParentType, + ContextType + > + previousEpochStartBlockHash?: Resolver< + ResolversTypes['String'], + ParentType, + ContextType + > + previousEpochStartBlockNumber?: Resolver + protocolNetwork?: Resolver + status?: Resolver + subgraphDeploymentID?: Resolver + __isTypeOf?: IsTypeOfResolverFn +} + +export type QueryResolvers< + ContextType = IndexerManagementResolverContext, + ParentType extends ResolversParentTypes['Query'] = ResolversParentTypes['Query'], +> = { + action?: Resolver< + Maybe, + ParentType, + ContextType, + RequireFields + > + actions?: Resolver< + Array>, + ParentType, + ContextType, + Partial + > + allocations?: Resolver< + Array, + ParentType, + ContextType, + RequireFields + > + costModel?: Resolver< + Maybe, + ParentType, + ContextType, + RequireFields + > + costModels?: Resolver< + Array, + ParentType, + ContextType, + Partial + > + dispute?: Resolver< + Maybe, + ParentType, + ContextType, + RequireFields + > + disputes?: Resolver< + Array>, + ParentType, + ContextType, + RequireFields + > + disputesClosedAfter?: Resolver< + Array>, + ParentType, + ContextType, + RequireFields + > + indexerAllocations?: Resolver< + Array>, + ParentType, + ContextType, + RequireFields + > + indexerDeployments?: Resolver< + Array>, + ParentType, + ContextType + > + indexerEndpoints?: Resolver< + Array, + ParentType, + ContextType, + Partial + > + indexerRegistration?: Resolver< + ResolversTypes['IndexerRegistration'], + ParentType, + ContextType, + RequireFields + > + indexingRule?: Resolver< + Maybe, + ParentType, + ContextType, + RequireFields + > + indexingRules?: Resolver< + Array, + ParentType, + ContextType, + RequireFields + > +} + +export type ReallocateAllocationResultResolvers< + ContextType = IndexerManagementResolverContext, + ParentType extends + ResolversParentTypes['ReallocateAllocationResult'] = ResolversParentTypes['ReallocateAllocationResult'], +> = { + closedAllocation?: Resolver + createdAllocation?: Resolver + createdAllocationStake?: Resolver + indexingRewardsCollected?: Resolver + protocolNetwork?: Resolver + receiptsWorthCollecting?: Resolver + __isTypeOf?: IsTypeOfResolverFn +} + +export type Resolvers = { + Action?: ActionResolvers + ActionResult?: ActionResultResolvers + Allocation?: AllocationResolvers + BigInt?: GraphQLScalarType + BlockPointer?: BlockPointerResolvers + ChainIndexingStatus?: ChainIndexingStatusResolvers + CloseAllocationResult?: CloseAllocationResultResolvers + CostModel?: CostModelResolvers + CreateAllocationResult?: CreateAllocationResultResolvers + GeoLocation?: GeoLocationResolvers + IndexerAllocation?: IndexerAllocationResolvers + IndexerDeployment?: IndexerDeploymentResolvers + IndexerEndpoint?: IndexerEndpointResolvers + IndexerEndpointTest?: IndexerEndpointTestResolvers + IndexerEndpoints?: IndexerEndpointsResolvers + IndexerRegistration?: IndexerRegistrationResolvers + IndexingError?: IndexingErrorResolvers + IndexingRule?: IndexingRuleResolvers + Mutation?: MutationResolvers + POIDispute?: POIDisputeResolvers + Query?: QueryResolvers + ReallocateAllocationResult?: ReallocateAllocationResultResolvers +} diff --git a/packages/indexer-common/tsconfig.json b/packages/indexer-common/tsconfig.json index 549f59cac..aa1c8e8ec 100644 --- a/packages/indexer-common/tsconfig.json +++ b/packages/indexer-common/tsconfig.json @@ -20,7 +20,7 @@ ], "resolveJsonModule": true }, - "include": ["src/**/*.ts"], + "include": ["src/**/*.ts", "codegen.ts"], "exclude": [], "references": [] } diff --git a/yarn.lock b/yarn.lock index 9ef1e6241..af0283357 100644 --- a/yarn.lock +++ b/yarn.lock @@ -33,6 +33,29 @@ tslib "^2.3.0" zen-observable-ts "^1.2.0" +"@ardatan/relay-compiler@12.0.0": + version "12.0.0" + resolved "https://registry.yarnpkg.com/@ardatan/relay-compiler/-/relay-compiler-12.0.0.tgz#2e4cca43088e807adc63450e8cab037020e91106" + integrity sha512-9anThAaj1dQr6IGmzBMcfzOQKTa5artjuPmw8NYK/fiGEMjADbSguBY2FMDykt+QhilR3wc9VA/3yVju7JHg7Q== + dependencies: + "@babel/core" "^7.14.0" + "@babel/generator" "^7.14.0" + "@babel/parser" "^7.14.0" + "@babel/runtime" "^7.0.0" + "@babel/traverse" "^7.14.0" + "@babel/types" "^7.0.0" + babel-preset-fbjs "^3.4.0" + chalk "^4.0.0" + fb-watchman "^2.0.0" + fbjs "^3.0.0" + glob "^7.1.1" + immutable "~3.7.6" + invariant "^2.2.4" + nullthrows "^1.1.1" + relay-runtime "12.0.0" + signedsource "^1.0.0" + yargs "^15.3.1" + "@ardatan/sync-fetch@^0.0.1": version "0.0.1" resolved "https://registry.npmjs.org/@ardatan/sync-fetch/-/sync-fetch-0.0.1.tgz" @@ -48,6 +71,19 @@ "@babel/highlight" "^7.22.13" chalk "^2.4.2" +"@babel/code-frame@^7.23.5": + version "7.23.5" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.23.5.tgz#9009b69a8c602293476ad598ff53e4562e15c244" + integrity sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA== + dependencies: + "@babel/highlight" "^7.23.4" + chalk "^2.4.2" + +"@babel/compat-data@^7.20.5", "@babel/compat-data@^7.23.5": + version "7.23.5" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.23.5.tgz#ffb878728bb6bdcb6f4510aa51b1be9afb8cfd98" + integrity sha512-uU27kfDRlhfKl+w1U6vp16IuvSLtjAxdArVXPa9BvLkrr7CYIsxH5adpHObeAGY/41+syctUWOZ140a2Rvkgjw== + "@babel/compat-data@^7.22.9": version "7.22.20" resolved "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.22.20.tgz" @@ -74,6 +110,37 @@ json5 "^2.2.3" semver "^6.3.1" +"@babel/core@^7.14.0", "@babel/core@^7.22.9": + version "7.23.9" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.23.9.tgz#b028820718000f267870822fec434820e9b1e4d1" + integrity sha512-5q0175NOjddqpvvzU+kDiSOAk4PfdO6FvwCWoQ6RO7rTzEe8vlo+4HVfcnAREhD4npMs0e9uZypjTwzZPCf/cw== + dependencies: + "@ampproject/remapping" "^2.2.0" + "@babel/code-frame" "^7.23.5" + "@babel/generator" "^7.23.6" + "@babel/helper-compilation-targets" "^7.23.6" + "@babel/helper-module-transforms" "^7.23.3" + "@babel/helpers" "^7.23.9" + "@babel/parser" "^7.23.9" + "@babel/template" "^7.23.9" + "@babel/traverse" "^7.23.9" + "@babel/types" "^7.23.9" + convert-source-map "^2.0.0" + debug "^4.1.0" + gensync "^1.0.0-beta.2" + json5 "^2.2.3" + semver "^6.3.1" + +"@babel/generator@^7.14.0", "@babel/generator@^7.18.13", "@babel/generator@^7.23.6": + version "7.23.6" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.23.6.tgz#9e1fca4811c77a10580d17d26b57b036133f3c2e" + integrity sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw== + dependencies: + "@babel/types" "^7.23.6" + "@jridgewell/gen-mapping" "^0.3.2" + "@jridgewell/trace-mapping" "^0.3.17" + jsesc "^2.5.1" + "@babel/generator@^7.22.15", "@babel/generator@^7.7.2": version "7.22.15" resolved "https://registry.npmjs.org/@babel/generator/-/generator-7.22.15.tgz" @@ -84,6 +151,24 @@ "@jridgewell/trace-mapping" "^0.3.17" jsesc "^2.5.1" +"@babel/helper-annotate-as-pure@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.22.5.tgz#e7f06737b197d580a01edf75d97e2c8be99d3882" + integrity sha512-LvBTxu8bQSQkcyKOU+a1btnNFQ1dMAd0R6PyW3arXes06F6QLWLIrd681bxRPIXlrMGR3XYnW9JyML7dP3qgxg== + dependencies: + "@babel/types" "^7.22.5" + +"@babel/helper-compilation-targets@^7.20.7", "@babel/helper-compilation-targets@^7.23.6": + version "7.23.6" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.23.6.tgz#4d79069b16cbcf1461289eccfbbd81501ae39991" + integrity sha512-9JB548GZoQVmzrFgp8o7KxdgkTGm6xs9DW0o/Pim72UDjzr5ObUQ6ZzYPqA+g9OTS2bBQoctLJrky0RDCAWRgQ== + dependencies: + "@babel/compat-data" "^7.23.5" + "@babel/helper-validator-option" "^7.23.5" + browserslist "^4.22.2" + lru-cache "^5.1.1" + semver "^6.3.1" + "@babel/helper-compilation-targets@^7.22.15": version "7.22.15" resolved "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.15.tgz" @@ -95,6 +180,21 @@ lru-cache "^5.1.1" semver "^6.3.1" +"@babel/helper-create-class-features-plugin@^7.18.6": + version "7.23.10" + resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.23.10.tgz#25d55fafbaea31fd0e723820bb6cc3df72edf7ea" + integrity sha512-2XpP2XhkXzgxecPNEEK8Vz8Asj9aRxt08oKOqtiZoqV2UGZ5T+EkyP9sXQ9nwMxBIG34a7jmasVqoMop7VdPUw== + dependencies: + "@babel/helper-annotate-as-pure" "^7.22.5" + "@babel/helper-environment-visitor" "^7.22.20" + "@babel/helper-function-name" "^7.23.0" + "@babel/helper-member-expression-to-functions" "^7.23.0" + "@babel/helper-optimise-call-expression" "^7.22.5" + "@babel/helper-replace-supers" "^7.22.20" + "@babel/helper-skip-transparent-expression-wrappers" "^7.22.5" + "@babel/helper-split-export-declaration" "^7.22.6" + semver "^6.3.1" + "@babel/helper-environment-visitor@^7.22.20": version "7.22.20" resolved "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz" @@ -108,6 +208,14 @@ "@babel/template" "^7.22.5" "@babel/types" "^7.22.5" +"@babel/helper-function-name@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz#1f9a3cdbd5b2698a670c30d2735f9af95ed52759" + integrity sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw== + dependencies: + "@babel/template" "^7.22.15" + "@babel/types" "^7.23.0" + "@babel/helper-hoist-variables@^7.22.5": version "7.22.5" resolved "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz" @@ -115,6 +223,13 @@ dependencies: "@babel/types" "^7.22.5" +"@babel/helper-member-expression-to-functions@^7.22.15", "@babel/helper-member-expression-to-functions@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.23.0.tgz#9263e88cc5e41d39ec18c9a3e0eced59a3e7d366" + integrity sha512-6gfrPwh7OuT6gZyJZvd6WbTfrqAo7vm4xCzAXOusKqq/vWdKXphTpj5klHKNmRUU6/QRGlBsyU9mAIPaWHlqJA== + dependencies: + "@babel/types" "^7.23.0" + "@babel/helper-module-imports@^7.22.15": version "7.22.15" resolved "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz" @@ -133,11 +248,27 @@ "@babel/helper-split-export-declaration" "^7.22.6" "@babel/helper-validator-identifier" "^7.22.20" -"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.22.5", "@babel/helper-plugin-utils@^7.8.0": +"@babel/helper-optimise-call-expression@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.22.5.tgz#f21531a9ccbff644fdd156b4077c16ff0c3f609e" + integrity sha512-HBwaojN0xFRx4yIvpwGqxiV2tUfl7401jlok564NgB9EHS1y6QT17FmKWm4ztqjeVdXLuC4fSvHc5ePpQjoTbw== + dependencies: + "@babel/types" "^7.22.5" + +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.20.2", "@babel/helper-plugin-utils@^7.22.5", "@babel/helper-plugin-utils@^7.8.0": version "7.22.5" resolved "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz" integrity sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg== +"@babel/helper-replace-supers@^7.22.20": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.22.20.tgz#e37d367123ca98fe455a9887734ed2e16eb7a793" + integrity sha512-qsW0In3dbwQUbK8kejJ4R7IHVGwHJlV6lpG6UA7a9hSa2YEiAib+N1T2kr6PEeUT+Fl7najmSOS6SmAwCHK6Tw== + dependencies: + "@babel/helper-environment-visitor" "^7.22.20" + "@babel/helper-member-expression-to-functions" "^7.22.15" + "@babel/helper-optimise-call-expression" "^7.22.5" + "@babel/helper-simple-access@^7.22.5": version "7.22.5" resolved "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.22.5.tgz" @@ -145,6 +276,13 @@ dependencies: "@babel/types" "^7.22.5" +"@babel/helper-skip-transparent-expression-wrappers@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.22.5.tgz#007f15240b5751c537c40e77abb4e89eeaaa8847" + integrity sha512-tK14r66JZKiC43p8Ki33yLBVJKlQDFoA8GYN67lWCDCqoL6EMMSuM9b+Iff2jHaM/RRFYl7K+iiru7hbRqNx8Q== + dependencies: + "@babel/types" "^7.22.5" + "@babel/helper-split-export-declaration@^7.22.6": version "7.22.6" resolved "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz" @@ -157,6 +295,11 @@ resolved "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz" integrity sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw== +"@babel/helper-string-parser@^7.23.4": + version "7.23.4" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz#9478c707febcbbe1ddb38a3d91a2e054ae622d83" + integrity sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ== + "@babel/helper-validator-identifier@^7.22.19", "@babel/helper-validator-identifier@^7.22.20": version "7.22.20" resolved "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz" @@ -167,6 +310,11 @@ resolved "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.22.15.tgz" integrity sha512-bMn7RmyFjY/mdECUbgn9eoSY4vqvacUnS9i9vGAGttgFWesO6B4CYWA7XlpbWgBt71iv/hfbPlynohStqnu5hA== +"@babel/helper-validator-option@^7.23.5": + version "7.23.5" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.23.5.tgz#907a3fbd4523426285365d1206c423c4c5520307" + integrity sha512-85ttAOMLsr53VgXkTbkx8oA6YTfT4q7/HzXSLEYmjcSTJPMPQtvq1BD79Byep5xMUYbGRzEpDsjUf3dyp54IKw== + "@babel/helpers@^7.22.15": version "7.22.15" resolved "https://registry.npmjs.org/@babel/helpers/-/helpers-7.22.15.tgz" @@ -176,6 +324,15 @@ "@babel/traverse" "^7.22.15" "@babel/types" "^7.22.15" +"@babel/helpers@^7.23.9": + version "7.23.9" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.23.9.tgz#c3e20bbe7f7a7e10cb9b178384b4affdf5995c7d" + integrity sha512-87ICKgU5t5SzOT7sBMfCOZQ2rHjRU+Pcb9BoILMYz600W6DkVRLFBPwQ18gwUVvggqXivaUakpnxWQGbpywbBQ== + dependencies: + "@babel/template" "^7.23.9" + "@babel/traverse" "^7.23.9" + "@babel/types" "^7.23.9" + "@babel/highlight@^7.22.13": version "7.22.20" resolved "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.20.tgz" @@ -185,11 +342,44 @@ chalk "^2.4.2" js-tokens "^4.0.0" +"@babel/highlight@^7.23.4": + version "7.23.4" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.23.4.tgz#edaadf4d8232e1a961432db785091207ead0621b" + integrity sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A== + dependencies: + "@babel/helper-validator-identifier" "^7.22.20" + chalk "^2.4.2" + js-tokens "^4.0.0" + "@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.22.15", "@babel/parser@^7.22.16": version "7.22.16" resolved "https://registry.npmjs.org/@babel/parser/-/parser-7.22.16.tgz" integrity sha512-+gPfKv8UWeKKeJTUxe59+OobVcrYHETCsORl61EmSkmgymguYk/X5bp7GuUIXaFsc6y++v8ZxPsLSSuujqDphA== +"@babel/parser@^7.14.0", "@babel/parser@^7.16.8", "@babel/parser@^7.23.9": + version "7.23.9" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.9.tgz#7b903b6149b0f8fa7ad564af646c4c38a77fc44b" + integrity sha512-9tcKgqKbs3xGJ+NtKF2ndOBBLVwPjl1SHxPQkd36r3Dlirw3xWUeGaTbqr7uGZcTaxkVNwc+03SVP7aCdWrTlA== + +"@babel/plugin-proposal-class-properties@^7.0.0": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.18.6.tgz#b110f59741895f7ec21a6fff696ec46265c446a3" + integrity sha512-cumfXOF0+nzZrrN8Rf0t7M+tF6sZc7vhQwYQck9q1/5w2OExlD+b4v4RpMJFaV1Z7WcDRgO6FqvxqxGlwo+RHQ== + dependencies: + "@babel/helper-create-class-features-plugin" "^7.18.6" + "@babel/helper-plugin-utils" "^7.18.6" + +"@babel/plugin-proposal-object-rest-spread@^7.0.0": + version "7.20.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.20.7.tgz#aa662940ef425779c75534a5c41e9d936edc390a" + integrity sha512-d2S98yCiLxDVmBmE8UjGcfPvNEUbA1U5q5WxaWFUGRzJSVAZqm5W6MbPct0jxnegUZ0niLeNX+IOzEs7wYg9Dg== + dependencies: + "@babel/compat-data" "^7.20.5" + "@babel/helper-compilation-targets" "^7.20.7" + "@babel/helper-plugin-utils" "^7.20.2" + "@babel/plugin-syntax-object-rest-spread" "^7.8.3" + "@babel/plugin-transform-parameters" "^7.20.7" + "@babel/plugin-syntax-async-generators@^7.8.4": version "7.8.4" resolved "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz" @@ -204,13 +394,27 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-class-properties@^7.8.3": +"@babel/plugin-syntax-class-properties@^7.0.0", "@babel/plugin-syntax-class-properties@^7.8.3": version "7.12.13" resolved "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz" integrity sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA== dependencies: "@babel/helper-plugin-utils" "^7.12.13" +"@babel/plugin-syntax-flow@^7.0.0", "@babel/plugin-syntax-flow@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.23.3.tgz#084564e0f3cc21ea6c70c44cff984a1c0509729a" + integrity sha512-YZiAIpkJAwQXBJLIQbRFayR5c+gJ35Vcz3bg954k7cd73zqjvhacJuL9RbrzPz8qPmZdgqP6EUKwy0PCNhaaPA== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-syntax-import-assertions@^7.20.0": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.23.3.tgz#9c05a7f592982aff1a2768260ad84bcd3f0c77fc" + integrity sha512-lPgDSU+SJLK3xmFDTV2ZRQAiM7UuUjGidwBywFavObCiZc1BeAAcMtHJKUya92hPHO+at63JJPLygilZard8jw== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/plugin-syntax-import-meta@^7.8.3": version "7.10.4" resolved "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz" @@ -225,6 +429,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" +"@babel/plugin-syntax-jsx@^7.0.0", "@babel/plugin-syntax-jsx@^7.23.3": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.23.3.tgz#8f2e4f8a9b5f9aa16067e142c1ac9cd9f810f473" + integrity sha512-EB2MELswq55OHUoRZLGg/zC7QWUKfNLpE57m/S2yr1uEneIgsTgrSzXP3NXEsMkVn76OlaVVnzN+ugObuYGwhg== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/plugin-syntax-jsx@^7.7.2": version "7.22.5" resolved "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.22.5.tgz" @@ -253,7 +464,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.10.4" -"@babel/plugin-syntax-object-rest-spread@^7.8.3": +"@babel/plugin-syntax-object-rest-spread@^7.0.0", "@babel/plugin-syntax-object-rest-spread@^7.8.3": version "7.8.3" resolved "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz" integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA== @@ -288,7 +499,96 @@ dependencies: "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-modules-commonjs@^7.23.3": +"@babel/plugin-transform-arrow-functions@^7.0.0": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.23.3.tgz#94c6dcfd731af90f27a79509f9ab7fb2120fc38b" + integrity sha512-NzQcQrzaQPkaEwoTm4Mhyl8jI1huEL/WWIEvudjTCMJ9aBZNpsJbMASx7EQECtQQPS/DcnFpo0FIh3LvEO9cxQ== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-block-scoped-functions@^7.0.0": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.23.3.tgz#fe1177d715fb569663095e04f3598525d98e8c77" + integrity sha512-vI+0sIaPIO6CNuM9Kk5VmXcMVRiOpDh7w2zZt9GXzmE/9KD70CUEVhvPR/etAeNK/FAEkhxQtXOzVF3EuRL41A== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-block-scoping@^7.0.0": + version "7.23.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.23.4.tgz#b2d38589531c6c80fbe25e6b58e763622d2d3cf5" + integrity sha512-0QqbP6B6HOh7/8iNR4CQU2Th/bbRtBp4KS9vcaZd1fZ0wSh5Fyssg0UCIHwxh+ka+pNDREbVLQnHCMHKZfPwfw== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-classes@^7.0.0": + version "7.23.8" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.23.8.tgz#d08ae096c240347badd68cdf1b6d1624a6435d92" + integrity sha512-yAYslGsY1bX6Knmg46RjiCiNSwJKv2IUC8qOdYKqMMr0491SXFhcHqOdRDeCRohOOIzwN/90C6mQ9qAKgrP7dg== + dependencies: + "@babel/helper-annotate-as-pure" "^7.22.5" + "@babel/helper-compilation-targets" "^7.23.6" + "@babel/helper-environment-visitor" "^7.22.20" + "@babel/helper-function-name" "^7.23.0" + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/helper-replace-supers" "^7.22.20" + "@babel/helper-split-export-declaration" "^7.22.6" + globals "^11.1.0" + +"@babel/plugin-transform-computed-properties@^7.0.0": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.23.3.tgz#652e69561fcc9d2b50ba4f7ac7f60dcf65e86474" + integrity sha512-dTj83UVTLw/+nbiHqQSFdwO9CbTtwq1DsDqm3CUEtDrZNET5rT5E6bIdTlOftDTDLMYxvxHNEYO4B9SLl8SLZw== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/template" "^7.22.15" + +"@babel/plugin-transform-destructuring@^7.0.0": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.23.3.tgz#8c9ee68228b12ae3dff986e56ed1ba4f3c446311" + integrity sha512-n225npDqjDIr967cMScVKHXJs7rout1q+tt50inyBCPkyZ8KxeI6d+GIbSBTT/w/9WdlWDOej3V9HE5Lgk57gw== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-flow-strip-types@^7.0.0": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.23.3.tgz#cfa7ca159cc3306fab526fc67091556b51af26ff" + integrity sha512-26/pQTf9nQSNVJCrLB1IkHUKyPxR+lMrH2QDPG89+Znu9rAMbtrybdbWeE9bb7gzjmE5iXHEY+e0HUwM6Co93Q== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/plugin-syntax-flow" "^7.23.3" + +"@babel/plugin-transform-for-of@^7.0.0": + version "7.23.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.23.6.tgz#81c37e24171b37b370ba6aaffa7ac86bcb46f94e" + integrity sha512-aYH4ytZ0qSuBbpfhuofbg/e96oQ7U2w1Aw/UQmKT+1l39uEhUPoFS3fHevDc1G0OvewyDudfMKY1OulczHzWIw== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/helper-skip-transparent-expression-wrappers" "^7.22.5" + +"@babel/plugin-transform-function-name@^7.0.0": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.23.3.tgz#8f424fcd862bf84cb9a1a6b42bc2f47ed630f8dc" + integrity sha512-I1QXp1LxIvt8yLaib49dRW5Okt7Q4oaxao6tFVKS/anCdEOMtYwWVKoiOA1p34GOWIZjUK0E+zCp7+l1pfQyiw== + dependencies: + "@babel/helper-compilation-targets" "^7.22.15" + "@babel/helper-function-name" "^7.23.0" + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-literals@^7.0.0": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.23.3.tgz#8214665f00506ead73de157eba233e7381f3beb4" + integrity sha512-wZ0PIXRxnwZvl9AYpqNUxpZ5BiTGrYt7kueGQ+N5FiQ7RCOD4cm8iShd6S6ggfVIWaJf2EMk8eRzAh52RfP4rQ== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-member-expression-literals@^7.0.0": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.23.3.tgz#e37b3f0502289f477ac0e776b05a833d853cabcc" + integrity sha512-sC3LdDBDi5x96LA+Ytekz2ZPk8i/Ck+DEuDbRAll5rknJ5XRTSaPKEYwomLcs1AA8wg9b3KjIQRsnApj+q51Ag== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-modules-commonjs@^7.0.0", "@babel/plugin-transform-modules-commonjs@^7.23.3": version "7.23.3" resolved "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.23.3.tgz" integrity sha512-aVS0F65LKsdNOtcz6FRCpE4OgsP2OFnW46qNxNIX9h3wuzaNcSQsJysuMwqSibC98HPrf2vCgtxKNwS0DAlgcA== @@ -297,6 +597,84 @@ "@babel/helper-plugin-utils" "^7.22.5" "@babel/helper-simple-access" "^7.22.5" +"@babel/plugin-transform-object-super@^7.0.0": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.23.3.tgz#81fdb636dcb306dd2e4e8fd80db5b2362ed2ebcd" + integrity sha512-BwQ8q0x2JG+3lxCVFohg+KbQM7plfpBwThdW9A6TMtWwLsbDA01Ek2Zb/AgDN39BiZsExm4qrXxjk+P1/fzGrA== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/helper-replace-supers" "^7.22.20" + +"@babel/plugin-transform-parameters@^7.0.0", "@babel/plugin-transform-parameters@^7.20.7": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.23.3.tgz#83ef5d1baf4b1072fa6e54b2b0999a7b2527e2af" + integrity sha512-09lMt6UsUb3/34BbECKVbVwrT9bO6lILWln237z7sLaWnMsTi7Yc9fhX5DLpkJzAGfaReXI22wP41SZmnAA3Vw== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-property-literals@^7.0.0": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.23.3.tgz#54518f14ac4755d22b92162e4a852d308a560875" + integrity sha512-jR3Jn3y7cZp4oEWPFAlRsSWjxKe4PZILGBSd4nis1TsC5qeSpb+nrtihJuDhNI7QHiVbUaiXa0X2RZY3/TI6Nw== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-react-display-name@^7.0.0": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.23.3.tgz#70529f034dd1e561045ad3c8152a267f0d7b6200" + integrity sha512-GnvhtVfA2OAtzdX58FJxU19rhoGeQzyVndw3GgtdECQvQFXPEZIOVULHVZGAYmOgmqjXpVpfocAbSjh99V/Fqw== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-react-jsx@^7.0.0": + version "7.23.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.23.4.tgz#393f99185110cea87184ea47bcb4a7b0c2e39312" + integrity sha512-5xOpoPguCZCRbo/JeHlloSkTA8Bld1J/E1/kLfD1nsuiW1m8tduTA1ERCgIZokDflX/IBzKcqR3l7VlRgiIfHA== + dependencies: + "@babel/helper-annotate-as-pure" "^7.22.5" + "@babel/helper-module-imports" "^7.22.15" + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/plugin-syntax-jsx" "^7.23.3" + "@babel/types" "^7.23.4" + +"@babel/plugin-transform-shorthand-properties@^7.0.0": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.23.3.tgz#97d82a39b0e0c24f8a981568a8ed851745f59210" + integrity sha512-ED2fgqZLmexWiN+YNFX26fx4gh5qHDhn1O2gvEhreLW2iI63Sqm4llRLCXALKrCnbN4Jy0VcMQZl/SAzqug/jg== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/plugin-transform-spread@^7.0.0": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.23.3.tgz#41d17aacb12bde55168403c6f2d6bdca563d362c" + integrity sha512-VvfVYlrlBVu+77xVTOAoxQ6mZbnIq5FM0aGBSFEcIh03qHf+zNqA4DC/3XMUozTg7bZV3e3mZQ0i13VB6v5yUg== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/helper-skip-transparent-expression-wrappers" "^7.22.5" + +"@babel/plugin-transform-template-literals@^7.0.0": + version "7.23.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.23.3.tgz#5f0f028eb14e50b5d0f76be57f90045757539d07" + integrity sha512-Flok06AYNp7GV2oJPZZcP9vZdszev6vPBkHLwxwSpaIqx75wn6mUd3UFWsSsA0l8nXAKkyCmL/sR02m8RYGeHg== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + +"@babel/runtime@^7.0.0": + version "7.23.9" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.23.9.tgz#47791a15e4603bb5f905bc0753801cf21d6345f7" + integrity sha512-0CX6F+BI2s9dkUqr08KFrAIZgNFj75rdBU/DjCyYLIaV/quFjkk6T+EJ2LkZHyZTbEV4L5p97mNkUsHl2wLFAw== + dependencies: + regenerator-runtime "^0.14.0" + +"@babel/template@^7.18.10", "@babel/template@^7.20.7", "@babel/template@^7.23.9": + version "7.23.9" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.23.9.tgz#f881d0487cba2828d3259dcb9ef5005a9731011a" + integrity sha512-+xrD2BWLpvHKNmX2QbpdpsBaWnRxahMwJjO+KZk2JOElj5nSmKezyS1B4u+QbHMTX69t4ukm6hh9lsYQ7GHCKA== + dependencies: + "@babel/code-frame" "^7.23.5" + "@babel/parser" "^7.23.9" + "@babel/types" "^7.23.9" + "@babel/template@^7.22.15", "@babel/template@^7.22.5", "@babel/template@^7.3.3": version "7.22.15" resolved "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz" @@ -306,6 +684,22 @@ "@babel/parser" "^7.22.15" "@babel/types" "^7.22.15" +"@babel/traverse@^7.14.0", "@babel/traverse@^7.16.8", "@babel/traverse@^7.23.9": + version "7.23.9" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.9.tgz#2f9d6aead6b564669394c5ce0f9302bb65b9d950" + integrity sha512-I/4UJ9vs90OkBtY6iiiTORVMyIhJ4kAVmsKo9KFc8UOxMeUfi2hvtIBsET5u9GizXE6/GFSuKCTNfgCswuEjRg== + dependencies: + "@babel/code-frame" "^7.23.5" + "@babel/generator" "^7.23.6" + "@babel/helper-environment-visitor" "^7.22.20" + "@babel/helper-function-name" "^7.23.0" + "@babel/helper-hoist-variables" "^7.22.5" + "@babel/helper-split-export-declaration" "^7.22.6" + "@babel/parser" "^7.23.9" + "@babel/types" "^7.23.9" + debug "^4.3.1" + globals "^11.1.0" + "@babel/traverse@^7.22.15", "@babel/traverse@^7.22.20": version "7.22.20" resolved "https://registry.npmjs.org/@babel/traverse/-/traverse-7.22.20.tgz" @@ -331,6 +725,15 @@ "@babel/helper-validator-identifier" "^7.22.19" to-fast-properties "^2.0.0" +"@babel/types@^7.16.8", "@babel/types@^7.18.13", "@babel/types@^7.23.0", "@babel/types@^7.23.4", "@babel/types@^7.23.6", "@babel/types@^7.23.9": + version "7.23.9" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.23.9.tgz#1dd7b59a9a2b5c87f8b41e52770b5ecbf492e002" + integrity sha512-dQjSq/7HaSjRM43FFGnv5keM2HsxpmyV1PfaSVm0nzzjwwTmjOe6J4bC8e3+pTEIgHaHj+1ZlLThRJ2auc/w1Q== + dependencies: + "@babel/helper-string-parser" "^7.23.4" + "@babel/helper-validator-identifier" "^7.22.20" + to-fast-properties "^2.0.0" + "@bcoe/v8-coverage@^0.2.3": version "0.2.3" resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz" @@ -348,6 +751,42 @@ dependencies: "@cspotcode/source-map-consumer" "0.8.0" +"@eddeee888/gcg-server-config@0.1.0": + version "0.1.0" + resolved "https://registry.yarnpkg.com/@eddeee888/gcg-server-config/-/gcg-server-config-0.1.0.tgz#5afc5c7ad277b186909d9e994cc8bd95bc069cce" + integrity sha512-ZM4Cfem3FWelpz5sdCfJ+fZTCyY1WDdcT6K5GZ/UZpr7JjMApSMKnf+o9VMT2T+BB91Hffr0AH8W4oLEWUEWuw== + dependencies: + "@graphql-codegen/typescript" "^4.0.0" + "@graphql-codegen/typescript-resolvers" "^4.0.0" + +"@eddeee888/gcg-typescript-resolver-files@^0.7.2": + version "0.7.2" + resolved "https://registry.yarnpkg.com/@eddeee888/gcg-typescript-resolver-files/-/gcg-typescript-resolver-files-0.7.2.tgz#4c46039a4878cfb458eabd4208f26799995325bf" + integrity sha512-9LBkn6pGtXSQmH9rLoF/CkUUlsNwX4A539pRolr/yS++arGN871IptmZ89ezM4iGbbW/OPwp+Zp7AmNTgBExmA== + dependencies: + "@eddeee888/gcg-server-config" "0.1.0" + "@graphql-codegen/add" "^5.0.0" + "@graphql-codegen/plugin-helpers" "^5.0.0" + "@graphql-codegen/typescript" "^4.0.0" + "@graphql-codegen/typescript-resolvers" "^4.0.0" + ts-morph "^19.0.0" + tslib "^2.3.0" + +"@envelop/core@^5.0.0": + version "5.0.0" + resolved "https://registry.yarnpkg.com/@envelop/core/-/core-5.0.0.tgz#131616ad9685599e501b14fdf1a983cfd3b72020" + integrity sha512-aJdnH/ptv+cvwfvciCBe7TSvccBwo9g0S5f6u35TBVzRVqIGkK03lFlIL+x1cnfZgN9EfR2b1PH2galrT1CdCQ== + dependencies: + "@envelop/types" "5.0.0" + tslib "^2.5.0" + +"@envelop/types@5.0.0": + version "5.0.0" + resolved "https://registry.yarnpkg.com/@envelop/types/-/types-5.0.0.tgz#3ae59b50ec31d4bdcc7bd0b47e9c8cf2ac44b0ff" + integrity sha512-IPjmgSc4KpQRlO4qbEDnBEixvtb06WDmjKfi/7fkZaryh5HuOmTtixe1EupQI5XfXO8joc3d27uUZ0QdC++euA== + dependencies: + tslib "^2.5.0" + "@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0": version "4.4.0" resolved "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz" @@ -913,6 +1352,187 @@ split2 "^3.1.1" through2 "^3.0.1" +"@graphql-codegen/add@^5.0.0", "@graphql-codegen/add@^5.0.2": + version "5.0.2" + resolved "https://registry.yarnpkg.com/@graphql-codegen/add/-/add-5.0.2.tgz#71b3ae0465a4537172dddb84531b6967ca5545f2" + integrity sha512-ouBkSvMFUhda5VoKumo/ZvsZM9P5ZTyDsI8LW18VxSNWOjrTeLXBWHG8Gfaai0HwhflPtCYVABbriEcOmrRShQ== + dependencies: + "@graphql-codegen/plugin-helpers" "^5.0.3" + tslib "~2.6.0" + +"@graphql-codegen/cli@^5.0.2": + version "5.0.2" + resolved "https://registry.yarnpkg.com/@graphql-codegen/cli/-/cli-5.0.2.tgz#07ff691c16da4c3dcc0e1995d3231530379ab317" + integrity sha512-MBIaFqDiLKuO4ojN6xxG9/xL9wmfD3ZjZ7RsPjwQnSHBCUXnEkdKvX+JVpx87Pq29Ycn8wTJUguXnTZ7Di0Mlw== + dependencies: + "@babel/generator" "^7.18.13" + "@babel/template" "^7.18.10" + "@babel/types" "^7.18.13" + "@graphql-codegen/client-preset" "^4.2.2" + "@graphql-codegen/core" "^4.0.2" + "@graphql-codegen/plugin-helpers" "^5.0.3" + "@graphql-tools/apollo-engine-loader" "^8.0.0" + "@graphql-tools/code-file-loader" "^8.0.0" + "@graphql-tools/git-loader" "^8.0.0" + "@graphql-tools/github-loader" "^8.0.0" + "@graphql-tools/graphql-file-loader" "^8.0.0" + "@graphql-tools/json-file-loader" "^8.0.0" + "@graphql-tools/load" "^8.0.0" + "@graphql-tools/prisma-loader" "^8.0.0" + "@graphql-tools/url-loader" "^8.0.0" + "@graphql-tools/utils" "^10.0.0" + "@whatwg-node/fetch" "^0.8.0" + chalk "^4.1.0" + cosmiconfig "^8.1.3" + debounce "^1.2.0" + detect-indent "^6.0.0" + graphql-config "^5.0.2" + inquirer "^8.0.0" + is-glob "^4.0.1" + jiti "^1.17.1" + json-to-pretty-yaml "^1.2.2" + listr2 "^4.0.5" + log-symbols "^4.0.0" + micromatch "^4.0.5" + shell-quote "^1.7.3" + string-env-interpolation "^1.0.1" + ts-log "^2.2.3" + tslib "^2.4.0" + yaml "^2.3.1" + yargs "^17.0.0" + +"@graphql-codegen/client-preset@^4.2.2": + version "4.2.3" + resolved "https://registry.yarnpkg.com/@graphql-codegen/client-preset/-/client-preset-4.2.3.tgz#5ccb357aad8b35e2745ebe25f7bb9fbd9d919202" + integrity sha512-ygfIKMtjoPY4iISYfNpvuVvV2e6BYAzHnC+MfDul7kZwY1pvv0P+IhezOaTHOheoTiah1BA7USFEOE5Nzp3Gdw== + dependencies: + "@babel/helper-plugin-utils" "^7.20.2" + "@babel/template" "^7.20.7" + "@graphql-codegen/add" "^5.0.2" + "@graphql-codegen/gql-tag-operations" "4.0.5" + "@graphql-codegen/plugin-helpers" "^5.0.3" + "@graphql-codegen/typed-document-node" "^5.0.5" + "@graphql-codegen/typescript" "^4.0.5" + "@graphql-codegen/typescript-operations" "^4.1.3" + "@graphql-codegen/visitor-plugin-common" "^5.0.0" + "@graphql-tools/documents" "^1.0.0" + "@graphql-tools/utils" "^10.0.0" + "@graphql-typed-document-node/core" "3.2.0" + tslib "~2.6.0" + +"@graphql-codegen/core@^4.0.2": + version "4.0.2" + resolved "https://registry.yarnpkg.com/@graphql-codegen/core/-/core-4.0.2.tgz#7e6ec266276f54bbf02f60599d9e518f4a59d85e" + integrity sha512-IZbpkhwVqgizcjNiaVzNAzm/xbWT6YnGgeOLwVjm4KbJn3V2jchVtuzHH09G5/WkkLSk2wgbXNdwjM41JxO6Eg== + dependencies: + "@graphql-codegen/plugin-helpers" "^5.0.3" + "@graphql-tools/schema" "^10.0.0" + "@graphql-tools/utils" "^10.0.0" + tslib "~2.6.0" + +"@graphql-codegen/gql-tag-operations@4.0.5": + version "4.0.5" + resolved "https://registry.yarnpkg.com/@graphql-codegen/gql-tag-operations/-/gql-tag-operations-4.0.5.tgz#7b1cbfbea0775bf5eb53c97e3a3fa4c28778a01a" + integrity sha512-FDiL1/fdP60Y10yQD+SsYoaApGLoirF4ATfi4eFklXu7GGosJzZBxni2D3+f99Qxd0iK368O3Dtbe38Z+Vd8Vg== + dependencies: + "@graphql-codegen/plugin-helpers" "^5.0.3" + "@graphql-codegen/visitor-plugin-common" "5.0.0" + "@graphql-tools/utils" "^10.0.0" + auto-bind "~4.0.0" + tslib "~2.6.0" + +"@graphql-codegen/plugin-helpers@^5.0.0", "@graphql-codegen/plugin-helpers@^5.0.3": + version "5.0.3" + resolved "https://registry.yarnpkg.com/@graphql-codegen/plugin-helpers/-/plugin-helpers-5.0.3.tgz#7027b9d911d7cb594663590fcf5d63e9cf7ec2ff" + integrity sha512-yZ1rpULIWKBZqCDlvGIJRSyj1B2utkEdGmXZTBT/GVayP4hyRYlkd36AJV/LfEsVD8dnsKL5rLz2VTYmRNlJ5Q== + dependencies: + "@graphql-tools/utils" "^10.0.0" + change-case-all "1.0.15" + common-tags "1.8.2" + import-from "4.0.0" + lodash "~4.17.0" + tslib "~2.6.0" + +"@graphql-codegen/schema-ast@^4.0.2": + version "4.0.2" + resolved "https://registry.yarnpkg.com/@graphql-codegen/schema-ast/-/schema-ast-4.0.2.tgz#aeaa104e4555cca73a058f0a9350b4b0e290b377" + integrity sha512-5mVAOQQK3Oz7EtMl/l3vOQdc2aYClUzVDHHkMvZlunc+KlGgl81j8TLa+X7ANIllqU4fUEsQU3lJmk4hXP6K7Q== + dependencies: + "@graphql-codegen/plugin-helpers" "^5.0.3" + "@graphql-tools/utils" "^10.0.0" + tslib "~2.6.0" + +"@graphql-codegen/typed-document-node@^5.0.5": + version "5.0.5" + resolved "https://registry.yarnpkg.com/@graphql-codegen/typed-document-node/-/typed-document-node-5.0.5.tgz#a7674dcde8713a12611a76e28a4918116a427fb5" + integrity sha512-1bWoHYL8673zqq/yyp3L93JKTYrDNLymvibaldWn90PASI770gJ4fzH71RhkGaJDq0F43wmQk0sjz3s/RoKsLA== + dependencies: + "@graphql-codegen/plugin-helpers" "^5.0.3" + "@graphql-codegen/visitor-plugin-common" "5.0.0" + auto-bind "~4.0.0" + change-case-all "1.0.15" + tslib "~2.6.0" + +"@graphql-codegen/typescript-operations@^4.1.3": + version "4.1.3" + resolved "https://registry.yarnpkg.com/@graphql-codegen/typescript-operations/-/typescript-operations-4.1.3.tgz#730ba21fb0f20f451e090983512c0b4153ec0acb" + integrity sha512-Goga2ISgicr/PLgK2NH5kwyQFctoGKpV+nv4Dr9II0xjHuuNvC6cqA66y/p8zKx6eS9p2GV87/IafqxV8r6K5Q== + dependencies: + "@graphql-codegen/plugin-helpers" "^5.0.3" + "@graphql-codegen/typescript" "^4.0.5" + "@graphql-codegen/visitor-plugin-common" "5.0.0" + auto-bind "~4.0.0" + tslib "~2.6.0" + +"@graphql-codegen/typescript-resolvers@^4.0.0": + version "4.0.5" + resolved "https://registry.yarnpkg.com/@graphql-codegen/typescript-resolvers/-/typescript-resolvers-4.0.5.tgz#9d60b7f3b7123ed93ece94ffacaab49c10f7ea7b" + integrity sha512-So6UvQRpOvyZz3YkGANY7+QqNj90LeSkV81Feak8x+JdBzrtzNUoPbxnVNCTOw2v7sbv8w18JZKs+++WVV5Ptg== + dependencies: + "@graphql-codegen/plugin-helpers" "^5.0.3" + "@graphql-codegen/typescript" "^4.0.5" + "@graphql-codegen/visitor-plugin-common" "5.0.0" + "@graphql-tools/utils" "^10.0.0" + auto-bind "~4.0.0" + tslib "~2.6.0" + +"@graphql-codegen/typescript@^4.0.0", "@graphql-codegen/typescript@^4.0.5": + version "4.0.5" + resolved "https://registry.yarnpkg.com/@graphql-codegen/typescript/-/typescript-4.0.5.tgz#dc9849a8c8a8d0bbcf9f7cb2af8ee77943e00874" + integrity sha512-PCS6LovGhyNfnmZ2AJ8rN5wGUhysWNsFwCPrZccuwBVCCvcet8/GNKStY5cHiDqG0B5Q+6g8OXVbffhxkkytLA== + dependencies: + "@graphql-codegen/plugin-helpers" "^5.0.3" + "@graphql-codegen/schema-ast" "^4.0.2" + "@graphql-codegen/visitor-plugin-common" "5.0.0" + auto-bind "~4.0.0" + tslib "~2.6.0" + +"@graphql-codegen/visitor-plugin-common@5.0.0", "@graphql-codegen/visitor-plugin-common@^5.0.0": + version "5.0.0" + resolved "https://registry.yarnpkg.com/@graphql-codegen/visitor-plugin-common/-/visitor-plugin-common-5.0.0.tgz#23258c52277a8be206c2d69aadf9738dd780f1c0" + integrity sha512-qQOZZZ2MxmBEyd0Lm3lVh7zgauLXVBsg3ToucQJHmbk2WUxLMOcaf/+BOBIkrDjvWA8L+JU6COUT6uZc57DBcw== + dependencies: + "@graphql-codegen/plugin-helpers" "^5.0.3" + "@graphql-tools/optimize" "^2.0.0" + "@graphql-tools/relay-operation-optimizer" "^7.0.0" + "@graphql-tools/utils" "^10.0.0" + auto-bind "~4.0.0" + change-case-all "1.0.15" + dependency-graph "^0.11.0" + graphql-tag "^2.11.0" + parse-filepath "^1.0.2" + tslib "~2.6.0" + +"@graphql-tools/apollo-engine-loader@^8.0.0": + version "8.0.0" + resolved "https://registry.yarnpkg.com/@graphql-tools/apollo-engine-loader/-/apollo-engine-loader-8.0.0.tgz#ac1f351cbe41508411784f25757f5557b0f27489" + integrity sha512-axQTbN5+Yxs1rJ6cWQBOfw3AEeC+fvIuZSfJLPLLvFJLj4pUm9fhxey/g6oQZAAQJqKPfw+tLDUQvnfvRK8Kmg== + dependencies: + "@ardatan/sync-fetch" "^0.0.1" + "@graphql-tools/utils" "^10.0.0" + "@whatwg-node/fetch" "^0.9.0" + tslib "^2.4.0" + "@graphql-tools/batch-execute@^9.0.1": version "9.0.2" resolved "https://registry.npmjs.org/@graphql-tools/batch-execute/-/batch-execute-9.0.2.tgz" @@ -923,6 +1543,17 @@ tslib "^2.4.0" value-or-promise "^1.0.12" +"@graphql-tools/code-file-loader@^8.0.0": + version "8.1.1" + resolved "https://registry.yarnpkg.com/@graphql-tools/code-file-loader/-/code-file-loader-8.1.1.tgz#517c37d4f8a20b2c6558b10cbe9a6f9bcfe98918" + integrity sha512-q4KN25EPSUztc8rA8YUU3ufh721Yk12xXDbtUA+YstczWS7a1RJlghYMFEfR1HsHSYbF7cUqkbnTKSGM3o52bQ== + dependencies: + "@graphql-tools/graphql-tag-pluck" "8.3.0" + "@graphql-tools/utils" "^10.0.13" + globby "^11.0.3" + tslib "^2.4.0" + unixify "^1.0.0" + "@graphql-tools/delegate@^10.0.0", "@graphql-tools/delegate@^10.0.3": version "10.0.3" resolved "https://registry.npmjs.org/@graphql-tools/delegate/-/delegate-10.0.3.tgz" @@ -935,6 +1566,14 @@ dataloader "^2.2.2" tslib "^2.5.0" +"@graphql-tools/documents@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@graphql-tools/documents/-/documents-1.0.0.tgz#e3ed97197cc22ec830ca227fd7d17e86d8424bdf" + integrity sha512-rHGjX1vg/nZ2DKqRGfDPNC55CWZBMldEVcH+91BThRa6JeT80NqXknffLLEZLRUxyikCfkwMsk6xR3UNMqG0Rg== + dependencies: + lodash.sortby "^4.7.0" + tslib "^2.4.0" + "@graphql-tools/executor-graphql-ws@^1.0.0": version "1.1.0" resolved "https://registry.npmjs.org/@graphql-tools/executor-graphql-ws/-/executor-graphql-ws-1.1.0.tgz" @@ -960,6 +1599,19 @@ tslib "^2.4.0" value-or-promise "^1.0.12" +"@graphql-tools/executor-http@^1.0.5": + version "1.0.8" + resolved "https://registry.yarnpkg.com/@graphql-tools/executor-http/-/executor-http-1.0.8.tgz#01e01915634acb65385a6cc0c60f0acdd5989026" + integrity sha512-tBHT4aRkMCeyo+tcfEz7znqdd4QqoYF9vY1YTSo2+FV00usBB+R1YL3YaINBQNVkSVpZ41elffoF/fjI+QE8ZQ== + dependencies: + "@graphql-tools/utils" "^10.0.2" + "@repeaterjs/repeater" "^3.0.4" + "@whatwg-node/fetch" "^0.9.0" + extract-files "^11.0.0" + meros "^1.2.1" + tslib "^2.4.0" + value-or-promise "^1.0.12" + "@graphql-tools/executor-legacy-ws@^1.0.0": version "1.0.3" resolved "https://registry.npmjs.org/@graphql-tools/executor-legacy-ws/-/executor-legacy-ws-1.0.3.tgz" @@ -982,6 +1634,74 @@ tslib "^2.4.0" value-or-promise "^1.0.12" +"@graphql-tools/git-loader@^8.0.0": + version "8.0.5" + resolved "https://registry.yarnpkg.com/@graphql-tools/git-loader/-/git-loader-8.0.5.tgz#77f9c2a35fdb3a403d33660ed11702720d4b016e" + integrity sha512-P97/1mhruDiA6D5WUmx3n/aeGPLWj2+4dpzDOxFGGU+z9NcI/JdygMkeFpGZNHeJfw+kHfxgPcMPnxHcyhAoVA== + dependencies: + "@graphql-tools/graphql-tag-pluck" "8.3.0" + "@graphql-tools/utils" "^10.0.13" + is-glob "4.0.3" + micromatch "^4.0.4" + tslib "^2.4.0" + unixify "^1.0.0" + +"@graphql-tools/github-loader@^8.0.0": + version "8.0.0" + resolved "https://registry.yarnpkg.com/@graphql-tools/github-loader/-/github-loader-8.0.0.tgz#683195800618364701cfea9bc6f88674486f053b" + integrity sha512-VuroArWKcG4yaOWzV0r19ElVIV6iH6UKDQn1MXemND0xu5TzrFme0kf3U9o0YwNo0kUYEk9CyFM0BYg4he17FA== + dependencies: + "@ardatan/sync-fetch" "^0.0.1" + "@graphql-tools/executor-http" "^1.0.0" + "@graphql-tools/graphql-tag-pluck" "^8.0.0" + "@graphql-tools/utils" "^10.0.0" + "@whatwg-node/fetch" "^0.9.0" + tslib "^2.4.0" + value-or-promise "^1.0.12" + +"@graphql-tools/graphql-file-loader@^8.0.0": + version "8.0.0" + resolved "https://registry.yarnpkg.com/@graphql-tools/graphql-file-loader/-/graphql-file-loader-8.0.0.tgz#a2026405bce86d974000455647511bf65df4f211" + integrity sha512-wRXj9Z1IFL3+zJG1HWEY0S4TXal7+s1vVhbZva96MSp0kbb/3JBF7j0cnJ44Eq0ClccMgGCDFqPFXty4JlpaPg== + dependencies: + "@graphql-tools/import" "7.0.0" + "@graphql-tools/utils" "^10.0.0" + globby "^11.0.3" + tslib "^2.4.0" + unixify "^1.0.0" + +"@graphql-tools/graphql-tag-pluck@8.3.0", "@graphql-tools/graphql-tag-pluck@^8.0.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@graphql-tools/graphql-tag-pluck/-/graphql-tag-pluck-8.3.0.tgz#11bb8c627253137b39b34fb765cd6ebe506388b9" + integrity sha512-gNqukC+s7iHC7vQZmx1SEJQmLnOguBq+aqE2zV2+o1hxkExvKqyFli1SY/9gmukFIKpKutCIj+8yLOM+jARutw== + dependencies: + "@babel/core" "^7.22.9" + "@babel/parser" "^7.16.8" + "@babel/plugin-syntax-import-assertions" "^7.20.0" + "@babel/traverse" "^7.16.8" + "@babel/types" "^7.16.8" + "@graphql-tools/utils" "^10.0.13" + tslib "^2.4.0" + +"@graphql-tools/import@7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@graphql-tools/import/-/import-7.0.0.tgz#a6a91a90a707d5f46bad0fd3fde2f407b548b2be" + integrity sha512-NVZiTO8o1GZs6OXzNfjB+5CtQtqsZZpQOq+Uu0w57kdUkT4RlQKlwhT8T81arEsbV55KpzkpFsOZP7J1wdmhBw== + dependencies: + "@graphql-tools/utils" "^10.0.0" + resolve-from "5.0.0" + tslib "^2.4.0" + +"@graphql-tools/json-file-loader@^8.0.0": + version "8.0.0" + resolved "https://registry.yarnpkg.com/@graphql-tools/json-file-loader/-/json-file-loader-8.0.0.tgz#9b1b62902f766ef3f1c9cd1c192813ea4f48109c" + integrity sha512-ki6EF/mobBWJjAAC84xNrFMhNfnUFD6Y0rQMGXekrUgY0NdeYXHU0ZUgHzC9O5+55FslqUmAUHABePDHTyZsLg== + dependencies: + "@graphql-tools/utils" "^10.0.0" + globby "^11.0.3" + tslib "^2.4.0" + unixify "^1.0.0" + "@graphql-tools/load@8.0.0": version "8.0.0" resolved "https://registry.npmjs.org/@graphql-tools/load/-/load-8.0.0.tgz" @@ -992,6 +1712,16 @@ p-limit "3.1.0" tslib "^2.4.0" +"@graphql-tools/load@^8.0.0": + version "8.0.1" + resolved "https://registry.yarnpkg.com/@graphql-tools/load/-/load-8.0.1.tgz#498f2230448601cb87894b8a93df7867daef69ea" + integrity sha512-qSMsKngJhDqRbuWyo3NvakEFqFL6+eSjy8ooJ1o5qYD26N7dqXkKzIMycQsX7rBK19hOuINAUSaRcVWH6hTccw== + dependencies: + "@graphql-tools/schema" "^10.0.0" + "@graphql-tools/utils" "^10.0.11" + p-limit "3.1.0" + tslib "^2.4.0" + "@graphql-tools/merge@8.2.8": version "8.2.8" resolved "https://registry.npmjs.org/@graphql-tools/merge/-/merge-8.2.8.tgz" @@ -1008,6 +1738,46 @@ "@graphql-tools/utils" "^10.0.0" tslib "^2.4.0" +"@graphql-tools/optimize@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@graphql-tools/optimize/-/optimize-2.0.0.tgz#7a9779d180824511248a50c5a241eff6e7a2d906" + integrity sha512-nhdT+CRGDZ+bk68ic+Jw1OZ99YCDIKYA5AlVAnBHJvMawSx9YQqQAIj4refNc1/LRieGiuWvhbG3jvPVYho0Dg== + dependencies: + tslib "^2.4.0" + +"@graphql-tools/prisma-loader@^8.0.0": + version "8.0.2" + resolved "https://registry.yarnpkg.com/@graphql-tools/prisma-loader/-/prisma-loader-8.0.2.tgz#3a7126ec2389a7aa7846bd0e441629ac5a1934fc" + integrity sha512-8d28bIB0bZ9Bj0UOz9sHagVPW+6AHeqvGljjERtwCnWl8OCQw2c2pNboYXISLYUG5ub76r4lDciLLTU+Ks7Q0w== + dependencies: + "@graphql-tools/url-loader" "^8.0.0" + "@graphql-tools/utils" "^10.0.8" + "@types/js-yaml" "^4.0.0" + "@types/json-stable-stringify" "^1.0.32" + "@whatwg-node/fetch" "^0.9.0" + chalk "^4.1.0" + debug "^4.3.1" + dotenv "^16.0.0" + graphql-request "^6.0.0" + http-proxy-agent "^7.0.0" + https-proxy-agent "^7.0.0" + jose "^5.0.0" + js-yaml "^4.0.0" + json-stable-stringify "^1.0.1" + lodash "^4.17.20" + scuid "^1.1.0" + tslib "^2.4.0" + yaml-ast-parser "^0.0.43" + +"@graphql-tools/relay-operation-optimizer@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@graphql-tools/relay-operation-optimizer/-/relay-operation-optimizer-7.0.0.tgz#24367666af87bc5a81748de5e8e9b3c523fd4207" + integrity sha512-UNlJi5y3JylhVWU4MBpL0Hun4Q7IoJwv9xYtmAz+CgRa066szzY7dcuPfxrA7cIGgG/Q6TVsKsYaiF4OHPs1Fw== + dependencies: + "@ardatan/relay-compiler" "12.0.0" + "@graphql-tools/utils" "^10.0.0" + tslib "^2.4.0" + "@graphql-tools/schema@8.3.8": version "8.3.8" resolved "https://registry.npmjs.org/@graphql-tools/schema/-/schema-8.3.8.tgz" @@ -1047,6 +1817,25 @@ value-or-promise "^1.0.11" ws "^8.12.0" +"@graphql-tools/url-loader@^8.0.0": + version "8.0.1" + resolved "https://registry.yarnpkg.com/@graphql-tools/url-loader/-/url-loader-8.0.1.tgz#91247247d253c538c4c28376ca74d944fa8cfb82" + integrity sha512-B2k8KQEkEQmfV1zhurT5GLoXo8jbXP+YQHUayhCSxKYlRV7j/1Fhp1b21PDM8LXIDGlDRXaZ0FbWKOs7eYXDuQ== + dependencies: + "@ardatan/sync-fetch" "^0.0.1" + "@graphql-tools/delegate" "^10.0.0" + "@graphql-tools/executor-graphql-ws" "^1.0.0" + "@graphql-tools/executor-http" "^1.0.5" + "@graphql-tools/executor-legacy-ws" "^1.0.0" + "@graphql-tools/utils" "^10.0.0" + "@graphql-tools/wrap" "^10.0.0" + "@types/ws" "^8.0.0" + "@whatwg-node/fetch" "^0.9.0" + isomorphic-ws "^5.0.0" + tslib "^2.4.0" + value-or-promise "^1.0.11" + ws "^8.12.0" + "@graphql-tools/utils@8.6.7": version "8.6.7" resolved "https://registry.npmjs.org/@graphql-tools/utils/-/utils-8.6.7.tgz" @@ -1063,6 +1852,16 @@ dset "^3.1.2" tslib "^2.4.0" +"@graphql-tools/utils@^10.0.11", "@graphql-tools/utils@^10.0.13", "@graphql-tools/utils@^10.0.8": + version "10.0.13" + resolved "https://registry.yarnpkg.com/@graphql-tools/utils/-/utils-10.0.13.tgz#d0ab7a4dd02a8405f5ef62dd140b7579ba69f8cb" + integrity sha512-fMILwGr5Dm2zefNItjQ6C2rauigklv69LIwppccICuGTnGaOp3DspLt/6Lxj72cbg5d9z60Sr+Egco3CJKLsNg== + dependencies: + "@graphql-typed-document-node/core" "^3.1.1" + cross-inspect "1.0.0" + dset "^3.1.2" + tslib "^2.4.0" + "@graphql-tools/wrap@10.0.1", "@graphql-tools/wrap@^10.0.0": version "10.0.1" resolved "https://registry.npmjs.org/@graphql-tools/wrap/-/wrap-10.0.1.tgz" @@ -1074,11 +1873,36 @@ tslib "^2.4.0" value-or-promise "^1.0.12" -"@graphql-typed-document-node/core@3.2.0", "@graphql-typed-document-node/core@^3.0.0", "@graphql-typed-document-node/core@^3.1.1": +"@graphql-typed-document-node/core@3.2.0", "@graphql-typed-document-node/core@^3.0.0", "@graphql-typed-document-node/core@^3.1.1", "@graphql-typed-document-node/core@^3.2.0": version "3.2.0" resolved "https://registry.npmjs.org/@graphql-typed-document-node/core/-/core-3.2.0.tgz" integrity sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ== +"@graphql-yoga/logger@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@graphql-yoga/logger/-/logger-2.0.0.tgz#51c91cf07fc42b0d100d887315a20a4c9cac342e" + integrity sha512-Mg8psdkAp+YTG1OGmvU+xa6xpsAmSir0hhr3yFYPyLNwzUj95DdIwsMpKadDj9xDpYgJcH3Hp/4JMal9DhQimA== + dependencies: + tslib "^2.5.2" + +"@graphql-yoga/subscription@^5.0.0": + version "5.0.0" + resolved "https://registry.yarnpkg.com/@graphql-yoga/subscription/-/subscription-5.0.0.tgz#c0aedd3f7c0c0564a2fe687e9f45c16f70bdffc5" + integrity sha512-Ri7sK8hmxd/kwaEa0YT8uqQUb2wOLsmBMxI90QDyf96lzOMJRgBuNYoEkU1pSgsgmW2glceZ96sRYfaXqwVxUw== + dependencies: + "@graphql-yoga/typed-event-target" "^3.0.0" + "@repeaterjs/repeater" "^3.0.4" + "@whatwg-node/events" "^0.1.0" + tslib "^2.5.2" + +"@graphql-yoga/typed-event-target@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@graphql-yoga/typed-event-target/-/typed-event-target-3.0.0.tgz#57dc42e052d8294555d26ee61854d72a0236fee0" + integrity sha512-w+liuBySifrstuHbFrHoHAEyVnDFVib+073q8AeAJ/qqJfvFvAwUPLLtNohR/WDVRgSasfXtl3dcNuVJWN+rjg== + dependencies: + "@repeaterjs/repeater" "^3.0.4" + tslib "^2.5.2" + "@grpc/grpc-js@~1.6.0": version "1.6.12" resolved "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.6.12.tgz" @@ -1408,6 +2232,11 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" +"@kamilkisiela/fast-url-parser@^1.1.4": + version "1.1.4" + resolved "https://registry.yarnpkg.com/@kamilkisiela/fast-url-parser/-/fast-url-parser-1.1.4.tgz#9d68877a489107411b953c54ea65d0658b515809" + integrity sha512-gbkePEBupNydxCelHCESvFSFM8XPh1Zs/OAVRW/rKpEqPAl5PbOM90Si8mv9bvnR53uPD2s/FiRxdvSejpRJew== + "@lerna/add@6.1.0": version "6.1.0" resolved "https://registry.npmjs.org/@lerna/add/-/add-6.1.0.tgz" @@ -2595,6 +3424,33 @@ node-addon-api "^3.2.1" node-gyp-build "^4.3.0" +"@peculiar/asn1-schema@^2.3.8": + version "2.3.8" + resolved "https://registry.yarnpkg.com/@peculiar/asn1-schema/-/asn1-schema-2.3.8.tgz#04b38832a814e25731232dd5be883460a156da3b" + integrity sha512-ULB1XqHKx1WBU/tTFIA+uARuRoBVZ4pNdOA878RDrRbBfBGcSzi5HBkdScC6ZbHn8z7L8gmKCgPC1LHRrP46tA== + dependencies: + asn1js "^3.0.5" + pvtsutils "^1.3.5" + tslib "^2.6.2" + +"@peculiar/json-schema@^1.1.12": + version "1.1.12" + resolved "https://registry.yarnpkg.com/@peculiar/json-schema/-/json-schema-1.1.12.tgz#fe61e85259e3b5ba5ad566cb62ca75b3d3cd5339" + integrity sha512-coUfuoMeIB7B8/NMekxaDzLhaYmp0HZNPEjYRm9goRou8UZIC3z21s0sL9AWoCw4EG876QyO3kYrc61WNF9B/w== + dependencies: + tslib "^2.0.0" + +"@peculiar/webcrypto@^1.4.0": + version "1.4.5" + resolved "https://registry.yarnpkg.com/@peculiar/webcrypto/-/webcrypto-1.4.5.tgz#424bed6b0d133b772f5cbffd143d0468a90f40a0" + integrity sha512-oDk93QCDGdxFRM8382Zdminzs44dg3M2+E5Np+JWkpqLDyJC9DviMh8F8mEJkYuUcUOGA5jHO5AJJ10MFWdbZw== + dependencies: + "@peculiar/asn1-schema" "^2.3.8" + "@peculiar/json-schema" "^1.1.12" + pvtsutils "^1.3.5" + tslib "^2.6.2" + webcrypto-core "^1.7.8" + "@pkgjs/parseargs@^0.11.0": version "0.11.0" resolved "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz" @@ -2914,6 +3770,16 @@ resolved "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz" integrity sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A== +"@ts-morph/common@~0.20.0": + version "0.20.0" + resolved "https://registry.yarnpkg.com/@ts-morph/common/-/common-0.20.0.tgz#3f161996b085ba4519731e4d24c35f6cba5b80af" + integrity sha512-7uKjByfbPpwuzkstL3L5MQyuXPSKdoNG93Fmi2JoDcTf3pEP731JdRFAduRVkOs8oqxPsXKA+ScrWkdQ8t/I+Q== + dependencies: + fast-glob "^3.2.12" + minimatch "^7.4.3" + mkdirp "^2.1.6" + path-browserify "^1.0.1" + "@tsconfig/node10@^1.0.7": version "1.0.9" resolved "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz" @@ -3087,11 +3953,21 @@ expect "^29.0.0" pretty-format "^29.0.0" +"@types/js-yaml@^4.0.0": + version "4.0.9" + resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-4.0.9.tgz#cd82382c4f902fed9691a2ed79ec68c5898af4c2" + integrity sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg== + "@types/json-schema@^7.0.12": version "7.0.13" resolved "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.13.tgz" integrity sha512-RbSSoHliUbnXj3ny0CNFOoxrIDV6SUGyStHsvDqosw6CkdPV8TtWGlfecuK4ToyMEAql6pzNxgCFKanovUzlgQ== +"@types/json-stable-stringify@^1.0.32": + version "1.0.36" + resolved "https://registry.yarnpkg.com/@types/json-stable-stringify/-/json-stable-stringify-1.0.36.tgz#fe6c6001a69ff8160a772da08779448a333c7ddd" + integrity sha512-b7bq23s4fgBB76n34m2b3RBf6M369B0Z9uRR8aHTMd8kZISRkmDEpPD8hhpYvDFzr3bJCPES96cm3Q6qRNDbQw== + "@types/lodash.clonedeep@^4.5.7": version "4.5.7" resolved "https://registry.npmjs.org/@types/lodash.clonedeep/-/lodash.clonedeep-4.5.7.tgz" @@ -3539,11 +4415,27 @@ "@urql/core" ">=2.3.6" wonka "^4.0.14" +"@whatwg-node/events@^0.0.3": + version "0.0.3" + resolved "https://registry.yarnpkg.com/@whatwg-node/events/-/events-0.0.3.tgz#13a65dd4f5893f55280f766e29ae48074927acad" + integrity sha512-IqnKIDWfXBJkvy/k6tzskWTc2NK3LcqHlb+KHGCrjOCH4jfQckRX0NAiIcC/vIqQkzLYw2r2CTSwAxcrtcD6lA== + "@whatwg-node/events@^0.1.0": version "0.1.1" resolved "https://registry.npmjs.org/@whatwg-node/events/-/events-0.1.1.tgz" integrity sha512-AyQEn5hIPV7Ze+xFoXVU3QTHXVbWPrzaOkxtENMPMuNL6VVHrp4hHfDt9nrQpjO7BgvuM95dMtkycX5M/DZR3w== +"@whatwg-node/fetch@^0.8.0": + version "0.8.8" + resolved "https://registry.yarnpkg.com/@whatwg-node/fetch/-/fetch-0.8.8.tgz#48c6ad0c6b7951a73e812f09dd22d75e9fa18cae" + integrity sha512-CdcjGC2vdKhc13KKxgsc6/616BQ7ooDIgPeTuAiE8qfCnS0mGzcfCOoZXypQSz73nxI+GWc7ZReIAVhxoE1KCg== + dependencies: + "@peculiar/webcrypto" "^1.4.0" + "@whatwg-node/node-fetch" "^0.3.6" + busboy "^1.6.0" + urlpattern-polyfill "^8.0.0" + web-streams-polyfill "^3.2.1" + "@whatwg-node/fetch@^0.9.0": version "0.9.13" resolved "https://registry.npmjs.org/@whatwg-node/fetch/-/fetch-0.9.13.tgz" @@ -3552,6 +4444,25 @@ "@whatwg-node/node-fetch" "^0.4.17" urlpattern-polyfill "^9.0.0" +"@whatwg-node/fetch@^0.9.10", "@whatwg-node/fetch@^0.9.7": + version "0.9.16" + resolved "https://registry.yarnpkg.com/@whatwg-node/fetch/-/fetch-0.9.16.tgz#c833eb714f41f5d2caf1a345bed7a05f56db7b16" + integrity sha512-mqasZiUNquRe3ea9+aCAuo81BR6vq5opUKprPilIHTnrg8a21Z1T1OrI+KiMFX8OmwO5HUJe/vro47lpj2JPWQ== + dependencies: + "@whatwg-node/node-fetch" "^0.5.5" + urlpattern-polyfill "^10.0.0" + +"@whatwg-node/node-fetch@^0.3.6": + version "0.3.6" + resolved "https://registry.yarnpkg.com/@whatwg-node/node-fetch/-/node-fetch-0.3.6.tgz#e28816955f359916e2d830b68a64493124faa6d0" + integrity sha512-w9wKgDO4C95qnXZRwZTfCmLWqyRnooGjcIwG0wADWjw9/HN0p7dtvtgSvItZtUyNteEvgTrd8QojNEqV6DAGTA== + dependencies: + "@whatwg-node/events" "^0.0.3" + busboy "^1.6.0" + fast-querystring "^1.1.1" + fast-url-parser "^1.1.3" + tslib "^2.3.1" + "@whatwg-node/node-fetch@^0.4.17": version "0.4.19" resolved "https://registry.npmjs.org/@whatwg-node/node-fetch/-/node-fetch-0.4.19.tgz" @@ -3563,6 +4474,25 @@ fast-url-parser "^1.1.3" tslib "^2.3.1" +"@whatwg-node/node-fetch@^0.5.5": + version "0.5.6" + resolved "https://registry.yarnpkg.com/@whatwg-node/node-fetch/-/node-fetch-0.5.6.tgz#3ec2044ff66dd78134492b5f2f841bedf1cc73c9" + integrity sha512-cmAsGMHoI0S3AHi3CmD3ma1Q234ZI2JNmXyDyM9rLtbXejBKxU3ZWdhS+mzRIAyUxZCMGlFW1tHmROv0MDdxpw== + dependencies: + "@kamilkisiela/fast-url-parser" "^1.1.4" + "@whatwg-node/events" "^0.1.0" + busboy "^1.6.0" + fast-querystring "^1.1.1" + tslib "^2.3.1" + +"@whatwg-node/server@^0.9.1": + version "0.9.25" + resolved "https://registry.yarnpkg.com/@whatwg-node/server/-/server-0.9.25.tgz#23c136ddcb7e5517120bb953ce4d3bac5b96be56" + integrity sha512-DlPqPPcfyzh4/9Lz1fl4c5bZsGp/1wCh7B+cK8FE1bWoW7tlZkVguvGn/XnYPKthGzEIwo/fLdHwevH44z+eeg== + dependencies: + "@whatwg-node/fetch" "^0.9.10" + tslib "^2.3.1" + "@wry/context@^0.6.0": version "0.6.1" resolved "https://registry.npmjs.org/@wry/context/-/context-0.6.1.tgz" @@ -3683,6 +4613,13 @@ agent-base@6, agent-base@^6.0.2: dependencies: debug "4" +agent-base@^7.0.2, agent-base@^7.1.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-7.1.0.tgz#536802b76bc0b34aa50195eb2442276d613e3434" + integrity sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg== + dependencies: + debug "^4.3.4" + agentkeepalive@^4.2.1: version "4.5.0" resolved "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz" @@ -3728,7 +4665,7 @@ ansi-colors@^4.1.1: resolved "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz" integrity sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw== -ansi-escapes@^4.2.1: +ansi-escapes@^4.2.1, ansi-escapes@^4.3.0: version "4.3.2" resolved "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz" integrity sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ== @@ -3965,11 +4902,20 @@ arrify@^2.0.0, arrify@^2.0.1: resolved "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz" integrity sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug== -asap@^2.0.0: +asap@^2.0.0, asap@~2.0.3: version "2.0.6" resolved "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz" integrity sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA== +asn1js@^3.0.1, asn1js@^3.0.5: + version "3.0.5" + resolved "https://registry.yarnpkg.com/asn1js/-/asn1js-3.0.5.tgz#5ea36820443dbefb51cc7f88a2ebb5b462114f38" + integrity sha512-FVnvrKJwpt9LP2lAMl8qZswRNm3T4q9CON+bxldk2iwk3FFpuwhx2FfinyitizWHsVYyaY+y5JzDR0rCMV5yTQ== + dependencies: + pvtsutils "^1.3.2" + pvutils "^1.1.3" + tslib "^2.4.0" + assert-plus@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz" @@ -4015,6 +4961,11 @@ atomic-sleep@^1.0.0: resolved "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz" integrity sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ== +auto-bind@~4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/auto-bind/-/auto-bind-4.0.0.tgz#e3589fc6c2da8f7ca43ba9f84fa52a744fc997fb" + integrity sha512-Hdw8qdNiqdJ8LqT0iK0sVzkFbzg6fhnQqqfWhBDxcHZvU75+B+ayzTy8x+k5Ix0Y92XOhOUlx74ps+bA6BeYMQ== + avvio@^7.1.2: version "7.2.5" resolved "https://registry.npmjs.org/avvio/-/avvio-7.2.5.tgz" @@ -4176,6 +5127,11 @@ babel-plugin-jest-hoist@^29.6.3: "@types/babel__core" "^7.1.14" "@types/babel__traverse" "^7.0.6" +babel-plugin-syntax-trailing-function-commas@^7.0.0-beta.0: + version "7.0.0-beta.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-7.0.0-beta.0.tgz#aa213c1435e2bffeb6fca842287ef534ad05d5cf" + integrity sha512-Xj9XuRuz3nTSbaTXWv3itLOcxyF4oPD8douBBmj7U9BBC6nEBYfyOJYQMf/8PJAFotC62UY5dFfIGEPr7WswzQ== + babel-polyfill@^6.26.0: version "6.26.0" resolved "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.26.0.tgz" @@ -4203,6 +5159,39 @@ babel-preset-current-node-syntax@^1.0.0: "@babel/plugin-syntax-optional-chaining" "^7.8.3" "@babel/plugin-syntax-top-level-await" "^7.8.3" +babel-preset-fbjs@^3.4.0: + version "3.4.0" + resolved "https://registry.yarnpkg.com/babel-preset-fbjs/-/babel-preset-fbjs-3.4.0.tgz#38a14e5a7a3b285a3f3a86552d650dca5cf6111c" + integrity sha512-9ywCsCvo1ojrw0b+XYk7aFvTH6D9064t0RIL1rtMf3nsa02Xw41MS7sZw216Im35xj/UY0PDBQsa1brUDDF1Ow== + dependencies: + "@babel/plugin-proposal-class-properties" "^7.0.0" + "@babel/plugin-proposal-object-rest-spread" "^7.0.0" + "@babel/plugin-syntax-class-properties" "^7.0.0" + "@babel/plugin-syntax-flow" "^7.0.0" + "@babel/plugin-syntax-jsx" "^7.0.0" + "@babel/plugin-syntax-object-rest-spread" "^7.0.0" + "@babel/plugin-transform-arrow-functions" "^7.0.0" + "@babel/plugin-transform-block-scoped-functions" "^7.0.0" + "@babel/plugin-transform-block-scoping" "^7.0.0" + "@babel/plugin-transform-classes" "^7.0.0" + "@babel/plugin-transform-computed-properties" "^7.0.0" + "@babel/plugin-transform-destructuring" "^7.0.0" + "@babel/plugin-transform-flow-strip-types" "^7.0.0" + "@babel/plugin-transform-for-of" "^7.0.0" + "@babel/plugin-transform-function-name" "^7.0.0" + "@babel/plugin-transform-literals" "^7.0.0" + "@babel/plugin-transform-member-expression-literals" "^7.0.0" + "@babel/plugin-transform-modules-commonjs" "^7.0.0" + "@babel/plugin-transform-object-super" "^7.0.0" + "@babel/plugin-transform-parameters" "^7.0.0" + "@babel/plugin-transform-property-literals" "^7.0.0" + "@babel/plugin-transform-react-display-name" "^7.0.0" + "@babel/plugin-transform-react-jsx" "^7.0.0" + "@babel/plugin-transform-shorthand-properties" "^7.0.0" + "@babel/plugin-transform-spread" "^7.0.0" + "@babel/plugin-transform-template-literals" "^7.0.0" + babel-plugin-syntax-trailing-function-commas "^7.0.0-beta.0" + babel-preset-jest@^29.6.3: version "29.6.3" resolved "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz" @@ -4486,6 +5475,16 @@ browserslist@^4.21.9: node-releases "^2.0.13" update-browserslist-db "^1.0.11" +browserslist@^4.22.2: + version "4.23.0" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.23.0.tgz#8f3acc2bbe73af7213399430890f86c63a5674ab" + integrity sha512-QW8HiM1shhT2GuzkvklfjcKDiWFXHOeFCIA/huJPwHsslwcydgk7X+z2zXpEijP98UCY7HbubZt5J2Zgvf0CaQ== + dependencies: + caniuse-lite "^1.0.30001587" + electron-to-chromium "^1.4.668" + node-releases "^2.0.14" + update-browserslist-db "^1.0.13" + bs-logger@0.x: version "0.2.6" resolved "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz" @@ -4629,11 +5628,30 @@ call-bind@^1.0.0: function-bind "^1.1.1" get-intrinsic "^1.0.2" +call-bind@^1.0.5: + version "1.0.7" + resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.7.tgz#06016599c40c56498c18769d2730be242b6fa3b9" + integrity sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w== + dependencies: + es-define-property "^1.0.0" + es-errors "^1.3.0" + function-bind "^1.1.2" + get-intrinsic "^1.2.4" + set-function-length "^1.2.1" + callsites@^3.0.0: version "3.1.0" resolved "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz" integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== +camel-case@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/camel-case/-/camel-case-4.1.2.tgz#9728072a954f805228225a6deea6b38461e1bd5a" + integrity sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw== + dependencies: + pascal-case "^3.1.2" + tslib "^2.0.3" + camelcase-keys@^6.2.2: version "6.2.2" resolved "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.2.tgz" @@ -4658,6 +5676,20 @@ caniuse-lite@^1.0.30001517: resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001538.tgz" integrity sha512-HWJnhnID+0YMtGlzcp3T9drmBJUVDchPJ08tpUGFLs9CYlwWPH2uLgpHn8fND5pCgXVtnGS3H4QR9XLMHVNkHw== +caniuse-lite@^1.0.30001587: + version "1.0.30001588" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001588.tgz#07f16b65a7f95dba82377096923947fb25bce6e3" + integrity sha512-+hVY9jE44uKLkH0SrUTqxjxqNTOWHsbnQDIKjwkZ3lNTzUUVdBLBGXtj/q5Mp5u98r3droaZAewQuEDzjQdZlQ== + +capital-case@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/capital-case/-/capital-case-1.0.4.tgz#9d130292353c9249f6b00fa5852bee38a717e669" + integrity sha512-ds37W8CytHgwnhGGTi88pcPyR15qoNkOpYwmMMfnWqqWgESapLqvDx6huFjQ5vqWSn2Z06173XNA7LtMOeUh1A== + dependencies: + no-case "^3.0.4" + tslib "^2.0.3" + upper-case-first "^2.0.2" + cargo-cp-artifact@0.1.8: version "0.1.8" resolved "https://registry.npmjs.org/cargo-cp-artifact/-/cargo-cp-artifact-0.1.8.tgz" @@ -4699,6 +5731,40 @@ chalk@^3.0.0: ansi-styles "^4.1.0" supports-color "^7.1.0" +change-case-all@1.0.15: + version "1.0.15" + resolved "https://registry.yarnpkg.com/change-case-all/-/change-case-all-1.0.15.tgz#de29393167fc101d646cd76b0ef23e27d09756ad" + integrity sha512-3+GIFhk3sNuvFAJKU46o26OdzudQlPNBCu1ZQi3cMeMHhty1bhDxu2WrEilVNYaGvqUtR1VSigFcJOiS13dRhQ== + dependencies: + change-case "^4.1.2" + is-lower-case "^2.0.2" + is-upper-case "^2.0.2" + lower-case "^2.0.2" + lower-case-first "^2.0.2" + sponge-case "^1.0.1" + swap-case "^2.0.2" + title-case "^3.0.3" + upper-case "^2.0.2" + upper-case-first "^2.0.2" + +change-case@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/change-case/-/change-case-4.1.2.tgz#fedfc5f136045e2398c0410ee441f95704641e12" + integrity sha512-bSxY2ws9OtviILG1EiY5K7NNxkqg/JnRnFxLtKQ96JaviiIxi7djMrSd0ECT9AC+lttClmYwKw53BWpOMblo7A== + dependencies: + camel-case "^4.1.2" + capital-case "^1.0.4" + constant-case "^3.0.4" + dot-case "^3.0.4" + header-case "^2.0.4" + no-case "^3.0.4" + param-case "^3.0.4" + pascal-case "^3.1.2" + path-case "^3.0.4" + sentence-case "^3.0.4" + snake-case "^3.0.4" + tslib "^2.0.3" + char-regex@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz" @@ -4787,11 +5853,28 @@ cli-table3@~0.5.0: optionalDependencies: colors "^1.1.2" +cli-truncate@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cli-truncate/-/cli-truncate-2.1.0.tgz#c39e28bf05edcde5be3b98992a22deed5a2b93c7" + integrity sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg== + dependencies: + slice-ansi "^3.0.0" + string-width "^4.2.0" + cli-width@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz" integrity sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw== +cliui@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-6.0.0.tgz#511d702c0c4e41ca156d7d0e96021f23e13225b1" + integrity sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.0" + wrap-ansi "^6.2.0" + cliui@^7.0.2: version "7.0.4" resolved "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz" @@ -4836,6 +5919,11 @@ co@^4.6.0: resolved "https://registry.npmjs.org/co/-/co-4.6.0.tgz" integrity sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ== +code-block-writer@^12.0.0: + version "12.0.0" + resolved "https://registry.yarnpkg.com/code-block-writer/-/code-block-writer-12.0.0.tgz#4dd58946eb4234105aff7f0035977b2afdc2a770" + integrity sha512-q4dMFMlXtKR3XNBHyMHt/3pwYNA69EDk00lloMOaaUMKPUXBw6lpXtbu3MMVG6/uOihGnRDOlkyqsONEUj60+w== + collect-v8-coverage@^1.0.0: version "1.0.2" resolved "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz" @@ -4878,6 +5966,11 @@ color-support@^1.1.2, color-support@^1.1.3: resolved "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz" integrity sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg== +colorette@^2.0.16: + version "2.0.20" + resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.20.tgz#9eb793e6833067f7235902fcd3b09917a000a95a" + integrity sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w== + colors@^1.1.2, colors@^1.3.3: version "1.4.0" resolved "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz" @@ -4938,6 +6031,11 @@ common-ancestor-path@^1.0.1: resolved "https://registry.npmjs.org/common-ancestor-path/-/common-ancestor-path-1.0.1.tgz" integrity sha512-L3sHRo1pXXEqX8VU28kfgUY+YGsk09hPqZiZmLacNib6XNTCM8ubYeT7ryXQw8asB1sKgcU5lkB7ONug08aB8w== +common-tags@1.8.2: + version "1.8.2" + resolved "https://registry.yarnpkg.com/common-tags/-/common-tags-1.8.2.tgz#94ebb3c076d26032745fd54face7f688ef5ac9c6" + integrity sha512-gk/Z852D2Wtb//0I+kRFNKKE9dIIVirjoqPoA1wJU+XePVXZfGeBpk45+A1rKO4Q43prqWBNY/MiIeRLbPWUaA== + compare-func@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/compare-func/-/compare-func-2.0.0.tgz" @@ -4991,6 +6089,15 @@ console-table-printer@^2.11.1: dependencies: simple-wcswidth "^1.0.1" +constant-case@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/constant-case/-/constant-case-3.0.4.tgz#3b84a9aeaf4cf31ec45e6bf5de91bdfb0589faf1" + integrity sha512-I2hSBi7Vvs7BEuJDr5dDHfzb/Ruj3FyvFyh7KLilAjNQw3Be+xgqUBA2W6scVEcL0hL1dwPRtIqEPVUCKkSsyQ== + dependencies: + no-case "^3.0.4" + tslib "^2.0.3" + upper-case "^2.0.2" + content-disposition@0.5.4: version "0.5.4" resolved "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz" @@ -5160,6 +6267,16 @@ cosmiconfig@^7.0.0: path-type "^4.0.0" yaml "^1.10.0" +cosmiconfig@^8.1.0, cosmiconfig@^8.1.3: + version "8.3.6" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-8.3.6.tgz#060a2b871d66dba6c8538ea1118ba1ac16f5fae3" + integrity sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA== + dependencies: + import-fresh "^3.3.0" + js-yaml "^4.1.0" + parse-json "^5.2.0" + path-type "^4.0.0" + create-jest@^29.7.0: version "29.7.0" resolved "https://registry.npmjs.org/create-jest/-/create-jest-29.7.0.tgz" @@ -5185,6 +6302,20 @@ cross-fetch@4.0.0: dependencies: node-fetch "^2.6.12" +cross-fetch@^3.1.5: + version "3.1.8" + resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.8.tgz#0327eba65fd68a7d119f8fb2bf9334a1a7956f82" + integrity sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg== + dependencies: + node-fetch "^2.6.12" + +cross-inspect@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/cross-inspect/-/cross-inspect-1.0.0.tgz#5fda1af759a148594d2d58394a9e21364f6849af" + integrity sha512-4PFfn4b5ZN6FMNGSZlyb7wUhuN8wvj8t/VQHZdM4JsDcruGJ8L2kf9zao98QIrBPFCpdk27qst/AGTl7pL3ypQ== + dependencies: + tslib "^2.4.0" + cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz" @@ -5214,6 +6345,11 @@ dateformat@^3.0.0: resolved "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz" integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q== +debounce@^1.2.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/debounce/-/debounce-1.2.1.tgz#38881d8f4166a5c5848020c11827b834bcb3e0a5" + integrity sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug== + debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9: version "2.6.9" resolved "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz" @@ -5288,6 +6424,15 @@ defaults@^1.0.3: dependencies: clone "^1.0.2" +define-data-property@^1.1.2: + version "1.1.4" + resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.4.tgz#894dc141bb7d3060ae4366f6a0107e68fbe48c5e" + integrity sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A== + dependencies: + es-define-property "^1.0.0" + es-errors "^1.3.0" + gopd "^1.0.1" + define-lazy-prop@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz" @@ -5340,6 +6485,11 @@ depd@~1.1.2: resolved "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz" integrity sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ== +dependency-graph@^0.11.0: + version "0.11.0" + resolved "https://registry.yarnpkg.com/dependency-graph/-/dependency-graph-0.11.0.tgz#ac0ce7ed68a54da22165a85e97a01d53f5eb2e27" + integrity sha512-JeMq7fEshyepOWDfcfHK06N3MhyPhz++vtqWhMT5O9A3K42rdsEDpfdVqjaqaAhsw6a+ZqeDvQVtD0hFHQWrzg== + deprecation@^2.0.0, deprecation@^2.3.1: version "2.3.1" resolved "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz" @@ -5414,6 +6564,14 @@ dom-walk@^0.1.0: resolved "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.2.tgz" integrity sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w== +dot-case@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/dot-case/-/dot-case-3.0.4.tgz#9b2b670d00a431667a8a75ba29cd1b98809ce751" + integrity sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w== + dependencies: + no-case "^3.0.4" + tslib "^2.0.3" + dot-prop@^5.1.0: version "5.3.0" resolved "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz" @@ -5428,6 +6586,11 @@ dot-prop@^6.0.0, dot-prop@^6.0.1: dependencies: is-obj "^2.0.0" +dotenv@^16.0.0: + version "16.4.5" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.5.tgz#cdd3b3b604cb327e286b4762e13502f717cb099f" + integrity sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg== + dotenv@~10.0.0: version "10.0.0" resolved "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz" @@ -5438,6 +6601,11 @@ dottie@^2.0.6: resolved "https://registry.npmjs.org/dottie/-/dottie-2.0.6.tgz" integrity sha512-iGCHkfUc5kFekGiqhe8B/mdaurD+lakO9txNnTvKtA6PISrw86LgqHvRzWYPyoE2Ph5aMIrCw9/uko6XHTKCwA== +dset@^3.1.1: + version "3.1.3" + resolved "https://registry.yarnpkg.com/dset/-/dset-3.1.3.tgz#c194147f159841148e8e34ca41f638556d9542d2" + integrity sha512-20TuZZHCEZ2O71q9/+8BwKwZ0QtD9D8ObhrihJPr+vLLYlSuAU3/zL4cSlgbfeoGHTjCSJBa7NGcrF9/Bx/WJQ== + dset@^3.1.2: version "3.1.2" resolved "https://registry.npmjs.org/dset/-/dset-3.1.2.tgz" @@ -5492,6 +6660,11 @@ electron-to-chromium@^1.4.477: resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.523.tgz" integrity sha512-9AreocSUWnzNtvLcbpng6N+GkXnCcBR80IQkxRC9Dfdyg4gaWNUPBujAHUpKkiUkoSoR9UlhA4zD/IgBklmhzg== +electron-to-chromium@^1.4.668: + version "1.4.677" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.677.tgz#49ee77713516740bdde32ac2d1443c444f0dafe7" + integrity sha512-erDa3CaDzwJOpyvfKhOiJjBVNnMM0qxHq47RheVVwsSQrgBA9ZSGV9kdaOfZDPXcHzhG7lBxhj6A7KvfLJBd6Q== + elliptic@6.5.4: version "6.5.4" resolved "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz" @@ -5585,6 +6758,18 @@ error-ex@^1.3.1: dependencies: is-arrayish "^0.2.1" +es-define-property@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/es-define-property/-/es-define-property-1.0.0.tgz#c7faefbdff8b2696cf5f46921edfb77cc4ba3845" + integrity sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ== + dependencies: + get-intrinsic "^1.2.4" + +es-errors@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" + integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== + es6-promise@^4.0.3: version "4.2.8" resolved "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz" @@ -6080,10 +7265,21 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== -fast-glob@3.2.7: - version "3.2.7" - resolved "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz" - integrity sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q== +fast-glob@3.2.7: + version "3.2.7" + resolved "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz" + integrity sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q== + dependencies: + "@nodelib/fs.stat" "^2.0.2" + "@nodelib/fs.walk" "^1.2.3" + glob-parent "^5.1.2" + merge2 "^1.3.0" + micromatch "^4.0.4" + +fast-glob@^3.2.12: + version "3.3.2" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" + integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow== dependencies: "@nodelib/fs.stat" "^2.0.2" "@nodelib/fs.walk" "^1.2.3" @@ -6196,6 +7392,24 @@ fb-watchman@^2.0.0: dependencies: bser "2.1.1" +fbjs-css-vars@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/fbjs-css-vars/-/fbjs-css-vars-1.0.2.tgz#216551136ae02fe255932c3ec8775f18e2c078b8" + integrity sha512-b2XGFAFdWZWg0phtAWLHCk836A1Xann+I+Dgd3Gk64MHKZO44FfoD1KxyvbSh0qZsIoXQGGlVztIY+oitJPpRQ== + +fbjs@^3.0.0: + version "3.0.5" + resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-3.0.5.tgz#aa0edb7d5caa6340011790bd9249dbef8a81128d" + integrity sha512-ztsSx77JBtkuMrEypfhgc3cI0+0h+svqeie7xHbh1k/IKdcydnvadp/mUaGgjAOXQmQSxsqgaRhS3q9fy+1kxg== + dependencies: + cross-fetch "^3.1.5" + fbjs-css-vars "^1.0.0" + loose-envify "^1.0.0" + object-assign "^4.1.0" + promise "^7.1.1" + setimmediate "^1.0.5" + ua-parser-js "^1.0.35" + figures@3.2.0, figures@^3.0.0: version "3.2.0" resolved "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz" @@ -6542,7 +7756,7 @@ gensync@^1.0.0-beta.2: resolved "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz" integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== -get-caller-file@^2.0.5: +get-caller-file@^2.0.1, get-caller-file@^2.0.5: version "2.0.5" resolved "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== @@ -6557,6 +7771,17 @@ get-intrinsic@^1.0.2: has-proto "^1.0.1" has-symbols "^1.0.3" +get-intrinsic@^1.1.3, get-intrinsic@^1.2.3, get-intrinsic@^1.2.4: + version "1.2.4" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.4.tgz#e385f5a4b5227d449c3eabbad05494ef0abbeadd" + integrity sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ== + dependencies: + es-errors "^1.3.0" + function-bind "^1.1.2" + has-proto "^1.0.1" + has-symbols "^1.0.3" + hasown "^2.0.0" + get-package-type@^0.1.0: version "0.1.0" resolved "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz" @@ -6707,7 +7932,7 @@ glob@^10.2.2: minipass "^5.0.0 || ^6.0.2 || ^7.0.0" path-scurry "^1.10.1" -glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: +glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: version "7.2.3" resolved "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz" integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== @@ -6755,7 +7980,7 @@ globals@^9.18.0: resolved "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz" integrity sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ== -globby@^11.0.2, globby@^11.1.0: +globby@^11.0.2, globby@^11.0.3, globby@^11.1.0: version "11.1.0" resolved "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz" integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== @@ -6845,6 +8070,13 @@ google-p12-pem@^3.1.3: dependencies: node-forge "^1.3.1" +gopd@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" + integrity sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA== + dependencies: + get-intrinsic "^1.1.3" + graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.4, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.6, graceful-fs@^4.2.9: version "4.2.11" resolved "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz" @@ -6855,7 +8087,32 @@ graphemer@^1.4.0: resolved "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz" integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== -graphql-tag@2.12.6, graphql-tag@^2.12.3: +graphql-config@^5.0.2: + version "5.0.3" + resolved "https://registry.yarnpkg.com/graphql-config/-/graphql-config-5.0.3.tgz#d9aa2954cf47a927f9cb83cdc4e42ae55d0b321e" + integrity sha512-BNGZaoxIBkv9yy6Y7omvsaBUHOzfFcII3UN++tpH8MGOKFPFkCPZuwx09ggANMt8FgyWP1Od8SWPmrUEZca4NQ== + dependencies: + "@graphql-tools/graphql-file-loader" "^8.0.0" + "@graphql-tools/json-file-loader" "^8.0.0" + "@graphql-tools/load" "^8.0.0" + "@graphql-tools/merge" "^9.0.0" + "@graphql-tools/url-loader" "^8.0.0" + "@graphql-tools/utils" "^10.0.0" + cosmiconfig "^8.1.0" + jiti "^1.18.2" + minimatch "^4.2.3" + string-env-interpolation "^1.0.1" + tslib "^2.4.0" + +graphql-request@^6.0.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/graphql-request/-/graphql-request-6.1.0.tgz#f4eb2107967af3c7a5907eb3131c671eac89be4f" + integrity sha512-p+XPfS4q7aIpKVcgmnZKhMNqhltk20hfXtkaIkTfjjmiKMJ5xrt5c743cL03y/K7y1rg3WrIC49xGiEQ4mxdNw== + dependencies: + "@graphql-typed-document-node/core" "^3.2.0" + cross-fetch "^3.1.5" + +graphql-tag@2.12.6, graphql-tag@^2.11.0, graphql-tag@^2.12.3: version "2.12.6" resolved "https://registry.npmjs.org/graphql-tag/-/graphql-tag-2.12.6.tgz" integrity sha512-FdSNcu2QQcWnM2VNvSCCDCVS5PpPqpzgFT8+GXzqJuoDd0CBncxCY278u4mhRO7tMgo2JjgJA5aZ+nWSQ/Z+xg== @@ -6877,6 +8134,23 @@ graphql-ws@^5.14.0: resolved "https://registry.npmjs.org/graphql-ws/-/graphql-ws-5.14.0.tgz" integrity sha512-itrUTQZP/TgswR4GSSYuwWUzrE/w5GhbwM2GX3ic2U7aw33jgEsayfIlvaj7/GcIvZgNMzsPTrE5hqPuFUiE5g== +graphql-yoga@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/graphql-yoga/-/graphql-yoga-5.1.1.tgz#e47f48217a4c7907290fdf164d9a4c7edb50e30b" + integrity sha512-oak5nVKTHpqJgpA1aT3cJPOlCidrW7l6nbc5L6w07VdFul16ielGI2ZnQDAXO+qQih09/4WspD5x0SsSZH+hkg== + dependencies: + "@envelop/core" "^5.0.0" + "@graphql-tools/executor" "^1.0.0" + "@graphql-tools/schema" "^10.0.0" + "@graphql-tools/utils" "^10.0.0" + "@graphql-yoga/logger" "^2.0.0" + "@graphql-yoga/subscription" "^5.0.0" + "@whatwg-node/fetch" "^0.9.7" + "@whatwg-node/server" "^0.9.1" + dset "^3.1.1" + lru-cache "^10.0.0" + tslib "^2.5.2" + graphql@16.8.0: version "16.8.0" resolved "https://registry.npmjs.org/graphql/-/graphql-16.8.0.tgz" @@ -6925,6 +8199,13 @@ has-flag@^4.0.0: resolved "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz" integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== +has-property-descriptors@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz#963ed7d071dc7bf5f084c5bfbe0d1b6222586854" + integrity sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg== + dependencies: + es-define-property "^1.0.0" + has-proto@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz" @@ -6993,6 +8274,14 @@ hasown@^2.0.0: dependencies: function-bind "^1.1.2" +header-case@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/header-case/-/header-case-2.0.4.tgz#5a42e63b55177349cf405beb8d775acabb92c063" + integrity sha512-H/vuk5TEEVZwrR0lp2zed9OCo1uAILMlx0JEMgC26rzyJJ3N1v6XkwHHXJQdR2doSjcGPM6OKPYoJgf0plJ11Q== + dependencies: + capital-case "^1.0.4" + tslib "^2.0.3" + helmet@7.0.0: version "7.0.0" resolved "https://registry.npmjs.org/helmet/-/helmet-7.0.0.tgz" @@ -7094,6 +8383,14 @@ http-proxy-agent@^5.0.0: agent-base "6" debug "4" +http-proxy-agent@^7.0.0: + version "7.0.2" + resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz#9a8b1f246866c028509486585f62b8f2c18c270e" + integrity sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig== + dependencies: + agent-base "^7.1.0" + debug "^4.3.4" + https-proxy-agent@^5.0.0: version "5.0.1" resolved "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz" @@ -7102,6 +8399,14 @@ https-proxy-agent@^5.0.0: agent-base "6" debug "4" +https-proxy-agent@^7.0.0: + version "7.0.4" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-7.0.4.tgz#8e97b841a029ad8ddc8731f26595bad868cb4168" + integrity sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg== + dependencies: + agent-base "^7.0.2" + debug "4" + human-signals@^1.1.1: version "1.1.1" resolved "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz" @@ -7150,7 +8455,12 @@ ignore@^5.0.4, ignore@^5.2.0, ignore@^5.2.4: resolved "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz" integrity sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ== -import-fresh@^3.1.0, import-fresh@^3.2.1: +immutable@~3.7.6: + version "3.7.6" + resolved "https://registry.yarnpkg.com/immutable/-/immutable-3.7.6.tgz#13b4d3cb12befa15482a26fe1b2ebae640071e4b" + integrity sha512-AizQPcaofEtO11RZhPPHBOJRdo/20MKQF9mBLnVkBoyHi1/zXK8fzVdnEpSV9gxqtnh6Qomfp3F0xT5qP/vThw== + +import-fresh@^3.1.0, import-fresh@^3.2.1, import-fresh@^3.3.0: version "3.3.0" resolved "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz" integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== @@ -7158,6 +8468,11 @@ import-fresh@^3.1.0, import-fresh@^3.2.1: parent-module "^1.0.0" resolve-from "^4.0.0" +import-from@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/import-from/-/import-from-4.0.0.tgz#2710b8d66817d232e16f4166e319248d3d5492e2" + integrity sha512-P9J71vT5nLlDeV8FHs5nNxaLbrpfAV5cF5srvbZfpwpcJoM/xZR3hiv+q+SAnuSmuGbXMWud063iIMx/V/EWZQ== + import-local@^3.0.2: version "3.1.0" resolved "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz" @@ -7217,7 +8532,7 @@ init-package-json@^3.0.2: validate-npm-package-license "^3.0.4" validate-npm-package-name "^4.0.0" -inquirer@^8.2.4: +inquirer@^8.0.0, inquirer@^8.2.4: version "8.2.6" resolved "https://registry.npmjs.org/inquirer/-/inquirer-8.2.6.tgz" integrity sha512-M1WuAmb7pn9zdFRtQYk26ZBoY043Sse0wVDdk4Bppr+JOXyQYybdtvK+l9wUibhtjdjvtoiNy8tk+EgsYIUqKg== @@ -7238,7 +8553,7 @@ inquirer@^8.2.4: through "^2.3.6" wrap-ansi "^6.0.1" -invariant@^2.2.2: +invariant@^2.2.2, invariant@^2.2.4: version "2.2.4" resolved "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz" integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA== @@ -7255,6 +8570,14 @@ ipaddr.js@1.9.1: resolved "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz" integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g== +is-absolute@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-absolute/-/is-absolute-1.0.0.tgz#395e1ae84b11f26ad1795e73c17378e48a301576" + integrity sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA== + dependencies: + is-relative "^1.0.0" + is-windows "^1.0.1" + is-accessor-descriptor@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.1.tgz" @@ -7375,6 +8698,13 @@ is-generator-fn@^2.0.0: resolved "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz" integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== +is-glob@4.0.3, is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3: + version "4.0.3" + resolved "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz" + integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== + dependencies: + is-extglob "^2.1.1" + is-glob@^2.0.0, is-glob@^2.0.1: version "2.0.1" resolved "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz" @@ -7382,13 +8712,6 @@ is-glob@^2.0.0, is-glob@^2.0.1: dependencies: is-extglob "^1.0.0" -is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3: - version "4.0.3" - resolved "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz" - integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== - dependencies: - is-extglob "^2.1.1" - is-hex-prefixed@1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz" @@ -7404,6 +8727,13 @@ is-lambda@^1.0.1: resolved "https://registry.npmjs.org/is-lambda/-/is-lambda-1.0.1.tgz" integrity sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ== +is-lower-case@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/is-lower-case/-/is-lower-case-2.0.2.tgz#1c0884d3012c841556243483aa5d522f47396d2a" + integrity sha512-bVcMJy4X5Og6VZfdOZstSexlEy20Sr0k/p/b2IlQJlfdKAQuMpiv5w2Ccxb8sKdRUNAG1PnHVHjFSdRDVS6NlQ== + dependencies: + tslib "^2.0.3" + is-number@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz" @@ -7470,6 +8800,13 @@ is-primitive@^2.0.0: resolved "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz" integrity sha512-N3w1tFaRfk3UrPfqeRyD+GYDASU3W5VinKhlORy8EWVf/sIdDL9GAcew85XmktCfH+ngG7SRXEVDoO18WMdB/Q== +is-relative@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-relative/-/is-relative-1.0.0.tgz#a1bb6935ce8c5dba1e8b9754b9b2dcc020e2260d" + integrity sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA== + dependencies: + is-unc-path "^1.0.0" + is-ssh@^1.4.0: version "1.4.0" resolved "https://registry.npmjs.org/is-ssh/-/is-ssh-1.4.0.tgz" @@ -7499,12 +8836,26 @@ is-typedarray@^1.0.0: resolved "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz" integrity sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA== +is-unc-path@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-unc-path/-/is-unc-path-1.0.0.tgz#d731e8898ed090a12c352ad2eaed5095ad322c9d" + integrity sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ== + dependencies: + unc-path-regex "^0.1.2" + is-unicode-supported@^0.1.0: version "0.1.0" resolved "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz" integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw== -is-windows@^1.0.2: +is-upper-case@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/is-upper-case/-/is-upper-case-2.0.2.tgz#f1105ced1fe4de906a5f39553e7d3803fd804649" + integrity sha512-44pxmxAvnnAOwBg4tHPnkfvgjPwbc5QIsSstNU+YcJ1ovxVzCWpSGosPJOZh/a1tdl81fbgnLc9LLv+x2ywbPQ== + dependencies: + tslib "^2.0.3" + +is-windows@^1.0.1, is-windows@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz" integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== @@ -7521,6 +8872,11 @@ isarray@1.0.0, isarray@~1.0.0: resolved "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz" integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ== +isarray@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.5.tgz#8af1e4c1221244cc62459faf38940d4e644a5723" + integrity sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw== + isexe@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz" @@ -8007,6 +9363,16 @@ jest@<30.0.0-0: import-local "^3.0.2" jest-cli "^29.7.0" +jiti@^1.17.1, jiti@^1.18.2: + version "1.21.0" + resolved "https://registry.yarnpkg.com/jiti/-/jiti-1.21.0.tgz#7c97f8fe045724e136a397f7340475244156105d" + integrity sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q== + +jose@^5.0.0: + version "5.2.2" + resolved "https://registry.yarnpkg.com/jose/-/jose-5.2.2.tgz#b91170e9ba6dbe609b0c0a86568f9a1fbe4335c0" + integrity sha512-/WByRr4jDcsKlvMd1dRJnPfS1GVO3WuKyaurJ/vvXcOaUQO8rnNObCQMlv/5uCceVQIq5Q4WLF44ohsdiTohdg== + js-sha3@0.8.0, js-sha3@^0.8.0: version "0.8.0" resolved "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz" @@ -8022,7 +9388,7 @@ js-tokens@^3.0.2: resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz" integrity sha512-RjTcuD4xjtthQkaWH7dFlH85L+QaVtSoOyGdZ3g6HFhS9dFNDfLyqgm2NFe2X6cQpeFmt0452FJjFG5UameExg== -js-yaml@4.1.0, js-yaml@^4.1.0: +js-yaml@4.1.0, js-yaml@^4.0.0, js-yaml@^4.1.0: version "4.1.0" resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz" integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== @@ -8089,6 +9455,16 @@ json-stable-stringify-without-jsonify@^1.0.1: resolved "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz" integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== +json-stable-stringify@^1.0.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.1.1.tgz#52d4361b47d49168bcc4e564189a42e5a7439454" + integrity sha512-SU/971Kt5qVQfJpyDveVhQ/vya+5hvrjClFOcr8c0Fq5aODJjMwutrOfCU+eCnVD5gpx1Q3fEqkyom77zH1iIg== + dependencies: + call-bind "^1.0.5" + isarray "^2.0.5" + jsonify "^0.0.1" + object-keys "^1.1.1" + json-stringify-nice@^1.1.4: version "1.1.4" resolved "https://registry.npmjs.org/json-stringify-nice/-/json-stringify-nice-1.1.4.tgz" @@ -8099,6 +9475,14 @@ json-stringify-safe@^5.0.1: resolved "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz" integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA== +json-to-pretty-yaml@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/json-to-pretty-yaml/-/json-to-pretty-yaml-1.2.2.tgz#f4cd0bd0a5e8fe1df25aaf5ba118b099fd992d5b" + integrity sha512-rvm6hunfCcqegwYaG5T4yKJWxc9FXFgBVrcTZ4XfSVRwa5HA/Xs+vB/Eo9treYYHCeNM0nrSUr82V/M31Urc7A== + dependencies: + remedial "^1.0.7" + remove-trailing-spaces "^1.0.6" + json5@^0.5.1: version "0.5.1" resolved "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz" @@ -8130,6 +9514,11 @@ jsonfile@^6.0.1: optionalDependencies: graceful-fs "^4.1.6" +jsonify@^0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.1.tgz#2aa3111dae3d34a0f151c63f3a45d995d9420978" + integrity sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg== + jsonparse@^1.2.0, jsonparse@^1.3.1: version "1.3.1" resolved "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz" @@ -8276,6 +9665,20 @@ lines-and-columns@~2.0.3: resolved "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-2.0.3.tgz" integrity sha512-cNOjgCnLB+FnvWWtyRTzmB3POJ+cXxTA81LoW7u8JdmhfXzriropYwpjShnz1QLLWsQwY7nIxoDmcPTwphDK9w== +listr2@^4.0.5: + version "4.0.5" + resolved "https://registry.yarnpkg.com/listr2/-/listr2-4.0.5.tgz#9dcc50221583e8b4c71c43f9c7dfd0ef546b75d5" + integrity sha512-juGHV1doQdpNT3GSTs9IUN43QJb7KHdF9uqg7Vufs/tG9VTzpFphqF4pm/ICdAABGQxsyNn9CiYA3StkI6jpwA== + dependencies: + cli-truncate "^2.1.0" + colorette "^2.0.16" + log-update "^4.0.0" + p-map "^4.0.0" + rfdc "^1.3.0" + rxjs "^7.5.5" + through "^2.3.8" + wrap-ansi "^7.0.0" + load-json-file@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz" @@ -8398,6 +9801,11 @@ lodash.snakecase@^4.1.1: resolved "https://registry.npmjs.org/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz" integrity sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw== +lodash.sortby@^4.7.0: + version "4.7.0" + resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" + integrity sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA== + lodash.startcase@^4.4.0: version "4.4.0" resolved "https://registry.npmjs.org/lodash.startcase/-/lodash.startcase-4.4.0.tgz" @@ -8443,7 +9851,7 @@ lodash.zip@^4.2.0: resolved "https://registry.npmjs.org/lodash.zip/-/lodash.zip-4.2.0.tgz" integrity sha512-C7IOaBBK/0gMORRBd8OETNx3kmOkgIWIPvyDpZSCTwUrpYmgZwJkjZeOD8ww4xbOUOs4/attY+pciKvadNfFbg== -lodash@^4.17.15, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.4: +lodash@^4.17.15, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.4, lodash@~4.17.0: version "4.17.21" resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -8455,7 +9863,7 @@ log-symbols@^3.0.0: dependencies: chalk "^2.4.2" -log-symbols@^4.1.0: +log-symbols@^4.0.0, log-symbols@^4.1.0: version "4.1.0" resolved "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz" integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg== @@ -8463,6 +9871,16 @@ log-symbols@^4.1.0: chalk "^4.1.0" is-unicode-supported "^0.1.0" +log-update@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/log-update/-/log-update-4.0.0.tgz#589ecd352471f2a1c0c570287543a64dfd20e0a1" + integrity sha512-9fkkDevMefjg0mmzWFBW8YkFP91OrizzkW3diF7CpG+S2EYdy4+TVfGwz1zeF8x7hCx1ovSPTOE9Ngib74qqUg== + dependencies: + ansi-escapes "^4.3.0" + cli-cursor "^3.1.0" + slice-ansi "^4.0.0" + wrap-ansi "^6.2.0" + long@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/long/-/long-4.0.0.tgz" @@ -8480,6 +9898,25 @@ loose-envify@^1.0.0, loose-envify@^1.4.0: dependencies: js-tokens "^3.0.0 || ^4.0.0" +lower-case-first@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/lower-case-first/-/lower-case-first-2.0.2.tgz#64c2324a2250bf7c37c5901e76a5b5309301160b" + integrity sha512-EVm/rR94FJTZi3zefZ82fLWab+GX14LJN4HrWBcuo6Evmsl9hEfnqxgcHCKb9q+mNf6EVdsjx/qucYFIIB84pg== + dependencies: + tslib "^2.0.3" + +lower-case@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-2.0.2.tgz#6fa237c63dbdc4a82ca0fd882e4722dc5e634e28" + integrity sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg== + dependencies: + tslib "^2.0.3" + +lru-cache@^10.0.0: + version "10.2.0" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.2.0.tgz#0bd445ca57363465900f4d1f9bd8db343a4d95c3" + integrity sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q== + lru-cache@^5.1.1: version "5.1.1" resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz" @@ -8586,7 +10023,7 @@ makeerror@1.0.12: dependencies: tmpl "1.0.5" -map-cache@^0.2.2: +map-cache@^0.2.0, map-cache@^0.2.2: version "0.2.2" resolved "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz" integrity sha512-8y/eV9QQZCiyn1SprXSrCmqJN0yNRATe+PO8ztwqrvrbdRLA3eYJF0yaR0YayLWkMbsQSKWS9N2gPcGEc4UsZg== @@ -8714,7 +10151,7 @@ micromatch@^3.1.10: snapdragon "^0.8.1" to-regex "^3.0.2" -micromatch@^4.0.4: +micromatch@^4.0.4, micromatch@^4.0.5: version "4.0.5" resolved "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz" integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== @@ -8790,6 +10227,13 @@ minimatch@^3.0.2, minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatc dependencies: brace-expansion "^1.1.7" +minimatch@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-4.2.3.tgz#b4dcece1d674dee104bb0fb833ebb85a78cbbca6" + integrity sha512-lIUdtK5hdofgCTu3aT0sOaHsYR37viUuIc0rwnnDXImbwFRcumyLMeZaM0t0I/fgxS6s6JMfu0rLD1Wz9pv1ng== + dependencies: + brace-expansion "^1.1.7" + minimatch@^5.0.1: version "5.1.6" resolved "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz" @@ -8797,6 +10241,13 @@ minimatch@^5.0.1: dependencies: brace-expansion "^2.0.1" +minimatch@^7.4.3: + version "7.4.6" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-7.4.6.tgz#845d6f254d8f4a5e4fd6baf44d5f10c8448365fb" + integrity sha512-sBz8G/YjVniEz6lKPNpKxXwazJe4c19fEfV2GDMX6AjFz+MX9uDWIZW8XreVhkFW3fkIdTv/gxWr/Kks5FFAVw== + dependencies: + brace-expansion "^2.0.1" + minimatch@^9.0.1: version "9.0.3" resolved "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz" @@ -8930,6 +10381,11 @@ mkdirp@^1.0.3, mkdirp@^1.0.4: resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== +mkdirp@^2.1.6: + version "2.1.6" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-2.1.6.tgz#964fbcb12b2d8c5d6fbc62a963ac95a273e2cc19" + integrity sha512-+hEnITedc8LAtIP9u3HJDFIdcLV2vXP33sqLLIzkv1Db1zO/1OxbvYf0Y1OC/S/Qo5dxHXepofhmxL02PsKe+A== + modify-values@^1.0.0: version "1.0.1" resolved "https://registry.npmjs.org/modify-values/-/modify-values-1.0.1.tgz" @@ -9042,6 +10498,14 @@ ngeohash@0.6.3: resolved "https://registry.npmjs.org/ngeohash/-/ngeohash-0.6.3.tgz" integrity sha512-kltF0cOxgx1AbmVzKxYZaoB0aj7mOxZeHaerEtQV0YaqnkXNq26WWqMmJ6lTqShYxVRWZ/mwvvTrNeOwdslWiw== +no-case@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/no-case/-/no-case-3.0.4.tgz#d361fd5c9800f558551a8369fc0dcd4662b6124d" + integrity sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg== + dependencies: + lower-case "^2.0.2" + tslib "^2.0.3" + nock@13.3.3: version "13.3.3" resolved "https://registry.npmjs.org/nock/-/nock-13.3.3.tgz" @@ -9109,6 +10573,11 @@ node-releases@^2.0.13: resolved "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz" integrity sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ== +node-releases@^2.0.14: + version "2.0.14" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.14.tgz#2ffb053bceb8b2be8495ece1ab6ce600c4461b0b" + integrity sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw== + nopt@^5.0.0: version "5.0.0" resolved "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz" @@ -9153,7 +10622,7 @@ normalize-package-data@^4.0.0: semver "^7.3.5" validate-npm-package-license "^3.0.4" -normalize-path@^2.0.0, normalize-path@^2.0.1: +normalize-path@^2.0.0, normalize-path@^2.0.1, normalize-path@^2.1.1: version "2.1.1" resolved "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz" integrity sha512-3pKJwH184Xo/lnH6oyP1q2pMd7HcypqqmRs91/6/i2CGtWwIKGCkOOMTm/zXbgTEWHw1uNpNi/igc3ePOYHb6w== @@ -9275,6 +10744,11 @@ npmlog@^6.0.0, npmlog@^6.0.2: gauge "^4.0.3" set-blocking "^2.0.0" +nullthrows@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/nullthrows/-/nullthrows-1.1.1.tgz#7818258843856ae971eae4208ad7d7eb19a431b1" + integrity sha512-2vPPEi+Z7WqML2jZYddDIfy5Dqb0r2fze2zTxNNknZaFpVHU3mFB3R+DWeJWGVx0ecvttSGlJTI+WG+8Z4cDWw== + number-to-bn@1.7.0: version "1.7.0" resolved "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz" @@ -9358,6 +10832,11 @@ object-inspect@^1.9.0: resolved "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz" integrity sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g== +object-keys@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" + integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== + object-visit@^1.0.0: version "1.0.1" resolved "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz" @@ -9658,6 +11137,14 @@ pacote@^13.0.3, pacote@^13.6.1: ssri "^9.0.0" tar "^6.1.11" +param-case@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/param-case/-/param-case-3.0.4.tgz#7d17fe4aa12bde34d4a77d91acfb6219caad01c5" + integrity sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A== + dependencies: + dot-case "^3.0.4" + tslib "^2.0.3" + parent-module@^1.0.0: version "1.0.1" resolved "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz" @@ -9679,6 +11166,15 @@ parse-duration@^1.0.0: resolved "https://registry.npmjs.org/parse-duration/-/parse-duration-1.1.0.tgz" integrity sha512-z6t9dvSJYaPoQq7quMzdEagSFtpGu+utzHqqxmpVWNNZRIXnvqyCvn9XsTdh7c/w0Bqmdz3RB3YnRaKtpRtEXQ== +parse-filepath@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/parse-filepath/-/parse-filepath-1.0.2.tgz#a632127f53aaf3d15876f5872f3ffac763d6c891" + integrity sha512-FwdRXKCohSVeXqwtYonZTXtbGJKrn+HNyWDYVcp5yuJlesTwNH4rsmRZ+GrKAPJ5bLpRxESMeS+Rl0VCHRvB2Q== + dependencies: + is-absolute "^1.0.0" + map-cache "^0.2.0" + path-root "^0.1.1" + parse-glob@^3.0.4: version "3.0.4" resolved "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz" @@ -9736,11 +11232,32 @@ parsimmon@^1.18.1: resolved "https://registry.npmjs.org/parsimmon/-/parsimmon-1.18.1.tgz" integrity sha512-u7p959wLfGAhJpSDJVYXoyMCXWYwHia78HhRBWqk7AIbxdmlrfdp5wX0l3xv/iTSH5HvhN9K7o26hwwpgS5Nmw== +pascal-case@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/pascal-case/-/pascal-case-3.1.2.tgz#b48e0ef2b98e205e7c1dae747d0b1508237660eb" + integrity sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g== + dependencies: + no-case "^3.0.4" + tslib "^2.0.3" + pascalcase@^0.1.1: version "0.1.1" resolved "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz" integrity sha512-XHXfu/yOQRy9vYOtUDVMN60OEJjW013GoObG1o+xwQTpB9eYJX/BjXMsdW13ZDPruFhYYn0AG22w0xgQMwl3Nw== +path-browserify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-1.0.1.tgz#d98454a9c3753d5790860f16f68867b9e46be1fd" + integrity sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g== + +path-case@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/path-case/-/path-case-3.0.4.tgz#9168645334eb942658375c56f80b4c0cb5f82c6f" + integrity sha512-qO4qCFjXqVTrcbPt/hQfhTQ+VhFsqNKOPtytgNKkKxSoEp3XPUQ8ObFuePylOIok5gjn69ry8XiULxCwot3Wfg== + dependencies: + dot-case "^3.0.4" + tslib "^2.0.3" + path-exists@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz" @@ -9766,6 +11283,18 @@ path-parse@^1.0.7: resolved "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== +path-root-regex@^0.1.0: + version "0.1.2" + resolved "https://registry.yarnpkg.com/path-root-regex/-/path-root-regex-0.1.2.tgz#bfccdc8df5b12dc52c8b43ec38d18d72c04ba96d" + integrity sha512-4GlJ6rZDhQZFE0DPVKh0e9jmZ5egZfxTkp7bcRDuPlJXbAwhxcl2dINPUAsjLdejqaLsCeg8axcLjIbvBjN4pQ== + +path-root@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/path-root/-/path-root-0.1.1.tgz#9a4a6814cac1c0cd73360a95f32083c8ea4745b7" + integrity sha512-QLcPegTHF11axjfojBIoDygmS2E3Lf+8+jI6wOVmNVenrKSo3mFdSGiIgdSHenczw3wPtlVMQaFVwGmM7BJdtg== + dependencies: + path-root-regex "^0.1.0" + path-scurry@^1.10.1: version "1.10.1" resolved "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz" @@ -10108,6 +11637,13 @@ promise-retry@^2.0.1: err-code "^2.0.2" retry "^0.12.0" +promise@^7.1.1: + version "7.3.1" + resolved "https://registry.yarnpkg.com/promise/-/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf" + integrity sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg== + dependencies: + asap "~2.0.3" + prompts@^2.0.1: version "2.4.2" resolved "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz" @@ -10255,6 +11791,18 @@ pure-rand@^6.0.0: resolved "https://registry.npmjs.org/pure-rand/-/pure-rand-6.0.3.tgz" integrity sha512-KddyFewCsO0j3+np81IQ+SweXLDnDQTs5s67BOnrYmYe/yNmUhttQyGsYzy8yUnoljGAQ9sl38YB4vH8ur7Y+w== +pvtsutils@^1.3.2, pvtsutils@^1.3.5: + version "1.3.5" + resolved "https://registry.yarnpkg.com/pvtsutils/-/pvtsutils-1.3.5.tgz#b8705b437b7b134cd7fd858f025a23456f1ce910" + integrity sha512-ARvb14YB9Nm2Xi6nBq1ZX6dAM0FsJnuk+31aUp4TrcZEdKUlSqOqsxJHUPJDNE3qiIp+iUPEIeR6Je/tgV7zsA== + dependencies: + tslib "^2.6.1" + +pvutils@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/pvutils/-/pvutils-1.1.3.tgz#f35fc1d27e7cd3dfbd39c0826d173e806a03f5a3" + integrity sha512-pMpnA0qRdFp32b1sJl1wOJNxZLQ2cbQx+k6tjNtZ8CpvVhNqEPRgivZ2WOUev2YMajecdH7ctUPDvEe87nariQ== + q@^1.5.1: version "1.5.1" resolved "https://registry.npmjs.org/q/-/q-1.5.1.tgz" @@ -10487,6 +12035,11 @@ regenerator-runtime@^0.11.0: resolved "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz" integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg== +regenerator-runtime@^0.14.0: + version "0.14.1" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz#356ade10263f685dda125100cd862c1db895327f" + integrity sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw== + regex-cache@^0.4.2: version "0.4.4" resolved "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz" @@ -10502,11 +12055,30 @@ regex-not@^1.0.0, regex-not@^1.0.2: extend-shallow "^3.0.2" safe-regex "^1.1.0" +relay-runtime@12.0.0: + version "12.0.0" + resolved "https://registry.yarnpkg.com/relay-runtime/-/relay-runtime-12.0.0.tgz#1e039282bdb5e0c1b9a7dc7f6b9a09d4f4ff8237" + integrity sha512-QU6JKr1tMsry22DXNy9Whsq5rmvwr3LSZiiWV/9+DFpuTWvp+WFhobWMc8TC4OjKFfNhEZy7mOiqUAn5atQtug== + dependencies: + "@babel/runtime" "^7.0.0" + fbjs "^3.0.0" + invariant "^2.2.4" + +remedial@^1.0.7: + version "1.0.8" + resolved "https://registry.yarnpkg.com/remedial/-/remedial-1.0.8.tgz#a5e4fd52a0e4956adbaf62da63a5a46a78c578a0" + integrity sha512-/62tYiOe6DzS5BqVsNpH/nkGlX45C/Sp6V+NtiN6JQNS1Viay7cWkazmRkrQrdFj2eshDe96SIQNIoMxqhzBOg== + remove-trailing-separator@^1.0.1: version "1.1.0" resolved "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz" integrity sha512-/hS+Y0u3aOfIETiaiirUFwDBDzmXPvO+jAfKTitUngIPzdKc6Z0LoFjM/CK5PL4C+eKwHohlHAb6H0VFfmmUsw== +remove-trailing-spaces@^1.0.6: + version "1.0.8" + resolved "https://registry.yarnpkg.com/remove-trailing-spaces/-/remove-trailing-spaces-1.0.8.tgz#4354d22f3236374702f58ee373168f6d6887ada7" + integrity sha512-O3vsMYfWighyFbTd8hk8VaSj9UAGENxAtX+//ugIst2RMk5e03h6RoIS+0ylsFxY1gvmPuAY/PO4It+gPEeySA== + repeat-element@^1.1.2: version "1.1.4" resolved "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.4.tgz" @@ -10534,6 +12106,11 @@ require-from-string@^2.0.2: resolved "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz" integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== +require-main-filename@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" + integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== + resolve-cwd@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz" @@ -10541,16 +12118,16 @@ resolve-cwd@^3.0.0: dependencies: resolve-from "^5.0.0" +resolve-from@5.0.0, resolve-from@^5.0.0: + version "5.0.0" + resolved "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz" + integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== + resolve-from@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz" integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== -resolve-from@^5.0.0: - version "5.0.0" - resolved "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz" - integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== - resolve-url@^0.2.1: version "0.2.1" resolved "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz" @@ -10621,6 +12198,11 @@ rfdc@^1.1.4, rfdc@^1.2.0: resolved "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz" integrity sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA== +rfdc@^1.3.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/rfdc/-/rfdc-1.3.1.tgz#2b6d4df52dffe8bb346992a10ea9451f24373a8f" + integrity sha512-r5a3l5HzYlIC68TpmYKlxWjmOP6wiPJ1vWv2HeLhNsRZMrCkxeqxiHlQ21oXmQ4F3SiryXBHhAD7JZqvOJjFmg== + rimraf@^2.6.3: version "2.7.1" resolved "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz" @@ -10700,6 +12282,11 @@ scrypt-js@3.0.1: resolved "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz" integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA== +scuid@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/scuid/-/scuid-1.1.0.tgz#d3f9f920956e737a60f72d0e4ad280bf324d5dab" + integrity sha512-MuCAyrGZcTLfQoH2XoBlQ8C6bzwN88XT/0slOGz0pn8+gIP85BOAfYa44ZXQUTOwRwPU0QvgU+V+OSajl/59Xg== + secure-json-parse@^2.0.0: version "2.7.0" resolved "https://registry.npmjs.org/secure-json-parse/-/secure-json-parse-2.7.0.tgz" @@ -10746,6 +12333,15 @@ send@0.18.0: range-parser "~1.2.1" statuses "2.0.1" +sentence-case@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/sentence-case/-/sentence-case-3.0.4.tgz#3645a7b8c117c787fde8702056225bb62a45131f" + integrity sha512-8LS0JInaQMCRoQ7YUytAo/xUu5W2XnQxV2HI/6uM6U7CITS1RqPElr30V6uIqyMKM9lJGRVFy5/4CuzcixNYSg== + dependencies: + no-case "^3.0.4" + tslib "^2.0.3" + upper-case-first "^2.0.2" + sequelize-pool@^7.1.0: version "7.1.0" resolved "https://registry.npmjs.org/sequelize-pool/-/sequelize-pool-7.1.0.tgz" @@ -10793,6 +12389,18 @@ set-cookie-parser@^2.4.1: resolved "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz" integrity sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ== +set-function-length@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.2.1.tgz#47cc5945f2c771e2cf261c6737cf9684a2a5e425" + integrity sha512-j4t6ccc+VsKwYHso+kElc5neZpjtq9EnRICFZtWyBsLojhmeF/ZBd/elqm22WJh/BziDe/SBiOeAt0m2mfLD0g== + dependencies: + define-data-property "^1.1.2" + es-errors "^1.3.0" + function-bind "^1.1.2" + get-intrinsic "^1.2.3" + gopd "^1.0.1" + has-property-descriptors "^1.0.1" + set-value@^2.0.0, set-value@^2.0.1: version "2.0.1" resolved "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz" @@ -10803,6 +12411,11 @@ set-value@^2.0.0, set-value@^2.0.1: is-plain-object "^2.0.3" split-string "^3.0.1" +setimmediate@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" + integrity sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA== + setprototypeof@1.2.0: version "1.2.0" resolved "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz" @@ -10827,6 +12440,11 @@ shebang-regex@^3.0.0: resolved "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== +shell-quote@^1.7.3: + version "1.8.1" + resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.8.1.tgz#6dbf4db75515ad5bac63b4f1894c3a154c766680" + integrity sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA== + side-channel@^1.0.4: version "1.0.4" resolved "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz" @@ -10846,6 +12464,11 @@ signal-exit@^4.0.1: resolved "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz" integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== +signedsource@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/signedsource/-/signedsource-1.0.0.tgz#1ddace4981798f93bd833973803d80d52e93ad6a" + integrity sha512-6+eerH9fEnNmi/hyM1DXcRK3pWdoMQtlkQ+ns0ntzunjKqp5i3sKCc80ym8Fib3iaYhdJUOPdhlJWj1tvge2Ww== + simple-wcswidth@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/simple-wcswidth/-/simple-wcswidth-1.0.1.tgz" @@ -10866,6 +12489,15 @@ slash@^3.0.0: resolved "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz" integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== +slice-ansi@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-3.0.0.tgz#31ddc10930a1b7e0b67b08c96c2f49b77a789787" + integrity sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ== + dependencies: + ansi-styles "^4.0.0" + astral-regex "^2.0.0" + is-fullwidth-code-point "^3.0.0" + slice-ansi@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz" @@ -10880,6 +12512,14 @@ smart-buffer@^4.2.0: resolved "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz" integrity sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg== +snake-case@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/snake-case/-/snake-case-3.0.4.tgz#4f2bbd568e9935abdfd593f34c691dadb49c452c" + integrity sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg== + dependencies: + dot-case "^3.0.4" + tslib "^2.0.3" + snapdragon-node@^2.0.1: version "2.1.1" resolved "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz" @@ -11054,6 +12694,13 @@ split@^1.0.0, split@^1.0.1: dependencies: through "2" +sponge-case@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/sponge-case/-/sponge-case-1.0.1.tgz#260833b86453883d974f84854cdb63aecc5aef4c" + integrity sha512-dblb9Et4DAtiZ5YSUZHLl4XhH4uK80GhAZrVXdN4O2P4gQ40Wa5UIOPUHlA/nFd2PLblBZWUioLMMAVrgpoYcA== + dependencies: + tslib "^2.0.3" + sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz" @@ -11120,6 +12767,11 @@ string-argv@~0.3.1: resolved "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz" integrity sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q== +string-env-interpolation@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/string-env-interpolation/-/string-env-interpolation-1.0.1.tgz#ad4397ae4ac53fe6c91d1402ad6f6a52862c7152" + integrity sha512-78lwMoCcn0nNu8LszbP1UA7g55OeE4v7rCeWnM5B453rnNr4aq+5it3FEYtZrSEiMvHZOZ9Jlqb0OD0M2VInqg== + string-format@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/string-format/-/string-format-2.0.0.tgz" @@ -11309,6 +12961,13 @@ supports-preserve-symlinks-flag@^1.0.0: resolved "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== +swap-case@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/swap-case/-/swap-case-2.0.2.tgz#671aedb3c9c137e2985ef51c51f9e98445bf70d9" + integrity sha512-kc6S2YS/2yXbtkSMunBtKdah4VFETZ8Oh6ONSmSd9bRxhqTrtARUCBUiWXH3xVPpvR7tz2CSnkuXVE42EcGnMw== + dependencies: + tslib "^2.0.3" + symbol-observable@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/symbol-observable/-/symbol-observable-4.0.0.tgz" @@ -11437,7 +13096,7 @@ through2@^4.0.0: dependencies: readable-stream "3" -through@2, "through@>=2.2.7 <3", through@^2.3.4, through@^2.3.6: +through@2, "through@>=2.2.7 <3", through@^2.3.4, through@^2.3.6, through@^2.3.8: version "2.3.8" resolved "https://registry.npmjs.org/through/-/through-2.3.8.tgz" integrity sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg== @@ -11457,6 +13116,13 @@ tiny-warning@^1.0.3: resolved "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz" integrity sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA== +title-case@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/title-case/-/title-case-3.0.3.tgz#bc689b46f02e411f1d1e1d081f7c3deca0489982" + integrity sha512-e1zGYRvbffpcHIrnuqT0Dh+gEJtDaxDSoG4JAIpq4oDFyooziLBIiYQv0GBT4FUAnUop5uZ1hiIAj7oAF6sOCA== + dependencies: + tslib "^2.0.3" + tmp@^0.0.33: version "0.0.33" resolved "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz" @@ -11616,6 +13282,19 @@ ts-jest@29.1.1: semver "^7.5.3" yargs-parser "^21.0.1" +ts-log@^2.2.3: + version "2.2.5" + resolved "https://registry.yarnpkg.com/ts-log/-/ts-log-2.2.5.tgz#aef3252f1143d11047e2cb6f7cfaac7408d96623" + integrity sha512-PGcnJoTBnVGy6yYNFxWVNkdcAuAMstvutN9MgDJIV6L0oG8fB+ZNNy1T+wJzah8RPGor1mZuPQkVfXNDpy9eHA== + +ts-morph@^19.0.0: + version "19.0.0" + resolved "https://registry.yarnpkg.com/ts-morph/-/ts-morph-19.0.0.tgz#43e95fb0156c3fe3c77c814ac26b7d0be2f93169" + integrity sha512-D6qcpiJdn46tUqV45vr5UGM2dnIEuTGNxVhg0sk5NX11orcouwj6i1bMqZIz2mZTZB1Hcgy7C3oEVhAT+f6mbQ== + dependencies: + "@ts-morph/common" "~0.20.0" + code-block-writer "^12.0.0" + ts-node@10.7.0: version "10.7.0" resolved "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz" @@ -11649,7 +13328,7 @@ tslib@^1.10.0, tslib@^1.9.3: resolved "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== -tslib@^2.1.0, tslib@^2.3.0, tslib@^2.3.1, tslib@^2.4.0, tslib@^2.5.0: +tslib@^2.0.0, tslib@^2.0.3, tslib@^2.1.0, tslib@^2.3.0, tslib@^2.3.1, tslib@^2.4.0, tslib@^2.5.0, tslib@^2.5.2, tslib@^2.6.1, tslib@^2.6.2, tslib@~2.6.0: version "2.6.2" resolved "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz" integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== @@ -11762,6 +13441,11 @@ typical@^5.2.0: resolved "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz" integrity sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg== +ua-parser-js@^1.0.35: + version "1.0.37" + resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-1.0.37.tgz#b5dc7b163a5c1f0c510b08446aed4da92c46373f" + integrity sha512-bhTyI94tZofjo+Dn8SN6Zv8nBDvyXTymAdM3LDI/0IboIUwTu1rEhW7v2TfiVsoYWgkQ4kOVqnI8APUFbIQIFQ== + uglify-js@^3.1.4: version "3.17.4" resolved "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz" @@ -11780,6 +13464,11 @@ umzug@3.0.0: type-fest "^2.0.0" verror "^1.10.0" +unc-path-regex@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/unc-path-regex/-/unc-path-regex-0.1.2.tgz#e73dd3d7b0d7c5ed86fbac6b0ae7d8c6a69d50fa" + integrity sha512-eXL4nmJT7oCpkZsHZUOJo8hcX3GbsiDOa0Qu9F646fi8dT3XuSVopVqAcEiVzSKKH7UoDti23wNX3qGFxcW5Qg== + underscore@^1.13.1: version "1.13.6" resolved "https://registry.npmjs.org/underscore/-/underscore-1.13.6.tgz" @@ -11838,6 +13527,13 @@ universalify@^2.0.0: resolved "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz" integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ== +unixify@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/unixify/-/unixify-1.0.0.tgz#3a641c8c2ffbce4da683a5c70f03a462940c2090" + integrity sha512-6bc58dPYhCMHHuwxldQxO3RRNZ4eCogZ/st++0+fcC1nr0jiGUtAdBJ2qzmLQWSxbtz42pWt4QQMiZ9HvZf5cg== + dependencies: + normalize-path "^2.1.1" + unpipe@1.0.0, unpipe@~1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz" @@ -11864,6 +13560,28 @@ update-browserslist-db@^1.0.11: escalade "^3.1.1" picocolors "^1.0.0" +update-browserslist-db@^1.0.13: + version "1.0.13" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz#3c5e4f5c083661bd38ef64b6328c26ed6c8248c4" + integrity sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg== + dependencies: + escalade "^3.1.1" + picocolors "^1.0.0" + +upper-case-first@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/upper-case-first/-/upper-case-first-2.0.2.tgz#992c3273f882abd19d1e02894cc147117f844324" + integrity sha512-514ppYHBaKwfJRK/pNC6c/OxfGa0obSnAl106u97Ed0I625Nin96KAjttZF6ZL3e1XLtphxnqrOi9iWgm+u+bg== + dependencies: + tslib "^2.0.3" + +upper-case@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/upper-case/-/upper-case-2.0.2.tgz#d89810823faab1df1549b7d97a76f8662bae6f7a" + integrity sha512-KgdgDGJt2TpuwBUIjgG6lzw2GWFRCW9Qkfkiv0DxqHHLYJHmtmdUIKcZd8rHgFSjopVTlw6ggzCm1b8MFQwikg== + dependencies: + tslib "^2.0.3" + uri-js@^4.2.2: version "4.4.1" resolved "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz" @@ -11876,6 +13594,16 @@ urix@^0.1.0: resolved "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz" integrity sha512-Am1ousAhSLBeB9cG/7k7r2R0zj50uDRlZHPGbazid5s9rlF1F/QKYObEKSIunSjIOkJZqwRRLpvewjEkM7pSqg== +urlpattern-polyfill@^10.0.0: + version "10.0.0" + resolved "https://registry.yarnpkg.com/urlpattern-polyfill/-/urlpattern-polyfill-10.0.0.tgz#f0a03a97bfb03cdf33553e5e79a2aadd22cac8ec" + integrity sha512-H/A06tKD7sS1O1X2SshBVeA5FLycRpjqiBeqGKmBwBDBy28EnRjORxTNe269KSSr5un5qyWi1iL61wLxpd+ZOg== + +urlpattern-polyfill@^8.0.0: + version "8.0.2" + resolved "https://registry.yarnpkg.com/urlpattern-polyfill/-/urlpattern-polyfill-8.0.2.tgz#99f096e35eff8bf4b5a2aa7d58a1523d6ebc7ce5" + integrity sha512-Qp95D4TPJl1kC9SKigDcqgyM2VDVO4RiJc2d4qe5GrYm+zbIQCWWKAFaJNQ4BhdFeDGwBmAxqJBwWSJDb9T3BQ== + urlpattern-polyfill@^9.0.0: version "9.0.0" resolved "https://registry.npmjs.org/urlpattern-polyfill/-/urlpattern-polyfill-9.0.0.tgz" @@ -12007,6 +13735,11 @@ wcwidth@^1.0.0, wcwidth@^1.0.1: dependencies: defaults "^1.0.3" +web-streams-polyfill@^3.2.1: + version "3.3.3" + resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz#2073b91a2fdb1fbfbd401e7de0ac9f8214cecb4b" + integrity sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw== + web3-utils@^1.3.4: version "1.10.2" resolved "https://registry.npmjs.org/web3-utils/-/web3-utils-1.10.2.tgz" @@ -12021,6 +13754,17 @@ web3-utils@^1.3.4: randombytes "^2.1.0" utf8 "3.0.0" +webcrypto-core@^1.7.8: + version "1.7.8" + resolved "https://registry.yarnpkg.com/webcrypto-core/-/webcrypto-core-1.7.8.tgz#056918036e846c72cfebbb04052e283f57f1114a" + integrity sha512-eBR98r9nQXTqXt/yDRtInszPMjTaSAMJAFDg2AHsgrnczawT1asx9YNBX6k5p+MekbPF4+s/UJJrr88zsTqkSg== + dependencies: + "@peculiar/asn1-schema" "^2.3.8" + "@peculiar/json-schema" "^1.1.12" + asn1js "^3.0.1" + pvtsutils "^1.3.5" + tslib "^2.6.2" + webidl-conversions@^3.0.0: version "3.0.1" resolved "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz" @@ -12039,6 +13783,11 @@ whatwg-url@^5.0.0: tr46 "~0.0.3" webidl-conversions "^3.0.0" +which-module@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.1.tgz#776b1fe35d90aebe99e8ac15eb24093389a4a409" + integrity sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ== + which@^2.0.0, which@^2.0.1, which@^2.0.2: version "2.0.2" resolved "https://registry.npmjs.org/which/-/which-2.0.2.tgz" @@ -12087,7 +13836,7 @@ wordwrapjs@^4.0.0: string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^6.0.1: +wrap-ansi@^6.0.1, wrap-ansi@^6.2.0: version "6.2.0" resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz" integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA== @@ -12195,6 +13944,11 @@ xtend@^4.0.0, xtend@~4.0.1: resolved "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz" integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== +y18n@^4.0.0: + version "4.0.3" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.3.tgz#b5f259c82cd6e336921efd7bfd8bf560de9eeedf" + integrity sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ== + y18n@^5.0.5: version "5.0.8" resolved "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz" @@ -12210,6 +13964,11 @@ yallist@^4.0.0: resolved "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== +yaml-ast-parser@^0.0.43: + version "0.0.43" + resolved "https://registry.yarnpkg.com/yaml-ast-parser/-/yaml-ast-parser-0.0.43.tgz#e8a23e6fb4c38076ab92995c5dca33f3d3d7c9bb" + integrity sha512-2PTINUwsRqSd+s8XxKaJWQlUuEMHJQyEuh2edBbW8KNJz0SJPwUSD2zRWqezFEdN7IzAgeuYHFUCF7o8zRdZ0A== + yaml@1.10.2, yaml@^1.10.0, yaml@^1.7.2: version "1.10.2" resolved "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz" @@ -12220,6 +13979,11 @@ yaml@^2.0.0-10: resolved "https://registry.npmjs.org/yaml/-/yaml-2.3.2.tgz" integrity sha512-N/lyzTPaJasoDmfV7YTrYCI0G/3ivm/9wdG0aHuheKowWQwGTsK0Eoiw6utmzAnI6pkJa0DUVygvp3spqqEKXg== +yaml@^2.3.1: + version "2.3.4" + resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.3.4.tgz#53fc1d514be80aabf386dc6001eb29bf3b7523b2" + integrity sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA== + yargs-parser@20.2.4: version "20.2.4" resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz" @@ -12238,6 +14002,14 @@ yargs-parser@^16.1.0: camelcase "^5.0.0" decamelize "^1.2.0" +yargs-parser@^18.1.2: + version "18.1.3" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0" + integrity sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ== + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" + yargs-parser@^20.2.2, yargs-parser@^20.2.3: version "20.2.9" resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz" @@ -12256,6 +14028,23 @@ yargs@17.4.1: y18n "^5.0.5" yargs-parser "^21.0.0" +yargs@^15.3.1: + version "15.4.1" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8" + integrity sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A== + dependencies: + cliui "^6.0.0" + decamelize "^1.2.0" + find-up "^4.1.0" + get-caller-file "^2.0.1" + require-directory "^2.1.1" + require-main-filename "^2.0.0" + set-blocking "^2.0.0" + string-width "^4.2.0" + which-module "^2.0.0" + y18n "^4.0.0" + yargs-parser "^18.1.2" + yargs@^16.2.0: version "16.2.0" resolved "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz" @@ -12269,7 +14058,7 @@ yargs@^16.2.0: y18n "^5.0.5" yargs-parser "^20.2.2" -yargs@^17.3.1, yargs@^17.6.2, yargs@^17.7.2: +yargs@^17.0.0, yargs@^17.3.1, yargs@^17.6.2, yargs@^17.7.2: version "17.7.2" resolved "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz" integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== From 35a172fb2fe604f19b5a55a2c12af62cae06128c Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Wed, 21 Feb 2024 11:54:11 -0500 Subject: [PATCH 02/48] port over code model resolvers --- .../src/indexer-management/index.ts | 1 + .../indexer-management/models/cost-model.ts | 11 ++- .../resolvers/Mutation/deleteCostModels.ts | 12 ++- .../resolvers/Mutation/setCostModel.ts | 83 ++++++++++++++++++- .../resolvers/Query/costModel.ts | 23 ++++- .../resolvers/Query/costModels.ts | 28 ++++++- 6 files changed, 143 insertions(+), 15 deletions(-) diff --git a/packages/indexer-common/src/indexer-management/index.ts b/packages/indexer-common/src/indexer-management/index.ts index 6990e72b3..1aeddfe92 100644 --- a/packages/indexer-common/src/indexer-management/index.ts +++ b/packages/indexer-common/src/indexer-management/index.ts @@ -6,3 +6,4 @@ export * from './monitor' export * from './server' export * from './rules' export * from './types' +export * from './context' diff --git a/packages/indexer-common/src/indexer-management/models/cost-model.ts b/packages/indexer-common/src/indexer-management/models/cost-model.ts index 65cb27bb4..dffd0fc2e 100644 --- a/packages/indexer-common/src/indexer-management/models/cost-model.ts +++ b/packages/indexer-common/src/indexer-management/models/cost-model.ts @@ -2,15 +2,18 @@ import { Optional, Model, DataTypes, Sequelize } from 'sequelize' import { utils } from 'ethers' - -export interface GraphQLCostModel { +import { + CostModel as GraphQLCostModelType, + CostModelInput as GraphQLCostModelInput, +} from '../../schema/types.generated' +interface GraphQLCostModel { deployment: string model: string | null | undefined variables: string | null | undefined } export const parseGraphQLCostModel = ( - costModel: GraphQLCostModel, + costModel: GraphQLCostModelInput, ): CostModelCreationAttributes => { try { const variables = !costModel.variables @@ -55,7 +58,7 @@ export class CostModel public updatedAt!: Date // eslint-disable-next-line @typescript-eslint/ban-types - public toGraphQL(): object { + public toGraphQL(): GraphQLCostModelType { return { ...this.toJSON(), variables: diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteCostModels.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteCostModels.ts index 0ca368f69..f948637e9 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteCostModels.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteCostModels.ts @@ -1,6 +1,14 @@ import type { MutationResolvers } from './../../../types.generated' + export const deleteCostModels: NonNullable< MutationResolvers['deleteCostModels'] -> = async (_parent, _arg, _ctx) => { - /* Implement Mutation.deleteCostModels resolver logic here */ +> = async (_parent, { deployments }, { models }) => { + return await models.CostModel.sequelize!.transaction(async (transaction) => { + return await models.CostModel.destroy({ + where: { + deployment: deployments, + }, + transaction, + }) + }) } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setCostModel.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setCostModel.ts index 32a56e436..2c9043248 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setCostModel.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setCostModel.ts @@ -1,8 +1,85 @@ +import { + CostModelVariables, + parseGraphQLCostModel, +} from 'indexer-common/src/indexer-management/models/cost-model' import type { MutationResolvers } from './../../../types.generated' +import { compileAsync } from '@graphprotocol/cost-model' + +const setVariable = ( + vars: CostModelVariables | null, + name: string, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + value: any, +): CostModelVariables => { + if (vars === null) { + return { [name]: value } + } else { + try { + vars[name] = value + return vars + } catch (e) { + return vars + } + } +} + export const setCostModel: NonNullable = async ( _parent, - _arg, - _ctx, + { costModel }, + { multiNetworks, models, dai }, ) => { - /* Implement Mutation.setCostModel resolver logic here */ + if (!multiNetworks) { + throw Error('IndexerManagementClient must be in `network` mode to set cost models') + } + + const update = parseGraphQLCostModel(costModel) + + // Validate cost model + try { + const modelForValidation = update.model || 'default => 1;' + const variablesForValidation = JSON.stringify(update.variables || {}) + await compileAsync(modelForValidation, variablesForValidation) + } catch (err) { + throw new Error(`Invalid cost model or variables: ${err.message}`) + } + const network = multiNetworks.inner['eip155:1'] + if (!network) { + throw new Error( + `Can't set cost model: Indexer Agent does not have Ethereum Mainnet network configured.`, + ) + } + + const injectDai = !!network.specification.dai.inject + const [model] = await models.CostModel.findOrBuild({ + where: { deployment: update.deployment }, + }) + // logger.info('Fetched current model', { current: model, update }) + // model.set('deployment', update.deployment || model.deployment) + // // model.set('model', update.model || model.model) + // model.model = update.model || model.model + // logger.info('Merged models', { now: model }) + model.deployment = update.deployment || model.deployment + model.model = update.model || model.model + + // Update the model variables (fall back to current value if unchanged) + let variables = update.variables || model.variables + + if (injectDai) { + const oldDai = model.variables?.DAI + const newDai = update.variables?.DAI + + // Inject the latest DAI value if available + if (dai.valueReady) { + variables = setVariable(variables, 'DAI', await dai.value()) + } else if (newDai === undefined && oldDai !== undefined) { + // Otherwise preserve the old DAI value if there is one; + // this ensures it's never dropped + variables = setVariable(variables, 'DAI', oldDai) + } + } + + // Apply new variables + model.variables = variables + + return (await model.save()).toGraphQL() } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/costModel.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/costModel.ts index a8d5441c6..4790276c9 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/costModel.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/costModel.ts @@ -1,8 +1,25 @@ +import { COST_MODEL_GLOBAL } from 'indexer-common/src/indexer-management/models' import type { QueryResolvers } from './../../../types.generated' + export const costModel: NonNullable = async ( _parent, - _arg, - _ctx, + { deployment }, + { models }, ) => { - /* Implement Query.costModel resolver logic here */ + const model = await models.CostModel.findOne({ + where: { deployment }, + }) + + if (model) return model.toGraphQL() + + const globalModel = await models.CostModel.findOne({ + where: { deployment: COST_MODEL_GLOBAL }, + }) + + if (globalModel) { + globalModel.setDataValue('deployment', deployment) + return globalModel.toGraphQL() + } + + return null } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/costModels.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/costModels.ts index f4c2f4891..863cf796e 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/costModels.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/costModels.ts @@ -1,8 +1,30 @@ +import { COST_MODEL_GLOBAL } from 'indexer-common/src/indexer-management/models' import type { QueryResolvers } from './../../../types.generated' + export const costModels: NonNullable = async ( _parent, - _arg, - _ctx, + { deployments }, + { models }, ) => { - /* Implement Query.costModels resolver logic here */ + const costModels = await models.CostModel.findAll({ + where: deployments ? { deployment: deployments } : undefined, + order: [['deployment', 'ASC']], + }) + + const definedDeployments = new Set(costModels.map((model) => model.deployment)) + const undefinedDeployments = deployments?.filter((d) => !definedDeployments.has(d)) + + const globalModel = await models.CostModel.findOne({ + where: { deployment: COST_MODEL_GLOBAL }, + }) + + if (globalModel && undefinedDeployments) { + const mergedCostModels = undefinedDeployments.map((d) => { + globalModel.setDataValue('deployment', d) + return globalModel.toGraphQL() + }) + return costModels.map((model) => model.toGraphQL()).concat(mergedCostModels) + } + + return costModels.map((model) => model.toGraphQL()) } From e1d205fc161b775924c8418f28d1f9efc0123807 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Wed, 21 Feb 2024 16:40:14 -0500 Subject: [PATCH 03/48] port over more queries --- packages/indexer-common/codegen.ts | 1 + packages/indexer-common/src/actions.ts | 45 ++---------- .../src/indexer-management/actions.ts | 6 +- .../indexer-management/models/poi-dispute.ts | 4 +- .../resolvers/allocations.ts | 23 +------ .../resolvers/Query/action.ts | 11 ++- .../resolvers/Query/actions.ts | 24 ++++++- .../resolvers/Query/allocations.ts | 68 ++++++++++++++++++- .../resolvers/Query/dispute.ts | 11 ++- .../resolvers/Query/disputes.ts | 28 +++++++- packages/indexer-common/src/types.ts | 6 +- 11 files changed, 140 insertions(+), 87 deletions(-) diff --git a/packages/indexer-common/codegen.ts b/packages/indexer-common/codegen.ts index dec76e0ce..18152d49e 100644 --- a/packages/indexer-common/codegen.ts +++ b/packages/indexer-common/codegen.ts @@ -7,6 +7,7 @@ const config: CodegenConfig = { 'src/schema': defineConfig({ typesPluginsConfig: { contextType: '@graphprotocol/indexer-common#IndexerManagementResolverContext', + enumsAsTypes: true, }, }), }, diff --git a/packages/indexer-common/src/actions.ts b/packages/indexer-common/src/actions.ts index 9aec66814..01e72e3ad 100644 --- a/packages/indexer-common/src/actions.ts +++ b/packages/indexer-common/src/actions.ts @@ -1,10 +1,13 @@ import { NetworkMonitor } from './indexer-management' import { AllocationStatus } from './allocations' import { Logger } from '@graphprotocol/common-ts' -import { WhereOperators, WhereOptions } from 'sequelize' +import { WhereOptions } from 'sequelize' import { Op } from 'sequelize' import { WhereAttributeHashValue } from 'sequelize/types/model' import { validateNetworkIdentifier } from './parsers' +import { ActionFilter, ActionUpdateInput, ActionParams } from './schema/types.generated' + +export { ActionUpdateInput, ActionParams } export interface ActionParamsInput { deploymentID?: string @@ -22,18 +25,6 @@ export interface ActionItem { protocolNetwork: string } -export interface ActionUpdateInput { - deploymentID?: string - allocationID?: string - amount?: string - poi?: string - force?: boolean - type?: ActionType - status?: ActionStatus - reason?: string - protocolNetwork?: string -} - export interface ActionInput { type: ActionType deploymentID: string @@ -153,16 +144,6 @@ export const validateActionInputs = async ( } } -export interface ActionFilter { - id?: number | undefined - type?: ActionType - status?: ActionStatus - source?: string - reason?: string - updatedAt?: WhereOperators - protocolNetwork?: string -} - export const actionFilterToWhereOptions = (filter: ActionFilter): WhereOptions => { const whereOptions = [] as WhereAttributeHashValue[] @@ -208,21 +189,3 @@ export enum ActionStatus { FAILED = 'failed', CANCELED = 'canceled', } - -export enum ActionParams { - ID = 'id', - STATUS = 'status', - TYPE = 'type', - DEPLOYMENT_ID = 'deploymentID', - ALLOCATION_ID = 'allocationID', - TRANSACTION = 'transaction', - AMOUNT = 'amount', - POI = 'poi', - FORCE = 'force', - SOURCE = 'source', - REASON = 'reason', - PRIORITY = 'priority', - CREATED_AT = 'createdAt', - UPDATED_AT = 'updatedAt', - PROTOCOL_NETWORK = 'protocolNetwork', -} diff --git a/packages/indexer-common/src/indexer-management/actions.ts b/packages/indexer-common/src/indexer-management/actions.ts index 7efbbafcb..aeb046480 100644 --- a/packages/indexer-common/src/indexer-management/actions.ts +++ b/packages/indexer-common/src/indexer-management/actions.ts @@ -1,6 +1,5 @@ import { Action, - ActionFilter, actionFilterToWhereOptions, ActionParams, ActionStatus, @@ -23,6 +22,7 @@ import { import { Order, Transaction } from 'sequelize' import { Eventual, join, Logger, timer } from '@graphprotocol/common-ts' import groupBy from 'lodash.groupby' +import { ActionFilter, Maybe } from '../schema/types.generated' export class ActionManager { declare multiNetworks: MultiNetworks @@ -293,7 +293,7 @@ export class ActionManager { public static async fetchActions( models: IndexerManagementModels, filter: ActionFilter, - orderBy?: ActionParams, + orderBy: Maybe, orderDirection?: OrderDirection, first?: number, ): Promise { @@ -318,7 +318,7 @@ export class ActionManager { 'Cannot bulk update actions without a filter, please provide a least 1 filter value', ) } - return await models.Action.update( + return models.Action.update( { ...action }, { where: actionFilterToWhereOptions(filter), diff --git a/packages/indexer-common/src/indexer-management/models/poi-dispute.ts b/packages/indexer-common/src/indexer-management/models/poi-dispute.ts index 3be43835b..d11322d63 100644 --- a/packages/indexer-common/src/indexer-management/models/poi-dispute.ts +++ b/packages/indexer-common/src/indexer-management/models/poi-dispute.ts @@ -3,7 +3,7 @@ import { Optional, Model, DataTypes, Sequelize } from 'sequelize' import { utils } from 'ethers' import { caip2IdRegex } from '../../parsers' - +import { POIDispute as GraphQLPOIDispute } from '../../schema/types.generated' export interface POIDisputeAttributes { allocationID: string subgraphDeploymentID: string @@ -70,7 +70,7 @@ export class POIDispute public updatedAt!: Date // eslint-disable-next-line @typescript-eslint/ban-types - public toGraphQL(): object { + public toGraphQL(): GraphQLPOIDispute { return { ...this.toJSON(), __typename: 'POIDispute' } } } diff --git a/packages/indexer-common/src/indexer-management/resolvers/allocations.ts b/packages/indexer-common/src/indexer-management/resolvers/allocations.ts index 3bd945a46..a93638a68 100644 --- a/packages/indexer-common/src/indexer-management/resolvers/allocations.ts +++ b/packages/indexer-common/src/indexer-management/resolvers/allocations.ts @@ -5,7 +5,7 @@ import { } from '@graphprotocol/indexer-common' /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ /* eslint-disable @typescript-eslint/ban-types */ - +import { Allocation as AllocationInfo } from '../../schema/types.generated' import pMap from 'p-map' import gql from 'graphql-tag' import { BigNumber, utils } from 'ethers' @@ -51,25 +51,6 @@ enum AllocationQuery { allocation = 'allocation', } -interface AllocationInfo { - id: Address - indexer: Address - subgraphDeployment: string - signalledTokens: string - stakedTokens: string - allocatedTokens: string - createdAtEpoch: number - closedAtEpoch: number | null - ageInEpochs: number - closeDeadlineEpoch: number - closeDeadlineBlocksRemaining: number - closeDeadlineTimeRemaining: number - indexingRewards: string - queryFeesCollected: string - status: string - protocolNetwork: string -} - const ALLOCATION_QUERIES = { [AllocationQuery.all]: gql` query allocations($indexer: String!) { @@ -157,7 +138,7 @@ const ALLOCATION_QUERIES = { `, } -async function queryAllocations( +export async function queryAllocations( logger: Logger, networkSubgraph: NetworkSubgraph, variables: { diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/action.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/action.ts index 38fed08f6..da7d85f49 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/action.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/action.ts @@ -1,8 +1,13 @@ import type { QueryResolvers } from './../../../types.generated' export const action: NonNullable = async ( _parent, - _arg, - _ctx, + { actionID }, + { logger, models }, ) => { - /* Implement Query.action resolver logic here */ + logger.debug(`Execute 'action' query`, { + actionID, + }) + return models.Action.findOne({ + where: { id: actionID }, + }) } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/actions.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/actions.ts index 6e580e46c..fee230793 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/actions.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/actions.ts @@ -1,8 +1,26 @@ import type { QueryResolvers } from './../../../types.generated' +import { actionFilterToWhereOptions } from 'indexer-common/src/actions' +import { Order } from 'sequelize' + export const actions: NonNullable = async ( _parent, - _arg, - _ctx, + { filter, orderBy, orderDirection, first }, + { logger, models }, ) => { - /* Implement Query.actions resolver logic here */ + logger.debug(`Execute 'actions' query`, { + filter, + orderBy, + orderDirection, + first, + }) + + const orderObject: Order = orderBy + ? [[orderBy.toString(), orderDirection ?? 'desc']] + : [['id', 'desc']] + + return models.Action.findAll({ + where: actionFilterToWhereOptions(filter || {}), + order: orderObject, + limit: first || undefined, + }) } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/allocations.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/allocations.ts index 8982edb93..11526cafd 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/allocations.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/allocations.ts @@ -1,8 +1,70 @@ +import { queryAllocations } from 'indexer-common/src/indexer-management/resolvers/allocations' import type { QueryResolvers } from './../../../types.generated' +import { toAddress } from '@graphprotocol/common-ts' +import { epochElapsedBlocks } from 'indexer-common/src/indexer-management' + export const allocations: NonNullable = async ( _parent, - _arg, - _ctx, + { filter }, + { logger, multiNetworks }, ) => { - /* Implement Query.allocations resolver logic here */ + logger.debug('Execute allocations() query', { + filter, + }) + if (!multiNetworks) { + throw Error('IndexerManagementClient must be in `network` mode to fetch allocations') + } + + const allocationsByNetwork = await multiNetworks.map(async (network) => { + // Return early if a different protocol network is specifically requested + if ( + filter.protocolNetwork && + filter.protocolNetwork !== network.specification.networkIdentifier + ) { + return [] + } + + const { + networkMonitor, + networkSubgraph, + contracts, + specification: { + indexerOptions: { address }, + }, + } = network + + const [currentEpoch, maxAllocationEpochs, epochLength] = await Promise.all([ + networkMonitor.networkCurrentEpoch(), + contracts.staking.maxAllocationEpochs(), + contracts.epochManager.epochLength(), + ]) + + const allocation = filter.allocation + ? filter.allocation === 'all' + ? null + : toAddress(filter.allocation) + : null + + const variables = { + indexer: toAddress(address), + allocation, + // TODO: we need to update schema to switch away from using `status` as a string + status: filter.status as 'active' | 'closed', + } + + const context = { + currentEpoch: currentEpoch.epochNumber, + currentEpochStartBlock: currentEpoch.startBlockNumber, + currentEpochElapsedBlocks: epochElapsedBlocks(currentEpoch), + latestBlock: currentEpoch.latestBlock, + maxAllocationEpochs, + blocksPerEpoch: epochLength.toNumber(), + avgBlockTime: 13000, + protocolNetwork: network.specification.networkIdentifier, + } + + return queryAllocations(logger, networkSubgraph, variables, context) + }) + + return Object.values(allocationsByNetwork).flat() } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/dispute.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/dispute.ts index cf96327d3..3564ac82c 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/dispute.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/dispute.ts @@ -1,8 +1,13 @@ import type { QueryResolvers } from './../../../types.generated' + export const dispute: NonNullable = async ( _parent, - _arg, - _ctx, + { identifier }, + { models }, ) => { - /* Implement Query.dispute resolver logic here */ + const dispute = await models.POIDispute.findOne({ + where: { ...identifier }, + }) + + return dispute?.toGraphQL() || null } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/disputes.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/disputes.ts index 5921cf202..7a7252527 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/disputes.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/disputes.ts @@ -1,8 +1,30 @@ +import { Op, WhereOptions } from 'sequelize' import type { QueryResolvers } from './../../../types.generated' +import { validateNetworkIdentifier } from 'indexer-common/src/parsers/validators' + export const disputes: NonNullable = async ( _parent, - _arg, - _ctx, + { protocolNetwork: uncheckedProtocolNetwork, status, minClosedEpoch }, + { models }, ) => { - /* Implement Query.disputes resolver logic here */ + // Sanitize protocol network identifier + const protocolNetwork = uncheckedProtocolNetwork + ? validateNetworkIdentifier(uncheckedProtocolNetwork) + : undefined + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const sqlAndExpression: WhereOptions = [ + { status }, + { closedEpoch: { [Op.gte]: minClosedEpoch } }, + ] + + if (protocolNetwork) { + sqlAndExpression.push({ protocolNetwork }) + } + + const disputes = await models.POIDispute.findAll({ + where: { [Op.and]: sqlAndExpression }, + order: [['allocationAmount', 'DESC']], + }) + return disputes.map((dispute) => dispute.toGraphQL()) } diff --git a/packages/indexer-common/src/types.ts b/packages/indexer-common/src/types.ts index cfd62747a..19f53ada6 100644 --- a/packages/indexer-common/src/types.ts +++ b/packages/indexer-common/src/types.ts @@ -1,5 +1,6 @@ import { SubgraphDeploymentID } from '@graphprotocol/common-ts' import { BigNumber, providers } from 'ethers' +export { OrderDirection } from './schema/types.generated' export enum AllocationManagementMode { AUTO = 'auto', @@ -12,11 +13,6 @@ export enum DeploymentManagementMode { MANUAL = 'manual', } -export enum OrderDirection { - ASC = 'asc', - DESC = 'desc', -} - export interface BlockPointer { number: number hash: string From 3cede5cc9e434dc59dc67f839df57039b1418823 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Fri, 23 Feb 2024 10:25:51 -0500 Subject: [PATCH 04/48] more resolvers --- .../models/indexing-rule.ts | 6 +- .../resolvers/Query/indexerAllocations.ts | 59 +++++- .../resolvers/Query/indexerDeployments.ts | 9 +- .../resolvers/Query/indexerEndpoints.ts | 195 +++++++++++++++++- .../resolvers/Query/indexerRegistration.ts | 46 ++++- .../resolvers/Query/indexingRule.ts | 31 ++- .../resolvers/Query/indexingRules.ts | 13 +- 7 files changed, 342 insertions(+), 17 deletions(-) diff --git a/packages/indexer-common/src/indexer-management/models/indexing-rule.ts b/packages/indexer-common/src/indexer-management/models/indexing-rule.ts index 76ee2b265..7646f7f3b 100644 --- a/packages/indexer-common/src/indexer-management/models/indexing-rule.ts +++ b/packages/indexer-common/src/indexer-management/models/indexing-rule.ts @@ -3,6 +3,7 @@ import { DataTypes, Model, Optional, Sequelize } from 'sequelize' import { processIdentifier, SubgraphIdentifierType } from '../../subgraphs' import { caip2IdRegex } from '../../parsers' +import { IndexingRule as GraphQLIndexingRuleType } from '../../schema/types.generated' export enum IndexingDecisionBasis { RULES = 'rules', @@ -88,7 +89,7 @@ export class IndexingRule public updatedAt!: Date // eslint-disable-next-line @typescript-eslint/ban-types - public toGraphQL(): object { + public toGraphQL(): GraphQLIndexingRuleType { return { ...this.toJSON(), __typename: 'IndexingRule' } } @@ -116,7 +117,7 @@ export class IndexingRule } // eslint-disable-next-line @typescript-eslint/ban-types - public mergeToGraphQL(global: IndexingRule | null): object { + public mergeToGraphQL(global: IndexingRule | null): GraphQLIndexingRuleType { if (global instanceof IndexingRule) { // eslint-disable-next-line @typescript-eslint/no-explicit-any const globalRule: { [key: string]: any } | null = global.toJSON() @@ -133,6 +134,7 @@ export class IndexingRule rule[k] = globalRule[k] } } + // @ts-expect-error TODO: very hacky, we need a better way to ensure this type is correct. return { ...rule, __typename: 'IndexingRule' } } else { return this.toGraphQL() diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerAllocations.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerAllocations.ts index c54ec8c68..0b8b3a16e 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerAllocations.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerAllocations.ts @@ -1,6 +1,61 @@ +import { extractNetwork } from 'indexer-common/src/indexer-management/resolvers/utils' import type { QueryResolvers } from './../../../types.generated' +import gql from 'graphql-tag' +import { SubgraphDeploymentID } from '@graphprotocol/common-ts' +import { IndexerErrorCode, indexerError } from 'indexer-common/src/errors' + export const indexerAllocations: NonNullable< QueryResolvers['indexerAllocations'] -> = async (_parent, _arg, _ctx) => { - /* Implement Query.indexerAllocations resolver logic here */ +> = async (_parent, { protocolNetwork }, { multiNetworks, logger }) => { + if (!multiNetworks) { + throw Error( + 'IndexerManagementClient must be in `network` mode to fetch indexer allocations', + ) + } + + const network = extractNetwork(protocolNetwork, multiNetworks) + const address = network.specification.indexerOptions.address + + try { + const result = await network.networkSubgraph.checkedQuery( + gql` + query allocations($indexer: String!) { + allocations( + where: { indexer: $indexer, status: Active } + first: 1000 + orderDirection: desc + ) { + id + allocatedTokens + createdAtEpoch + closedAtEpoch + subgraphDeployment { + id + stakedTokens + signalledTokens + } + } + } + `, + { indexer: address.toLocaleLowerCase() }, + ) + if (result.error) { + throw result.error + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return result.data.allocations.map((allocation: any) => ({ + ...allocation, + subgraphDeployment: new SubgraphDeploymentID(allocation.subgraphDeployment.id) + .ipfsHash, + signalledTokens: allocation.subgraphDeployment.signalledTokens, + stakedTokens: allocation.subgraphDeployment.stakedTokens, + protocolNetwork: network.specification.networkIdentifier, + })) + } catch (error) { + const err = indexerError(IndexerErrorCode.IE010, error) + logger?.error(`Failed to query indexer allocations`, { + err, + }) + throw err + } } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerDeployments.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerDeployments.ts index ec9132198..9fe7d652c 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerDeployments.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerDeployments.ts @@ -1,6 +1,11 @@ import type { QueryResolvers } from './../../../types.generated' + export const indexerDeployments: NonNullable< QueryResolvers['indexerDeployments'] -> = async (_parent, _arg, _ctx) => { - /* Implement Query.indexerDeployments resolver logic here */ +> = async (_parent, _arg, { graphNode }) => { + const result = await graphNode.indexingStatus([]) + return result.map((status) => ({ + ...status, + subgraphDeployment: status.subgraphDeployment.ipfsHash, + })) } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerEndpoints.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerEndpoints.ts index da52dec6a..bf26098e1 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerEndpoints.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerEndpoints.ts @@ -1,8 +1,197 @@ +import { validateNetworkIdentifier } from 'indexer-common/src/parsers/validators' import type { QueryResolvers } from './../../../types.generated' +import { Network } from 'indexer-common/src/network' + +const URL_VALIDATION_TEST = { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + test: (url: string) => `URL validation`, + run: async (url: string) => { + new URL(url) + }, + possibleActions: (url: string) => [`Make sure ${url} is a valid URL`], +} + +interface TestResult { + test: string + error: string | null + possibleActions: string[] +} + +interface Endpoint { + url: string | null + healthy: boolean + protocolNetwork: string + // eslint-disable-next-line @typescript-eslint/no-explicit-any + tests: any[] +} + +interface Endpoints { + service: Endpoint + status: Endpoint +} + +function defaultEndpoint(protocolNetwork: string): Endpoint { + return { + url: null as string | null, + healthy: false, + protocolNetwork, + tests: [] as TestResult[], + } +} +function defaultEndpoints(protocolNetwork: string): Endpoints { + return { + service: defaultEndpoint(protocolNetwork), + status: defaultEndpoint(protocolNetwork), + } +} + +const testURL = async ( + url: string, + tests: (typeof URL_VALIDATION_TEST)[], +): Promise<{ url: string; ok: boolean; tests: TestResult[] }> => { + const results: TestResult[] = [] + + for (const test of tests) { + const cmd = test.test(url) + + try { + await test.run(url) + + results.push({ + test: cmd, + error: null, + possibleActions: [], + }) + } catch (e) { + results.push({ + test: cmd, + error: e.message, + possibleActions: test.possibleActions(url), + }) + } + } + + return { url, tests: results, ok: !results.find((result) => result.error !== null) } +} + +async function endpointForNetwork(network: Network): Promise { + const contracts = network.contracts + const address = network.specification.indexerOptions.address + const endpoints = defaultEndpoints(network.specification.networkIdentifier) + const service = await contracts.serviceRegistry.services(address) + if (service) { + { + const { url, tests, ok } = await testURL(service.url, [ + URL_VALIDATION_TEST, + { + test: (url) => `http get ${url}`, + run: async (url) => { + const response = await fetch(url) + if (!response.ok) { + throw new Error( + `Returned status ${response.status}: ${ + response.body ? response.body.toString() : 'No data returned' + }`, + ) + } + }, + possibleActions: (url) => [ + `Make sure ${url} can be resolved and reached from this machine`, + `Make sure the port of ${url} is set up correctly`, + `Make sure the test command returns an HTTP status code < 400`, + ], + }, + ]) + + endpoints.service.url = url + endpoints.service.healthy = ok + endpoints.service.tests = tests + } + + { + const statusURL = endpoints.service.url.endsWith('/') + ? endpoints.service.url.substring(0, endpoints.service.url.length - 1) + '/status' + : endpoints.service.url + '/status' + + const { url, tests, ok } = await testURL(statusURL, [ + URL_VALIDATION_TEST, + { + test: (url) => `http post ${url} query="{ indexingStatuses { subgraph } }"`, + run: async (url) => { + const response = await fetch(url, { + method: 'POST', + headers: { 'content-type': 'application/json' }, + body: JSON.stringify({ query: '{ indexingStatuses { subgraph } }' }), + }) + if (!response.ok) { + throw new Error( + `Returned status ${response.status}: ${ + response.body ? response.body.toString() : 'No data returned' + }`, + ) + } + }, + possibleActions: (url) => [ + `Make sure ${url} can be reached from this machine`, + `Make sure the port of ${url} is set up correctly`, + `Make sure ${url} is the /status endpoint of indexer-service`, + `Make sure the test command returns an HTTP status code < 400`, + `Make sure the test command returns a valid GraphQL response`, + ], + }, + ]) + + endpoints.status.url = url + endpoints.status.healthy = ok + endpoints.status.tests = tests + } + } + return endpoints +} + export const indexerEndpoints: NonNullable = async ( _parent, - _arg, - _ctx, + { protocolNetwork: unvalidatedProtocolNetwork }, + { multiNetworks, logger }, ) => { - /* Implement Query.indexerEndpoints resolver logic here */ + if (!multiNetworks) { + throw Error( + 'IndexerManagementClient must be in `network` mode to fetch indexer endpoints', + ) + } + + const endpoints: Endpoints[] = [] + let networkIdentifier: string | null = null + + // Validate protocol network + try { + if (unvalidatedProtocolNetwork) { + networkIdentifier = validateNetworkIdentifier(unvalidatedProtocolNetwork) + } + } catch (parseError) { + throw new Error( + `Invalid protocol network identifier: '${unvalidatedProtocolNetwork}'. Error: ${parseError}`, + ) + } + + await multiNetworks.map(async (network) => { + // Skip if this query asks for another protocol network + if ( + networkIdentifier && + networkIdentifier !== network.specification.networkIdentifier + ) { + return + } + try { + const networkEndpoints = await endpointForNetwork(network) + endpoints.push(networkEndpoints) + } catch (err) { + // Ignore endpoints for this network + logger?.warn(`Failed to detect service endpoints for network`, { + err, + protocolNetwork: network.specification.networkIdentifier, + }) + } + }) + return endpoints } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerRegistration.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerRegistration.ts index 9b6e2d49b..aab4fa692 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerRegistration.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerRegistration.ts @@ -1,6 +1,48 @@ +import { extractNetwork } from 'indexer-common/src/indexer-management/resolvers/utils' +import geohash from 'ngeohash' import type { QueryResolvers } from './../../../types.generated' + export const indexerRegistration: NonNullable< QueryResolvers['indexerRegistration'] -> = async (_parent, _arg, _ctx) => { - /* Implement Query.indexerRegistration resolver logic here */ +> = async ( + _parent, + { protocolNetwork: unvalidatedProtocolNetwork }, + { multiNetworks }, +) => { + if (!multiNetworks) { + throw Error( + 'IndexerManagementClient must be in `network` mode to fetch indexer registration information', + ) + } + + const network = extractNetwork(unvalidatedProtocolNetwork, multiNetworks) + const protocolNetwork = network.specification.networkIdentifier + const address = network.specification.indexerOptions.address + const contracts = network.contracts + const registered = await contracts.serviceRegistry.isRegistered(address) + + if (registered) { + const service = await contracts.serviceRegistry.services(address) + const location = geohash.decode(service.geohash) + return { + address, + protocolNetwork, + url: service.url, + location: { + latitude: location.latitude.toString(), + longitude: location.longitude.toString(), + }, + registered, + __typename: 'IndexerRegistration', + } + } + + return { + address, + url: null, + registered, + protocolNetwork, + location: null, + __typename: 'IndexerRegistration', + } } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRule.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRule.ts index 7f4b38a15..25a180bdf 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRule.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRule.ts @@ -1,8 +1,33 @@ +import { processIdentifier } from 'indexer-common/src/subgraphs' import type { QueryResolvers } from './../../../types.generated' +import { validateNetworkIdentifier } from 'indexer-common/src/parsers/validators' +import { INDEXING_RULE_GLOBAL } from 'indexer-common/src/indexer-management/models/indexing-rule' + export const indexingRule: NonNullable = async ( _parent, - _arg, - _ctx, + { identifier: indexingRuleIdentifier, merged }, + { models }, ) => { - /* Implement Query.indexingRule resolver logic here */ + const [identifier] = await processIdentifier(indexingRuleIdentifier.identifier, { + all: false, + global: true, + }) + + // Sanitize protocol network identifier + const protocolNetwork = validateNetworkIdentifier( + indexingRuleIdentifier.protocolNetwork, + ) + + const rule = await models.IndexingRule.findOne({ + where: { identifier, protocolNetwork }, + }) + if (rule && merged) { + return rule.mergeToGraphQL( + await models.IndexingRule.findOne({ + where: { identifier: INDEXING_RULE_GLOBAL }, + }), + ) + } else { + return rule?.toGraphQL() || null + } } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRules.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRules.ts index c0bad7029..aa3565e35 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRules.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRules.ts @@ -1,8 +1,15 @@ +import { validateNetworkIdentifier } from 'indexer-common/src/parsers/validators' +import { fetchIndexingRules } from 'indexer-common/src/indexer-management/rules' import type { QueryResolvers } from './../../../types.generated' + export const indexingRules: NonNullable = async ( _parent, - _arg, - _ctx, + { merged, protocolNetwork: uncheckedProtocolNetwork }, + { models }, ) => { - /* Implement Query.indexingRules resolver logic here */ + // Convert the input `protocolNetwork` value to a CAIP2-ID + const protocolNetwork = uncheckedProtocolNetwork + ? validateNetworkIdentifier(uncheckedProtocolNetwork) + : undefined + return fetchIndexingRules(models, merged, protocolNetwork) } From 897a88f003b8b995363a770253fdb1286b5838e4 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Fri, 23 Feb 2024 10:55:37 -0500 Subject: [PATCH 05/48] mutations --- .../src/indexer-management/actions.ts | 18 +- .../resolvers/indexing-rules.ts | 2 +- .../resolvers/Mutation/approveActions.ts | 20 +- .../resolvers/Mutation/cancelActions.ts | 20 +- .../resolvers/Mutation/closeAllocation.ts | 231 ++++++++++++++++- .../resolvers/Mutation/createAllocation.ts | 238 +++++++++++++++++- .../resolvers/Mutation/deleteActions.ts | 16 +- .../resolvers/Mutation/deleteDisputes.ts | 32 ++- .../resolvers/Mutation/deleteIndexingRule.ts | 45 +++- .../resolvers/Mutation/deleteIndexingRules.ts | 50 +++- .../Mutation/executeApprovedActions.ts | 24 +- .../resolvers/Mutation/queueActions.ts | 228 ++++++++++++++++- 12 files changed, 890 insertions(+), 34 deletions(-) diff --git a/packages/indexer-common/src/indexer-management/actions.ts b/packages/indexer-common/src/indexer-management/actions.ts index aeb046480..fff309c34 100644 --- a/packages/indexer-common/src/indexer-management/actions.ts +++ b/packages/indexer-common/src/indexer-management/actions.ts @@ -19,10 +19,14 @@ import { GraphNode, } from '@graphprotocol/indexer-common' -import { Order, Transaction } from 'sequelize' +import { Order, Transaction, WhereOperators } from 'sequelize' import { Eventual, join, Logger, timer } from '@graphprotocol/common-ts' import groupBy from 'lodash.groupby' -import { ActionFilter, Maybe } from '../schema/types.generated' +import { ActionFilter as GraphQLActionFilter, Maybe } from '../schema/types.generated' + +type ActionFilter = GraphQLActionFilter & { + updatedAt?: WhereOperators +} export class ActionManager { declare multiNetworks: MultiNetworks @@ -121,9 +125,13 @@ export class ActionManager { logger.trace('Fetching approved actions') let actions: Action[] = [] try { - actions = await ActionManager.fetchActions(this.models, { - status: ActionStatus.APPROVED, - }) + actions = await ActionManager.fetchActions( + this.models, + { + status: ActionStatus.APPROVED, + }, + null, + ) logger.trace(`Fetched ${actions.length} approved actions`) } catch (err) { logger.warn('Failed to fetch approved actions from queue', { err }) diff --git a/packages/indexer-common/src/indexer-management/resolvers/indexing-rules.ts b/packages/indexer-common/src/indexer-management/resolvers/indexing-rules.ts index 954ef42ca..490a7fd9d 100644 --- a/packages/indexer-common/src/indexer-management/resolvers/indexing-rules.ts +++ b/packages/indexer-common/src/indexer-management/resolvers/indexing-rules.ts @@ -14,7 +14,7 @@ import { processIdentifier } from '../../' import { validateNetworkIdentifier } from '../../parsers' import groupBy from 'lodash.groupby' -const resetGlobalRule = async ( +export const resetGlobalRule = async ( ruleIdentifier: IndexingRuleIdentifier, defaults: IndexerManagementDefaults['globalIndexingRule'], models: IndexerManagementModels, diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/approveActions.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/approveActions.ts index 948912c2e..57c3833b2 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/approveActions.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/approveActions.ts @@ -1,8 +1,22 @@ +import { ActionStatus } from '@graphprotocol/indexer-common' import type { MutationResolvers } from './../../../types.generated' + export const approveActions: NonNullable = async ( _parent, - _arg, - _ctx, + { actionIDs }, + { logger, models }, ) => { - /* Implement Mutation.approveActions resolver logic here */ + logger.debug(`Execute 'approveActions' mutation`, { + actionIDs, + }) + const [, updatedActions] = await models.Action.update( + { status: ActionStatus.APPROVED }, + { where: { id: actionIDs }, returning: true }, + ) + + if (updatedActions.length === 0) { + throw Error(`Approve action failed: No action items found with id in [${actionIDs}]`) + } + + return updatedActions } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/cancelActions.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/cancelActions.ts index 7d7275d75..10b2b9b36 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/cancelActions.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/cancelActions.ts @@ -1,8 +1,22 @@ +import { ActionStatus } from 'indexer-common/src/actions' import type { MutationResolvers } from './../../../types.generated' + export const cancelActions: NonNullable = async ( _parent, - _arg, - _ctx, + { actionIDs }, + { logger, models }, ) => { - /* Implement Mutation.cancelActions resolver logic here */ + logger.debug(`Execute 'cancelActions' mutation`, { + actionIDs, + }) + const [, canceledActions] = await models.Action.update( + { status: ActionStatus.CANCELED }, + { where: { id: actionIDs }, returning: true }, + ) + + if (canceledActions.length === 0) { + throw Error(`Cancel action failed: No action items found with id in [${actionIDs}]`) + } + + return canceledActions } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/closeAllocation.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/closeAllocation.ts index abb239735..842709f74 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/closeAllocation.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/closeAllocation.ts @@ -1,8 +1,233 @@ +import { extractNetwork } from 'indexer-common/src/indexer-management/resolvers/utils' import type { MutationResolvers } from './../../../types.generated' +import { BigNumber, utils } from 'ethers' +import { IndexerErrorCode, indexerError } from 'indexer-common/src/errors' +import { NetworkMonitor } from 'indexer-common/src/indexer-management/monitor' +import { GraphNode } from 'indexer-common/src/graph-node' +import { formatGRT } from '@graphprotocol/common-ts' +import { SubgraphIdentifierType } from 'indexer-common/src/subgraphs' +import { IndexingDecisionBasis } from 'indexer-common/src/indexer-management/models/indexing-rule' +import { Allocation } from 'indexer-common/src/allocations/types' + +async function resolvePOI( + networkMonitor: NetworkMonitor, + graphNode: GraphNode, + allocation: Allocation, + poi: string | undefined, + force: boolean, +): Promise { + // poi = undefined, force=true -- submit even if poi is 0x0 + // poi = defined, force=true -- no generatedPOI needed, just submit the POI supplied (with some sanitation?) + // poi = undefined, force=false -- submit with generated POI if one available + // poi = defined, force=false -- submit user defined POI only if generated POI matches + switch (force) { + case true: + switch (!!poi) { + case true: + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + return poi! + case false: + return ( + (await graphNode.proofOfIndexing( + allocation.subgraphDeployment.id, + await networkMonitor.fetchPOIBlockPointer(allocation), + allocation.indexer, + )) || utils.hexlify(Array(32).fill(0)) + ) + } + break + case false: { + const currentEpochStartBlock = await networkMonitor.fetchPOIBlockPointer(allocation) + const generatedPOI = await graphNode.proofOfIndexing( + allocation.subgraphDeployment.id, + currentEpochStartBlock, + allocation.indexer, + ) + switch (poi == generatedPOI) { + case true: + if (poi == undefined) { + const deploymentStatus = await graphNode.indexingStatus([ + allocation.subgraphDeployment.id, + ]) + throw indexerError( + IndexerErrorCode.IE067, + `POI not available for deployment at current epoch start block. + currentEpochStartBlock: ${currentEpochStartBlock.number} + deploymentStatus: ${ + deploymentStatus.length > 0 + ? JSON.stringify(deploymentStatus) + : 'not deployed' + }`, + ) + } else { + return poi + } + case false: + if (poi == undefined && generatedPOI !== undefined) { + return generatedPOI + } else if (poi !== undefined && generatedPOI == undefined) { + return poi + } + throw indexerError( + IndexerErrorCode.IE068, + `User provided POI does not match reference fetched from the graph-node. Use '--force' to bypass this POI accuracy check. + POI: ${poi}, + referencePOI: ${generatedPOI}`, + ) + } + } + } +} + export const closeAllocation: NonNullable = async ( _parent, - _arg, - _ctx, + { protocolNetwork, allocation, poi, force }, + { multiNetworks, logger, models, graphNode }, ) => { - /* Implement Mutation.closeAllocation resolver logic here */ + if (!multiNetworks) { + throw Error('IndexerManagementClient must be in `network` mode to fetch allocations') + } + const network = extractNetwork(protocolNetwork, multiNetworks) + const networkMonitor = network.networkMonitor + const contracts = network.contracts + const transactionManager = network.transactionManager + const receiptCollector = network.receiptCollector + + const allocationData = await networkMonitor.allocation(allocation) + + try { + // Ensure allocation is old enough to close + const currentEpoch = await contracts.epochManager.currentEpoch() + if (BigNumber.from(allocationData.createdAtEpoch).eq(currentEpoch)) { + throw indexerError( + IndexerErrorCode.IE064, + `Allocation '${ + allocationData.id + }' cannot be closed until epoch ${currentEpoch.add( + 1, + )}. (Allocations cannot be closed in the same epoch they were created)`, + ) + } + + poi = await resolvePOI(networkMonitor, graphNode, allocationData, poi, force) + + // Double-check whether the allocation is still active on chain, to + // avoid unnecessary transactions. + // Note: We're checking the allocation state here, which is defined as + // + // enum AllocationState { Null, Active, Closed, Finalized } + // + // in the contracts. + const state = await contracts.staking.getAllocationState(allocationData.id) + if (state !== 1) { + throw indexerError(IndexerErrorCode.IE065, 'Allocation has already been closed') + } + + logger.debug('Sending closeAllocation transaction') + const receipt = await transactionManager.executeTransaction( + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + () => contracts.staking.estimateGas.closeAllocation(allocationData.id, poi!), + (gasLimit) => + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + contracts.staking.closeAllocation(allocationData.id, poi!, { + gasLimit, + }), + logger, + ) + + if (receipt === 'paused' || receipt === 'unauthorized') { + throw indexerError( + IndexerErrorCode.IE062, + `Allocation '${allocationData.id}' could not be closed: ${receipt}`, + ) + } + + const closeAllocationEventLogs = transactionManager.findEvent( + 'AllocationClosed', + contracts.staking.interface, + 'allocationID', + allocation, + receipt, + logger, + ) + + if (!closeAllocationEventLogs) { + throw indexerError( + IndexerErrorCode.IE015, + `Allocation close transaction was never successfully mined`, + ) + } + + const rewardsEventLogs = transactionManager.findEvent( + 'RewardsAssigned', + contracts.rewardsManager.interface, + 'allocationID', + allocation, + receipt, + logger, + ) + + const rewardsAssigned = rewardsEventLogs ? rewardsEventLogs.amount : 0 + + if (rewardsAssigned == 0) { + logger.warn('No rewards were distributed upon closing the allocation') + } + + logger.info(`Successfully closed allocation`, { + deployment: closeAllocationEventLogs.subgraphDeploymentID, + allocation: closeAllocationEventLogs.allocationID, + indexer: closeAllocationEventLogs.indexer, + amountGRT: formatGRT(closeAllocationEventLogs.tokens), + effectiveAllocation: closeAllocationEventLogs.effectiveAllocation.toString(), + poi: closeAllocationEventLogs.poi, + epoch: closeAllocationEventLogs.epoch.toString(), + transaction: receipt.transactionHash, + indexingRewards: rewardsAssigned, + }) + + logger.info('Identifying receipts worth collecting', { + allocation: closeAllocationEventLogs.allocationID, + }) + + // Collect query fees for this allocation + const isCollectingQueryFees = await receiptCollector.collectReceipts( + 0, + allocationData, + ) + + logger.debug( + `Updating indexing rules, so indexer-agent keeps the deployment synced but doesn't reallocate to it`, + ) + const offchainIndexingRule = { + protocolNetwork: network.specification.networkIdentifier, + identifier: allocationData.subgraphDeployment.id.ipfsHash, + identifierType: SubgraphIdentifierType.DEPLOYMENT, + decisionBasis: IndexingDecisionBasis.OFFCHAIN, + } + + await models.IndexingRule.upsert(offchainIndexingRule) + + // Since upsert succeeded, we _must_ have a rule + const updatedRule = await models.IndexingRule.findOne({ + where: { identifier: offchainIndexingRule.identifier }, + }) + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + logger.info(`DecisionBasis.OFFCHAIN rule merged into indexing rules`, { + rule: updatedRule, + }) + + return { + actionID: 0, + type: 'unallocate', + transactionID: receipt.transactionHash, + allocation: closeAllocationEventLogs.allocationID, + allocatedTokens: formatGRT(closeAllocationEventLogs.tokens), + indexingRewards: formatGRT(rewardsAssigned), + receiptsWorthCollecting: isCollectingQueryFees, + protocolNetwork: network.specification.networkIdentifier, + } + } catch (error) { + logger.error(error.toString()) + throw error + } } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/createAllocation.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/createAllocation.ts index 89e72e568..3d759ba17 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/createAllocation.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/createAllocation.ts @@ -1,6 +1,240 @@ +import { extractNetwork } from 'indexer-common/src/indexer-management/resolvers/utils' import type { MutationResolvers } from './../../../types.generated' +import { SubgraphDeploymentID, formatGRT, parseGRT } from '@graphprotocol/common-ts' +import { AllocationStatus } from 'indexer-common/src/allocations/types' +import { IndexerErrorCode, indexerError } from 'indexer-common/src/errors' +import { + allocationIdProof, + uniqueAllocationID, +} from 'indexer-common/src/allocations/keys' +import { utils } from 'ethers' +import { SubgraphIdentifierType } from 'indexer-common/src/subgraphs' +import { IndexingDecisionBasis } from 'indexer-common/src/indexer-management/models/indexing-rule' + export const createAllocation: NonNullable< MutationResolvers['createAllocation'] -> = async (_parent, _arg, _ctx) => { - /* Implement Mutation.createAllocation resolver logic here */ +> = async ( + _parent, + { deployment, amount, protocolNetwork }, + { logger, multiNetworks, graphNode, models }, +) => { + logger.debug('Execute createAllocation() mutation', { + deployment, + amount, + protocolNetwork, + }) + if (!multiNetworks) { + throw Error('IndexerManagementClient must be in `network` mode to fetch allocations') + } + const network = extractNetwork(protocolNetwork, multiNetworks) + const networkMonitor = network.networkMonitor + const contracts = network.contracts + const transactionManager = network.transactionManager + const address = network.specification.indexerOptions.address + + const allocationAmount = parseGRT(amount) + const subgraphDeployment = new SubgraphDeploymentID(deployment) + + const activeAllocations = await networkMonitor.allocations(AllocationStatus.ACTIVE) + + const allocation = activeAllocations.find( + (allocation) => + allocation.subgraphDeployment.id.toString() === subgraphDeployment.toString(), + ) + if (allocation) { + logger.warn('Already allocated to deployment', { + deployment: allocation.subgraphDeployment.id.ipfsHash, + activeAllocation: allocation.id, + }) + throw indexerError( + IndexerErrorCode.IE060, + `Allocation failed. An active allocation already exists for deployment '${allocation.subgraphDeployment.id.ipfsHash}'`, + ) + } + + if (allocationAmount.lt('0')) { + logger.warn('Cannot allocate a negative amount of GRT', { + amount: formatGRT(allocationAmount), + }) + throw indexerError( + IndexerErrorCode.IE061, + `Invalid allocation amount provided (${amount.toString()}). Must use positive allocation amount`, + ) + } + + try { + const currentEpoch = await contracts.epochManager.currentEpoch() + + // Identify how many GRT the indexer has staked + const freeStake = await contracts.staking.getIndexerCapacity(address) + + // If there isn't enough left for allocating, abort + if (freeStake.lt(allocationAmount)) { + logger.error( + `Allocation of ${formatGRT( + allocationAmount, + )} GRT cancelled: indexer only has a free stake amount of ${formatGRT( + freeStake, + )} GRT`, + ) + throw indexerError( + IndexerErrorCode.IE013, + `Allocation of ${formatGRT( + allocationAmount, + )} GRT cancelled: indexer only has a free stake amount of ${formatGRT( + freeStake, + )} GRT`, + ) + } + + // Ensure subgraph is deployed before allocating + await graphNode.ensure( + `indexer-agent/${subgraphDeployment.ipfsHash.slice(-10)}`, + subgraphDeployment, + ) + + logger.debug('Obtain a unique Allocation ID') + + // Obtain a unique allocation ID + const { allocationSigner, allocationId } = uniqueAllocationID( + transactionManager.wallet.mnemonic.phrase, + currentEpoch.toNumber(), + subgraphDeployment, + activeAllocations.map((allocation) => allocation.id), + ) + + // Double-check whether the allocationID already exists on chain, to + // avoid unnecessary transactions. + // Note: We're checking the allocation state here, which is defined as + // + // enum AllocationState { Null, Active, Closed, Finalized } + // + // in the contracts. + const state = await contracts.staking.getAllocationState(allocationId) + if (state !== 0) { + logger.debug(`Skipping allocation as it already exists onchain`, { + indexer: address, + allocation: allocationId, + state, + }) + throw indexerError( + IndexerErrorCode.IE066, + `Allocation '${allocationId}' already exists onchain`, + ) + } + + logger.debug('Generating new allocation ID proof', { + newAllocationSigner: allocationSigner, + newAllocationID: allocationId, + indexerAddress: address, + }) + + const proof = await allocationIdProof(allocationSigner, address, allocationId) + + logger.debug('Successfully generated allocation ID proof', { + allocationIDProof: proof, + }) + + logger.debug(`Sending allocateFrom transaction`, { + indexer: address, + subgraphDeployment: subgraphDeployment.ipfsHash, + amount: formatGRT(allocationAmount), + allocation: allocationId, + proof, + protocolNetwork, + }) + + const receipt = await transactionManager.executeTransaction( + async () => + contracts.staking.estimateGas.allocateFrom( + address, + subgraphDeployment.bytes32, + allocationAmount, + allocationId, + utils.hexlify(Array(32).fill(0)), + proof, + ), + async (gasLimit) => + contracts.staking.allocateFrom( + address, + subgraphDeployment.bytes32, + allocationAmount, + allocationId, + utils.hexlify(Array(32).fill(0)), + proof, + { gasLimit }, + ), + logger.child({ action: 'allocate' }), + ) + + if (receipt === 'paused' || receipt === 'unauthorized') { + throw indexerError( + IndexerErrorCode.IE062, + `Allocation not created. ${ + receipt === 'paused' ? 'Network paused' : 'Operator not authorized' + }`, + ) + } + + const createAllocationEventLogs = network.transactionManager.findEvent( + 'AllocationCreated', + network.contracts.staking.interface, + 'subgraphDeploymentID', + subgraphDeployment.toString(), + receipt, + logger, + ) + + if (!createAllocationEventLogs) { + throw indexerError( + IndexerErrorCode.IE014, + `Allocation create transaction was never mined`, + ) + } + + logger.info(`Successfully allocated to subgraph deployment`, { + amountGRT: formatGRT(createAllocationEventLogs.tokens), + allocation: createAllocationEventLogs.allocationID, + epoch: createAllocationEventLogs.epoch.toString(), + transaction: receipt.transactionHash, + }) + + logger.debug( + `Updating indexing rules, so indexer-agent will now manage the active allocation`, + ) + const indexingRule = { + identifier: subgraphDeployment.ipfsHash, + allocationAmount: allocationAmount.toString(), + identifierType: SubgraphIdentifierType.DEPLOYMENT, + decisionBasis: IndexingDecisionBasis.ALWAYS, + protocolNetwork, + } + + await models.IndexingRule.upsert(indexingRule) + + // Since upsert succeeded, we _must_ have a rule + const updatedRule = await models.IndexingRule.findOne({ + where: { identifier: indexingRule.identifier }, + }) + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + logger.debug(`DecisionBasis.ALWAYS rule merged into indexing rules`, { + rule: updatedRule, + }) + + return { + actionID: 0, + type: 'allocate', + transactionID: receipt.transactionHash, + deployment, + allocation: createAllocationEventLogs.allocationID, + allocatedTokens: formatGRT(allocationAmount.toString()), + protocolNetwork, + } + } catch (error) { + logger.error(`Failed to allocate`, { + amount: formatGRT(allocationAmount), + error, + }) + throw error + } } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteActions.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteActions.ts index cce54de91..e3e434259 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteActions.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteActions.ts @@ -1,8 +1,18 @@ import type { MutationResolvers } from './../../../types.generated' + export const deleteActions: NonNullable = async ( _parent, - _arg, - _ctx, + { actionIDs }, + { logger, models }, ) => { - /* Implement Mutation.deleteActions resolver logic here */ + logger.debug(`Execute 'deleteActions' mutation`, { + actionIDs, + }) + const numDeleted = await models.Action.destroy({ where: { id: actionIDs } }) + + if (numDeleted === 0) { + throw Error(`Delete action failed: No action items found with id in [${actionIDs}]`) + } + + return numDeleted } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteDisputes.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteDisputes.ts index a56313892..b242e8300 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteDisputes.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteDisputes.ts @@ -1,8 +1,34 @@ +import { validateNetworkIdentifier } from 'indexer-common/src/parsers/validators' import type { MutationResolvers } from './../../../types.generated' +import groupBy from 'lodash.groupby' + export const deleteDisputes: NonNullable = async ( _parent, - _arg, - _ctx, + { identifiers }, + { models }, ) => { - /* Implement Mutation.deleteDisputes resolver logic here */ + let totalNumDeleted = 0 + + // Sanitize protocol network identifiers + for (const identifier of identifiers) { + if (!identifier.protocolNetwork) { + throw new Error(`Dispute is missing the attribute 'protocolNetwork'`) + } + identifier.protocolNetwork = validateNetworkIdentifier(identifier.protocolNetwork) + } + + // Batch by protocolNetwork + const batches = groupBy(identifiers, (x) => x.protocolNetwork) + + for (const protocolNetwork in batches) { + const batch = batches[protocolNetwork] + const numDeleted = await models.POIDispute.destroy({ + where: { + allocationID: batch.map((x) => x.allocationID), + }, + force: true, + }) + totalNumDeleted += numDeleted + } + return totalNumDeleted } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRule.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRule.ts index 83316c93a..df1764449 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRule.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRule.ts @@ -1,6 +1,45 @@ -import type { MutationResolvers } from './../../../types.generated' +import { processIdentifier } from 'indexer-common/src/subgraphs' +import type { + MutationResolvers +} from './../../../types.generated' +import { validateNetworkIdentifier } from 'indexer-common/src/parsers/validators' +import { resetGlobalRule } from 'indexer-common/src/indexer-management/resolvers/indexing-rules' + export const deleteIndexingRule: NonNullable< MutationResolvers['deleteIndexingRule'] -> = async (_parent, _arg, _ctx) => { - /* Implement Mutation.deleteIndexingRule resolver logic here */ +> = async (_parent, { identifier: indexingRuleIdentifier }, { models, defaults }) => { + const [identifier] = await processIdentifier(indexingRuleIdentifier.identifier, { + all: false, + global: true, + }) + + // Sanitize protocol network identifier + const protocolNetwork = validateNetworkIdentifier( + indexingRuleIdentifier.protocolNetwork, + ) + + const validatedRuleIdentifier = { + protocolNetwork, + identifier, + } + + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + return models.IndexingRule.sequelize!.transaction(async (transaction) => { + const numDeleted = await models.IndexingRule.destroy({ + where: validatedRuleIdentifier, + transaction, + }) + + // Reset the global rule + if (validatedRuleIdentifier.identifier === 'global') { + await resetGlobalRule( + validatedRuleIdentifier, + defaults.globalIndexingRule, + models, + transaction, + ) + } + + return numDeleted > 0 + }) } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRules.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRules.ts index 67c4eaa55..8ee981f70 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRules.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRules.ts @@ -1,6 +1,52 @@ +import { validateNetworkIdentifier } from 'indexer-common/src/parsers/validators' import type { MutationResolvers } from './../../../types.generated' +import groupBy from 'lodash.groupby' +import { processIdentifier } from 'indexer-common/src/subgraphs' +import { resetGlobalRule } from 'indexer-common/src/indexer-management/resolvers/indexing-rules' + export const deleteIndexingRules: NonNullable< MutationResolvers['deleteIndexingRules'] -> = async (_parent, _arg, _ctx) => { - /* Implement Mutation.deleteIndexingRules resolver logic here */ +> = async (_parent, { identifiers: indexingRuleIdentifiers }, { models, defaults }) => { + let totalNumDeleted = 0 + + // Sanitize protocol network identifiers + for (const identifier of indexingRuleIdentifiers) { + identifier.protocolNetwork = validateNetworkIdentifier(identifier.protocolNetwork) + } + + // Batch deletions by the `IndexingRuleIdentifier.protocolNetwork` attribute . + const batches = groupBy(indexingRuleIdentifiers, (x) => x.protocolNetwork) + + for (const protocolNetwork in batches) { + const batch = batches[protocolNetwork] + const identifiers = await Promise.all( + batch.map( + async ({ identifier }) => + (await processIdentifier(identifier, { all: false, global: true }))[0], + ), + ) + // Execute deletion batch + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + await models.IndexingRule.sequelize!.transaction(async (transaction) => { + const numDeleted = await models.IndexingRule.destroy({ + where: { + identifier: identifiers, + protocolNetwork: protocolNetwork, + }, + transaction, + }) + + if (identifiers.includes('global')) { + const globalIdentifier = { identifier: 'global', protocolNetwork } + await resetGlobalRule( + globalIdentifier, + defaults.globalIndexingRule, + models, + transaction, + ) + } + totalNumDeleted += numDeleted + }) + } + return totalNumDeleted > 0 } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/executeApprovedActions.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/executeApprovedActions.ts index d3c1824eb..f23c26504 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/executeApprovedActions.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/executeApprovedActions.ts @@ -1,6 +1,26 @@ import type { MutationResolvers } from './../../../types.generated' + export const executeApprovedActions: NonNullable< MutationResolvers['executeApprovedActions'] -> = async (_parent, _arg, _ctx) => { - /* Implement Mutation.executeApprovedActions resolver logic here */ +> = async (_parent, _arg, { logger: parentLogger, actionManager }) => { + const logger = parentLogger.child({ function: 'executeApprovedActions' }) + logger.trace(`Begin executing 'executeApprovedActions' mutation`) + if (!actionManager) { + throw Error('IndexerManagementClient must be in `network` mode to modify actions') + } + const result = await actionManager.multiNetworks.map(async (network) => { + logger.debug(`Execute 'executeApprovedActions' mutation`, { + protocolNetwork: network.specification.networkIdentifier, + }) + try { + return await actionManager.executeApprovedActions(network) + } catch (error) { + logger.error('Failed to execute approved actions for network', { + protocolNetwork: network.specification.networkIdentifier, + error, + }) + return [] + } + }) + return Object.values(result).flat() } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/queueActions.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/queueActions.ts index 3b0bb9bf5..48bb5395a 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/queueActions.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/queueActions.ts @@ -1,8 +1,228 @@ -import type { MutationResolvers } from './../../../types.generated' +import { validateNetworkIdentifier } from 'indexer-common/src/parsers/validators' +import type { + Action, + ActionInput, + ActionResult, + MutationResolvers, +} from './../../../types.generated' +import groupBy from 'lodash.groupby' +import { + ActionStatus, + ActionType, + validateActionInputs, +} from 'indexer-common/src/actions' +import { ActionManager } from 'indexer-common/src/indexer-management/actions' +import { Op, Transaction, literal } from 'sequelize' +import { Logger } from '@graphprotocol/common-ts' +import { IndexerManagementModels } from '@graphprotocol/indexer-common' + +/* Helper function to assess equality among a enqueued and a proposed actions */ +function compareActions(enqueued: Action, proposed: ActionInput): boolean { + // actions are not the same if they target different protocol networks + if (enqueued.protocolNetwork !== proposed.protocolNetwork) { + return false + } + + // actions are not the same if they target different deployments + if (enqueued.deploymentID !== proposed.deploymentID) { + return false + } + // actions are not the same if they have different types + if (enqueued.type !== proposed.type) { + return false + } + + // Different fields are used to assess equality depending on the action type + const amount = enqueued.amount === proposed.amount + const poi = enqueued.poi == proposed.poi + const force = enqueued.force == proposed.force + switch (proposed.type) { + case ActionType.ALLOCATE: + return amount + case ActionType.UNALLOCATE: + return poi && force + case ActionType.REALLOCATE: + return amount && poi && force + default: + return false + } +} + +// Perform insert, update, or no-op depending on existing queue data +// INSERT - No item in the queue yet targeting this deploymentID +// UPDATE - Already an item in the queue targeting the same deploymentID AND that item was added by the same 'source' +// NO-OP - Already an item in the queue targeting the same deploymentID BUT was added by a different source +// TODO: Use pending status for actions in process of execution, detect here and if duplicate pending found, NOOP +async function executeQueueOperation( + logger: Logger, + action: ActionInput, + actionsAwaitingExecution: Action[], + recentlyAttemptedActions: Action[], + models: IndexerManagementModels, + transaction: Transaction, +) { + // Check for previously failed conflicting actions + const conflictingActions = recentlyAttemptedActions.filter(function (recentAction) { + const areEqual = compareActions(recentAction, action) + const fromAgent = action.source === 'indexerAgent' + return areEqual && fromAgent + }) + if (conflictingActions.length > 0) { + const message = `Recently executed '${action.type}' action found in queue targeting '${action.deploymentID}', ignoring.` + logger.warn(message, { + recentlyAttemptedAction: conflictingActions, + proposedAction: action, + }) + throw Error(message) + } + + // Check for duplicated actions + const duplicateActions = actionsAwaitingExecution.filter( + (a) => + a.deploymentID === action.deploymentID && + a.protocolNetwork === action.protocolNetwork, + ) + if (duplicateActions.length === 0) { + logger.trace('Inserting Action in database', { action }) + return [ + await models.Action.create(action, { + validate: true, + returning: true, + transaction, + }), + ] + } else if (duplicateActions.length === 1) { + if ( + duplicateActions[0].source === action.source && + duplicateActions[0].status === action.status + ) { + // TODO: Log this only when update will actually change existing item + logger.trace( + `Action found in queue that effects the same deployment as proposed queue action, updating existing action`, + { + actionInQueue: duplicateActions, + proposedAction: action, + proposedSource: action.source, + actionSources: duplicateActions[0].source, + }, + ) + const [, updatedAction] = await models.Action.update( + { ...action }, + { + where: { id: duplicateActions[0].id }, + returning: true, + validate: true, + transaction, + }, + ) + return updatedAction + } else { + const message = + `Duplicate action found in queue that effects '${action.deploymentID}' but NOT overwritten because it has a different source and/or status. If you ` + + `would like to replace the item currently in the queue please cancel it and then queue the proposed action` + logger.warn(message, { + actionInQueue: duplicateActions, + proposedAction: action, + }) + throw Error(message) + } + } else { + throw Error( + `Uniqueness constraint broken: Multiple actions items targeting the same deployment found in queue (ActionStatus = queued). Something has gone wrong, please cleanup your 'Actions' table to continue`, + ) + } +} + export const queueActions: NonNullable = async ( _parent, - _arg, - _ctx, + { actions }, + { logger, models, actionManager, multiNetworks }, ) => { - /* Implement Mutation.queueActions resolver logic here */ + logger.debug(`Execute 'queueActions' mutation`, { + actions, + }) + + if (!actionManager || !multiNetworks) { + throw Error('IndexerManagementClient must be in `network` mode to modify actions') + } + + // Sanitize protocol network identifier + actions.forEach((action) => { + try { + action.protocolNetwork = validateNetworkIdentifier(action.protocolNetwork) + } catch (e) { + throw Error(`Invalid value for the field 'protocolNetwork'. ${e}`) + } + }) + + // Let Network Monitors validate actions based on their protocol networks + await multiNetworks.mapNetworkMapped( + groupBy(actions, (action) => action.protocolNetwork), + (network, actions) => validateActionInputs(actions, network.networkMonitor, logger), + ) + + const alreadyQueuedActions = await ActionManager.fetchActions( + models, + { + status: ActionStatus.QUEUED, + }, + null, + ) + const alreadyApprovedActions = await ActionManager.fetchActions( + models, + { + status: ActionStatus.APPROVED, + }, + null, + ) + const actionsAwaitingExecution = alreadyQueuedActions.concat(alreadyApprovedActions) + + // Fetch recently attempted actions + const last15Minutes = { + [Op.gte]: literal("NOW() - INTERVAL '15m'"), + } + + const recentlyFailedActions = await ActionManager.fetchActions( + models, + { + status: ActionStatus.FAILED, + updatedAt: last15Minutes, + }, + null, + ) + + const recentlySuccessfulActions = await ActionManager.fetchActions( + models, + { + status: ActionStatus.SUCCESS, + updatedAt: last15Minutes, + }, + null, + ) + + logger.trace('Recently attempted actions', { + recentlySuccessfulActions, + recentlyFailedActions, + }) + + const recentlyAttemptedActions = recentlyFailedActions.concat(recentlySuccessfulActions) + + let results: ActionResult[] = [] + + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + await models.Action.sequelize!.transaction(async (transaction) => { + for (const action of actions) { + const result = await executeQueueOperation( + logger, + action, + actionsAwaitingExecution, + recentlyAttemptedActions, + models, + transaction, + ) + results = results.concat(result) + } + }) + + return results } From dea58e495485f73f0a6d5c770f2ac65b5283b827 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Fri, 23 Feb 2024 10:55:51 -0500 Subject: [PATCH 06/48] format --- .../resolvers/Mutation/deleteIndexingRule.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRule.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRule.ts index df1764449..47baf6f06 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRule.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRule.ts @@ -1,7 +1,5 @@ import { processIdentifier } from 'indexer-common/src/subgraphs' -import type { - MutationResolvers -} from './../../../types.generated' +import type { MutationResolvers } from './../../../types.generated' import { validateNetworkIdentifier } from 'indexer-common/src/parsers/validators' import { resetGlobalRule } from 'indexer-common/src/indexer-management/resolvers/indexing-rules' From 3f474eaf71d8fdbaa24a1bd8610823cdf94e29cf Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Fri, 23 Feb 2024 10:59:55 -0500 Subject: [PATCH 07/48] remove generate types --- packages/indexer-common/package.json | 2 +- packages/indexer-common/src/schema/.gitignore | 1 + .../src/schema/resolvers.generated.ts | 111 - .../src/schema/typeDefs.generated.ts | 5358 ----------------- .../src/schema/types.generated.ts | 1246 ---- 5 files changed, 2 insertions(+), 6716 deletions(-) create mode 100644 packages/indexer-common/src/schema/.gitignore delete mode 100644 packages/indexer-common/src/schema/resolvers.generated.ts delete mode 100644 packages/indexer-common/src/schema/typeDefs.generated.ts delete mode 100644 packages/indexer-common/src/schema/types.generated.ts diff --git a/packages/indexer-common/package.json b/packages/indexer-common/package.json index 7f43a280d..087aff4f2 100644 --- a/packages/indexer-common/package.json +++ b/packages/indexer-common/package.json @@ -13,7 +13,7 @@ "scripts": { "format": "prettier --write 'src/**/*.ts'", "lint": "eslint . --ext .ts,.tsx --fix", - "compile": "tsc", + "compile": "yarn codegen && tsc", "prepare": "yarn format && yarn lint && yarn compile", "test": "LOG_LEVEL=info jest --colors --verbose --runInBand --detectOpenHandles", "test:ci": "LOG_LEVEL=info jest --verbose --maxWorkers=1 --ci", diff --git a/packages/indexer-common/src/schema/.gitignore b/packages/indexer-common/src/schema/.gitignore new file mode 100644 index 000000000..2d5c5d4cd --- /dev/null +++ b/packages/indexer-common/src/schema/.gitignore @@ -0,0 +1 @@ +*.generated.ts \ No newline at end of file diff --git a/packages/indexer-common/src/schema/resolvers.generated.ts b/packages/indexer-common/src/schema/resolvers.generated.ts deleted file mode 100644 index 9b54215f4..000000000 --- a/packages/indexer-common/src/schema/resolvers.generated.ts +++ /dev/null @@ -1,111 +0,0 @@ -/* This file was automatically generated. DO NOT UPDATE MANUALLY. */ -import type { Resolvers } from './types.generated' -import { Action } from './indexer-management/resolvers/Action' -import { ActionResult } from './indexer-management/resolvers/ActionResult' -import { Allocation } from './indexer-management/resolvers/Allocation' -import { BigInt } from './indexer-management/resolvers/BigInt' -import { BlockPointer } from './indexer-management/resolvers/BlockPointer' -import { ChainIndexingStatus } from './indexer-management/resolvers/ChainIndexingStatus' -import { CloseAllocationResult } from './indexer-management/resolvers/CloseAllocationResult' -import { CostModel } from './indexer-management/resolvers/CostModel' -import { CreateAllocationResult } from './indexer-management/resolvers/CreateAllocationResult' -import { GeoLocation } from './indexer-management/resolvers/GeoLocation' -import { IndexerAllocation } from './indexer-management/resolvers/IndexerAllocation' -import { IndexerDeployment } from './indexer-management/resolvers/IndexerDeployment' -import { IndexerEndpoint } from './indexer-management/resolvers/IndexerEndpoint' -import { IndexerEndpointTest } from './indexer-management/resolvers/IndexerEndpointTest' -import { IndexerEndpoints } from './indexer-management/resolvers/IndexerEndpoints' -import { IndexerRegistration } from './indexer-management/resolvers/IndexerRegistration' -import { IndexingError } from './indexer-management/resolvers/IndexingError' -import { IndexingRule } from './indexer-management/resolvers/IndexingRule' -import { approveActions as Mutation_approveActions } from './indexer-management/resolvers/Mutation/approveActions' -import { cancelActions as Mutation_cancelActions } from './indexer-management/resolvers/Mutation/cancelActions' -import { closeAllocation as Mutation_closeAllocation } from './indexer-management/resolvers/Mutation/closeAllocation' -import { createAllocation as Mutation_createAllocation } from './indexer-management/resolvers/Mutation/createAllocation' -import { deleteActions as Mutation_deleteActions } from './indexer-management/resolvers/Mutation/deleteActions' -import { deleteCostModels as Mutation_deleteCostModels } from './indexer-management/resolvers/Mutation/deleteCostModels' -import { deleteDisputes as Mutation_deleteDisputes } from './indexer-management/resolvers/Mutation/deleteDisputes' -import { deleteIndexingRule as Mutation_deleteIndexingRule } from './indexer-management/resolvers/Mutation/deleteIndexingRule' -import { deleteIndexingRules as Mutation_deleteIndexingRules } from './indexer-management/resolvers/Mutation/deleteIndexingRules' -import { executeApprovedActions as Mutation_executeApprovedActions } from './indexer-management/resolvers/Mutation/executeApprovedActions' -import { queueActions as Mutation_queueActions } from './indexer-management/resolvers/Mutation/queueActions' -import { reallocateAllocation as Mutation_reallocateAllocation } from './indexer-management/resolvers/Mutation/reallocateAllocation' -import { setCostModel as Mutation_setCostModel } from './indexer-management/resolvers/Mutation/setCostModel' -import { setIndexingRule as Mutation_setIndexingRule } from './indexer-management/resolvers/Mutation/setIndexingRule' -import { storeDisputes as Mutation_storeDisputes } from './indexer-management/resolvers/Mutation/storeDisputes' -import { updateAction as Mutation_updateAction } from './indexer-management/resolvers/Mutation/updateAction' -import { updateActions as Mutation_updateActions } from './indexer-management/resolvers/Mutation/updateActions' -import { POIDispute } from './indexer-management/resolvers/POIDispute' -import { action as Query_action } from './indexer-management/resolvers/Query/action' -import { actions as Query_actions } from './indexer-management/resolvers/Query/actions' -import { allocations as Query_allocations } from './indexer-management/resolvers/Query/allocations' -import { costModel as Query_costModel } from './indexer-management/resolvers/Query/costModel' -import { costModels as Query_costModels } from './indexer-management/resolvers/Query/costModels' -import { dispute as Query_dispute } from './indexer-management/resolvers/Query/dispute' -import { disputes as Query_disputes } from './indexer-management/resolvers/Query/disputes' -import { disputesClosedAfter as Query_disputesClosedAfter } from './indexer-management/resolvers/Query/disputesClosedAfter' -import { indexerAllocations as Query_indexerAllocations } from './indexer-management/resolvers/Query/indexerAllocations' -import { indexerDeployments as Query_indexerDeployments } from './indexer-management/resolvers/Query/indexerDeployments' -import { indexerEndpoints as Query_indexerEndpoints } from './indexer-management/resolvers/Query/indexerEndpoints' -import { indexerRegistration as Query_indexerRegistration } from './indexer-management/resolvers/Query/indexerRegistration' -import { indexingRule as Query_indexingRule } from './indexer-management/resolvers/Query/indexingRule' -import { indexingRules as Query_indexingRules } from './indexer-management/resolvers/Query/indexingRules' -import { ReallocateAllocationResult } from './indexer-management/resolvers/ReallocateAllocationResult' -export const resolvers: Resolvers = { - Query: { - action: Query_action, - actions: Query_actions, - allocations: Query_allocations, - costModel: Query_costModel, - costModels: Query_costModels, - dispute: Query_dispute, - disputes: Query_disputes, - disputesClosedAfter: Query_disputesClosedAfter, - indexerAllocations: Query_indexerAllocations, - indexerDeployments: Query_indexerDeployments, - indexerEndpoints: Query_indexerEndpoints, - indexerRegistration: Query_indexerRegistration, - indexingRule: Query_indexingRule, - indexingRules: Query_indexingRules, - }, - Mutation: { - approveActions: Mutation_approveActions, - cancelActions: Mutation_cancelActions, - closeAllocation: Mutation_closeAllocation, - createAllocation: Mutation_createAllocation, - deleteActions: Mutation_deleteActions, - deleteCostModels: Mutation_deleteCostModels, - deleteDisputes: Mutation_deleteDisputes, - deleteIndexingRule: Mutation_deleteIndexingRule, - deleteIndexingRules: Mutation_deleteIndexingRules, - executeApprovedActions: Mutation_executeApprovedActions, - queueActions: Mutation_queueActions, - reallocateAllocation: Mutation_reallocateAllocation, - setCostModel: Mutation_setCostModel, - setIndexingRule: Mutation_setIndexingRule, - storeDisputes: Mutation_storeDisputes, - updateAction: Mutation_updateAction, - updateActions: Mutation_updateActions, - }, - - Action: Action, - ActionResult: ActionResult, - Allocation: Allocation, - BigInt: BigInt, - BlockPointer: BlockPointer, - ChainIndexingStatus: ChainIndexingStatus, - CloseAllocationResult: CloseAllocationResult, - CostModel: CostModel, - CreateAllocationResult: CreateAllocationResult, - GeoLocation: GeoLocation, - IndexerAllocation: IndexerAllocation, - IndexerDeployment: IndexerDeployment, - IndexerEndpoint: IndexerEndpoint, - IndexerEndpointTest: IndexerEndpointTest, - IndexerEndpoints: IndexerEndpoints, - IndexerRegistration: IndexerRegistration, - IndexingError: IndexingError, - IndexingRule: IndexingRule, - POIDispute: POIDispute, - ReallocateAllocationResult: ReallocateAllocationResult, -} diff --git a/packages/indexer-common/src/schema/typeDefs.generated.ts b/packages/indexer-common/src/schema/typeDefs.generated.ts deleted file mode 100644 index 770cd39f1..000000000 --- a/packages/indexer-common/src/schema/typeDefs.generated.ts +++ /dev/null @@ -1,5358 +0,0 @@ -import type { DocumentNode } from 'graphql' -export const typeDefs = { - kind: 'Document', - definitions: [ - { - kind: 'ScalarTypeDefinition', - name: { kind: 'Name', value: 'BigInt', loc: { start: 7, end: 13 } }, - directives: [], - loc: { start: 0, end: 13 }, - }, - { - kind: 'EnumTypeDefinition', - name: { kind: 'Name', value: 'OrderDirection', loc: { start: 20, end: 34 } }, - directives: [], - values: [ - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'asc', loc: { start: 39, end: 42 } }, - directives: [], - loc: { start: 39, end: 42 }, - }, - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'desc', loc: { start: 45, end: 49 } }, - directives: [], - loc: { start: 45, end: 49 }, - }, - ], - loc: { start: 15, end: 51 }, - }, - { - kind: 'EnumTypeDefinition', - name: { kind: 'Name', value: 'IndexingDecisionBasis', loc: { start: 58, end: 79 } }, - directives: [], - values: [ - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'rules', loc: { start: 84, end: 89 } }, - directives: [], - loc: { start: 84, end: 89 }, - }, - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'never', loc: { start: 92, end: 97 } }, - directives: [], - loc: { start: 92, end: 97 }, - }, - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'always', loc: { start: 100, end: 106 } }, - directives: [], - loc: { start: 100, end: 106 }, - }, - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'offchain', loc: { start: 109, end: 117 } }, - directives: [], - loc: { start: 109, end: 117 }, - }, - ], - loc: { start: 53, end: 119 }, - }, - { - kind: 'EnumTypeDefinition', - name: { kind: 'Name', value: 'IdentifierType', loc: { start: 126, end: 140 } }, - directives: [], - values: [ - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'deployment', loc: { start: 145, end: 155 } }, - directives: [], - loc: { start: 145, end: 155 }, - }, - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'subgraph', loc: { start: 158, end: 166 } }, - directives: [], - loc: { start: 158, end: 166 }, - }, - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'group', loc: { start: 169, end: 174 } }, - directives: [], - loc: { start: 169, end: 174 }, - }, - ], - loc: { start: 121, end: 176 }, - }, - { - kind: 'InputObjectTypeDefinition', - name: { kind: 'Name', value: 'AllocationFilter', loc: { start: 184, end: 200 } }, - directives: [], - fields: [ - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'status', loc: { start: 205, end: 211 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 213, end: 219 } }, - loc: { start: 213, end: 219 }, - }, - directives: [], - loc: { start: 205, end: 219 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'allocation', loc: { start: 222, end: 232 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 234, end: 240 } }, - loc: { start: 234, end: 240 }, - }, - directives: [], - loc: { start: 222, end: 240 }, - }, - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'subgraphDeployment', - loc: { start: 243, end: 261 }, - }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 263, end: 269 } }, - loc: { start: 263, end: 269 }, - }, - directives: [], - loc: { start: 243, end: 269 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'protocolNetwork', loc: { start: 272, end: 287 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 289, end: 295 } }, - loc: { start: 289, end: 295 }, - }, - directives: [], - loc: { start: 272, end: 295 }, - }, - ], - loc: { start: 178, end: 297 }, - }, - { - kind: 'EnumTypeDefinition', - name: { kind: 'Name', value: 'AllocationStatus', loc: { start: 304, end: 320 } }, - directives: [], - values: [ - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'Null', loc: { start: 325, end: 329 } }, - directives: [], - loc: { start: 325, end: 329 }, - }, - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'Active', loc: { start: 332, end: 338 } }, - directives: [], - loc: { start: 332, end: 338 }, - }, - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'Closed', loc: { start: 341, end: 347 } }, - directives: [], - loc: { start: 341, end: 347 }, - }, - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'Finalized', loc: { start: 350, end: 359 } }, - directives: [], - loc: { start: 350, end: 359 }, - }, - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'Claimed', loc: { start: 362, end: 369 } }, - directives: [], - loc: { start: 362, end: 369 }, - }, - ], - loc: { start: 299, end: 371 }, - }, - { - kind: 'ObjectTypeDefinition', - name: { kind: 'Name', value: 'Allocation', loc: { start: 378, end: 388 } }, - interfaces: [], - directives: [], - fields: [ - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'id', loc: { start: 393, end: 395 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 397, end: 403 } }, - loc: { start: 397, end: 403 }, - }, - loc: { start: 397, end: 404 }, - }, - directives: [], - loc: { start: 393, end: 404 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'indexer', loc: { start: 407, end: 414 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 416, end: 422 } }, - loc: { start: 416, end: 422 }, - }, - loc: { start: 416, end: 423 }, - }, - directives: [], - loc: { start: 407, end: 423 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'subgraphDeployment', - loc: { start: 426, end: 444 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 446, end: 452 } }, - loc: { start: 446, end: 452 }, - }, - loc: { start: 446, end: 453 }, - }, - directives: [], - loc: { start: 426, end: 453 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'allocatedTokens', loc: { start: 456, end: 471 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 473, end: 479 } }, - loc: { start: 473, end: 479 }, - }, - loc: { start: 473, end: 480 }, - }, - directives: [], - loc: { start: 456, end: 480 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'createdAtEpoch', loc: { start: 483, end: 497 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Int', loc: { start: 499, end: 502 } }, - loc: { start: 499, end: 502 }, - }, - loc: { start: 499, end: 503 }, - }, - directives: [], - loc: { start: 483, end: 503 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'closedAtEpoch', loc: { start: 506, end: 519 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Int', loc: { start: 521, end: 524 } }, - loc: { start: 521, end: 524 }, - }, - directives: [], - loc: { start: 506, end: 524 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'ageInEpochs', loc: { start: 527, end: 538 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Int', loc: { start: 540, end: 543 } }, - loc: { start: 540, end: 543 }, - }, - loc: { start: 540, end: 544 }, - }, - directives: [], - loc: { start: 527, end: 544 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'indexingRewards', loc: { start: 547, end: 562 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 564, end: 570 } }, - loc: { start: 564, end: 570 }, - }, - loc: { start: 564, end: 571 }, - }, - directives: [], - loc: { start: 547, end: 571 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'queryFeesCollected', - loc: { start: 574, end: 592 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 594, end: 600 } }, - loc: { start: 594, end: 600 }, - }, - loc: { start: 594, end: 601 }, - }, - directives: [], - loc: { start: 574, end: 601 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'signalledTokens', loc: { start: 604, end: 619 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'BigInt', loc: { start: 621, end: 627 } }, - loc: { start: 621, end: 627 }, - }, - loc: { start: 621, end: 628 }, - }, - directives: [], - loc: { start: 604, end: 628 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'stakedTokens', loc: { start: 631, end: 643 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'BigInt', loc: { start: 645, end: 651 } }, - loc: { start: 645, end: 651 }, - }, - loc: { start: 645, end: 652 }, - }, - directives: [], - loc: { start: 631, end: 652 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'status', loc: { start: 655, end: 661 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'AllocationStatus', - loc: { start: 663, end: 679 }, - }, - loc: { start: 663, end: 679 }, - }, - loc: { start: 663, end: 680 }, - }, - directives: [], - loc: { start: 655, end: 680 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'protocolNetwork', loc: { start: 683, end: 698 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 700, end: 706 } }, - loc: { start: 700, end: 706 }, - }, - loc: { start: 700, end: 707 }, - }, - directives: [], - loc: { start: 683, end: 707 }, - }, - ], - loc: { start: 373, end: 709 }, - }, - { - kind: 'ObjectTypeDefinition', - name: { - kind: 'Name', - value: 'CreateAllocationResult', - loc: { start: 716, end: 738 }, - }, - interfaces: [], - directives: [], - fields: [ - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'allocation', loc: { start: 743, end: 753 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 755, end: 761 } }, - loc: { start: 755, end: 761 }, - }, - loc: { start: 755, end: 762 }, - }, - directives: [], - loc: { start: 743, end: 762 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'deployment', loc: { start: 765, end: 775 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 777, end: 783 } }, - loc: { start: 777, end: 783 }, - }, - loc: { start: 777, end: 784 }, - }, - directives: [], - loc: { start: 765, end: 784 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'allocatedTokens', loc: { start: 787, end: 802 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 804, end: 810 } }, - loc: { start: 804, end: 810 }, - }, - loc: { start: 804, end: 811 }, - }, - directives: [], - loc: { start: 787, end: 811 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'protocolNetwork', loc: { start: 814, end: 829 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 831, end: 837 } }, - loc: { start: 831, end: 837 }, - }, - loc: { start: 831, end: 838 }, - }, - directives: [], - loc: { start: 814, end: 838 }, - }, - ], - loc: { start: 711, end: 840 }, - }, - { - kind: 'ObjectTypeDefinition', - name: { - kind: 'Name', - value: 'CloseAllocationResult', - loc: { start: 847, end: 868 }, - }, - interfaces: [], - directives: [], - fields: [ - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'allocation', loc: { start: 873, end: 883 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 885, end: 891 } }, - loc: { start: 885, end: 891 }, - }, - loc: { start: 885, end: 892 }, - }, - directives: [], - loc: { start: 873, end: 892 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'allocatedTokens', loc: { start: 895, end: 910 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 912, end: 918 } }, - loc: { start: 912, end: 918 }, - }, - loc: { start: 912, end: 919 }, - }, - directives: [], - loc: { start: 895, end: 919 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'indexingRewards', loc: { start: 922, end: 937 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 939, end: 945 } }, - loc: { start: 939, end: 945 }, - }, - loc: { start: 939, end: 946 }, - }, - directives: [], - loc: { start: 922, end: 946 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'receiptsWorthCollecting', - loc: { start: 949, end: 972 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Boolean', loc: { start: 974, end: 981 } }, - loc: { start: 974, end: 981 }, - }, - loc: { start: 974, end: 982 }, - }, - directives: [], - loc: { start: 949, end: 982 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'protocolNetwork', - loc: { start: 985, end: 1000 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 1002, end: 1008 } }, - loc: { start: 1002, end: 1008 }, - }, - loc: { start: 1002, end: 1009 }, - }, - directives: [], - loc: { start: 985, end: 1009 }, - }, - ], - loc: { start: 842, end: 1011 }, - }, - { - kind: 'ObjectTypeDefinition', - name: { - kind: 'Name', - value: 'ReallocateAllocationResult', - loc: { start: 1018, end: 1044 }, - }, - interfaces: [], - directives: [], - fields: [ - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'closedAllocation', - loc: { start: 1049, end: 1065 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 1067, end: 1073 } }, - loc: { start: 1067, end: 1073 }, - }, - loc: { start: 1067, end: 1074 }, - }, - directives: [], - loc: { start: 1049, end: 1074 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'indexingRewardsCollected', - loc: { start: 1077, end: 1101 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 1103, end: 1109 } }, - loc: { start: 1103, end: 1109 }, - }, - loc: { start: 1103, end: 1110 }, - }, - directives: [], - loc: { start: 1077, end: 1110 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'receiptsWorthCollecting', - loc: { start: 1113, end: 1136 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Boolean', loc: { start: 1138, end: 1145 } }, - loc: { start: 1138, end: 1145 }, - }, - loc: { start: 1138, end: 1146 }, - }, - directives: [], - loc: { start: 1113, end: 1146 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'createdAllocation', - loc: { start: 1149, end: 1166 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 1168, end: 1174 } }, - loc: { start: 1168, end: 1174 }, - }, - loc: { start: 1168, end: 1175 }, - }, - directives: [], - loc: { start: 1149, end: 1175 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'createdAllocationStake', - loc: { start: 1178, end: 1200 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 1202, end: 1208 } }, - loc: { start: 1202, end: 1208 }, - }, - loc: { start: 1202, end: 1209 }, - }, - directives: [], - loc: { start: 1178, end: 1209 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'protocolNetwork', - loc: { start: 1212, end: 1227 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 1229, end: 1235 } }, - loc: { start: 1229, end: 1235 }, - }, - loc: { start: 1229, end: 1236 }, - }, - directives: [], - loc: { start: 1212, end: 1236 }, - }, - ], - loc: { start: 1013, end: 1238 }, - }, - { - kind: 'EnumTypeDefinition', - name: { kind: 'Name', value: 'ActionStatus', loc: { start: 1245, end: 1257 } }, - directives: [], - values: [ - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'queued', loc: { start: 1262, end: 1268 } }, - directives: [], - loc: { start: 1262, end: 1268 }, - }, - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'approved', loc: { start: 1271, end: 1279 } }, - directives: [], - loc: { start: 1271, end: 1279 }, - }, - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'pending', loc: { start: 1282, end: 1289 } }, - directives: [], - loc: { start: 1282, end: 1289 }, - }, - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'success', loc: { start: 1292, end: 1299 } }, - directives: [], - loc: { start: 1292, end: 1299 }, - }, - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'failed', loc: { start: 1302, end: 1308 } }, - directives: [], - loc: { start: 1302, end: 1308 }, - }, - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'canceled', loc: { start: 1311, end: 1319 } }, - directives: [], - loc: { start: 1311, end: 1319 }, - }, - ], - loc: { start: 1240, end: 1321 }, - }, - { - kind: 'EnumTypeDefinition', - name: { kind: 'Name', value: 'ActionType', loc: { start: 1328, end: 1338 } }, - directives: [], - values: [ - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'allocate', loc: { start: 1343, end: 1351 } }, - directives: [], - loc: { start: 1343, end: 1351 }, - }, - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'unallocate', loc: { start: 1354, end: 1364 } }, - directives: [], - loc: { start: 1354, end: 1364 }, - }, - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'reallocate', loc: { start: 1367, end: 1377 } }, - directives: [], - loc: { start: 1367, end: 1377 }, - }, - ], - loc: { start: 1323, end: 1379 }, - }, - { - kind: 'ObjectTypeDefinition', - name: { kind: 'Name', value: 'Action', loc: { start: 1386, end: 1392 } }, - interfaces: [], - directives: [], - fields: [ - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'id', loc: { start: 1397, end: 1399 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Int', loc: { start: 1401, end: 1404 } }, - loc: { start: 1401, end: 1404 }, - }, - loc: { start: 1401, end: 1405 }, - }, - directives: [], - loc: { start: 1397, end: 1405 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'status', loc: { start: 1408, end: 1414 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'ActionStatus', - loc: { start: 1416, end: 1428 }, - }, - loc: { start: 1416, end: 1428 }, - }, - loc: { start: 1416, end: 1429 }, - }, - directives: [], - loc: { start: 1408, end: 1429 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'type', loc: { start: 1432, end: 1436 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'ActionType', - loc: { start: 1438, end: 1448 }, - }, - loc: { start: 1438, end: 1448 }, - }, - loc: { start: 1438, end: 1449 }, - }, - directives: [], - loc: { start: 1432, end: 1449 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'deploymentID', loc: { start: 1452, end: 1464 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 1466, end: 1472 } }, - loc: { start: 1466, end: 1472 }, - }, - directives: [], - loc: { start: 1452, end: 1472 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'allocationID', loc: { start: 1475, end: 1487 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 1489, end: 1495 } }, - loc: { start: 1489, end: 1495 }, - }, - directives: [], - loc: { start: 1475, end: 1495 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'amount', loc: { start: 1498, end: 1504 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 1506, end: 1512 } }, - loc: { start: 1506, end: 1512 }, - }, - directives: [], - loc: { start: 1498, end: 1512 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'poi', loc: { start: 1515, end: 1518 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 1520, end: 1526 } }, - loc: { start: 1520, end: 1526 }, - }, - directives: [], - loc: { start: 1515, end: 1526 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'force', loc: { start: 1529, end: 1534 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Boolean', loc: { start: 1536, end: 1543 } }, - loc: { start: 1536, end: 1543 }, - }, - directives: [], - loc: { start: 1529, end: 1543 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'priority', loc: { start: 1546, end: 1554 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Int', loc: { start: 1556, end: 1559 } }, - loc: { start: 1556, end: 1559 }, - }, - loc: { start: 1556, end: 1560 }, - }, - directives: [], - loc: { start: 1546, end: 1560 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'source', loc: { start: 1563, end: 1569 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 1571, end: 1577 } }, - loc: { start: 1571, end: 1577 }, - }, - loc: { start: 1571, end: 1578 }, - }, - directives: [], - loc: { start: 1563, end: 1578 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'reason', loc: { start: 1581, end: 1587 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 1589, end: 1595 } }, - loc: { start: 1589, end: 1595 }, - }, - loc: { start: 1589, end: 1596 }, - }, - directives: [], - loc: { start: 1581, end: 1596 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'transaction', loc: { start: 1599, end: 1610 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 1612, end: 1618 } }, - loc: { start: 1612, end: 1618 }, - }, - directives: [], - loc: { start: 1599, end: 1618 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'failureReason', loc: { start: 1621, end: 1634 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 1636, end: 1642 } }, - loc: { start: 1636, end: 1642 }, - }, - directives: [], - loc: { start: 1621, end: 1642 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'createdAt', loc: { start: 1645, end: 1654 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'BigInt', loc: { start: 1656, end: 1662 } }, - loc: { start: 1656, end: 1662 }, - }, - loc: { start: 1656, end: 1663 }, - }, - directives: [], - loc: { start: 1645, end: 1663 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'updatedAt', loc: { start: 1666, end: 1675 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'BigInt', loc: { start: 1677, end: 1683 } }, - loc: { start: 1677, end: 1683 }, - }, - directives: [], - loc: { start: 1666, end: 1683 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'protocolNetwork', - loc: { start: 1686, end: 1701 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 1703, end: 1709 } }, - loc: { start: 1703, end: 1709 }, - }, - loc: { start: 1703, end: 1710 }, - }, - directives: [], - loc: { start: 1686, end: 1710 }, - }, - ], - loc: { start: 1381, end: 1712 }, - }, - { - kind: 'InputObjectTypeDefinition', - name: { kind: 'Name', value: 'ActionInput', loc: { start: 1720, end: 1731 } }, - directives: [], - fields: [ - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'status', loc: { start: 1736, end: 1742 } }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'ActionStatus', - loc: { start: 1744, end: 1756 }, - }, - loc: { start: 1744, end: 1756 }, - }, - loc: { start: 1744, end: 1757 }, - }, - directives: [], - loc: { start: 1736, end: 1757 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'type', loc: { start: 1760, end: 1764 } }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'ActionType', - loc: { start: 1766, end: 1776 }, - }, - loc: { start: 1766, end: 1776 }, - }, - loc: { start: 1766, end: 1777 }, - }, - directives: [], - loc: { start: 1760, end: 1777 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'deploymentID', loc: { start: 1780, end: 1792 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 1794, end: 1800 } }, - loc: { start: 1794, end: 1800 }, - }, - directives: [], - loc: { start: 1780, end: 1800 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'allocationID', loc: { start: 1803, end: 1815 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 1817, end: 1823 } }, - loc: { start: 1817, end: 1823 }, - }, - directives: [], - loc: { start: 1803, end: 1823 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'amount', loc: { start: 1826, end: 1832 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 1834, end: 1840 } }, - loc: { start: 1834, end: 1840 }, - }, - directives: [], - loc: { start: 1826, end: 1840 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'poi', loc: { start: 1843, end: 1846 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 1848, end: 1854 } }, - loc: { start: 1848, end: 1854 }, - }, - directives: [], - loc: { start: 1843, end: 1854 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'force', loc: { start: 1857, end: 1862 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Boolean', loc: { start: 1864, end: 1871 } }, - loc: { start: 1864, end: 1871 }, - }, - directives: [], - loc: { start: 1857, end: 1871 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'source', loc: { start: 1874, end: 1880 } }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 1882, end: 1888 } }, - loc: { start: 1882, end: 1888 }, - }, - loc: { start: 1882, end: 1889 }, - }, - directives: [], - loc: { start: 1874, end: 1889 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'reason', loc: { start: 1892, end: 1898 } }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 1900, end: 1906 } }, - loc: { start: 1900, end: 1906 }, - }, - loc: { start: 1900, end: 1907 }, - }, - directives: [], - loc: { start: 1892, end: 1907 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'priority', loc: { start: 1910, end: 1918 } }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Int', loc: { start: 1920, end: 1923 } }, - loc: { start: 1920, end: 1923 }, - }, - loc: { start: 1920, end: 1924 }, - }, - directives: [], - loc: { start: 1910, end: 1924 }, - }, - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'protocolNetwork', - loc: { start: 1927, end: 1942 }, - }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 1944, end: 1950 } }, - loc: { start: 1944, end: 1950 }, - }, - loc: { start: 1944, end: 1951 }, - }, - directives: [], - loc: { start: 1927, end: 1951 }, - }, - ], - loc: { start: 1714, end: 1953 }, - }, - { - kind: 'InputObjectTypeDefinition', - name: { kind: 'Name', value: 'ActionUpdateInput', loc: { start: 1961, end: 1978 } }, - directives: [], - fields: [ - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'id', loc: { start: 1983, end: 1985 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Int', loc: { start: 1987, end: 1990 } }, - loc: { start: 1987, end: 1990 }, - }, - directives: [], - loc: { start: 1983, end: 1990 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'deploymentID', loc: { start: 1993, end: 2005 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 2007, end: 2013 } }, - loc: { start: 2007, end: 2013 }, - }, - directives: [], - loc: { start: 1993, end: 2013 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'allocationID', loc: { start: 2016, end: 2028 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 2030, end: 2036 } }, - loc: { start: 2030, end: 2036 }, - }, - directives: [], - loc: { start: 2016, end: 2036 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'amount', loc: { start: 2039, end: 2045 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Int', loc: { start: 2047, end: 2050 } }, - loc: { start: 2047, end: 2050 }, - }, - directives: [], - loc: { start: 2039, end: 2050 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'poi', loc: { start: 2053, end: 2056 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 2058, end: 2064 } }, - loc: { start: 2058, end: 2064 }, - }, - directives: [], - loc: { start: 2053, end: 2064 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'force', loc: { start: 2067, end: 2072 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Boolean', loc: { start: 2074, end: 2081 } }, - loc: { start: 2074, end: 2081 }, - }, - directives: [], - loc: { start: 2067, end: 2081 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'type', loc: { start: 2084, end: 2088 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'ActionType', loc: { start: 2090, end: 2100 } }, - loc: { start: 2090, end: 2100 }, - }, - directives: [], - loc: { start: 2084, end: 2100 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'status', loc: { start: 2103, end: 2109 } }, - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'ActionStatus', - loc: { start: 2111, end: 2123 }, - }, - loc: { start: 2111, end: 2123 }, - }, - directives: [], - loc: { start: 2103, end: 2123 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'reason', loc: { start: 2126, end: 2132 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 2134, end: 2140 } }, - loc: { start: 2134, end: 2140 }, - }, - directives: [], - loc: { start: 2126, end: 2140 }, - }, - ], - loc: { start: 1955, end: 2142 }, - }, - { - kind: 'EnumTypeDefinition', - name: { kind: 'Name', value: 'ActionParams', loc: { start: 2149, end: 2161 } }, - directives: [], - values: [ - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'id', loc: { start: 2166, end: 2168 } }, - directives: [], - loc: { start: 2166, end: 2168 }, - }, - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'status', loc: { start: 2171, end: 2177 } }, - directives: [], - loc: { start: 2171, end: 2177 }, - }, - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'type', loc: { start: 2180, end: 2184 } }, - directives: [], - loc: { start: 2180, end: 2184 }, - }, - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'deploymentID', loc: { start: 2187, end: 2199 } }, - directives: [], - loc: { start: 2187, end: 2199 }, - }, - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'allocationID', loc: { start: 2202, end: 2214 } }, - directives: [], - loc: { start: 2202, end: 2214 }, - }, - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'transaction', loc: { start: 2217, end: 2228 } }, - directives: [], - loc: { start: 2217, end: 2228 }, - }, - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'amount', loc: { start: 2231, end: 2237 } }, - directives: [], - loc: { start: 2231, end: 2237 }, - }, - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'poi', loc: { start: 2240, end: 2243 } }, - directives: [], - loc: { start: 2240, end: 2243 }, - }, - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'force', loc: { start: 2246, end: 2251 } }, - directives: [], - loc: { start: 2246, end: 2251 }, - }, - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'source', loc: { start: 2254, end: 2260 } }, - directives: [], - loc: { start: 2254, end: 2260 }, - }, - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'reason', loc: { start: 2263, end: 2269 } }, - directives: [], - loc: { start: 2263, end: 2269 }, - }, - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'priority', loc: { start: 2272, end: 2280 } }, - directives: [], - loc: { start: 2272, end: 2280 }, - }, - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'createdAt', loc: { start: 2283, end: 2292 } }, - directives: [], - loc: { start: 2283, end: 2292 }, - }, - { - kind: 'EnumValueDefinition', - name: { kind: 'Name', value: 'updatedAt', loc: { start: 2295, end: 2304 } }, - directives: [], - loc: { start: 2295, end: 2304 }, - }, - { - kind: 'EnumValueDefinition', - name: { - kind: 'Name', - value: 'protocolNetwork', - loc: { start: 2307, end: 2322 }, - }, - directives: [], - loc: { start: 2307, end: 2322 }, - }, - ], - loc: { start: 2144, end: 2324 }, - }, - { - kind: 'ObjectTypeDefinition', - name: { kind: 'Name', value: 'ActionResult', loc: { start: 2331, end: 2343 } }, - interfaces: [], - directives: [], - fields: [ - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'id', loc: { start: 2348, end: 2350 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Int', loc: { start: 2352, end: 2355 } }, - loc: { start: 2352, end: 2355 }, - }, - loc: { start: 2352, end: 2356 }, - }, - directives: [], - loc: { start: 2348, end: 2356 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'type', loc: { start: 2359, end: 2363 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'ActionType', - loc: { start: 2365, end: 2375 }, - }, - loc: { start: 2365, end: 2375 }, - }, - loc: { start: 2365, end: 2376 }, - }, - directives: [], - loc: { start: 2359, end: 2376 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'deploymentID', loc: { start: 2379, end: 2391 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 2393, end: 2399 } }, - loc: { start: 2393, end: 2399 }, - }, - directives: [], - loc: { start: 2379, end: 2399 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'allocationID', loc: { start: 2402, end: 2414 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 2416, end: 2422 } }, - loc: { start: 2416, end: 2422 }, - }, - directives: [], - loc: { start: 2402, end: 2422 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'amount', loc: { start: 2425, end: 2431 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 2433, end: 2439 } }, - loc: { start: 2433, end: 2439 }, - }, - directives: [], - loc: { start: 2425, end: 2439 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'poi', loc: { start: 2442, end: 2445 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 2447, end: 2453 } }, - loc: { start: 2447, end: 2453 }, - }, - directives: [], - loc: { start: 2442, end: 2453 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'force', loc: { start: 2456, end: 2461 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Boolean', loc: { start: 2463, end: 2470 } }, - loc: { start: 2463, end: 2470 }, - }, - directives: [], - loc: { start: 2456, end: 2470 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'source', loc: { start: 2473, end: 2479 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 2481, end: 2487 } }, - loc: { start: 2481, end: 2487 }, - }, - loc: { start: 2481, end: 2488 }, - }, - directives: [], - loc: { start: 2473, end: 2488 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'reason', loc: { start: 2491, end: 2497 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 2499, end: 2505 } }, - loc: { start: 2499, end: 2505 }, - }, - loc: { start: 2499, end: 2506 }, - }, - directives: [], - loc: { start: 2491, end: 2506 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'status', loc: { start: 2509, end: 2515 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 2517, end: 2523 } }, - loc: { start: 2517, end: 2523 }, - }, - loc: { start: 2517, end: 2524 }, - }, - directives: [], - loc: { start: 2509, end: 2524 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'transaction', loc: { start: 2527, end: 2538 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 2540, end: 2546 } }, - loc: { start: 2540, end: 2546 }, - }, - directives: [], - loc: { start: 2527, end: 2546 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'failureReason', loc: { start: 2549, end: 2562 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 2564, end: 2570 } }, - loc: { start: 2564, end: 2570 }, - }, - directives: [], - loc: { start: 2549, end: 2570 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'priority', loc: { start: 2573, end: 2581 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Int', loc: { start: 2583, end: 2586 } }, - loc: { start: 2583, end: 2586 }, - }, - directives: [], - loc: { start: 2573, end: 2586 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'protocolNetwork', - loc: { start: 2589, end: 2604 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 2606, end: 2612 } }, - loc: { start: 2606, end: 2612 }, - }, - loc: { start: 2606, end: 2613 }, - }, - directives: [], - loc: { start: 2589, end: 2613 }, - }, - ], - loc: { start: 2326, end: 2615 }, - }, - { - kind: 'InputObjectTypeDefinition', - name: { kind: 'Name', value: 'ActionFilter', loc: { start: 2623, end: 2635 } }, - directives: [], - fields: [ - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'id', loc: { start: 2640, end: 2642 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Int', loc: { start: 2644, end: 2647 } }, - loc: { start: 2644, end: 2647 }, - }, - directives: [], - loc: { start: 2640, end: 2647 }, - }, - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'protocolNetwork', - loc: { start: 2650, end: 2665 }, - }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 2667, end: 2673 } }, - loc: { start: 2667, end: 2673 }, - }, - directives: [], - loc: { start: 2650, end: 2673 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'type', loc: { start: 2676, end: 2680 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'ActionType', loc: { start: 2682, end: 2692 } }, - loc: { start: 2682, end: 2692 }, - }, - directives: [], - loc: { start: 2676, end: 2692 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'status', loc: { start: 2695, end: 2701 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 2703, end: 2709 } }, - loc: { start: 2703, end: 2709 }, - }, - directives: [], - loc: { start: 2695, end: 2709 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'source', loc: { start: 2712, end: 2718 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 2720, end: 2726 } }, - loc: { start: 2720, end: 2726 }, - }, - directives: [], - loc: { start: 2712, end: 2726 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'reason', loc: { start: 2729, end: 2735 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 2737, end: 2743 } }, - loc: { start: 2737, end: 2743 }, - }, - directives: [], - loc: { start: 2729, end: 2743 }, - }, - ], - loc: { start: 2617, end: 2745 }, - }, - { - kind: 'InputObjectTypeDefinition', - name: { - kind: 'Name', - value: 'POIDisputeIdentifier', - loc: { start: 2753, end: 2773 }, - }, - directives: [], - fields: [ - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'allocationID', loc: { start: 2778, end: 2790 } }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 2792, end: 2798 } }, - loc: { start: 2792, end: 2798 }, - }, - loc: { start: 2792, end: 2799 }, - }, - directives: [], - loc: { start: 2778, end: 2799 }, - }, - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'protocolNetwork', - loc: { start: 2802, end: 2817 }, - }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 2819, end: 2825 } }, - loc: { start: 2819, end: 2825 }, - }, - loc: { start: 2819, end: 2826 }, - }, - directives: [], - loc: { start: 2802, end: 2826 }, - }, - ], - loc: { start: 2747, end: 2828 }, - }, - { - kind: 'ObjectTypeDefinition', - name: { kind: 'Name', value: 'POIDispute', loc: { start: 2835, end: 2845 } }, - interfaces: [], - directives: [], - fields: [ - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'allocationID', loc: { start: 2850, end: 2862 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 2864, end: 2870 } }, - loc: { start: 2864, end: 2870 }, - }, - loc: { start: 2864, end: 2871 }, - }, - directives: [], - loc: { start: 2850, end: 2871 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'subgraphDeploymentID', - loc: { start: 2874, end: 2894 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 2896, end: 2902 } }, - loc: { start: 2896, end: 2902 }, - }, - loc: { start: 2896, end: 2903 }, - }, - directives: [], - loc: { start: 2874, end: 2903 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'allocationIndexer', - loc: { start: 2906, end: 2923 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 2925, end: 2931 } }, - loc: { start: 2925, end: 2931 }, - }, - loc: { start: 2925, end: 2932 }, - }, - directives: [], - loc: { start: 2906, end: 2932 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'allocationAmount', - loc: { start: 2935, end: 2951 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'BigInt', loc: { start: 2953, end: 2959 } }, - loc: { start: 2953, end: 2959 }, - }, - loc: { start: 2953, end: 2960 }, - }, - directives: [], - loc: { start: 2935, end: 2960 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'allocationProof', - loc: { start: 2963, end: 2978 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 2980, end: 2986 } }, - loc: { start: 2980, end: 2986 }, - }, - loc: { start: 2980, end: 2987 }, - }, - directives: [], - loc: { start: 2963, end: 2987 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'closedEpoch', loc: { start: 2990, end: 3001 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Int', loc: { start: 3003, end: 3006 } }, - loc: { start: 3003, end: 3006 }, - }, - loc: { start: 3003, end: 3007 }, - }, - directives: [], - loc: { start: 2990, end: 3007 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'closedEpochStartBlockHash', - loc: { start: 3010, end: 3035 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 3037, end: 3043 } }, - loc: { start: 3037, end: 3043 }, - }, - loc: { start: 3037, end: 3044 }, - }, - directives: [], - loc: { start: 3010, end: 3044 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'closedEpochStartBlockNumber', - loc: { start: 3047, end: 3074 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Int', loc: { start: 3076, end: 3079 } }, - loc: { start: 3076, end: 3079 }, - }, - loc: { start: 3076, end: 3080 }, - }, - directives: [], - loc: { start: 3047, end: 3080 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'closedEpochReferenceProof', - loc: { start: 3083, end: 3108 }, - }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 3110, end: 3116 } }, - loc: { start: 3110, end: 3116 }, - }, - directives: [], - loc: { start: 3083, end: 3116 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'previousEpochStartBlockHash', - loc: { start: 3119, end: 3146 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 3148, end: 3154 } }, - loc: { start: 3148, end: 3154 }, - }, - loc: { start: 3148, end: 3155 }, - }, - directives: [], - loc: { start: 3119, end: 3155 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'previousEpochStartBlockNumber', - loc: { start: 3158, end: 3187 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Int', loc: { start: 3189, end: 3192 } }, - loc: { start: 3189, end: 3192 }, - }, - loc: { start: 3189, end: 3193 }, - }, - directives: [], - loc: { start: 3158, end: 3193 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'previousEpochReferenceProof', - loc: { start: 3196, end: 3223 }, - }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 3225, end: 3231 } }, - loc: { start: 3225, end: 3231 }, - }, - directives: [], - loc: { start: 3196, end: 3231 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'status', loc: { start: 3234, end: 3240 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 3242, end: 3248 } }, - loc: { start: 3242, end: 3248 }, - }, - loc: { start: 3242, end: 3249 }, - }, - directives: [], - loc: { start: 3234, end: 3249 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'protocolNetwork', - loc: { start: 3252, end: 3267 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 3269, end: 3275 } }, - loc: { start: 3269, end: 3275 }, - }, - loc: { start: 3269, end: 3276 }, - }, - directives: [], - loc: { start: 3252, end: 3276 }, - }, - ], - loc: { start: 2830, end: 3278 }, - }, - { - kind: 'InputObjectTypeDefinition', - name: { kind: 'Name', value: 'POIDisputeInput', loc: { start: 3286, end: 3301 } }, - directives: [], - fields: [ - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'allocationID', loc: { start: 3306, end: 3318 } }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 3320, end: 3326 } }, - loc: { start: 3320, end: 3326 }, - }, - loc: { start: 3320, end: 3327 }, - }, - directives: [], - loc: { start: 3306, end: 3327 }, - }, - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'subgraphDeploymentID', - loc: { start: 3330, end: 3350 }, - }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 3352, end: 3358 } }, - loc: { start: 3352, end: 3358 }, - }, - loc: { start: 3352, end: 3359 }, - }, - directives: [], - loc: { start: 3330, end: 3359 }, - }, - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'allocationIndexer', - loc: { start: 3362, end: 3379 }, - }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 3381, end: 3387 } }, - loc: { start: 3381, end: 3387 }, - }, - loc: { start: 3381, end: 3388 }, - }, - directives: [], - loc: { start: 3362, end: 3388 }, - }, - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'allocationAmount', - loc: { start: 3391, end: 3407 }, - }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'BigInt', loc: { start: 3409, end: 3415 } }, - loc: { start: 3409, end: 3415 }, - }, - loc: { start: 3409, end: 3416 }, - }, - directives: [], - loc: { start: 3391, end: 3416 }, - }, - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'allocationProof', - loc: { start: 3419, end: 3434 }, - }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 3436, end: 3442 } }, - loc: { start: 3436, end: 3442 }, - }, - loc: { start: 3436, end: 3443 }, - }, - directives: [], - loc: { start: 3419, end: 3443 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'closedEpoch', loc: { start: 3446, end: 3457 } }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Int', loc: { start: 3459, end: 3462 } }, - loc: { start: 3459, end: 3462 }, - }, - loc: { start: 3459, end: 3463 }, - }, - directives: [], - loc: { start: 3446, end: 3463 }, - }, - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'closedEpochStartBlockHash', - loc: { start: 3466, end: 3491 }, - }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 3493, end: 3499 } }, - loc: { start: 3493, end: 3499 }, - }, - loc: { start: 3493, end: 3500 }, - }, - directives: [], - loc: { start: 3466, end: 3500 }, - }, - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'closedEpochStartBlockNumber', - loc: { start: 3503, end: 3530 }, - }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Int', loc: { start: 3532, end: 3535 } }, - loc: { start: 3532, end: 3535 }, - }, - loc: { start: 3532, end: 3536 }, - }, - directives: [], - loc: { start: 3503, end: 3536 }, - }, - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'closedEpochReferenceProof', - loc: { start: 3539, end: 3564 }, - }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 3566, end: 3572 } }, - loc: { start: 3566, end: 3572 }, - }, - directives: [], - loc: { start: 3539, end: 3572 }, - }, - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'previousEpochStartBlockHash', - loc: { start: 3575, end: 3602 }, - }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 3604, end: 3610 } }, - loc: { start: 3604, end: 3610 }, - }, - loc: { start: 3604, end: 3611 }, - }, - directives: [], - loc: { start: 3575, end: 3611 }, - }, - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'previousEpochStartBlockNumber', - loc: { start: 3614, end: 3643 }, - }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Int', loc: { start: 3645, end: 3648 } }, - loc: { start: 3645, end: 3648 }, - }, - loc: { start: 3645, end: 3649 }, - }, - directives: [], - loc: { start: 3614, end: 3649 }, - }, - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'previousEpochReferenceProof', - loc: { start: 3652, end: 3679 }, - }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 3681, end: 3687 } }, - loc: { start: 3681, end: 3687 }, - }, - directives: [], - loc: { start: 3652, end: 3687 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'status', loc: { start: 3690, end: 3696 } }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 3698, end: 3704 } }, - loc: { start: 3698, end: 3704 }, - }, - loc: { start: 3698, end: 3705 }, - }, - directives: [], - loc: { start: 3690, end: 3705 }, - }, - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'protocolNetwork', - loc: { start: 3708, end: 3723 }, - }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 3725, end: 3731 } }, - loc: { start: 3725, end: 3731 }, - }, - loc: { start: 3725, end: 3732 }, - }, - directives: [], - loc: { start: 3708, end: 3732 }, - }, - ], - loc: { start: 3280, end: 3734 }, - }, - { - kind: 'ObjectTypeDefinition', - name: { kind: 'Name', value: 'IndexingRule', loc: { start: 3741, end: 3753 } }, - interfaces: [], - directives: [], - fields: [ - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'identifier', loc: { start: 3758, end: 3768 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 3770, end: 3776 } }, - loc: { start: 3770, end: 3776 }, - }, - loc: { start: 3770, end: 3777 }, - }, - directives: [], - loc: { start: 3758, end: 3777 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'identifierType', - loc: { start: 3780, end: 3794 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'IdentifierType', - loc: { start: 3796, end: 3810 }, - }, - loc: { start: 3796, end: 3810 }, - }, - loc: { start: 3796, end: 3811 }, - }, - directives: [], - loc: { start: 3780, end: 3811 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'allocationAmount', - loc: { start: 3814, end: 3830 }, - }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'BigInt', loc: { start: 3832, end: 3838 } }, - loc: { start: 3832, end: 3838 }, - }, - directives: [], - loc: { start: 3814, end: 3838 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'allocationLifetime', - loc: { start: 3841, end: 3859 }, - }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Int', loc: { start: 3861, end: 3864 } }, - loc: { start: 3861, end: 3864 }, - }, - directives: [], - loc: { start: 3841, end: 3864 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'autoRenewal', loc: { start: 3867, end: 3878 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Boolean', loc: { start: 3880, end: 3887 } }, - loc: { start: 3880, end: 3887 }, - }, - loc: { start: 3880, end: 3888 }, - }, - directives: [], - loc: { start: 3867, end: 3888 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'parallelAllocations', - loc: { start: 3891, end: 3910 }, - }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Int', loc: { start: 3912, end: 3915 } }, - loc: { start: 3912, end: 3915 }, - }, - directives: [], - loc: { start: 3891, end: 3915 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'maxAllocationPercentage', - loc: { start: 3918, end: 3941 }, - }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Float', loc: { start: 3943, end: 3948 } }, - loc: { start: 3943, end: 3948 }, - }, - directives: [], - loc: { start: 3918, end: 3948 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'minSignal', loc: { start: 3951, end: 3960 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'BigInt', loc: { start: 3962, end: 3968 } }, - loc: { start: 3962, end: 3968 }, - }, - directives: [], - loc: { start: 3951, end: 3968 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'maxSignal', loc: { start: 3971, end: 3980 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'BigInt', loc: { start: 3982, end: 3988 } }, - loc: { start: 3982, end: 3988 }, - }, - directives: [], - loc: { start: 3971, end: 3988 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'minStake', loc: { start: 3991, end: 3999 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'BigInt', loc: { start: 4001, end: 4007 } }, - loc: { start: 4001, end: 4007 }, - }, - directives: [], - loc: { start: 3991, end: 4007 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'minAverageQueryFees', - loc: { start: 4010, end: 4029 }, - }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'BigInt', loc: { start: 4031, end: 4037 } }, - loc: { start: 4031, end: 4037 }, - }, - directives: [], - loc: { start: 4010, end: 4037 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'custom', loc: { start: 4040, end: 4046 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 4048, end: 4054 } }, - loc: { start: 4048, end: 4054 }, - }, - directives: [], - loc: { start: 4040, end: 4054 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'decisionBasis', loc: { start: 4057, end: 4070 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'IndexingDecisionBasis', - loc: { start: 4072, end: 4093 }, - }, - loc: { start: 4072, end: 4093 }, - }, - loc: { start: 4072, end: 4094 }, - }, - directives: [], - loc: { start: 4057, end: 4094 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'requireSupported', - loc: { start: 4097, end: 4113 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Boolean', loc: { start: 4115, end: 4122 } }, - loc: { start: 4115, end: 4122 }, - }, - loc: { start: 4115, end: 4123 }, - }, - directives: [], - loc: { start: 4097, end: 4123 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'safety', loc: { start: 4126, end: 4132 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Boolean', loc: { start: 4134, end: 4141 } }, - loc: { start: 4134, end: 4141 }, - }, - loc: { start: 4134, end: 4142 }, - }, - directives: [], - loc: { start: 4126, end: 4142 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'protocolNetwork', - loc: { start: 4145, end: 4160 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 4162, end: 4168 } }, - loc: { start: 4162, end: 4168 }, - }, - loc: { start: 4162, end: 4169 }, - }, - directives: [], - loc: { start: 4145, end: 4169 }, - }, - ], - loc: { start: 3736, end: 4171 }, - }, - { - kind: 'InputObjectTypeDefinition', - name: { kind: 'Name', value: 'IndexingRuleInput', loc: { start: 4179, end: 4196 } }, - directives: [], - fields: [ - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'identifier', loc: { start: 4201, end: 4211 } }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 4213, end: 4219 } }, - loc: { start: 4213, end: 4219 }, - }, - loc: { start: 4213, end: 4220 }, - }, - directives: [], - loc: { start: 4201, end: 4220 }, - }, - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'identifierType', - loc: { start: 4223, end: 4237 }, - }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'IdentifierType', - loc: { start: 4239, end: 4253 }, - }, - loc: { start: 4239, end: 4253 }, - }, - loc: { start: 4239, end: 4254 }, - }, - directives: [], - loc: { start: 4223, end: 4254 }, - }, - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'allocationAmount', - loc: { start: 4257, end: 4273 }, - }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'BigInt', loc: { start: 4275, end: 4281 } }, - loc: { start: 4275, end: 4281 }, - }, - directives: [], - loc: { start: 4257, end: 4281 }, - }, - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'allocationLifetime', - loc: { start: 4284, end: 4302 }, - }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Int', loc: { start: 4304, end: 4307 } }, - loc: { start: 4304, end: 4307 }, - }, - directives: [], - loc: { start: 4284, end: 4307 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'autoRenewal', loc: { start: 4310, end: 4321 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Boolean', loc: { start: 4323, end: 4330 } }, - loc: { start: 4323, end: 4330 }, - }, - directives: [], - loc: { start: 4310, end: 4330 }, - }, - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'parallelAllocations', - loc: { start: 4333, end: 4352 }, - }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Int', loc: { start: 4354, end: 4357 } }, - loc: { start: 4354, end: 4357 }, - }, - directives: [], - loc: { start: 4333, end: 4357 }, - }, - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'maxAllocationPercentage', - loc: { start: 4360, end: 4383 }, - }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Float', loc: { start: 4385, end: 4390 } }, - loc: { start: 4385, end: 4390 }, - }, - directives: [], - loc: { start: 4360, end: 4390 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'minSignal', loc: { start: 4393, end: 4402 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'BigInt', loc: { start: 4404, end: 4410 } }, - loc: { start: 4404, end: 4410 }, - }, - directives: [], - loc: { start: 4393, end: 4410 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'maxSignal', loc: { start: 4413, end: 4422 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'BigInt', loc: { start: 4424, end: 4430 } }, - loc: { start: 4424, end: 4430 }, - }, - directives: [], - loc: { start: 4413, end: 4430 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'minStake', loc: { start: 4433, end: 4441 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'BigInt', loc: { start: 4443, end: 4449 } }, - loc: { start: 4443, end: 4449 }, - }, - directives: [], - loc: { start: 4433, end: 4449 }, - }, - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'minAverageQueryFees', - loc: { start: 4452, end: 4471 }, - }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'BigInt', loc: { start: 4473, end: 4479 } }, - loc: { start: 4473, end: 4479 }, - }, - directives: [], - loc: { start: 4452, end: 4479 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'custom', loc: { start: 4482, end: 4488 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 4490, end: 4496 } }, - loc: { start: 4490, end: 4496 }, - }, - directives: [], - loc: { start: 4482, end: 4496 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'decisionBasis', loc: { start: 4499, end: 4512 } }, - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'IndexingDecisionBasis', - loc: { start: 4514, end: 4535 }, - }, - loc: { start: 4514, end: 4535 }, - }, - directives: [], - loc: { start: 4499, end: 4535 }, - }, - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'requireSupported', - loc: { start: 4538, end: 4554 }, - }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Boolean', loc: { start: 4556, end: 4563 } }, - loc: { start: 4556, end: 4563 }, - }, - directives: [], - loc: { start: 4538, end: 4563 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'safety', loc: { start: 4566, end: 4572 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Boolean', loc: { start: 4574, end: 4581 } }, - loc: { start: 4574, end: 4581 }, - }, - directives: [], - loc: { start: 4566, end: 4581 }, - }, - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'protocolNetwork', - loc: { start: 4584, end: 4599 }, - }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 4601, end: 4607 } }, - loc: { start: 4601, end: 4607 }, - }, - loc: { start: 4601, end: 4608 }, - }, - directives: [], - loc: { start: 4584, end: 4608 }, - }, - ], - loc: { start: 4173, end: 4610 }, - }, - { - kind: 'InputObjectTypeDefinition', - name: { - kind: 'Name', - value: 'IndexingRuleIdentifier', - loc: { start: 4618, end: 4640 }, - }, - directives: [], - fields: [ - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'identifier', loc: { start: 4645, end: 4655 } }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 4657, end: 4663 } }, - loc: { start: 4657, end: 4663 }, - }, - loc: { start: 4657, end: 4664 }, - }, - directives: [], - loc: { start: 4645, end: 4664 }, - }, - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'protocolNetwork', - loc: { start: 4667, end: 4682 }, - }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 4684, end: 4690 } }, - loc: { start: 4684, end: 4690 }, - }, - loc: { start: 4684, end: 4691 }, - }, - directives: [], - loc: { start: 4667, end: 4691 }, - }, - ], - loc: { start: 4612, end: 4693 }, - }, - { - kind: 'ObjectTypeDefinition', - name: { kind: 'Name', value: 'GeoLocation', loc: { start: 4700, end: 4711 } }, - interfaces: [], - directives: [], - fields: [ - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'latitude', loc: { start: 4716, end: 4724 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 4726, end: 4732 } }, - loc: { start: 4726, end: 4732 }, - }, - loc: { start: 4726, end: 4733 }, - }, - directives: [], - loc: { start: 4716, end: 4733 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'longitude', loc: { start: 4736, end: 4745 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 4747, end: 4753 } }, - loc: { start: 4747, end: 4753 }, - }, - loc: { start: 4747, end: 4754 }, - }, - directives: [], - loc: { start: 4736, end: 4754 }, - }, - ], - loc: { start: 4695, end: 4756 }, - }, - { - kind: 'ObjectTypeDefinition', - name: { - kind: 'Name', - value: 'IndexerRegistration', - loc: { start: 4763, end: 4782 }, - }, - interfaces: [], - directives: [], - fields: [ - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'url', loc: { start: 4787, end: 4790 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 4792, end: 4798 } }, - loc: { start: 4792, end: 4798 }, - }, - directives: [], - loc: { start: 4787, end: 4798 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'protocolNetwork', - loc: { start: 4801, end: 4816 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 4818, end: 4824 } }, - loc: { start: 4818, end: 4824 }, - }, - loc: { start: 4818, end: 4825 }, - }, - directives: [], - loc: { start: 4801, end: 4825 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'address', loc: { start: 4828, end: 4835 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 4837, end: 4843 } }, - loc: { start: 4837, end: 4843 }, - }, - directives: [], - loc: { start: 4828, end: 4843 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'registered', loc: { start: 4846, end: 4856 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Boolean', loc: { start: 4858, end: 4865 } }, - loc: { start: 4858, end: 4865 }, - }, - loc: { start: 4858, end: 4866 }, - }, - directives: [], - loc: { start: 4846, end: 4866 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'location', loc: { start: 4869, end: 4877 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'GeoLocation', loc: { start: 4879, end: 4890 } }, - loc: { start: 4879, end: 4890 }, - }, - directives: [], - loc: { start: 4869, end: 4890 }, - }, - ], - loc: { start: 4758, end: 4892 }, - }, - { - kind: 'ObjectTypeDefinition', - name: { kind: 'Name', value: 'IndexingError', loc: { start: 4899, end: 4912 } }, - interfaces: [], - directives: [], - fields: [ - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'handler', loc: { start: 4917, end: 4924 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 4926, end: 4932 } }, - loc: { start: 4926, end: 4932 }, - }, - directives: [], - loc: { start: 4917, end: 4932 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'message', loc: { start: 4935, end: 4942 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 4944, end: 4950 } }, - loc: { start: 4944, end: 4950 }, - }, - loc: { start: 4944, end: 4951 }, - }, - directives: [], - loc: { start: 4935, end: 4951 }, - }, - ], - loc: { start: 4894, end: 4953 }, - }, - { - kind: 'ObjectTypeDefinition', - name: { kind: 'Name', value: 'BlockPointer', loc: { start: 4960, end: 4972 } }, - interfaces: [], - directives: [], - fields: [ - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'number', loc: { start: 4977, end: 4983 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Int', loc: { start: 4985, end: 4988 } }, - loc: { start: 4985, end: 4988 }, - }, - loc: { start: 4985, end: 4989 }, - }, - directives: [], - loc: { start: 4977, end: 4989 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'hash', loc: { start: 4992, end: 4996 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 4998, end: 5004 } }, - loc: { start: 4998, end: 5004 }, - }, - loc: { start: 4998, end: 5005 }, - }, - directives: [], - loc: { start: 4992, end: 5005 }, - }, - ], - loc: { start: 4955, end: 5007 }, - }, - { - kind: 'ObjectTypeDefinition', - name: { - kind: 'Name', - value: 'ChainIndexingStatus', - loc: { start: 5014, end: 5033 }, - }, - interfaces: [], - directives: [], - fields: [ - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'network', loc: { start: 5038, end: 5045 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 5047, end: 5053 } }, - loc: { start: 5047, end: 5053 }, - }, - loc: { start: 5047, end: 5054 }, - }, - directives: [], - loc: { start: 5038, end: 5054 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'latestBlock', loc: { start: 5057, end: 5068 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'BlockPointer', - loc: { start: 5070, end: 5082 }, - }, - loc: { start: 5070, end: 5082 }, - }, - directives: [], - loc: { start: 5057, end: 5082 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'chainHeadBlock', - loc: { start: 5085, end: 5099 }, - }, - arguments: [], - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'BlockPointer', - loc: { start: 5101, end: 5113 }, - }, - loc: { start: 5101, end: 5113 }, - }, - directives: [], - loc: { start: 5085, end: 5113 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'earliestBlock', loc: { start: 5116, end: 5129 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'BlockPointer', - loc: { start: 5131, end: 5143 }, - }, - loc: { start: 5131, end: 5143 }, - }, - directives: [], - loc: { start: 5116, end: 5143 }, - }, - ], - loc: { start: 5009, end: 5145 }, - }, - { - kind: 'ObjectTypeDefinition', - name: { kind: 'Name', value: 'IndexerDeployment', loc: { start: 5152, end: 5169 } }, - interfaces: [], - directives: [], - fields: [ - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'subgraphDeployment', - loc: { start: 5174, end: 5192 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 5194, end: 5200 } }, - loc: { start: 5194, end: 5200 }, - }, - loc: { start: 5194, end: 5201 }, - }, - directives: [], - loc: { start: 5174, end: 5201 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'synced', loc: { start: 5204, end: 5210 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Boolean', loc: { start: 5212, end: 5219 } }, - loc: { start: 5212, end: 5219 }, - }, - loc: { start: 5212, end: 5220 }, - }, - directives: [], - loc: { start: 5204, end: 5220 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'health', loc: { start: 5223, end: 5229 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 5231, end: 5237 } }, - loc: { start: 5231, end: 5237 }, - }, - loc: { start: 5231, end: 5238 }, - }, - directives: [], - loc: { start: 5223, end: 5238 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'fatalError', loc: { start: 5241, end: 5251 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'IndexingError', - loc: { start: 5253, end: 5266 }, - }, - loc: { start: 5253, end: 5266 }, - }, - directives: [], - loc: { start: 5241, end: 5266 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'node', loc: { start: 5269, end: 5273 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 5275, end: 5281 } }, - loc: { start: 5275, end: 5281 }, - }, - directives: [], - loc: { start: 5269, end: 5281 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'chains', loc: { start: 5284, end: 5290 } }, - arguments: [], - type: { - kind: 'ListType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'ChainIndexingStatus', - loc: { start: 5293, end: 5312 }, - }, - loc: { start: 5293, end: 5312 }, - }, - loc: { start: 5292, end: 5313 }, - }, - directives: [], - loc: { start: 5284, end: 5313 }, - }, - ], - loc: { start: 5147, end: 5315 }, - }, - { - kind: 'ObjectTypeDefinition', - name: { kind: 'Name', value: 'IndexerAllocation', loc: { start: 5322, end: 5339 } }, - interfaces: [], - directives: [], - fields: [ - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'id', loc: { start: 5344, end: 5346 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 5348, end: 5354 } }, - loc: { start: 5348, end: 5354 }, - }, - loc: { start: 5348, end: 5355 }, - }, - directives: [], - loc: { start: 5344, end: 5355 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'allocatedTokens', - loc: { start: 5358, end: 5373 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'BigInt', loc: { start: 5375, end: 5381 } }, - loc: { start: 5375, end: 5381 }, - }, - loc: { start: 5375, end: 5382 }, - }, - directives: [], - loc: { start: 5358, end: 5382 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'createdAtEpoch', - loc: { start: 5385, end: 5399 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Int', loc: { start: 5401, end: 5404 } }, - loc: { start: 5401, end: 5404 }, - }, - loc: { start: 5401, end: 5405 }, - }, - directives: [], - loc: { start: 5385, end: 5405 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'closedAtEpoch', loc: { start: 5408, end: 5421 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Int', loc: { start: 5423, end: 5426 } }, - loc: { start: 5423, end: 5426 }, - }, - directives: [], - loc: { start: 5408, end: 5426 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'subgraphDeployment', - loc: { start: 5429, end: 5447 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 5449, end: 5455 } }, - loc: { start: 5449, end: 5455 }, - }, - loc: { start: 5449, end: 5456 }, - }, - directives: [], - loc: { start: 5429, end: 5456 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'signalledTokens', - loc: { start: 5459, end: 5474 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'BigInt', loc: { start: 5476, end: 5482 } }, - loc: { start: 5476, end: 5482 }, - }, - loc: { start: 5476, end: 5483 }, - }, - directives: [], - loc: { start: 5459, end: 5483 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'stakedTokens', loc: { start: 5486, end: 5498 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'BigInt', loc: { start: 5500, end: 5506 } }, - loc: { start: 5500, end: 5506 }, - }, - loc: { start: 5500, end: 5507 }, - }, - directives: [], - loc: { start: 5486, end: 5507 }, - }, - ], - loc: { start: 5317, end: 5509 }, - }, - { - kind: 'ObjectTypeDefinition', - name: { - kind: 'Name', - value: 'IndexerEndpointTest', - loc: { start: 5516, end: 5535 }, - }, - interfaces: [], - directives: [], - fields: [ - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'test', loc: { start: 5540, end: 5544 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 5546, end: 5552 } }, - loc: { start: 5546, end: 5552 }, - }, - loc: { start: 5546, end: 5553 }, - }, - directives: [], - loc: { start: 5540, end: 5553 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'error', loc: { start: 5556, end: 5561 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 5563, end: 5569 } }, - loc: { start: 5563, end: 5569 }, - }, - directives: [], - loc: { start: 5556, end: 5569 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'possibleActions', - loc: { start: 5572, end: 5587 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'ListType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 5590, end: 5596 } }, - loc: { start: 5590, end: 5596 }, - }, - loc: { start: 5589, end: 5597 }, - }, - loc: { start: 5589, end: 5598 }, - }, - directives: [], - loc: { start: 5572, end: 5598 }, - }, - ], - loc: { start: 5511, end: 5600 }, - }, - { - kind: 'ObjectTypeDefinition', - name: { kind: 'Name', value: 'IndexerEndpoint', loc: { start: 5607, end: 5622 } }, - interfaces: [], - directives: [], - fields: [ - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'url', loc: { start: 5627, end: 5630 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 5632, end: 5638 } }, - loc: { start: 5632, end: 5638 }, - }, - directives: [], - loc: { start: 5627, end: 5638 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'healthy', loc: { start: 5641, end: 5648 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Boolean', loc: { start: 5650, end: 5657 } }, - loc: { start: 5650, end: 5657 }, - }, - loc: { start: 5650, end: 5658 }, - }, - directives: [], - loc: { start: 5641, end: 5658 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'protocolNetwork', - loc: { start: 5661, end: 5676 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 5678, end: 5684 } }, - loc: { start: 5678, end: 5684 }, - }, - loc: { start: 5678, end: 5685 }, - }, - directives: [], - loc: { start: 5661, end: 5685 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'tests', loc: { start: 5688, end: 5693 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'ListType', - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'IndexerEndpointTest', - loc: { start: 5696, end: 5715 }, - }, - loc: { start: 5696, end: 5715 }, - }, - loc: { start: 5696, end: 5716 }, - }, - loc: { start: 5695, end: 5717 }, - }, - loc: { start: 5695, end: 5718 }, - }, - directives: [], - loc: { start: 5688, end: 5718 }, - }, - ], - loc: { start: 5602, end: 5720 }, - }, - { - kind: 'ObjectTypeDefinition', - name: { kind: 'Name', value: 'IndexerEndpoints', loc: { start: 5727, end: 5743 } }, - interfaces: [], - directives: [], - fields: [ - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'service', loc: { start: 5748, end: 5755 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'IndexerEndpoint', - loc: { start: 5757, end: 5772 }, - }, - loc: { start: 5757, end: 5772 }, - }, - loc: { start: 5757, end: 5773 }, - }, - directives: [], - loc: { start: 5748, end: 5773 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'status', loc: { start: 5776, end: 5782 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'IndexerEndpoint', - loc: { start: 5784, end: 5799 }, - }, - loc: { start: 5784, end: 5799 }, - }, - loc: { start: 5784, end: 5800 }, - }, - directives: [], - loc: { start: 5776, end: 5800 }, - }, - ], - loc: { start: 5722, end: 5802 }, - }, - { - kind: 'ObjectTypeDefinition', - name: { kind: 'Name', value: 'CostModel', loc: { start: 5809, end: 5818 } }, - interfaces: [], - directives: [], - fields: [ - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'deployment', loc: { start: 5823, end: 5833 } }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 5835, end: 5841 } }, - loc: { start: 5835, end: 5841 }, - }, - loc: { start: 5835, end: 5842 }, - }, - directives: [], - loc: { start: 5823, end: 5842 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'model', loc: { start: 5845, end: 5850 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 5852, end: 5858 } }, - loc: { start: 5852, end: 5858 }, - }, - directives: [], - loc: { start: 5845, end: 5858 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'variables', loc: { start: 5861, end: 5870 } }, - arguments: [], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 5872, end: 5878 } }, - loc: { start: 5872, end: 5878 }, - }, - directives: [], - loc: { start: 5861, end: 5878 }, - }, - ], - loc: { start: 5804, end: 5880 }, - }, - { - kind: 'InputObjectTypeDefinition', - name: { kind: 'Name', value: 'CostModelInput', loc: { start: 5888, end: 5902 } }, - directives: [], - fields: [ - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'deployment', loc: { start: 5907, end: 5917 } }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 5919, end: 5925 } }, - loc: { start: 5919, end: 5925 }, - }, - loc: { start: 5919, end: 5926 }, - }, - directives: [], - loc: { start: 5907, end: 5926 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'model', loc: { start: 5929, end: 5934 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 5936, end: 5942 } }, - loc: { start: 5936, end: 5942 }, - }, - directives: [], - loc: { start: 5929, end: 5942 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'variables', loc: { start: 5945, end: 5954 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 5956, end: 5962 } }, - loc: { start: 5956, end: 5962 }, - }, - directives: [], - loc: { start: 5945, end: 5962 }, - }, - ], - loc: { start: 5882, end: 5964 }, - }, - { - kind: 'ObjectTypeDefinition', - name: { kind: 'Name', value: 'Query', loc: { start: 5971, end: 5976 } }, - interfaces: [], - directives: [], - fields: [ - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'indexingRule', loc: { start: 5981, end: 5993 } }, - arguments: [ - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'identifier', - loc: { start: 5994, end: 6004 }, - }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'IndexingRuleIdentifier', - loc: { start: 6006, end: 6028 }, - }, - loc: { start: 6006, end: 6028 }, - }, - loc: { start: 6006, end: 6029 }, - }, - directives: [], - loc: { start: 5994, end: 6029 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'merged', loc: { start: 6031, end: 6037 } }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'Boolean', - loc: { start: 6039, end: 6046 }, - }, - loc: { start: 6039, end: 6046 }, - }, - loc: { start: 6039, end: 6047 }, - }, - defaultValue: { - kind: 'BooleanValue', - value: false, - loc: { start: 6050, end: 6055 }, - }, - directives: [], - loc: { start: 6031, end: 6055 }, - }, - ], - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'IndexingRule', - loc: { start: 6058, end: 6070 }, - }, - loc: { start: 6058, end: 6070 }, - }, - directives: [], - loc: { start: 5981, end: 6070 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'indexingRules', loc: { start: 6073, end: 6086 } }, - arguments: [ - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'merged', loc: { start: 6087, end: 6093 } }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'Boolean', - loc: { start: 6095, end: 6102 }, - }, - loc: { start: 6095, end: 6102 }, - }, - loc: { start: 6095, end: 6103 }, - }, - defaultValue: { - kind: 'BooleanValue', - value: false, - loc: { start: 6106, end: 6111 }, - }, - directives: [], - loc: { start: 6087, end: 6111 }, - }, - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'protocolNetwork', - loc: { start: 6113, end: 6128 }, - }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 6130, end: 6136 } }, - loc: { start: 6130, end: 6136 }, - }, - directives: [], - loc: { start: 6113, end: 6136 }, - }, - ], - type: { - kind: 'NonNullType', - type: { - kind: 'ListType', - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'IndexingRule', - loc: { start: 6140, end: 6152 }, - }, - loc: { start: 6140, end: 6152 }, - }, - loc: { start: 6140, end: 6153 }, - }, - loc: { start: 6139, end: 6154 }, - }, - loc: { start: 6139, end: 6155 }, - }, - directives: [], - loc: { start: 6073, end: 6155 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'indexerRegistration', - loc: { start: 6158, end: 6177 }, - }, - arguments: [ - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'protocolNetwork', - loc: { start: 6178, end: 6193 }, - }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'String', - loc: { start: 6195, end: 6201 }, - }, - loc: { start: 6195, end: 6201 }, - }, - loc: { start: 6195, end: 6202 }, - }, - directives: [], - loc: { start: 6178, end: 6202 }, - }, - ], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'IndexerRegistration', - loc: { start: 6205, end: 6224 }, - }, - loc: { start: 6205, end: 6224 }, - }, - loc: { start: 6205, end: 6225 }, - }, - directives: [], - loc: { start: 6158, end: 6225 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'indexerDeployments', - loc: { start: 6228, end: 6246 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'ListType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'IndexerDeployment', - loc: { start: 6249, end: 6266 }, - }, - loc: { start: 6249, end: 6266 }, - }, - loc: { start: 6248, end: 6267 }, - }, - loc: { start: 6248, end: 6268 }, - }, - directives: [], - loc: { start: 6228, end: 6268 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'indexerAllocations', - loc: { start: 6271, end: 6289 }, - }, - arguments: [ - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'protocolNetwork', - loc: { start: 6290, end: 6305 }, - }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'String', - loc: { start: 6307, end: 6313 }, - }, - loc: { start: 6307, end: 6313 }, - }, - loc: { start: 6307, end: 6314 }, - }, - directives: [], - loc: { start: 6290, end: 6314 }, - }, - ], - type: { - kind: 'NonNullType', - type: { - kind: 'ListType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'IndexerAllocation', - loc: { start: 6318, end: 6335 }, - }, - loc: { start: 6318, end: 6335 }, - }, - loc: { start: 6317, end: 6336 }, - }, - loc: { start: 6317, end: 6337 }, - }, - directives: [], - loc: { start: 6271, end: 6337 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'indexerEndpoints', - loc: { start: 6340, end: 6356 }, - }, - arguments: [ - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'protocolNetwork', - loc: { start: 6357, end: 6372 }, - }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 6374, end: 6380 } }, - loc: { start: 6374, end: 6380 }, - }, - directives: [], - loc: { start: 6357, end: 6380 }, - }, - ], - type: { - kind: 'NonNullType', - type: { - kind: 'ListType', - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'IndexerEndpoints', - loc: { start: 6384, end: 6400 }, - }, - loc: { start: 6384, end: 6400 }, - }, - loc: { start: 6384, end: 6401 }, - }, - loc: { start: 6383, end: 6402 }, - }, - loc: { start: 6383, end: 6403 }, - }, - directives: [], - loc: { start: 6340, end: 6403 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'costModels', loc: { start: 6406, end: 6416 } }, - arguments: [ - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'deployments', - loc: { start: 6417, end: 6428 }, - }, - type: { - kind: 'ListType', - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'String', - loc: { start: 6431, end: 6437 }, - }, - loc: { start: 6431, end: 6437 }, - }, - loc: { start: 6431, end: 6438 }, - }, - loc: { start: 6430, end: 6439 }, - }, - directives: [], - loc: { start: 6417, end: 6439 }, - }, - ], - type: { - kind: 'NonNullType', - type: { - kind: 'ListType', - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'CostModel', - loc: { start: 6443, end: 6452 }, - }, - loc: { start: 6443, end: 6452 }, - }, - loc: { start: 6443, end: 6453 }, - }, - loc: { start: 6442, end: 6454 }, - }, - loc: { start: 6442, end: 6455 }, - }, - directives: [], - loc: { start: 6406, end: 6455 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'costModel', loc: { start: 6458, end: 6467 } }, - arguments: [ - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'deployment', - loc: { start: 6468, end: 6478 }, - }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'String', - loc: { start: 6480, end: 6486 }, - }, - loc: { start: 6480, end: 6486 }, - }, - loc: { start: 6480, end: 6487 }, - }, - directives: [], - loc: { start: 6468, end: 6487 }, - }, - ], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'CostModel', loc: { start: 6490, end: 6499 } }, - loc: { start: 6490, end: 6499 }, - }, - directives: [], - loc: { start: 6458, end: 6499 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'dispute', loc: { start: 6502, end: 6509 } }, - arguments: [ - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'identifier', - loc: { start: 6510, end: 6520 }, - }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'POIDisputeIdentifier', - loc: { start: 6522, end: 6542 }, - }, - loc: { start: 6522, end: 6542 }, - }, - loc: { start: 6522, end: 6543 }, - }, - directives: [], - loc: { start: 6510, end: 6543 }, - }, - ], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'POIDispute', loc: { start: 6546, end: 6556 } }, - loc: { start: 6546, end: 6556 }, - }, - directives: [], - loc: { start: 6502, end: 6556 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'disputes', loc: { start: 6559, end: 6567 } }, - arguments: [ - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'status', loc: { start: 6568, end: 6574 } }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'String', - loc: { start: 6576, end: 6582 }, - }, - loc: { start: 6576, end: 6582 }, - }, - loc: { start: 6576, end: 6583 }, - }, - directives: [], - loc: { start: 6568, end: 6583 }, - }, - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'minClosedEpoch', - loc: { start: 6585, end: 6599 }, - }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Int', loc: { start: 6601, end: 6604 } }, - loc: { start: 6601, end: 6604 }, - }, - loc: { start: 6601, end: 6605 }, - }, - directives: [], - loc: { start: 6585, end: 6605 }, - }, - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'protocolNetwork', - loc: { start: 6607, end: 6622 }, - }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 6624, end: 6630 } }, - loc: { start: 6624, end: 6630 }, - }, - directives: [], - loc: { start: 6607, end: 6630 }, - }, - ], - type: { - kind: 'NonNullType', - type: { - kind: 'ListType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'POIDispute', - loc: { start: 6634, end: 6644 }, - }, - loc: { start: 6634, end: 6644 }, - }, - loc: { start: 6633, end: 6645 }, - }, - loc: { start: 6633, end: 6646 }, - }, - directives: [], - loc: { start: 6559, end: 6646 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'disputesClosedAfter', - loc: { start: 6649, end: 6668 }, - }, - arguments: [ - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'closedAfterBlock', - loc: { start: 6669, end: 6685 }, - }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'BigInt', - loc: { start: 6687, end: 6693 }, - }, - loc: { start: 6687, end: 6693 }, - }, - loc: { start: 6687, end: 6694 }, - }, - directives: [], - loc: { start: 6669, end: 6694 }, - }, - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'protocolNetwork', - loc: { start: 6696, end: 6711 }, - }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 6713, end: 6719 } }, - loc: { start: 6713, end: 6719 }, - }, - directives: [], - loc: { start: 6696, end: 6719 }, - }, - ], - type: { - kind: 'NonNullType', - type: { - kind: 'ListType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'POIDispute', - loc: { start: 6723, end: 6733 }, - }, - loc: { start: 6723, end: 6733 }, - }, - loc: { start: 6722, end: 6734 }, - }, - loc: { start: 6722, end: 6735 }, - }, - directives: [], - loc: { start: 6649, end: 6735 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'allocations', loc: { start: 6738, end: 6749 } }, - arguments: [ - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'filter', loc: { start: 6750, end: 6756 } }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'AllocationFilter', - loc: { start: 6758, end: 6774 }, - }, - loc: { start: 6758, end: 6774 }, - }, - loc: { start: 6758, end: 6775 }, - }, - directives: [], - loc: { start: 6750, end: 6775 }, - }, - ], - type: { - kind: 'NonNullType', - type: { - kind: 'ListType', - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'Allocation', - loc: { start: 6779, end: 6789 }, - }, - loc: { start: 6779, end: 6789 }, - }, - loc: { start: 6779, end: 6790 }, - }, - loc: { start: 6778, end: 6791 }, - }, - loc: { start: 6778, end: 6792 }, - }, - directives: [], - loc: { start: 6738, end: 6792 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'action', loc: { start: 6795, end: 6801 } }, - arguments: [ - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'actionID', loc: { start: 6802, end: 6810 } }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'String', - loc: { start: 6812, end: 6818 }, - }, - loc: { start: 6812, end: 6818 }, - }, - loc: { start: 6812, end: 6819 }, - }, - directives: [], - loc: { start: 6802, end: 6819 }, - }, - ], - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Action', loc: { start: 6822, end: 6828 } }, - loc: { start: 6822, end: 6828 }, - }, - directives: [], - loc: { start: 6795, end: 6828 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'actions', loc: { start: 6831, end: 6838 } }, - arguments: [ - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'filter', loc: { start: 6839, end: 6845 } }, - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'ActionFilter', - loc: { start: 6847, end: 6859 }, - }, - loc: { start: 6847, end: 6859 }, - }, - directives: [], - loc: { start: 6839, end: 6859 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'orderBy', loc: { start: 6861, end: 6868 } }, - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'ActionParams', - loc: { start: 6870, end: 6882 }, - }, - loc: { start: 6870, end: 6882 }, - }, - directives: [], - loc: { start: 6861, end: 6882 }, - }, - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'orderDirection', - loc: { start: 6884, end: 6898 }, - }, - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'OrderDirection', - loc: { start: 6900, end: 6914 }, - }, - loc: { start: 6900, end: 6914 }, - }, - directives: [], - loc: { start: 6884, end: 6914 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'first', loc: { start: 6916, end: 6921 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Int', loc: { start: 6923, end: 6926 } }, - loc: { start: 6923, end: 6926 }, - }, - directives: [], - loc: { start: 6916, end: 6926 }, - }, - ], - type: { - kind: 'NonNullType', - type: { - kind: 'ListType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Action', loc: { start: 6930, end: 6936 } }, - loc: { start: 6930, end: 6936 }, - }, - loc: { start: 6929, end: 6937 }, - }, - loc: { start: 6929, end: 6938 }, - }, - directives: [], - loc: { start: 6831, end: 6938 }, - }, - ], - loc: { start: 5966, end: 6940 }, - }, - { - kind: 'ObjectTypeDefinition', - name: { kind: 'Name', value: 'Mutation', loc: { start: 6947, end: 6955 } }, - interfaces: [], - directives: [], - fields: [ - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'setIndexingRule', - loc: { start: 6960, end: 6975 }, - }, - arguments: [ - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'rule', loc: { start: 6976, end: 6980 } }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'IndexingRuleInput', - loc: { start: 6982, end: 6999 }, - }, - loc: { start: 6982, end: 6999 }, - }, - loc: { start: 6982, end: 7000 }, - }, - directives: [], - loc: { start: 6976, end: 7000 }, - }, - ], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'IndexingRule', - loc: { start: 7003, end: 7015 }, - }, - loc: { start: 7003, end: 7015 }, - }, - loc: { start: 7003, end: 7016 }, - }, - directives: [], - loc: { start: 6960, end: 7016 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'deleteIndexingRule', - loc: { start: 7019, end: 7037 }, - }, - arguments: [ - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'identifier', - loc: { start: 7038, end: 7048 }, - }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'IndexingRuleIdentifier', - loc: { start: 7050, end: 7072 }, - }, - loc: { start: 7050, end: 7072 }, - }, - loc: { start: 7050, end: 7073 }, - }, - directives: [], - loc: { start: 7038, end: 7073 }, - }, - ], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Boolean', loc: { start: 7076, end: 7083 } }, - loc: { start: 7076, end: 7083 }, - }, - loc: { start: 7076, end: 7084 }, - }, - directives: [], - loc: { start: 7019, end: 7084 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'deleteIndexingRules', - loc: { start: 7087, end: 7106 }, - }, - arguments: [ - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'identifiers', - loc: { start: 7107, end: 7118 }, - }, - type: { - kind: 'NonNullType', - type: { - kind: 'ListType', - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'IndexingRuleIdentifier', - loc: { start: 7121, end: 7143 }, - }, - loc: { start: 7121, end: 7143 }, - }, - loc: { start: 7121, end: 7144 }, - }, - loc: { start: 7120, end: 7145 }, - }, - loc: { start: 7120, end: 7146 }, - }, - directives: [], - loc: { start: 7107, end: 7146 }, - }, - ], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Boolean', loc: { start: 7149, end: 7156 } }, - loc: { start: 7149, end: 7156 }, - }, - loc: { start: 7149, end: 7157 }, - }, - directives: [], - loc: { start: 7087, end: 7157 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'setCostModel', loc: { start: 7160, end: 7172 } }, - arguments: [ - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'costModel', loc: { start: 7173, end: 7182 } }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'CostModelInput', - loc: { start: 7184, end: 7198 }, - }, - loc: { start: 7184, end: 7198 }, - }, - loc: { start: 7184, end: 7199 }, - }, - directives: [], - loc: { start: 7173, end: 7199 }, - }, - ], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'CostModel', loc: { start: 7202, end: 7211 } }, - loc: { start: 7202, end: 7211 }, - }, - loc: { start: 7202, end: 7212 }, - }, - directives: [], - loc: { start: 7160, end: 7212 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'deleteCostModels', - loc: { start: 7215, end: 7231 }, - }, - arguments: [ - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'deployments', - loc: { start: 7232, end: 7243 }, - }, - type: { - kind: 'NonNullType', - type: { - kind: 'ListType', - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'String', - loc: { start: 7246, end: 7252 }, - }, - loc: { start: 7246, end: 7252 }, - }, - loc: { start: 7246, end: 7253 }, - }, - loc: { start: 7245, end: 7254 }, - }, - loc: { start: 7245, end: 7255 }, - }, - directives: [], - loc: { start: 7232, end: 7255 }, - }, - ], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Int', loc: { start: 7258, end: 7261 } }, - loc: { start: 7258, end: 7261 }, - }, - loc: { start: 7258, end: 7262 }, - }, - directives: [], - loc: { start: 7215, end: 7262 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'storeDisputes', loc: { start: 7265, end: 7278 } }, - arguments: [ - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'disputes', loc: { start: 7279, end: 7287 } }, - type: { - kind: 'NonNullType', - type: { - kind: 'ListType', - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'POIDisputeInput', - loc: { start: 7290, end: 7305 }, - }, - loc: { start: 7290, end: 7305 }, - }, - loc: { start: 7290, end: 7306 }, - }, - loc: { start: 7289, end: 7307 }, - }, - loc: { start: 7289, end: 7308 }, - }, - directives: [], - loc: { start: 7279, end: 7308 }, - }, - ], - type: { - kind: 'ListType', - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'POIDispute', - loc: { start: 7312, end: 7322 }, - }, - loc: { start: 7312, end: 7322 }, - }, - loc: { start: 7312, end: 7323 }, - }, - loc: { start: 7311, end: 7324 }, - }, - directives: [], - loc: { start: 7265, end: 7324 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'deleteDisputes', - loc: { start: 7327, end: 7341 }, - }, - arguments: [ - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'identifiers', - loc: { start: 7342, end: 7353 }, - }, - type: { - kind: 'NonNullType', - type: { - kind: 'ListType', - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'POIDisputeIdentifier', - loc: { start: 7356, end: 7376 }, - }, - loc: { start: 7356, end: 7376 }, - }, - loc: { start: 7356, end: 7377 }, - }, - loc: { start: 7355, end: 7378 }, - }, - loc: { start: 7355, end: 7379 }, - }, - directives: [], - loc: { start: 7342, end: 7379 }, - }, - ], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Int', loc: { start: 7382, end: 7385 } }, - loc: { start: 7382, end: 7385 }, - }, - loc: { start: 7382, end: 7386 }, - }, - directives: [], - loc: { start: 7327, end: 7386 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'createAllocation', - loc: { start: 7389, end: 7405 }, - }, - arguments: [ - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'deployment', - loc: { start: 7406, end: 7416 }, - }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'String', - loc: { start: 7418, end: 7424 }, - }, - loc: { start: 7418, end: 7424 }, - }, - loc: { start: 7418, end: 7425 }, - }, - directives: [], - loc: { start: 7406, end: 7425 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'amount', loc: { start: 7427, end: 7433 } }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'String', - loc: { start: 7435, end: 7441 }, - }, - loc: { start: 7435, end: 7441 }, - }, - loc: { start: 7435, end: 7442 }, - }, - directives: [], - loc: { start: 7427, end: 7442 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'indexNode', loc: { start: 7444, end: 7453 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 7455, end: 7461 } }, - loc: { start: 7455, end: 7461 }, - }, - directives: [], - loc: { start: 7444, end: 7461 }, - }, - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'protocolNetwork', - loc: { start: 7463, end: 7478 }, - }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'String', - loc: { start: 7480, end: 7486 }, - }, - loc: { start: 7480, end: 7486 }, - }, - loc: { start: 7480, end: 7487 }, - }, - directives: [], - loc: { start: 7463, end: 7487 }, - }, - ], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'CreateAllocationResult', - loc: { start: 7490, end: 7512 }, - }, - loc: { start: 7490, end: 7512 }, - }, - loc: { start: 7490, end: 7513 }, - }, - directives: [], - loc: { start: 7389, end: 7513 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'closeAllocation', - loc: { start: 7516, end: 7531 }, - }, - arguments: [ - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'allocation', - loc: { start: 7532, end: 7542 }, - }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'String', - loc: { start: 7544, end: 7550 }, - }, - loc: { start: 7544, end: 7550 }, - }, - loc: { start: 7544, end: 7551 }, - }, - directives: [], - loc: { start: 7532, end: 7551 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'poi', loc: { start: 7553, end: 7556 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 7558, end: 7564 } }, - loc: { start: 7558, end: 7564 }, - }, - directives: [], - loc: { start: 7553, end: 7564 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'force', loc: { start: 7566, end: 7571 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Boolean', loc: { start: 7573, end: 7580 } }, - loc: { start: 7573, end: 7580 }, - }, - directives: [], - loc: { start: 7566, end: 7580 }, - }, - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'protocolNetwork', - loc: { start: 7582, end: 7597 }, - }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'String', - loc: { start: 7599, end: 7605 }, - }, - loc: { start: 7599, end: 7605 }, - }, - loc: { start: 7599, end: 7606 }, - }, - directives: [], - loc: { start: 7582, end: 7606 }, - }, - ], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'CloseAllocationResult', - loc: { start: 7609, end: 7630 }, - }, - loc: { start: 7609, end: 7630 }, - }, - loc: { start: 7609, end: 7631 }, - }, - directives: [], - loc: { start: 7516, end: 7631 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'reallocateAllocation', - loc: { start: 7634, end: 7654 }, - }, - arguments: [ - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'allocation', - loc: { start: 7655, end: 7665 }, - }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'String', - loc: { start: 7667, end: 7673 }, - }, - loc: { start: 7667, end: 7673 }, - }, - loc: { start: 7667, end: 7674 }, - }, - directives: [], - loc: { start: 7655, end: 7674 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'poi', loc: { start: 7676, end: 7679 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'String', loc: { start: 7681, end: 7687 } }, - loc: { start: 7681, end: 7687 }, - }, - directives: [], - loc: { start: 7676, end: 7687 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'amount', loc: { start: 7689, end: 7695 } }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'String', - loc: { start: 7697, end: 7703 }, - }, - loc: { start: 7697, end: 7703 }, - }, - loc: { start: 7697, end: 7704 }, - }, - directives: [], - loc: { start: 7689, end: 7704 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'force', loc: { start: 7706, end: 7711 } }, - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Boolean', loc: { start: 7713, end: 7720 } }, - loc: { start: 7713, end: 7720 }, - }, - directives: [], - loc: { start: 7706, end: 7720 }, - }, - { - kind: 'InputValueDefinition', - name: { - kind: 'Name', - value: 'protocolNetwork', - loc: { start: 7722, end: 7737 }, - }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'String', - loc: { start: 7739, end: 7745 }, - }, - loc: { start: 7739, end: 7745 }, - }, - loc: { start: 7739, end: 7746 }, - }, - directives: [], - loc: { start: 7722, end: 7746 }, - }, - ], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'ReallocateAllocationResult', - loc: { start: 7749, end: 7775 }, - }, - loc: { start: 7749, end: 7775 }, - }, - loc: { start: 7749, end: 7776 }, - }, - directives: [], - loc: { start: 7634, end: 7776 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'updateAction', loc: { start: 7779, end: 7791 } }, - arguments: [ - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'action', loc: { start: 7792, end: 7798 } }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'ActionInput', - loc: { start: 7800, end: 7811 }, - }, - loc: { start: 7800, end: 7811 }, - }, - loc: { start: 7800, end: 7812 }, - }, - directives: [], - loc: { start: 7792, end: 7812 }, - }, - ], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Action', loc: { start: 7815, end: 7821 } }, - loc: { start: 7815, end: 7821 }, - }, - loc: { start: 7815, end: 7822 }, - }, - directives: [], - loc: { start: 7779, end: 7822 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'updateActions', loc: { start: 7825, end: 7838 } }, - arguments: [ - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'filter', loc: { start: 7839, end: 7845 } }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'ActionFilter', - loc: { start: 7847, end: 7859 }, - }, - loc: { start: 7847, end: 7859 }, - }, - loc: { start: 7847, end: 7860 }, - }, - directives: [], - loc: { start: 7839, end: 7860 }, - }, - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'action', loc: { start: 7862, end: 7868 } }, - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'ActionUpdateInput', - loc: { start: 7870, end: 7887 }, - }, - loc: { start: 7870, end: 7887 }, - }, - loc: { start: 7870, end: 7888 }, - }, - directives: [], - loc: { start: 7862, end: 7888 }, - }, - ], - type: { - kind: 'NonNullType', - type: { - kind: 'ListType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Action', loc: { start: 7892, end: 7898 } }, - loc: { start: 7892, end: 7898 }, - }, - loc: { start: 7891, end: 7899 }, - }, - loc: { start: 7891, end: 7900 }, - }, - directives: [], - loc: { start: 7825, end: 7900 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'queueActions', loc: { start: 7903, end: 7915 } }, - arguments: [ - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'actions', loc: { start: 7916, end: 7923 } }, - type: { - kind: 'NonNullType', - type: { - kind: 'ListType', - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'ActionInput', - loc: { start: 7926, end: 7937 }, - }, - loc: { start: 7926, end: 7937 }, - }, - loc: { start: 7926, end: 7938 }, - }, - loc: { start: 7925, end: 7939 }, - }, - loc: { start: 7925, end: 7940 }, - }, - directives: [], - loc: { start: 7916, end: 7940 }, - }, - ], - type: { - kind: 'NonNullType', - type: { - kind: 'ListType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Action', loc: { start: 7944, end: 7950 } }, - loc: { start: 7944, end: 7950 }, - }, - loc: { start: 7943, end: 7951 }, - }, - loc: { start: 7943, end: 7952 }, - }, - directives: [], - loc: { start: 7903, end: 7952 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'cancelActions', loc: { start: 7955, end: 7968 } }, - arguments: [ - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'actionIDs', loc: { start: 7969, end: 7978 } }, - type: { - kind: 'NonNullType', - type: { - kind: 'ListType', - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'String', - loc: { start: 7981, end: 7987 }, - }, - loc: { start: 7981, end: 7987 }, - }, - loc: { start: 7981, end: 7988 }, - }, - loc: { start: 7980, end: 7989 }, - }, - loc: { start: 7980, end: 7990 }, - }, - directives: [], - loc: { start: 7969, end: 7990 }, - }, - ], - type: { - kind: 'NonNullType', - type: { - kind: 'ListType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Action', loc: { start: 7994, end: 8000 } }, - loc: { start: 7994, end: 8000 }, - }, - loc: { start: 7993, end: 8001 }, - }, - loc: { start: 7993, end: 8002 }, - }, - directives: [], - loc: { start: 7955, end: 8002 }, - }, - { - kind: 'FieldDefinition', - name: { kind: 'Name', value: 'deleteActions', loc: { start: 8005, end: 8018 } }, - arguments: [ - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'actionIDs', loc: { start: 8019, end: 8028 } }, - type: { - kind: 'NonNullType', - type: { - kind: 'ListType', - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'String', - loc: { start: 8031, end: 8037 }, - }, - loc: { start: 8031, end: 8037 }, - }, - loc: { start: 8031, end: 8038 }, - }, - loc: { start: 8030, end: 8039 }, - }, - loc: { start: 8030, end: 8040 }, - }, - directives: [], - loc: { start: 8019, end: 8040 }, - }, - ], - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Int', loc: { start: 8043, end: 8046 } }, - loc: { start: 8043, end: 8046 }, - }, - loc: { start: 8043, end: 8047 }, - }, - directives: [], - loc: { start: 8005, end: 8047 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'approveActions', - loc: { start: 8050, end: 8064 }, - }, - arguments: [ - { - kind: 'InputValueDefinition', - name: { kind: 'Name', value: 'actionIDs', loc: { start: 8065, end: 8074 } }, - type: { - kind: 'NonNullType', - type: { - kind: 'ListType', - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'String', - loc: { start: 8077, end: 8083 }, - }, - loc: { start: 8077, end: 8083 }, - }, - loc: { start: 8077, end: 8084 }, - }, - loc: { start: 8076, end: 8085 }, - }, - loc: { start: 8076, end: 8086 }, - }, - directives: [], - loc: { start: 8065, end: 8086 }, - }, - ], - type: { - kind: 'NonNullType', - type: { - kind: 'ListType', - type: { - kind: 'NamedType', - name: { kind: 'Name', value: 'Action', loc: { start: 8090, end: 8096 } }, - loc: { start: 8090, end: 8096 }, - }, - loc: { start: 8089, end: 8097 }, - }, - loc: { start: 8089, end: 8098 }, - }, - directives: [], - loc: { start: 8050, end: 8098 }, - }, - { - kind: 'FieldDefinition', - name: { - kind: 'Name', - value: 'executeApprovedActions', - loc: { start: 8101, end: 8123 }, - }, - arguments: [], - type: { - kind: 'NonNullType', - type: { - kind: 'ListType', - type: { - kind: 'NonNullType', - type: { - kind: 'NamedType', - name: { - kind: 'Name', - value: 'ActionResult', - loc: { start: 8126, end: 8138 }, - }, - loc: { start: 8126, end: 8138 }, - }, - loc: { start: 8126, end: 8139 }, - }, - loc: { start: 8125, end: 8140 }, - }, - loc: { start: 8125, end: 8141 }, - }, - directives: [], - loc: { start: 8101, end: 8141 }, - }, - ], - loc: { start: 6942, end: 8143 }, - }, - ], - loc: { start: 0, end: 8144 }, -} as unknown as DocumentNode diff --git a/packages/indexer-common/src/schema/types.generated.ts b/packages/indexer-common/src/schema/types.generated.ts deleted file mode 100644 index ecd74215f..000000000 --- a/packages/indexer-common/src/schema/types.generated.ts +++ /dev/null @@ -1,1246 +0,0 @@ -import { GraphQLResolveInfo, GraphQLScalarType, GraphQLScalarTypeConfig } from 'graphql' -import { IndexerManagementResolverContext } from '@graphprotocol/indexer-common' -export type Maybe = T | null | undefined -export type InputMaybe = T | null | undefined -export type Exact = { [K in keyof T]: T[K] } -export type MakeOptional = Omit & { - [SubKey in K]?: Maybe -} -export type MakeMaybe = Omit & { - [SubKey in K]: Maybe -} -export type MakeEmpty = { - [_ in K]?: never -} -export type Incremental = - | T - | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never } -export type RequireFields = Omit & { - [P in K]-?: NonNullable -} -/** All built-in and custom scalars, mapped to their actual values */ -export type Scalars = { - ID: { input: string; output: string } - String: { input: string; output: string } - Boolean: { input: boolean; output: boolean } - Int: { input: number; output: number } - Float: { input: number; output: number } - BigInt: { input: any; output: any } -} - -export type Action = { - __typename?: 'Action' - allocationID?: Maybe - amount?: Maybe - createdAt: Scalars['BigInt']['output'] - deploymentID?: Maybe - failureReason?: Maybe - force?: Maybe - id: Scalars['Int']['output'] - poi?: Maybe - priority: Scalars['Int']['output'] - protocolNetwork: Scalars['String']['output'] - reason: Scalars['String']['output'] - source: Scalars['String']['output'] - status: ActionStatus - transaction?: Maybe - type: ActionType - updatedAt?: Maybe -} - -export type ActionFilter = { - id?: InputMaybe - protocolNetwork?: InputMaybe - reason?: InputMaybe - source?: InputMaybe - status?: InputMaybe - type?: InputMaybe -} - -export type ActionInput = { - allocationID?: InputMaybe - amount?: InputMaybe - deploymentID?: InputMaybe - force?: InputMaybe - poi?: InputMaybe - priority: Scalars['Int']['input'] - protocolNetwork: Scalars['String']['input'] - reason: Scalars['String']['input'] - source: Scalars['String']['input'] - status: ActionStatus - type: ActionType -} - -export type ActionParams = - | 'allocationID' - | 'amount' - | 'createdAt' - | 'deploymentID' - | 'force' - | 'id' - | 'poi' - | 'priority' - | 'protocolNetwork' - | 'reason' - | 'source' - | 'status' - | 'transaction' - | 'type' - | 'updatedAt' - -export type ActionResult = { - __typename?: 'ActionResult' - allocationID?: Maybe - amount?: Maybe - deploymentID?: Maybe - failureReason?: Maybe - force?: Maybe - id: Scalars['Int']['output'] - poi?: Maybe - priority?: Maybe - protocolNetwork: Scalars['String']['output'] - reason: Scalars['String']['output'] - source: Scalars['String']['output'] - status: Scalars['String']['output'] - transaction?: Maybe - type: ActionType -} - -export type ActionStatus = - | 'approved' - | 'canceled' - | 'failed' - | 'pending' - | 'queued' - | 'success' - -export type ActionType = 'allocate' | 'reallocate' | 'unallocate' - -export type ActionUpdateInput = { - allocationID?: InputMaybe - amount?: InputMaybe - deploymentID?: InputMaybe - force?: InputMaybe - id?: InputMaybe - poi?: InputMaybe - reason?: InputMaybe - status?: InputMaybe - type?: InputMaybe -} - -export type Allocation = { - __typename?: 'Allocation' - ageInEpochs: Scalars['Int']['output'] - allocatedTokens: Scalars['String']['output'] - closedAtEpoch?: Maybe - createdAtEpoch: Scalars['Int']['output'] - id: Scalars['String']['output'] - indexer: Scalars['String']['output'] - indexingRewards: Scalars['String']['output'] - protocolNetwork: Scalars['String']['output'] - queryFeesCollected: Scalars['String']['output'] - signalledTokens: Scalars['BigInt']['output'] - stakedTokens: Scalars['BigInt']['output'] - status: AllocationStatus - subgraphDeployment: Scalars['String']['output'] -} - -export type AllocationFilter = { - allocation?: InputMaybe - protocolNetwork?: InputMaybe - status?: InputMaybe - subgraphDeployment?: InputMaybe -} - -export type AllocationStatus = 'Active' | 'Claimed' | 'Closed' | 'Finalized' | 'Null' - -export type BlockPointer = { - __typename?: 'BlockPointer' - hash: Scalars['String']['output'] - number: Scalars['Int']['output'] -} - -export type ChainIndexingStatus = { - __typename?: 'ChainIndexingStatus' - chainHeadBlock?: Maybe - earliestBlock?: Maybe - latestBlock?: Maybe - network: Scalars['String']['output'] -} - -export type CloseAllocationResult = { - __typename?: 'CloseAllocationResult' - allocatedTokens: Scalars['String']['output'] - allocation: Scalars['String']['output'] - indexingRewards: Scalars['String']['output'] - protocolNetwork: Scalars['String']['output'] - receiptsWorthCollecting: Scalars['Boolean']['output'] -} - -export type CostModel = { - __typename?: 'CostModel' - deployment: Scalars['String']['output'] - model?: Maybe - variables?: Maybe -} - -export type CostModelInput = { - deployment: Scalars['String']['input'] - model?: InputMaybe - variables?: InputMaybe -} - -export type CreateAllocationResult = { - __typename?: 'CreateAllocationResult' - allocatedTokens: Scalars['String']['output'] - allocation: Scalars['String']['output'] - deployment: Scalars['String']['output'] - protocolNetwork: Scalars['String']['output'] -} - -export type GeoLocation = { - __typename?: 'GeoLocation' - latitude: Scalars['String']['output'] - longitude: Scalars['String']['output'] -} - -export type IdentifierType = 'deployment' | 'group' | 'subgraph' - -export type IndexerAllocation = { - __typename?: 'IndexerAllocation' - allocatedTokens: Scalars['BigInt']['output'] - closedAtEpoch?: Maybe - createdAtEpoch: Scalars['Int']['output'] - id: Scalars['String']['output'] - signalledTokens: Scalars['BigInt']['output'] - stakedTokens: Scalars['BigInt']['output'] - subgraphDeployment: Scalars['String']['output'] -} - -export type IndexerDeployment = { - __typename?: 'IndexerDeployment' - chains?: Maybe>> - fatalError?: Maybe - health: Scalars['String']['output'] - node?: Maybe - subgraphDeployment: Scalars['String']['output'] - synced: Scalars['Boolean']['output'] -} - -export type IndexerEndpoint = { - __typename?: 'IndexerEndpoint' - healthy: Scalars['Boolean']['output'] - protocolNetwork: Scalars['String']['output'] - tests: Array - url?: Maybe -} - -export type IndexerEndpointTest = { - __typename?: 'IndexerEndpointTest' - error?: Maybe - possibleActions: Array> - test: Scalars['String']['output'] -} - -export type IndexerEndpoints = { - __typename?: 'IndexerEndpoints' - service: IndexerEndpoint - status: IndexerEndpoint -} - -export type IndexerRegistration = { - __typename?: 'IndexerRegistration' - address?: Maybe - location?: Maybe - protocolNetwork: Scalars['String']['output'] - registered: Scalars['Boolean']['output'] - url?: Maybe -} - -export type IndexingDecisionBasis = 'always' | 'never' | 'offchain' | 'rules' - -export type IndexingError = { - __typename?: 'IndexingError' - handler?: Maybe - message: Scalars['String']['output'] -} - -export type IndexingRule = { - __typename?: 'IndexingRule' - allocationAmount?: Maybe - allocationLifetime?: Maybe - autoRenewal: Scalars['Boolean']['output'] - custom?: Maybe - decisionBasis: IndexingDecisionBasis - identifier: Scalars['String']['output'] - identifierType: IdentifierType - maxAllocationPercentage?: Maybe - maxSignal?: Maybe - minAverageQueryFees?: Maybe - minSignal?: Maybe - minStake?: Maybe - parallelAllocations?: Maybe - protocolNetwork: Scalars['String']['output'] - requireSupported: Scalars['Boolean']['output'] - safety: Scalars['Boolean']['output'] -} - -export type IndexingRuleIdentifier = { - identifier: Scalars['String']['input'] - protocolNetwork: Scalars['String']['input'] -} - -export type IndexingRuleInput = { - allocationAmount?: InputMaybe - allocationLifetime?: InputMaybe - autoRenewal?: InputMaybe - custom?: InputMaybe - decisionBasis?: InputMaybe - identifier: Scalars['String']['input'] - identifierType: IdentifierType - maxAllocationPercentage?: InputMaybe - maxSignal?: InputMaybe - minAverageQueryFees?: InputMaybe - minSignal?: InputMaybe - minStake?: InputMaybe - parallelAllocations?: InputMaybe - protocolNetwork: Scalars['String']['input'] - requireSupported?: InputMaybe - safety?: InputMaybe -} - -export type Mutation = { - __typename?: 'Mutation' - approveActions: Array> - cancelActions: Array> - closeAllocation: CloseAllocationResult - createAllocation: CreateAllocationResult - deleteActions: Scalars['Int']['output'] - deleteCostModels: Scalars['Int']['output'] - deleteDisputes: Scalars['Int']['output'] - deleteIndexingRule: Scalars['Boolean']['output'] - deleteIndexingRules: Scalars['Boolean']['output'] - executeApprovedActions: Array - queueActions: Array> - reallocateAllocation: ReallocateAllocationResult - setCostModel: CostModel - setIndexingRule: IndexingRule - storeDisputes?: Maybe> - updateAction: Action - updateActions: Array> -} - -export type MutationapproveActionsArgs = { - actionIDs: Array -} - -export type MutationcancelActionsArgs = { - actionIDs: Array -} - -export type MutationcloseAllocationArgs = { - allocation: Scalars['String']['input'] - force?: InputMaybe - poi?: InputMaybe - protocolNetwork: Scalars['String']['input'] -} - -export type MutationcreateAllocationArgs = { - amount: Scalars['String']['input'] - deployment: Scalars['String']['input'] - indexNode?: InputMaybe - protocolNetwork: Scalars['String']['input'] -} - -export type MutationdeleteActionsArgs = { - actionIDs: Array -} - -export type MutationdeleteCostModelsArgs = { - deployments: Array -} - -export type MutationdeleteDisputesArgs = { - identifiers: Array -} - -export type MutationdeleteIndexingRuleArgs = { - identifier: IndexingRuleIdentifier -} - -export type MutationdeleteIndexingRulesArgs = { - identifiers: Array -} - -export type MutationqueueActionsArgs = { - actions: Array -} - -export type MutationreallocateAllocationArgs = { - allocation: Scalars['String']['input'] - amount: Scalars['String']['input'] - force?: InputMaybe - poi?: InputMaybe - protocolNetwork: Scalars['String']['input'] -} - -export type MutationsetCostModelArgs = { - costModel: CostModelInput -} - -export type MutationsetIndexingRuleArgs = { - rule: IndexingRuleInput -} - -export type MutationstoreDisputesArgs = { - disputes: Array -} - -export type MutationupdateActionArgs = { - action: ActionInput -} - -export type MutationupdateActionsArgs = { - action: ActionUpdateInput - filter: ActionFilter -} - -export type OrderDirection = 'asc' | 'desc' - -export type POIDispute = { - __typename?: 'POIDispute' - allocationAmount: Scalars['BigInt']['output'] - allocationID: Scalars['String']['output'] - allocationIndexer: Scalars['String']['output'] - allocationProof: Scalars['String']['output'] - closedEpoch: Scalars['Int']['output'] - closedEpochReferenceProof?: Maybe - closedEpochStartBlockHash: Scalars['String']['output'] - closedEpochStartBlockNumber: Scalars['Int']['output'] - previousEpochReferenceProof?: Maybe - previousEpochStartBlockHash: Scalars['String']['output'] - previousEpochStartBlockNumber: Scalars['Int']['output'] - protocolNetwork: Scalars['String']['output'] - status: Scalars['String']['output'] - subgraphDeploymentID: Scalars['String']['output'] -} - -export type POIDisputeIdentifier = { - allocationID: Scalars['String']['input'] - protocolNetwork: Scalars['String']['input'] -} - -export type POIDisputeInput = { - allocationAmount: Scalars['BigInt']['input'] - allocationID: Scalars['String']['input'] - allocationIndexer: Scalars['String']['input'] - allocationProof: Scalars['String']['input'] - closedEpoch: Scalars['Int']['input'] - closedEpochReferenceProof?: InputMaybe - closedEpochStartBlockHash: Scalars['String']['input'] - closedEpochStartBlockNumber: Scalars['Int']['input'] - previousEpochReferenceProof?: InputMaybe - previousEpochStartBlockHash: Scalars['String']['input'] - previousEpochStartBlockNumber: Scalars['Int']['input'] - protocolNetwork: Scalars['String']['input'] - status: Scalars['String']['input'] - subgraphDeploymentID: Scalars['String']['input'] -} - -export type Query = { - __typename?: 'Query' - action?: Maybe - actions: Array> - allocations: Array - costModel?: Maybe - costModels: Array - dispute?: Maybe - disputes: Array> - disputesClosedAfter: Array> - indexerAllocations: Array> - indexerDeployments: Array> - indexerEndpoints: Array - indexerRegistration: IndexerRegistration - indexingRule?: Maybe - indexingRules: Array -} - -export type QueryactionArgs = { - actionID: Scalars['String']['input'] -} - -export type QueryactionsArgs = { - filter?: InputMaybe - first?: InputMaybe - orderBy?: InputMaybe - orderDirection?: InputMaybe -} - -export type QueryallocationsArgs = { - filter: AllocationFilter -} - -export type QuerycostModelArgs = { - deployment: Scalars['String']['input'] -} - -export type QuerycostModelsArgs = { - deployments?: InputMaybe> -} - -export type QuerydisputeArgs = { - identifier: POIDisputeIdentifier -} - -export type QuerydisputesArgs = { - minClosedEpoch: Scalars['Int']['input'] - protocolNetwork?: InputMaybe - status: Scalars['String']['input'] -} - -export type QuerydisputesClosedAfterArgs = { - closedAfterBlock: Scalars['BigInt']['input'] - protocolNetwork?: InputMaybe -} - -export type QueryindexerAllocationsArgs = { - protocolNetwork: Scalars['String']['input'] -} - -export type QueryindexerEndpointsArgs = { - protocolNetwork?: InputMaybe -} - -export type QueryindexerRegistrationArgs = { - protocolNetwork: Scalars['String']['input'] -} - -export type QueryindexingRuleArgs = { - identifier: IndexingRuleIdentifier - merged?: Scalars['Boolean']['input'] -} - -export type QueryindexingRulesArgs = { - merged?: Scalars['Boolean']['input'] - protocolNetwork?: InputMaybe -} - -export type ReallocateAllocationResult = { - __typename?: 'ReallocateAllocationResult' - closedAllocation: Scalars['String']['output'] - createdAllocation: Scalars['String']['output'] - createdAllocationStake: Scalars['String']['output'] - indexingRewardsCollected: Scalars['String']['output'] - protocolNetwork: Scalars['String']['output'] - receiptsWorthCollecting: Scalars['Boolean']['output'] -} - -export type ResolverTypeWrapper = Promise | T - -export type ResolverWithResolve = { - resolve: ResolverFn -} -export type Resolver = - | ResolverFn - | ResolverWithResolve - -export type ResolverFn = ( - parent: TParent, - args: TArgs, - context: TContext, - info: GraphQLResolveInfo, -) => Promise | TResult - -export type SubscriptionSubscribeFn = ( - parent: TParent, - args: TArgs, - context: TContext, - info: GraphQLResolveInfo, -) => AsyncIterable | Promise> - -export type SubscriptionResolveFn = ( - parent: TParent, - args: TArgs, - context: TContext, - info: GraphQLResolveInfo, -) => TResult | Promise - -export interface SubscriptionSubscriberObject< - TResult, - TKey extends string, - TParent, - TContext, - TArgs, -> { - subscribe: SubscriptionSubscribeFn<{ [key in TKey]: TResult }, TParent, TContext, TArgs> - resolve?: SubscriptionResolveFn -} - -export interface SubscriptionResolverObject { - subscribe: SubscriptionSubscribeFn - resolve: SubscriptionResolveFn -} - -export type SubscriptionObject = - | SubscriptionSubscriberObject - | SubscriptionResolverObject - -export type SubscriptionResolver< - TResult, - TKey extends string, - TParent = {}, - TContext = {}, - TArgs = {}, -> = - | ((...args: any[]) => SubscriptionObject) - | SubscriptionObject - -export type TypeResolveFn = ( - parent: TParent, - context: TContext, - info: GraphQLResolveInfo, -) => Maybe | Promise> - -export type IsTypeOfResolverFn = ( - obj: T, - context: TContext, - info: GraphQLResolveInfo, -) => boolean | Promise - -export type NextResolverFn = () => Promise - -export type DirectiveResolverFn = ( - next: NextResolverFn, - parent: TParent, - args: TArgs, - context: TContext, - info: GraphQLResolveInfo, -) => TResult | Promise - -/** Mapping between all available schema types and the resolvers types */ -export type ResolversTypes = { - Action: ResolverTypeWrapper - String: ResolverTypeWrapper - Boolean: ResolverTypeWrapper - Int: ResolverTypeWrapper - ActionFilter: ActionFilter - ActionInput: ActionInput - ActionParams: ActionParams - ActionResult: ResolverTypeWrapper - ActionStatus: ActionStatus - ActionType: ActionType - ActionUpdateInput: ActionUpdateInput - Allocation: ResolverTypeWrapper - AllocationFilter: AllocationFilter - AllocationStatus: AllocationStatus - BigInt: ResolverTypeWrapper - BlockPointer: ResolverTypeWrapper - ChainIndexingStatus: ResolverTypeWrapper - CloseAllocationResult: ResolverTypeWrapper - CostModel: ResolverTypeWrapper - CostModelInput: CostModelInput - CreateAllocationResult: ResolverTypeWrapper - GeoLocation: ResolverTypeWrapper - IdentifierType: IdentifierType - IndexerAllocation: ResolverTypeWrapper - IndexerDeployment: ResolverTypeWrapper - IndexerEndpoint: ResolverTypeWrapper - IndexerEndpointTest: ResolverTypeWrapper - IndexerEndpoints: ResolverTypeWrapper - IndexerRegistration: ResolverTypeWrapper - IndexingDecisionBasis: IndexingDecisionBasis - IndexingError: ResolverTypeWrapper - IndexingRule: ResolverTypeWrapper - Float: ResolverTypeWrapper - IndexingRuleIdentifier: IndexingRuleIdentifier - IndexingRuleInput: IndexingRuleInput - Mutation: ResolverTypeWrapper<{}> - OrderDirection: OrderDirection - POIDispute: ResolverTypeWrapper - POIDisputeIdentifier: POIDisputeIdentifier - POIDisputeInput: POIDisputeInput - Query: ResolverTypeWrapper<{}> - ReallocateAllocationResult: ResolverTypeWrapper -} - -/** Mapping between all available schema types and the resolvers parents */ -export type ResolversParentTypes = { - Action: Action - String: Scalars['String']['output'] - Boolean: Scalars['Boolean']['output'] - Int: Scalars['Int']['output'] - ActionFilter: ActionFilter - ActionInput: ActionInput - ActionResult: ActionResult - ActionUpdateInput: ActionUpdateInput - Allocation: Allocation - AllocationFilter: AllocationFilter - BigInt: Scalars['BigInt']['output'] - BlockPointer: BlockPointer - ChainIndexingStatus: ChainIndexingStatus - CloseAllocationResult: CloseAllocationResult - CostModel: CostModel - CostModelInput: CostModelInput - CreateAllocationResult: CreateAllocationResult - GeoLocation: GeoLocation - IndexerAllocation: IndexerAllocation - IndexerDeployment: IndexerDeployment - IndexerEndpoint: IndexerEndpoint - IndexerEndpointTest: IndexerEndpointTest - IndexerEndpoints: IndexerEndpoints - IndexerRegistration: IndexerRegistration - IndexingError: IndexingError - IndexingRule: IndexingRule - Float: Scalars['Float']['output'] - IndexingRuleIdentifier: IndexingRuleIdentifier - IndexingRuleInput: IndexingRuleInput - Mutation: {} - POIDispute: POIDispute - POIDisputeIdentifier: POIDisputeIdentifier - POIDisputeInput: POIDisputeInput - Query: {} - ReallocateAllocationResult: ReallocateAllocationResult -} - -export type ActionResolvers< - ContextType = IndexerManagementResolverContext, - ParentType extends ResolversParentTypes['Action'] = ResolversParentTypes['Action'], -> = { - allocationID?: Resolver, ParentType, ContextType> - amount?: Resolver, ParentType, ContextType> - createdAt?: Resolver - deploymentID?: Resolver, ParentType, ContextType> - failureReason?: Resolver, ParentType, ContextType> - force?: Resolver, ParentType, ContextType> - id?: Resolver - poi?: Resolver, ParentType, ContextType> - priority?: Resolver - protocolNetwork?: Resolver - reason?: Resolver - source?: Resolver - status?: Resolver - transaction?: Resolver, ParentType, ContextType> - type?: Resolver - updatedAt?: Resolver, ParentType, ContextType> - __isTypeOf?: IsTypeOfResolverFn -} - -export type ActionResultResolvers< - ContextType = IndexerManagementResolverContext, - ParentType extends - ResolversParentTypes['ActionResult'] = ResolversParentTypes['ActionResult'], -> = { - allocationID?: Resolver, ParentType, ContextType> - amount?: Resolver, ParentType, ContextType> - deploymentID?: Resolver, ParentType, ContextType> - failureReason?: Resolver, ParentType, ContextType> - force?: Resolver, ParentType, ContextType> - id?: Resolver - poi?: Resolver, ParentType, ContextType> - priority?: Resolver, ParentType, ContextType> - protocolNetwork?: Resolver - reason?: Resolver - source?: Resolver - status?: Resolver - transaction?: Resolver, ParentType, ContextType> - type?: Resolver - __isTypeOf?: IsTypeOfResolverFn -} - -export type AllocationResolvers< - ContextType = IndexerManagementResolverContext, - ParentType extends - ResolversParentTypes['Allocation'] = ResolversParentTypes['Allocation'], -> = { - ageInEpochs?: Resolver - allocatedTokens?: Resolver - closedAtEpoch?: Resolver, ParentType, ContextType> - createdAtEpoch?: Resolver - id?: Resolver - indexer?: Resolver - indexingRewards?: Resolver - protocolNetwork?: Resolver - queryFeesCollected?: Resolver - signalledTokens?: Resolver - stakedTokens?: Resolver - status?: Resolver - subgraphDeployment?: Resolver - __isTypeOf?: IsTypeOfResolverFn -} - -export interface BigIntScalarConfig - extends GraphQLScalarTypeConfig { - name: 'BigInt' -} - -export type BlockPointerResolvers< - ContextType = IndexerManagementResolverContext, - ParentType extends - ResolversParentTypes['BlockPointer'] = ResolversParentTypes['BlockPointer'], -> = { - hash?: Resolver - number?: Resolver - __isTypeOf?: IsTypeOfResolverFn -} - -export type ChainIndexingStatusResolvers< - ContextType = IndexerManagementResolverContext, - ParentType extends - ResolversParentTypes['ChainIndexingStatus'] = ResolversParentTypes['ChainIndexingStatus'], -> = { - chainHeadBlock?: Resolver< - Maybe, - ParentType, - ContextType - > - earliestBlock?: Resolver, ParentType, ContextType> - latestBlock?: Resolver, ParentType, ContextType> - network?: Resolver - __isTypeOf?: IsTypeOfResolverFn -} - -export type CloseAllocationResultResolvers< - ContextType = IndexerManagementResolverContext, - ParentType extends - ResolversParentTypes['CloseAllocationResult'] = ResolversParentTypes['CloseAllocationResult'], -> = { - allocatedTokens?: Resolver - allocation?: Resolver - indexingRewards?: Resolver - protocolNetwork?: Resolver - receiptsWorthCollecting?: Resolver - __isTypeOf?: IsTypeOfResolverFn -} - -export type CostModelResolvers< - ContextType = IndexerManagementResolverContext, - ParentType extends - ResolversParentTypes['CostModel'] = ResolversParentTypes['CostModel'], -> = { - deployment?: Resolver - model?: Resolver, ParentType, ContextType> - variables?: Resolver, ParentType, ContextType> - __isTypeOf?: IsTypeOfResolverFn -} - -export type CreateAllocationResultResolvers< - ContextType = IndexerManagementResolverContext, - ParentType extends - ResolversParentTypes['CreateAllocationResult'] = ResolversParentTypes['CreateAllocationResult'], -> = { - allocatedTokens?: Resolver - allocation?: Resolver - deployment?: Resolver - protocolNetwork?: Resolver - __isTypeOf?: IsTypeOfResolverFn -} - -export type GeoLocationResolvers< - ContextType = IndexerManagementResolverContext, - ParentType extends - ResolversParentTypes['GeoLocation'] = ResolversParentTypes['GeoLocation'], -> = { - latitude?: Resolver - longitude?: Resolver - __isTypeOf?: IsTypeOfResolverFn -} - -export type IndexerAllocationResolvers< - ContextType = IndexerManagementResolverContext, - ParentType extends - ResolversParentTypes['IndexerAllocation'] = ResolversParentTypes['IndexerAllocation'], -> = { - allocatedTokens?: Resolver - closedAtEpoch?: Resolver, ParentType, ContextType> - createdAtEpoch?: Resolver - id?: Resolver - signalledTokens?: Resolver - stakedTokens?: Resolver - subgraphDeployment?: Resolver - __isTypeOf?: IsTypeOfResolverFn -} - -export type IndexerDeploymentResolvers< - ContextType = IndexerManagementResolverContext, - ParentType extends - ResolversParentTypes['IndexerDeployment'] = ResolversParentTypes['IndexerDeployment'], -> = { - chains?: Resolver< - Maybe>>, - ParentType, - ContextType - > - fatalError?: Resolver, ParentType, ContextType> - health?: Resolver - node?: Resolver, ParentType, ContextType> - subgraphDeployment?: Resolver - synced?: Resolver - __isTypeOf?: IsTypeOfResolverFn -} - -export type IndexerEndpointResolvers< - ContextType = IndexerManagementResolverContext, - ParentType extends - ResolversParentTypes['IndexerEndpoint'] = ResolversParentTypes['IndexerEndpoint'], -> = { - healthy?: Resolver - protocolNetwork?: Resolver - tests?: Resolver, ParentType, ContextType> - url?: Resolver, ParentType, ContextType> - __isTypeOf?: IsTypeOfResolverFn -} - -export type IndexerEndpointTestResolvers< - ContextType = IndexerManagementResolverContext, - ParentType extends - ResolversParentTypes['IndexerEndpointTest'] = ResolversParentTypes['IndexerEndpointTest'], -> = { - error?: Resolver, ParentType, ContextType> - possibleActions?: Resolver< - Array>, - ParentType, - ContextType - > - test?: Resolver - __isTypeOf?: IsTypeOfResolverFn -} - -export type IndexerEndpointsResolvers< - ContextType = IndexerManagementResolverContext, - ParentType extends - ResolversParentTypes['IndexerEndpoints'] = ResolversParentTypes['IndexerEndpoints'], -> = { - service?: Resolver - status?: Resolver - __isTypeOf?: IsTypeOfResolverFn -} - -export type IndexerRegistrationResolvers< - ContextType = IndexerManagementResolverContext, - ParentType extends - ResolversParentTypes['IndexerRegistration'] = ResolversParentTypes['IndexerRegistration'], -> = { - address?: Resolver, ParentType, ContextType> - location?: Resolver, ParentType, ContextType> - protocolNetwork?: Resolver - registered?: Resolver - url?: Resolver, ParentType, ContextType> - __isTypeOf?: IsTypeOfResolverFn -} - -export type IndexingErrorResolvers< - ContextType = IndexerManagementResolverContext, - ParentType extends - ResolversParentTypes['IndexingError'] = ResolversParentTypes['IndexingError'], -> = { - handler?: Resolver, ParentType, ContextType> - message?: Resolver - __isTypeOf?: IsTypeOfResolverFn -} - -export type IndexingRuleResolvers< - ContextType = IndexerManagementResolverContext, - ParentType extends - ResolversParentTypes['IndexingRule'] = ResolversParentTypes['IndexingRule'], -> = { - allocationAmount?: Resolver, ParentType, ContextType> - allocationLifetime?: Resolver, ParentType, ContextType> - autoRenewal?: Resolver - custom?: Resolver, ParentType, ContextType> - decisionBasis?: Resolver< - ResolversTypes['IndexingDecisionBasis'], - ParentType, - ContextType - > - identifier?: Resolver - identifierType?: Resolver - maxAllocationPercentage?: Resolver< - Maybe, - ParentType, - ContextType - > - maxSignal?: Resolver, ParentType, ContextType> - minAverageQueryFees?: Resolver, ParentType, ContextType> - minSignal?: Resolver, ParentType, ContextType> - minStake?: Resolver, ParentType, ContextType> - parallelAllocations?: Resolver, ParentType, ContextType> - protocolNetwork?: Resolver - requireSupported?: Resolver - safety?: Resolver - __isTypeOf?: IsTypeOfResolverFn -} - -export type MutationResolvers< - ContextType = IndexerManagementResolverContext, - ParentType extends ResolversParentTypes['Mutation'] = ResolversParentTypes['Mutation'], -> = { - approveActions?: Resolver< - Array>, - ParentType, - ContextType, - RequireFields - > - cancelActions?: Resolver< - Array>, - ParentType, - ContextType, - RequireFields - > - closeAllocation?: Resolver< - ResolversTypes['CloseAllocationResult'], - ParentType, - ContextType, - RequireFields - > - createAllocation?: Resolver< - ResolversTypes['CreateAllocationResult'], - ParentType, - ContextType, - RequireFields< - MutationcreateAllocationArgs, - 'amount' | 'deployment' | 'protocolNetwork' - > - > - deleteActions?: Resolver< - ResolversTypes['Int'], - ParentType, - ContextType, - RequireFields - > - deleteCostModels?: Resolver< - ResolversTypes['Int'], - ParentType, - ContextType, - RequireFields - > - deleteDisputes?: Resolver< - ResolversTypes['Int'], - ParentType, - ContextType, - RequireFields - > - deleteIndexingRule?: Resolver< - ResolversTypes['Boolean'], - ParentType, - ContextType, - RequireFields - > - deleteIndexingRules?: Resolver< - ResolversTypes['Boolean'], - ParentType, - ContextType, - RequireFields - > - executeApprovedActions?: Resolver< - Array, - ParentType, - ContextType - > - queueActions?: Resolver< - Array>, - ParentType, - ContextType, - RequireFields - > - reallocateAllocation?: Resolver< - ResolversTypes['ReallocateAllocationResult'], - ParentType, - ContextType, - RequireFields< - MutationreallocateAllocationArgs, - 'allocation' | 'amount' | 'protocolNetwork' - > - > - setCostModel?: Resolver< - ResolversTypes['CostModel'], - ParentType, - ContextType, - RequireFields - > - setIndexingRule?: Resolver< - ResolversTypes['IndexingRule'], - ParentType, - ContextType, - RequireFields - > - storeDisputes?: Resolver< - Maybe>, - ParentType, - ContextType, - RequireFields - > - updateAction?: Resolver< - ResolversTypes['Action'], - ParentType, - ContextType, - RequireFields - > - updateActions?: Resolver< - Array>, - ParentType, - ContextType, - RequireFields - > -} - -export type POIDisputeResolvers< - ContextType = IndexerManagementResolverContext, - ParentType extends - ResolversParentTypes['POIDispute'] = ResolversParentTypes['POIDispute'], -> = { - allocationAmount?: Resolver - allocationID?: Resolver - allocationIndexer?: Resolver - allocationProof?: Resolver - closedEpoch?: Resolver - closedEpochReferenceProof?: Resolver< - Maybe, - ParentType, - ContextType - > - closedEpochStartBlockHash?: Resolver - closedEpochStartBlockNumber?: Resolver - previousEpochReferenceProof?: Resolver< - Maybe, - ParentType, - ContextType - > - previousEpochStartBlockHash?: Resolver< - ResolversTypes['String'], - ParentType, - ContextType - > - previousEpochStartBlockNumber?: Resolver - protocolNetwork?: Resolver - status?: Resolver - subgraphDeploymentID?: Resolver - __isTypeOf?: IsTypeOfResolverFn -} - -export type QueryResolvers< - ContextType = IndexerManagementResolverContext, - ParentType extends ResolversParentTypes['Query'] = ResolversParentTypes['Query'], -> = { - action?: Resolver< - Maybe, - ParentType, - ContextType, - RequireFields - > - actions?: Resolver< - Array>, - ParentType, - ContextType, - Partial - > - allocations?: Resolver< - Array, - ParentType, - ContextType, - RequireFields - > - costModel?: Resolver< - Maybe, - ParentType, - ContextType, - RequireFields - > - costModels?: Resolver< - Array, - ParentType, - ContextType, - Partial - > - dispute?: Resolver< - Maybe, - ParentType, - ContextType, - RequireFields - > - disputes?: Resolver< - Array>, - ParentType, - ContextType, - RequireFields - > - disputesClosedAfter?: Resolver< - Array>, - ParentType, - ContextType, - RequireFields - > - indexerAllocations?: Resolver< - Array>, - ParentType, - ContextType, - RequireFields - > - indexerDeployments?: Resolver< - Array>, - ParentType, - ContextType - > - indexerEndpoints?: Resolver< - Array, - ParentType, - ContextType, - Partial - > - indexerRegistration?: Resolver< - ResolversTypes['IndexerRegistration'], - ParentType, - ContextType, - RequireFields - > - indexingRule?: Resolver< - Maybe, - ParentType, - ContextType, - RequireFields - > - indexingRules?: Resolver< - Array, - ParentType, - ContextType, - RequireFields - > -} - -export type ReallocateAllocationResultResolvers< - ContextType = IndexerManagementResolverContext, - ParentType extends - ResolversParentTypes['ReallocateAllocationResult'] = ResolversParentTypes['ReallocateAllocationResult'], -> = { - closedAllocation?: Resolver - createdAllocation?: Resolver - createdAllocationStake?: Resolver - indexingRewardsCollected?: Resolver - protocolNetwork?: Resolver - receiptsWorthCollecting?: Resolver - __isTypeOf?: IsTypeOfResolverFn -} - -export type Resolvers = { - Action?: ActionResolvers - ActionResult?: ActionResultResolvers - Allocation?: AllocationResolvers - BigInt?: GraphQLScalarType - BlockPointer?: BlockPointerResolvers - ChainIndexingStatus?: ChainIndexingStatusResolvers - CloseAllocationResult?: CloseAllocationResultResolvers - CostModel?: CostModelResolvers - CreateAllocationResult?: CreateAllocationResultResolvers - GeoLocation?: GeoLocationResolvers - IndexerAllocation?: IndexerAllocationResolvers - IndexerDeployment?: IndexerDeploymentResolvers - IndexerEndpoint?: IndexerEndpointResolvers - IndexerEndpointTest?: IndexerEndpointTestResolvers - IndexerEndpoints?: IndexerEndpointsResolvers - IndexerRegistration?: IndexerRegistrationResolvers - IndexingError?: IndexingErrorResolvers - IndexingRule?: IndexingRuleResolvers - Mutation?: MutationResolvers - POIDispute?: POIDisputeResolvers - Query?: QueryResolvers - ReallocateAllocationResult?: ReallocateAllocationResultResolvers -} From 86af179f9d05c8d5dea960f2f8d3aa60ea9e7bb9 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Fri, 23 Feb 2024 11:00:25 -0500 Subject: [PATCH 08/48] new line --- packages/indexer-common/src/schema/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/indexer-common/src/schema/.gitignore b/packages/indexer-common/src/schema/.gitignore index 2d5c5d4cd..c61f4a4a4 100644 --- a/packages/indexer-common/src/schema/.gitignore +++ b/packages/indexer-common/src/schema/.gitignore @@ -1 +1 @@ -*.generated.ts \ No newline at end of file +*.generated.ts From b2e122cd3e0775411314051ba856d33109d452c2 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Fri, 23 Feb 2024 11:01:09 -0500 Subject: [PATCH 09/48] fix build --- packages/indexer-common/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/indexer-common/tsconfig.json b/packages/indexer-common/tsconfig.json index aa1c8e8ec..549f59cac 100644 --- a/packages/indexer-common/tsconfig.json +++ b/packages/indexer-common/tsconfig.json @@ -20,7 +20,7 @@ ], "resolveJsonModule": true }, - "include": ["src/**/*.ts", "codegen.ts"], + "include": ["src/**/*.ts"], "exclude": [], "references": [] } From 1be1651a82a0d9250cdf1431efd9b39e5c61cb54 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Fri, 23 Feb 2024 11:10:53 -0500 Subject: [PATCH 10/48] scalars --- packages/indexer-common/package.json | 1 + .../indexer-management/resolvers/BigInt.ts | 17 +++-------------- yarn.lock | 7 +++++++ 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/packages/indexer-common/package.json b/packages/indexer-common/package.json index 087aff4f2..aac65591f 100644 --- a/packages/indexer-common/package.json +++ b/packages/indexer-common/package.json @@ -39,6 +39,7 @@ "express": "4.18.2", "fastify": "3.25.0", "graphql": "16.8.0", + "graphql-scalars": "^1.22.5", "graphql-tag": "2.12.6", "graphql-yoga": "^5.1.1", "jayson": "3.6.6", diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/BigInt.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/BigInt.ts index 7515eca21..9bcc010bd 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/BigInt.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/BigInt.ts @@ -1,14 +1,3 @@ -import { GraphQLScalarType } from 'graphql' -export const BigInt = new GraphQLScalarType({ - name: 'BigInt', - description: 'BigInt description', - serialize: (value) => { - /* Implement logic to turn the returned value from resolvers to a value that can be sent to clients */ - }, - parseValue: (value) => { - /* Implement logic to parse input that was sent to the server as variables */ - }, - parseLiteral: (ast) => { - /* Implement logic to parse input that was sent to the server as literal values (string, number, or boolean) */ - }, -}) +import { BigIntResolver } from 'graphql-scalars' + +export const BigInt = BigIntResolver diff --git a/yarn.lock b/yarn.lock index af0283357..421077f1d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8112,6 +8112,13 @@ graphql-request@^6.0.0: "@graphql-typed-document-node/core" "^3.2.0" cross-fetch "^3.1.5" +graphql-scalars@^1.22.5: + version "1.22.5" + resolved "https://registry.yarnpkg.com/graphql-scalars/-/graphql-scalars-1.22.5.tgz#f7aceacf0efd2f38d53635c69895e3c67c04bd37" + integrity sha512-Mw7uaqRscjdaXmxlHbt3sYGLU8o1hfFvTvN2VRrYEJyEPy6zGIbaFyJ4PPyt9H6GRHp01MQwS6HqXroRYHyGOg== + dependencies: + tslib "^2.5.0" + graphql-tag@2.12.6, graphql-tag@^2.11.0, graphql-tag@^2.12.3: version "2.12.6" resolved "https://registry.npmjs.org/graphql-tag/-/graphql-tag-2.12.6.tgz" From 68315771c7b2e32d4a341261609d955eae3973ee Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Fri, 23 Feb 2024 11:28:48 -0500 Subject: [PATCH 11/48] mutation --- .../Mutation/reallocateAllocation.ts | 394 +++++++++++++++++- .../resolvers/Mutation/setIndexingRule.ts | 31 +- .../resolvers/Mutation/storeDisputes.ts | 26 +- .../resolvers/Mutation/updateAction.ts | 25 +- .../resolvers/Mutation/updateActions.ts | 25 +- 5 files changed, 487 insertions(+), 14 deletions(-) diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/reallocateAllocation.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/reallocateAllocation.ts index 832af329a..168a94fdc 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/reallocateAllocation.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/reallocateAllocation.ts @@ -1,6 +1,396 @@ +import { extractNetwork } from 'indexer-common/src/indexer-management/resolvers/utils' import type { MutationResolvers } from './../../../types.generated' +import { formatGRT, parseGRT, toAddress } from '@graphprotocol/common-ts' +import { Allocation, AllocationStatus } from 'indexer-common/src/allocations/types' +import { IndexerErrorCode, indexerError } from 'indexer-common/src/errors' +import { BigNumber, utils } from 'ethers' +import { NetworkMonitor } from 'indexer-common/src/indexer-management/monitor' +import { GraphNode } from 'indexer-common/src/graph-node' +import { + allocationIdProof, + uniqueAllocationID, +} from 'indexer-common/src/allocations/keys' +import { SubgraphIdentifierType } from 'indexer-common/src/subgraphs' +import { IndexingDecisionBasis } from 'indexer-common/src/indexer-management/models/indexing-rule' + +async function resolvePOI( + networkMonitor: NetworkMonitor, + graphNode: GraphNode, + allocation: Allocation, + poi: string | undefined, + force: boolean, +): Promise { + // poi = undefined, force=true -- submit even if poi is 0x0 + // poi = defined, force=true -- no generatedPOI needed, just submit the POI supplied (with some sanitation?) + // poi = undefined, force=false -- submit with generated POI if one available + // poi = defined, force=false -- submit user defined POI only if generated POI matches + switch (force) { + case true: + switch (!!poi) { + case true: + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + return poi! + case false: + return ( + (await graphNode.proofOfIndexing( + allocation.subgraphDeployment.id, + await networkMonitor.fetchPOIBlockPointer(allocation), + allocation.indexer, + )) || utils.hexlify(Array(32).fill(0)) + ) + } + break + case false: { + const currentEpochStartBlock = await networkMonitor.fetchPOIBlockPointer(allocation) + const generatedPOI = await graphNode.proofOfIndexing( + allocation.subgraphDeployment.id, + currentEpochStartBlock, + allocation.indexer, + ) + switch (poi == generatedPOI) { + case true: + if (poi == undefined) { + const deploymentStatus = await graphNode.indexingStatus([ + allocation.subgraphDeployment.id, + ]) + throw indexerError( + IndexerErrorCode.IE067, + `POI not available for deployment at current epoch start block. + currentEpochStartBlock: ${currentEpochStartBlock.number} + deploymentStatus: ${ + deploymentStatus.length > 0 + ? JSON.stringify(deploymentStatus) + : 'not deployed' + }`, + ) + } else { + return poi + } + case false: + if (poi == undefined && generatedPOI !== undefined) { + return generatedPOI + } else if (poi !== undefined && generatedPOI == undefined) { + return poi + } + throw indexerError( + IndexerErrorCode.IE068, + `User provided POI does not match reference fetched from the graph-node. Use '--force' to bypass this POI accuracy check. + POI: ${poi}, + referencePOI: ${generatedPOI}`, + ) + } + } + } +} + export const reallocateAllocation: NonNullable< MutationResolvers['reallocateAllocation'] -> = async (_parent, _arg, _ctx) => { - /* Implement Mutation.reallocateAllocation resolver logic here */ +> = async ( + _parent, + { allocation, poi, amount, force, protocolNetwork }, + { logger, graphNode, models, multiNetworks }, +) => { + logger = logger.child({ + component: 'reallocateAllocationResolver', + }) + + logger.info('Reallocating allocation', { + allocation: allocation, + poi: poi || 'none provided', + amount, + force, + }) + + if (!multiNetworks) { + throw Error('IndexerManagementClient must be in `network` mode to fetch allocations') + } + + // Obtain the Network object and its associated components and data + const network = extractNetwork(protocolNetwork, multiNetworks) + const networkMonitor = network.networkMonitor + const contracts = network.contracts + const transactionManager = network.transactionManager + const receiptCollector = network.receiptCollector + const address = network.specification.indexerOptions.address + + const allocationAmount = parseGRT(amount) + + const activeAllocations = await networkMonitor.allocations(AllocationStatus.ACTIVE) + + const allocationAddress = toAddress(allocation) + const allocationData = activeAllocations.find((allocation) => { + return allocation.id === allocationAddress + }) + + if (!allocationData) { + throw indexerError( + IndexerErrorCode.IE063, + `Reallocation failed: No active allocation with id '${allocation}' found`, + ) + } + + try { + // Ensure allocation is old enough to close + const currentEpoch = await contracts.epochManager.currentEpoch() + if (BigNumber.from(allocationData.createdAtEpoch).eq(currentEpoch)) { + throw indexerError( + IndexerErrorCode.IE064, + `Allocation '${ + allocationData.id + }' cannot be closed until epoch ${currentEpoch.add( + 1, + )}. (Allocations cannot be closed in the same epoch they were created)`, + ) + } + + logger.debug('Resolving POI') + const allocationPOI = await resolvePOI( + networkMonitor, + graphNode, + allocationData, + poi || undefined, + Boolean(force), + ) + logger.debug('POI resolved', { + userProvidedPOI: poi, + poi: allocationPOI, + }) + + // Double-check whether the allocation is still active on chain, to + // avoid unnecessary transactions. + // Note: We're checking the allocation state here, which is defined as + // + // enum AllocationState { Null, Active, Closed, Finalized } + // + // in the contracts. + const state = await contracts.staking.getAllocationState(allocationData.id) + if (state !== 1) { + logger.warn(`Allocation has already been closed`) + throw indexerError(IndexerErrorCode.IE065, `Allocation has already been closed`) + } + + if (allocationAmount.lt('0')) { + logger.warn('Cannot reallocate a negative amount of GRT', { + amount: allocationAmount.toString(), + }) + throw indexerError( + IndexerErrorCode.IE061, + 'Cannot reallocate a negative amount of GRT', + ) + } + + logger.info(`Reallocate to subgraph deployment`, { + existingAllocationAmount: formatGRT(allocationData.allocatedTokens), + newAllocationAmount: formatGRT(allocationAmount), + epoch: currentEpoch.toString(), + }) + + // Identify how many GRT the indexer has staked + const freeStake = await contracts.staking.getIndexerCapacity(address) + + // When reallocating, we will first close the old allocation and free up the GRT in that allocation + // This GRT will be available in addition to freeStake for the new allocation + const postCloseFreeStake = freeStake.add(allocationData.allocatedTokens) + + // If there isn't enough left for allocating, abort + if (postCloseFreeStake.lt(allocationAmount)) { + throw indexerError( + IndexerErrorCode.IE013, + `Unable to allocate ${formatGRT( + allocationAmount, + )} GRT: indexer only has a free stake amount of ${formatGRT( + freeStake, + )} GRT, plus ${formatGRT( + allocationData.allocatedTokens, + )} GRT from the existing allocation`, + ) + } + + logger.debug('Generating a new unique Allocation ID') + const { allocationSigner, allocationId: newAllocationId } = uniqueAllocationID( + transactionManager.wallet.mnemonic.phrase, + currentEpoch.toNumber(), + allocationData.subgraphDeployment.id, + activeAllocations.map((allocation) => allocation.id), + ) + + logger.debug('New unique Allocation ID generated', { + newAllocationID: newAllocationId, + newAllocationSigner: allocationSigner, + }) + + // Double-check whether the allocationID already exists on chain, to + // avoid unnecessary transactions. + // Note: We're checking the allocation state here, which is defined as + // + // enum AllocationState { Null, Active, Closed, Finalized } + // + // in the contracts. + const newAllocationState = await contracts.staking.getAllocationState(newAllocationId) + if (newAllocationState !== 0) { + logger.warn(`Skipping Allocation as it already exists onchain`, { + indexer: address, + allocation: newAllocationId, + newAllocationState, + }) + throw indexerError(IndexerErrorCode.IE066, 'AllocationID already exists') + } + + logger.debug('Generating new allocation ID proof', { + newAllocationSigner: allocationSigner, + newAllocationID: newAllocationId, + indexerAddress: address, + }) + const proof = await allocationIdProof(allocationSigner, address, newAllocationId) + logger.debug('Successfully generated allocation ID proof', { + allocationIDProof: proof, + }) + + logger.info(`Sending close and allocate multicall transaction`, { + indexer: address, + amount: formatGRT(allocationAmount), + oldAllocation: allocationData.id, + newAllocation: newAllocationId, + newAllocationAmount: formatGRT(allocationAmount), + deployment: allocationData.subgraphDeployment.id.toString(), + poi: allocationPOI, + proof, + epoch: currentEpoch.toString(), + }) + + const callData = [ + await contracts.staking.populateTransaction.closeAllocation( + allocationData.id, + allocationPOI, + ), + await contracts.staking.populateTransaction.allocateFrom( + address, + allocationData.subgraphDeployment.id.bytes32, + allocationAmount, + newAllocationId, + utils.hexlify(Array(32).fill(0)), // metadata + proof, + ), + ].map((tx) => tx.data as string) + + const receipt = await transactionManager.executeTransaction( + async () => contracts.staking.estimateGas.multicall(callData), + async (gasLimit) => contracts.staking.multicall(callData, { gasLimit }), + logger.child({ + function: 'closeAndAllocate', + }), + ) + + if (receipt === 'paused' || receipt === 'unauthorized') { + throw indexerError( + IndexerErrorCode.IE062, + `Allocation '${newAllocationId}' could not be closed: ${receipt}`, + ) + } + + const createAllocationEventLogs = transactionManager.findEvent( + 'AllocationCreated', + contracts.staking.interface, + 'subgraphDeploymentID', + allocationData.subgraphDeployment.id.toString(), + receipt, + logger, + ) + + if (!createAllocationEventLogs) { + throw indexerError(IndexerErrorCode.IE014, `Allocation was never mined`) + } + + const closeAllocationEventLogs = transactionManager.findEvent( + 'AllocationClosed', + contracts.staking.interface, + 'allocationID', + allocation, + receipt, + logger, + ) + + if (!closeAllocationEventLogs) { + throw indexerError( + IndexerErrorCode.IE015, + `Allocation close transaction was never successfully mined`, + ) + } + + const rewardsEventLogs = transactionManager.findEvent( + 'RewardsAssigned', + contracts.rewardsManager.interface, + 'allocationID', + allocation, + receipt, + logger, + ) + + const rewardsAssigned = rewardsEventLogs ? rewardsEventLogs.amount : 0 + + if (rewardsAssigned == 0) { + logger.warn('No rewards were distributed upon closing the allocation') + } + + logger.info(`Successfully reallocated allocation`, { + deployment: createAllocationEventLogs.subgraphDeploymentID, + closedAllocation: closeAllocationEventLogs.allocationID, + closedAllocationStakeGRT: formatGRT(closeAllocationEventLogs.tokens), + closedAllocationPOI: closeAllocationEventLogs.poi, + closedAllocationEpoch: closeAllocationEventLogs.epoch.toString(), + indexingRewardsCollected: rewardsAssigned, + createdAllocation: createAllocationEventLogs.allocationID, + createdAllocationStakeGRT: formatGRT(createAllocationEventLogs.tokens), + indexer: createAllocationEventLogs.indexer, + epoch: createAllocationEventLogs.epoch.toString(), + transaction: receipt.transactionHash, + }) + + logger.info('Identifying receipts worth collecting', { + allocation: closeAllocationEventLogs.allocationID, + }) + + // Collect query fees for this allocation + const isCollectingQueryFees = await receiptCollector.collectReceipts( + 0, + allocationData, + ) + + logger.debug( + `Updating indexing rules, so indexer-agent will now manage the active allocation`, + ) + const indexingRule = { + identifier: allocationData.subgraphDeployment.id.ipfsHash, + allocationAmount: allocationAmount.toString(), + identifierType: SubgraphIdentifierType.DEPLOYMENT, + decisionBasis: IndexingDecisionBasis.ALWAYS, + protocolNetwork, + } + + await models.IndexingRule.upsert(indexingRule) + + // Since upsert succeeded, we _must_ have a rule + const updatedRule = await models.IndexingRule.findOne({ + where: { identifier: indexingRule.identifier }, + }) + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + logger.debug(`DecisionBasis.ALWAYS rule merged into indexing rules`, { + rule: updatedRule, + }) + + return { + actionID: 0, + type: 'reallocate', + transactionID: receipt.transactionHash, + closedAllocation: closeAllocationEventLogs.allocationID, + indexingRewardsCollected: formatGRT(rewardsAssigned), + receiptsWorthCollecting: isCollectingQueryFees, + createdAllocation: createAllocationEventLogs.allocationID, + createdAllocationStake: formatGRT(createAllocationEventLogs.tokens), + protocolNetwork, + } + } catch (error) { + logger.error(error.toString()) + throw error + } } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setIndexingRule.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setIndexingRule.ts index b02d5bc83..f47aa3f7e 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setIndexingRule.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setIndexingRule.ts @@ -1,8 +1,33 @@ +import { validateNetworkIdentifier } from 'indexer-common/src/parsers/validators' import type { MutationResolvers } from './../../../types.generated' +import { processIdentifier } from 'indexer-common/src/subgraphs' + export const setIndexingRule: NonNullable = async ( _parent, - _arg, - _ctx, + { rule }, + { models }, ) => { - /* Implement Mutation.setIndexingRule resolver logic here */ + if (!rule.identifier) { + throw Error('Cannot set indexingRule without identifier') + } + + if (!rule.protocolNetwork) { + throw Error("Cannot set an indexing rule without the field 'protocolNetwork'") + } else { + try { + rule.protocolNetwork = validateNetworkIdentifier(rule.protocolNetwork) + } catch (e) { + throw Error(`Invalid value for the field 'protocolNetwork'. ${e}`) + } + } + + const [identifier] = await processIdentifier(rule.identifier, { + all: false, + global: true, + }) + rule.identifier = identifier + + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const [updatedRule, _created] = await models.IndexingRule.upsert(rule) + return updatedRule.toGraphQL() } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/storeDisputes.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/storeDisputes.ts index 94d57e92a..95d0e7914 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/storeDisputes.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/storeDisputes.ts @@ -1,8 +1,28 @@ +import { validateNetworkIdentifier } from 'indexer-common/src/parsers/validators' import type { MutationResolvers } from './../../../types.generated' + export const storeDisputes: NonNullable = async ( _parent, - _arg, - _ctx, + { disputes }, + { models }, ) => { - /* Implement Mutation.storeDisputes resolver logic here */ + // Sanitize protocol network identifiers + for (const dispute of disputes) { + if (!dispute.protocolNetwork) { + throw new Error(`Dispute is missing the attribute 'protocolNetwork'`) + } + dispute.protocolNetwork = validateNetworkIdentifier(dispute.protocolNetwork) + } + + const createdDisputes = await models.POIDispute.bulkCreate(disputes, { + returning: true, + validate: true, + updateOnDuplicate: [ + 'closedEpochReferenceProof', + 'previousEpochReferenceProof', + 'status', + ], + conflictAttributes: ['allocationID', 'protocolNetwork'], + }) + return createdDisputes.map((dispute) => dispute.toGraphQL()) } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/updateAction.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/updateAction.ts index 61e32ccd6..309d27940 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/updateAction.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/updateAction.ts @@ -1,8 +1,27 @@ import type { MutationResolvers } from './../../../types.generated' + export const updateAction: NonNullable = async ( _parent, - _arg, - _ctx, + { action }, + { logger, models }, ) => { - /* Implement Mutation.updateAction resolver logic here */ + logger.debug(`Execute 'updateAction' mutation`, { + action, + }) + const [, updatedActions] = await models.Action.update(action, { + where: { id: action.id }, + returning: true, + }) + + if (updatedActions.length === 0) { + throw Error( + `Update action failed, are you sure there is an item in the queue with id = ${action.id}`, + ) + } + if (updatedActions.length > 1) { + throw Error( + `${updatedActions.length} action items updated in the queue. Should be '1'`, + ) + } + return updatedActions[0] } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/updateActions.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/updateActions.ts index dd510dcc9..dadd59530 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/updateActions.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/updateActions.ts @@ -1,8 +1,27 @@ +import { ActionManager } from 'indexer-common/src/indexer-management/actions' import type { MutationResolvers } from './../../../types.generated' + export const updateActions: NonNullable = async ( _parent, - _arg, - _ctx, + { filter, action }, + { logger, models }, ) => { - /* Implement Mutation.updateActions resolver logic here */ + logger.debug(`Execute 'updateActions' mutation`, { + filter, + action, + }) + + const results = await ActionManager.updateActions(models, action, filter) + + if (results[0] === 0) { + const msg = `Actions update failed: No action was matched by the filter, '${JSON.stringify( + filter, + )}'` + logger.debug(msg) + throw Error(msg) + } + logger.info(`'${results[0]}' actions updated`) + const response = results[1] + + return response } From 465f04f1baa70d35ba67d13b1072431f5533f707 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Fri, 23 Feb 2024 12:33:30 -0500 Subject: [PATCH 12/48] remove unused --- packages/indexer-common/src/indexer-management/client.ts | 1 - .../indexer-common/src/indexer-management/schema.graphql | 1 - .../resolvers/Query/disputesClosedAfter.ts | 6 ------ 3 files changed, 8 deletions(-) delete mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Query/disputesClosedAfter.ts diff --git a/packages/indexer-common/src/indexer-management/client.ts b/packages/indexer-common/src/indexer-management/client.ts index 2b839bfd8..c3ea4c9a7 100644 --- a/packages/indexer-common/src/indexer-management/client.ts +++ b/packages/indexer-common/src/indexer-management/client.ts @@ -379,7 +379,6 @@ const SCHEMA_SDL = gql` minClosedEpoch: Int! protocolNetwork: String ): [POIDispute]! - disputesClosedAfter(closedAfterBlock: BigInt!, protocolNetwork: String): [POIDispute]! allocations(filter: AllocationFilter!): [Allocation!]! diff --git a/packages/indexer-common/src/indexer-management/schema.graphql b/packages/indexer-common/src/indexer-management/schema.graphql index 9fa32dae9..5db2dfeb2 100644 --- a/packages/indexer-common/src/indexer-management/schema.graphql +++ b/packages/indexer-common/src/indexer-management/schema.graphql @@ -354,7 +354,6 @@ type Query { dispute(identifier: POIDisputeIdentifier!): POIDispute disputes(status: String!, minClosedEpoch: Int!, protocolNetwork: String): [POIDispute]! - disputesClosedAfter(closedAfterBlock: BigInt!, protocolNetwork: String): [POIDispute]! allocations(filter: AllocationFilter!): [Allocation!]! diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/disputesClosedAfter.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/disputesClosedAfter.ts deleted file mode 100644 index 160943cd5..000000000 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/disputesClosedAfter.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { QueryResolvers } from './../../../types.generated' -export const disputesClosedAfter: NonNullable< - QueryResolvers['disputesClosedAfter'] -> = async (_parent, _arg, _ctx) => { - /* Implement Query.disputesClosedAfter resolver logic here */ -} From 145fce59bbce6388c41b7a10879026bc1a1fa861 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Fri, 23 Feb 2024 12:35:14 -0500 Subject: [PATCH 13/48] remove Mutation.updateAction not used anywhere --- .../src/indexer-management/schema.graphql | 1 - .../resolvers/Mutation/updateAction.ts | 27 ------------------- 2 files changed, 28 deletions(-) delete mode 100644 packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/updateAction.ts diff --git a/packages/indexer-common/src/indexer-management/schema.graphql b/packages/indexer-common/src/indexer-management/schema.graphql index 5db2dfeb2..416cf5724 100644 --- a/packages/indexer-common/src/indexer-management/schema.graphql +++ b/packages/indexer-common/src/indexer-management/schema.graphql @@ -397,7 +397,6 @@ type Mutation { protocolNetwork: String! ): ReallocateAllocationResult! - updateAction(action: ActionInput!): Action! updateActions(filter: ActionFilter!, action: ActionUpdateInput!): [Action]! queueActions(actions: [ActionInput!]!): [Action]! cancelActions(actionIDs: [String!]!): [Action]! diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/updateAction.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/updateAction.ts deleted file mode 100644 index 309d27940..000000000 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/updateAction.ts +++ /dev/null @@ -1,27 +0,0 @@ -import type { MutationResolvers } from './../../../types.generated' - -export const updateAction: NonNullable = async ( - _parent, - { action }, - { logger, models }, -) => { - logger.debug(`Execute 'updateAction' mutation`, { - action, - }) - const [, updatedActions] = await models.Action.update(action, { - where: { id: action.id }, - returning: true, - }) - - if (updatedActions.length === 0) { - throw Error( - `Update action failed, are you sure there is an item in the queue with id = ${action.id}`, - ) - } - if (updatedActions.length > 1) { - throw Error( - `${updatedActions.length} action items updated in the queue. Should be '1'`, - ) - } - return updatedActions[0] -} From 57abcb2c500e71de3b6b413f7344276c83ab70b4 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Mon, 18 Mar 2024 16:16:28 -0400 Subject: [PATCH 14/48] make progress --- .../indexer-agent/src/__tests__/indexer.ts | 9 +- packages/indexer-common/package.json | 1 + .../__tests__/resolvers/actions.test.ts | 1280 +++++++++-------- .../src/indexer-management/__tests__/util.ts | 5 +- .../src/indexer-management/actions.ts | 1 + .../src/indexer-management/index.ts | 1 + .../indexer-management/models/cost-model.ts | 5 - .../models/indexing-rule.ts | 2 +- .../indexer-management/resolvers/actions.ts | 46 +- .../resolvers/cost-models.ts | 10 +- .../src/indexer-management/schema.graphql | 3 + .../src/indexer-management/yoga.ts | 31 +- packages/indexer-common/src/operator.ts | 2 +- yarn.lock | 13 + 14 files changed, 737 insertions(+), 672 deletions(-) diff --git a/packages/indexer-agent/src/__tests__/indexer.ts b/packages/indexer-agent/src/__tests__/indexer.ts index d1b22a5c7..7e10b8ea1 100644 --- a/packages/indexer-agent/src/__tests__/indexer.ts +++ b/packages/indexer-agent/src/__tests__/indexer.ts @@ -7,9 +7,7 @@ import { parseGRT, } from '@graphprotocol/common-ts' import { - createIndexerManagementClient, defineIndexerManagementModels, - IndexerManagementClient, IndexerManagementModels, GraphNode, Operator, @@ -19,6 +17,7 @@ import { QueryFeeModels, defineQueryFeeModels, MultiNetworks, + createIndexerManagementYogaClient, } from '@graphprotocol/indexer-common' import { BigNumber } from 'ethers' import { Sequelize } from 'sequelize' @@ -111,7 +110,9 @@ let sequelize: Sequelize let models: IndexerManagementModels let queryFeeModels: QueryFeeModels let logger: Logger -let indexerManagementClient: IndexerManagementClient +let indexerManagementClient: Awaited< + ReturnType +> let graphNode: GraphNode let operator: Operator let metrics: Metrics @@ -196,7 +197,7 @@ const setup = async () => { (n: Network) => n.specification.networkIdentifier, ) - indexerManagementClient = await createIndexerManagementClient({ + indexerManagementClient = await createIndexerManagementYogaClient({ models, graphNode, indexNodeIDs, diff --git a/packages/indexer-common/package.json b/packages/indexer-common/package.json index aac65591f..57a0de8be 100644 --- a/packages/indexer-common/package.json +++ b/packages/indexer-common/package.json @@ -25,6 +25,7 @@ "dependencies": { "@graphprotocol/common-ts": "2.0.9", "@graphprotocol/cost-model": "0.1.18", + "@graphql-tools/executor-http": "^1.0.9", "@thi.ng/heaps": "1.2.38", "@types/lodash.clonedeep": "^4.5.7", "@types/lodash.intersection": "^4.4.7", diff --git a/packages/indexer-common/src/indexer-management/__tests__/resolvers/actions.test.ts b/packages/indexer-common/src/indexer-management/__tests__/resolvers/actions.test.ts index 245d46dc1..964315f68 100644 --- a/packages/indexer-common/src/indexer-management/__tests__/resolvers/actions.test.ts +++ b/packages/indexer-common/src/indexer-management/__tests__/resolvers/actions.test.ts @@ -10,7 +10,6 @@ import { createMetrics, } from '@graphprotocol/common-ts' -import { IndexerManagementClient } from '../../client' import { Action, defineIndexerManagementModels, @@ -21,6 +20,7 @@ import { ActionParams, ActionStatus, ActionType, + createIndexerManagementYogaClient, defineQueryFeeModels, OrderDirection, QueryFeeModels, @@ -36,6 +36,7 @@ import { subgraphDeployment2, subgraphDeployment3, } from '../util' +import { buildHTTPExecutor } from '@graphql-tools/executor-http' const QUEUE_ACTIONS_MUTATION = gql` mutation queueActions($actions: [ActionInput!]!) { @@ -178,7 +179,7 @@ let sequelize: Sequelize let managementModels: IndexerManagementModels let queryFeeModels: QueryFeeModels let logger: Logger -let client: IndexerManagementClient +let executor: ReturnType let metrics: Metrics // Make global Jest variables available @@ -199,7 +200,10 @@ const setup = async () => { async: false, level: __LOG_LEVEL__ ?? 'error', }) - client = await createTestManagementClient(__DATABASE__, logger, true, metrics) + const client = await createTestManagementClient(__DATABASE__, logger, true, metrics) + executor = buildHTTPExecutor({ + fetch: client.fetch, + }) } const setupEach = async () => { @@ -231,643 +235,653 @@ describe('Actions', () => { afterEach(teardownEach) afterAll(teardownAll) - test('Queue and retrieve action', async () => { - const inputAction = queuedAllocateAction - const expected = await actionInputToExpected(inputAction, 1) - - await expect( - client.mutation(QUEUE_ACTIONS_MUTATION, { actions: [inputAction] }).toPromise(), - ).resolves.toHaveProperty('data.queueActions', [expected]) - - await expect( - client - .query(ACTIONS_QUERY, { - filter: { status: ActionStatus.QUEUED, source: 'indexerAgent' }, - }) - .toPromise(), - ).resolves.toHaveProperty('data.actions', [expected]) - }) - - test('Queue many actions and retrieve all of a certain status with certain ordering', async () => { - const queuedAllocateAction1 = { ...queuedAllocateAction } - const queuedAllocateAction2 = { ...queuedAllocateAction } - const queuedAllocateAction3 = { ...queuedAllocateAction } - queuedAllocateAction1.deploymentID = subgraphDeployment2 - queuedAllocateAction1.source = '1' - queuedAllocateAction2.deploymentID = subgraphDeployment3 - queuedAllocateAction2.source = '2' - queuedAllocateAction3.deploymentID = subgraphDeployment1 - queuedAllocateAction3.source = '3' - - const inputActions = [ - queuedAllocateAction, - queuedAllocateAction1, - queuedAllocateAction2, - ] - const expecteds = await Promise.all( - inputActions.map(async (action, key) => { - return await actionInputToExpected(action, key + 1) - }), - ) - - await expect( - client.mutation(QUEUE_ACTIONS_MUTATION, { actions: inputActions }).toPromise(), - ).resolves.toHaveProperty('data.queueActions', expecteds) - - await expect( - client - .query(ACTIONS_QUERY, { - filter: { - status: ActionStatus.QUEUED, - type: ActionType.ALLOCATE, - }, - orderBy: ActionParams.SOURCE, - orderDirection: OrderDirection.DESC, - }) - .toPromise(), - ).resolves.toHaveProperty( - 'data.actions', - expecteds.sort((a, b) => (a.source > b.source ? -1 : 1)), - ) - }) - - test('Queue many actions and retrieve all of a certain status with invalid ordering', async () => { - const queuedAllocateAction1 = { ...queuedAllocateAction } - const queuedAllocateAction2 = { ...queuedAllocateAction } - const queuedAllocateAction3 = { ...queuedAllocateAction } - queuedAllocateAction1.deploymentID = subgraphDeployment2 - queuedAllocateAction2.deploymentID = subgraphDeployment3 - queuedAllocateAction3.deploymentID = subgraphDeployment1 - - const inputActions = [ - queuedAllocateAction, - queuedAllocateAction1, - queuedAllocateAction2, - ] - const expecteds = await Promise.all( - inputActions.map(async (action, key) => { - return await actionInputToExpected(action, key + 1) - }), - ) - - await expect( - client.mutation(QUEUE_ACTIONS_MUTATION, { actions: inputActions }).toPromise(), - ).resolves.toHaveProperty('data.queueActions', expecteds) - - await expect( - client - .query(ACTIONS_QUERY, { - filter: { - status: ActionStatus.QUEUED, - type: ActionType.ALLOCATE, - source: 'indexerAgent', - }, - orderBy: 'adonut', - orderDirection: OrderDirection.DESC, - }) - .toPromise(), - ).resolves.toHaveProperty( - 'error', - new CombinedError({ - graphQLErrors: [ - new GraphQLError( - 'Variable "$orderBy" got invalid value "adonut"; Value "adonut" does not exist in "ActionParams" enum. Did you mean the enum value "amount"?', - ), - ], - }), - ) - }) - - test('Cancel all actions in queue', async () => { - const queuedAllocateAction1 = { ...queuedAllocateAction } - const queuedAllocateAction2 = { ...queuedAllocateAction } - queuedAllocateAction1.deploymentID = subgraphDeployment2 - queuedAllocateAction2.deploymentID = subgraphDeployment3 - - const inputActions = [ - queuedAllocateAction, - queuedAllocateAction1, - queuedAllocateAction2, - ] - const expecteds = await Promise.all( - inputActions.map(async (action, key) => { - return await actionInputToExpected(action, key + 1) - }), - ) - - await expect( - client.mutation(QUEUE_ACTIONS_MUTATION, { actions: inputActions }).toPromise(), - ).resolves.toHaveProperty('data.queueActions', expecteds) - - // Cancel all actions - const toCancel = expecteds.map((action) => action.id) - - const expectedCancels = expecteds.map((action) => { - action.status = ActionStatus.CANCELED - return action - }) - - await expect( - client.mutation(CANCEL_ACTIONS_MUTATION, { actionIDs: toCancel }).toPromise(), - ).resolves.toHaveProperty('data.cancelActions', expectedCancels) - - await expect( - client - .query(ACTIONS_QUERY, { - filter: { - status: ActionStatus.CANCELED, - source: 'indexerAgent', - }, - orderBy: ActionParams.ID, - orderDirection: OrderDirection.ASC, - }) - .toPromise(), - ).resolves.toHaveProperty('data.actions', expectedCancels) - }) - - test('Approve action in queue', async () => { - const queuedAllocateAction1 = { ...queuedAllocateAction } - const queuedAllocateAction2 = { ...queuedAllocateAction } - queuedAllocateAction1.deploymentID = subgraphDeployment2 - queuedAllocateAction2.deploymentID = subgraphDeployment3 - - const inputActions = [ - queuedAllocateAction, - queuedAllocateAction1, - queuedAllocateAction2, - ] - const expecteds = await Promise.all( - inputActions.map(async (action, key) => { - return await actionInputToExpected(action, key + 1) - }), - ) - - await expect( - client.mutation(QUEUE_ACTIONS_MUTATION, { actions: inputActions }).toPromise(), - ).resolves.toHaveProperty('data.queueActions', expecteds) - - const actions = await client - .query(ACTIONS_QUERY, { filter: { type: ActionType.ALLOCATE } }) - .toPromise() - const subgraph1ActionID = actions.data.actions - // eslint-disable-next-line @typescript-eslint/no-explicit-any - .filter((action: any) => action.deploymentID === subgraphDeployment2) - // eslint-disable-next-line @typescript-eslint/no-explicit-any - .map((action: any) => action.id) - - const expectedApprovedAction = expecteds.find( - (action) => action.deploymentID === subgraphDeployment2, - ) - /* eslint-disable @typescript-eslint/no-non-null-assertion */ - expectedApprovedAction!['status'] = ActionStatus.APPROVED - - await expect( - client - .mutation(APPROVE_ACTIONS_MUTATION, { actionIDs: subgraph1ActionID }) - .toPromise(), - ).resolves.toHaveProperty('data.approveActions', [expectedApprovedAction]) - - await expect( - client - .query(ACTIONS_QUERY, { - filter: { - status: ActionStatus.APPROVED, - source: 'indexerAgent', - }, - }) - .toPromise(), - ).resolves.toHaveProperty('data.actions', [expectedApprovedAction]) - }) - - test('Delete action in queue', async () => { - const queuedAllocateAction1 = { ...queuedAllocateAction } - const queuedAllocateAction2 = { ...queuedAllocateAction } - queuedAllocateAction1.deploymentID = subgraphDeployment2 - queuedAllocateAction2.deploymentID = subgraphDeployment3 - - const inputActions = [ - queuedAllocateAction, - queuedAllocateAction1, - queuedAllocateAction2, - ] - const expecteds = await Promise.all( - inputActions.map(async (action, key) => { - return await actionInputToExpected(action, key + 1) - }), - ) - - await expect( - client.mutation(QUEUE_ACTIONS_MUTATION, { actions: inputActions }).toPromise(), - ).resolves.toHaveProperty('data.queueActions', expecteds) - - const actions = await client - .query(ACTIONS_QUERY, { filter: { type: ActionType.ALLOCATE } }) - .toPromise() - const actionIDs = actions.data.actions.map((action: any) => action.id) - - await expect( - client.mutation(DELETE_ACTIONS_MUTATION, { actionIDs }).toPromise(), - ).resolves.toHaveProperty('data.deleteActions', 3) - }) - - test('Delete non-existent action in queue', async () => { - const actionIDs = [0] - - await expect( - client.mutation(DELETE_ACTIONS_MUTATION, { actionIDs }).toPromise(), - ).resolves.toHaveProperty( - 'error', - new CombinedError({ - graphQLErrors: [ - new GraphQLError('Delete action failed: No action items found with id in [0]'), - ], - }), - ) - }) - - test('Reject empty action input', async () => { - const expectedFieldNamesAndTypes: [string, string][] = [ - ['status', 'ActionStatus'], - ['type', 'ActionType'], - ['source', 'String'], - ['reason', 'String'], - ['priority', 'Int'], - ['protocolNetwork', 'String'], - ] - const graphQLErrors = expectedFieldNamesAndTypes.map( - ([fieldName, fieldType]) => - new GraphQLError( - `Variable "$actions" got invalid value {} at "actions[0]"; Field "${fieldName}" of required type "${fieldType}!" was not provided.`, - ), - ) - const expected = new CombinedError({ graphQLErrors }) - - await expect( - client.mutation(QUEUE_ACTIONS_MUTATION, { actions: [{}] }).toPromise(), - ).resolves.toHaveProperty('error', expected) - }) - - test('Reject action with invalid params for action type', async () => { - const inputAction = invalidReallocateAction - const expected = { ...inputAction, protocolNetwork: 'eip155:5' } - const fields = JSON.stringify(expected) - await expect( - client.mutation(QUEUE_ACTIONS_MUTATION, { actions: [inputAction] }).toPromise(), - ).resolves.toHaveProperty( - 'error', - new CombinedError({ - graphQLErrors: [ - new GraphQLError( - `Failed to queue action: Invalid action input, actionInput: ${fields}`, - ), - ], - }), - ) - - await expect( - client - .query(ACTIONS_QUERY, { - filter: { status: ActionStatus.QUEUED, source: 'indexerAgent' }, - }) - .toPromise(), - ).resolves.toHaveProperty('data.actions', []) - }) - - test('Reject duplicate queued action from different source', async () => { + test.only('Queue and retrieve action', async () => { const inputAction = queuedAllocateAction const expected = await actionInputToExpected(inputAction, 1) - await expect( - client.mutation(QUEUE_ACTIONS_MUTATION, { actions: [inputAction] }).toPromise(), - ).resolves.toHaveProperty('data.queueActions', [expected]) - - await expect( - client - .query(ACTIONS_QUERY, { - filter: { status: ActionStatus.QUEUED, source: 'indexerAgent' }, - }) - .toPromise(), - ).resolves.toHaveProperty( - 'data.actions', - [expected].sort((a, b) => (a.id > b.id ? -1 : 1)), - ) - - const differentSourceSameTarget = { ...inputAction } - differentSourceSameTarget.source = 'different' - - await expect( - client - .mutation(QUEUE_ACTIONS_MUTATION, { actions: [differentSourceSameTarget] }) - .toPromise(), - ).resolves.toHaveProperty( - 'error', - new CombinedError({ - graphQLErrors: [ - new GraphQLError( - `Duplicate action found in queue that effects 'Qmew9PZUJCoDzXqqU6vGyTENTKHrrN4dy5h94kertfudqy' but NOT overwritten because it has a different source and/or status. If you ` + - `would like to replace the item currently in the queue please cancel it and then queue the proposed action`, - ), - ], - }), - ) - }) - - test('Update duplicate approved action (effects deployment already targeted by approved action)', async () => { - const inputAction = queuedAllocateAction - const expected = await actionInputToExpected(inputAction, 1) - - await expect( - client.mutation(QUEUE_ACTIONS_MUTATION, { actions: [inputAction] }).toPromise(), - ).resolves.toHaveProperty('data.queueActions', [expected]) - - const actions = await client - .query(ACTIONS_QUERY, { filter: { type: ActionType.ALLOCATE } }) - .toPromise() - const subgraph1ActionID = actions.data.actions - // eslint-disable-next-line @typescript-eslint/no-explicit-any - .filter((action: any) => action.deploymentID === queuedAllocateAction.deploymentID) - // eslint-disable-next-line @typescript-eslint/no-explicit-any - .map((action: any) => action.id) - - const expectedApprovedAction = { ...expected } - /* eslint-disable @typescript-eslint/no-non-null-assertion */ - expectedApprovedAction!['status'] = ActionStatus.APPROVED - - await expect( - client - .mutation(APPROVE_ACTIONS_MUTATION, { actionIDs: subgraph1ActionID }) - .toPromise(), - ).resolves.toHaveProperty('data.approveActions', [expectedApprovedAction]) - - await expect( - client - .query(ACTIONS_QUERY, { - filter: { - status: ActionStatus.APPROVED, - source: 'indexerAgent', - }, - }) - .toPromise(), - ).resolves.toHaveProperty('data.actions', [expectedApprovedAction]) - - const updateAction = { ...inputAction } - updateAction.amount = '25000' - updateAction.status = ActionStatus.APPROVED - - const expectedUpdated = { ...expectedApprovedAction } - expectedUpdated.amount = '25000' - - await expect( - client.mutation(QUEUE_ACTIONS_MUTATION, { actions: [updateAction] }).toPromise(), - ).resolves.toHaveProperty('data.queueActions', [expectedUpdated]) - - await expect( - client - .query(ACTIONS_QUERY, { - filter: { status: ActionStatus.APPROVED, source: 'indexerAgent' }, - }) - .toPromise(), - ).resolves.toHaveProperty('data.actions', [expectedUpdated]) - }) - - test('Reject unallocate action with inactive allocationID', async () => { - // This allocation has been closed on chain - const closedAllocation = '0x0001572b5fde192fc1c65630fabb5e13d3ad173e' - - // Reuse a valid inputAction but use an allocationID dedicated to this test purpose, - // as the previously used allocationID does not exist on chain. - const inputActions = [{ ...invalidUnallocateAction, allocationID: closedAllocation }] - - await expect( - client.mutation(QUEUE_ACTIONS_MUTATION, { actions: inputActions }).toPromise(), - ).resolves.toHaveProperty( - 'error', - new CombinedError({ - graphQLErrors: [ - new GraphQLError( - `An active allocation does not exist with id = '${closedAllocation}'`, - ), - ], - }), - ) - }) - - test('Reject approve request with nonexistent actionID ', async () => { - const queuedAllocateAction1 = { ...queuedAllocateAction } - const queuedAllocateAction2 = { ...queuedAllocateAction } - queuedAllocateAction1.deploymentID = subgraphDeployment2 - queuedAllocateAction2.deploymentID = subgraphDeployment3 - - const inputActions = [ - queuedAllocateAction, - queuedAllocateAction1, - queuedAllocateAction2, - ] - const expecteds = await Promise.all( - inputActions.map(async (action, key) => { - return await actionInputToExpected(action, key + 1) - }), - ) - - await expect( - client.mutation(QUEUE_ACTIONS_MUTATION, { actions: inputActions }).toPromise(), - ).resolves.toHaveProperty('data.queueActions', expecteds) - - await expect( - client.mutation(APPROVE_ACTIONS_MUTATION, { actionIDs: [100, 200] }).toPromise(), - ).resolves.toHaveProperty( - 'error', - new CombinedError({ - graphQLErrors: [ - new GraphQLError( - `Approve action failed: No action items found with id in [100,200]`, - ), - ], - }), - ) - - await expect( - client - .query(ACTIONS_QUERY, { - filter: { - status: ActionStatus.APPROVED, - source: 'indexerAgent', - }, - }) - .toPromise(), - ).resolves.toHaveProperty('data.actions', []) - }) - - test('Reject queueing for action that has recently failed', async () => { - const failedAction = { - status: ActionStatus.FAILED, - type: ActionType.ALLOCATE, - deploymentID: subgraphDeployment1, - amount: '10000', - force: false, - source: 'indexerAgent', - reason: 'indexingRule', - priority: 0, - // When writing directly to the database, `protocolNetwork` must be in the CAIP2-ID format. - protocolNetwork: 'eip155:5', - } as ActionInput - - const proposedAction = { - status: ActionStatus.QUEUED, - type: ActionType.ALLOCATE, - deploymentID: subgraphDeployment1, - amount: '10000', - source: 'indexerAgent', - reason: 'indexingRule', - priority: 0, - protocolNetwork: 'goerli', - } as ActionInput - - await managementModels.Action.create(failedAction, { - validate: true, - returning: true, + const result = executor({ + document: QUEUE_ACTIONS_MUTATION, + variables: { + actions: [inputAction], + }, }) - const result = await client - .mutation(QUEUE_ACTIONS_MUTATION, { actions: [proposedAction] }) - .toPromise() - - expect(result).toHaveProperty( - 'error', - new CombinedError({ - graphQLErrors: [ - new GraphQLError( - `Recently executed 'allocate' action found in queue targeting '${subgraphDeployment1}', ignoring.`, - ), - ], - }), - ) - await expect( - client - .query(ACTIONS_QUERY, { - filter: { source: 'indexerAgent' }, - }) - .toPromise(), - ).resolves.toHaveProperty('data.actions', [ - await actionInputToExpected(failedAction, 1), - ]) - }) + console.log('result', result) - test('Reject queueing for action that has recently succeeded', async () => { - const successfulAction = { - status: ActionStatus.SUCCESS, - type: ActionType.ALLOCATE, - deploymentID: subgraphDeployment1, - amount: '10000', - force: false, - source: 'indexerAgent', - reason: 'indexingRule', - priority: 0, - // When writing directly to the database, `protocolNetwork` must be in the CAIP2-ID format. - protocolNetwork: 'eip155:5', - } as ActionInput - - const proposedAction = { - status: ActionStatus.QUEUED, - type: ActionType.ALLOCATE, - deploymentID: subgraphDeployment1, - amount: '10000', - source: 'indexerAgent', - reason: 'indexingRule', - priority: 0, - protocolNetwork: 'goerli', - } as ActionInput - - await managementModels.Action.create(successfulAction, { - validate: true, - returning: true, - }) + // await expect( + // executor({document:QUEUE_ACTIONS_MUTATION, variables:{ + // { actions: [inputAction]}}) + // ).resolves.toHaveProperty('data.queueActions', [expected]) - await expect( - client.mutation(QUEUE_ACTIONS_MUTATION, { actions: [proposedAction] }).toPromise(), - ).resolves.toHaveProperty( - 'error', - new CombinedError({ - graphQLErrors: [ - new GraphQLError( - `Recently executed 'allocate' action found in queue targeting '${subgraphDeployment1}', ignoring.`, - ), - ], - }), - ) - await expect( - client - .query(ACTIONS_QUERY, { - filter: { source: 'indexerAgent' }, - }) - .toPromise(), - ).resolves.toHaveProperty('data.actions', [ - await actionInputToExpected(successfulAction, 1), - ]) + // await expect( + // client + // .query(ACTIONS_QUERY, { + // filter: { status: ActionStatus.QUEUED, source: 'indexerAgent' }, + // }) + // .toPromise(), + // ).resolves.toHaveProperty('data.actions', [expected]) }) - test('Update all queued unallocate actions', async () => { - const queuedUnallocateAction = { - status: ActionStatus.QUEUED, - type: ActionType.UNALLOCATE, - deploymentID: subgraphDeployment1, - amount: '10000', - force: false, - source: 'indexerAgent', - reason: 'indexingRule', - priority: 0, - // When writing directly to the database, `protocolNetwork` must be in the CAIP2-ID format. - protocolNetwork: 'eip155:5', - } as ActionInput - - const queuedAllocateAction = { - status: ActionStatus.QUEUED, - type: ActionType.ALLOCATE, - deploymentID: subgraphDeployment1, - force: false, - amount: '10000', - source: 'indexerAgent', - reason: 'indexingRule', - priority: 0, - protocolNetwork: 'goerli', - } as ActionInput - - await managementModels.Action.create(queuedUnallocateAction, { - validate: true, - returning: true, - }) - - const queuedAllocateAction1 = { ...queuedAllocateAction } - const queuedAllocateAction2 = { ...queuedAllocateAction } - queuedAllocateAction2.deploymentID = subgraphDeployment2 - - const inputActions = [queuedAllocateAction1, queuedAllocateAction2] - const expecteds = ( - await Promise.all( - inputActions.sort().map(async (action, key) => { - return await actionInputToExpected(action, key + 1) - }), - ) - ).sort((a, b) => a.id - b.id) - - await expect( - client.mutation(QUEUE_ACTIONS_MUTATION, { actions: inputActions }).toPromise(), - ).resolves.toHaveProperty('data.queueActions', expecteds) - - const updatedExpecteds = expecteds.map((value) => { - value.force = true - return value - }) - - await expect( - client - .mutation(UPDATE_ACTIONS_MUTATION, { - filter: { type: 'allocate' }, - action: { - force: true, - }, - }) - .toPromise(), - ).resolves.toHaveProperty('data.updateActions', updatedExpecteds) - }) + // test('Queue many actions and retrieve all of a certain status with certain ordering', async () => { + // const queuedAllocateAction1 = { ...queuedAllocateAction } + // const queuedAllocateAction2 = { ...queuedAllocateAction } + // const queuedAllocateAction3 = { ...queuedAllocateAction } + // queuedAllocateAction1.deploymentID = subgraphDeployment2 + // queuedAllocateAction1.source = '1' + // queuedAllocateAction2.deploymentID = subgraphDeployment3 + // queuedAllocateAction2.source = '2' + // queuedAllocateAction3.deploymentID = subgraphDeployment1 + // queuedAllocateAction3.source = '3' + + // const inputActions = [ + // queuedAllocateAction, + // queuedAllocateAction1, + // queuedAllocateAction2, + // ] + // const expecteds = await Promise.all( + // inputActions.map(async (action, key) => { + // return await actionInputToExpected(action, key + 1) + // }), + // ) + + // await expect( + // client.mutation(QUEUE_ACTIONS_MUTATION, { actions: inputActions }).toPromise(), + // ).resolves.toHaveProperty('data.queueActions', expecteds) + + // await expect( + // client + // .query(ACTIONS_QUERY, { + // filter: { + // status: ActionStatus.QUEUED, + // type: ActionType.ALLOCATE, + // }, + // orderBy: ActionParams.SOURCE, + // orderDirection: OrderDirection.DESC, + // }) + // .toPromise(), + // ).resolves.toHaveProperty( + // 'data.actions', + // expecteds.sort((a, b) => (a.source > b.source ? -1 : 1)), + // ) + // }) + + // test('Queue many actions and retrieve all of a certain status with invalid ordering', async () => { + // const queuedAllocateAction1 = { ...queuedAllocateAction } + // const queuedAllocateAction2 = { ...queuedAllocateAction } + // const queuedAllocateAction3 = { ...queuedAllocateAction } + // queuedAllocateAction1.deploymentID = subgraphDeployment2 + // queuedAllocateAction2.deploymentID = subgraphDeployment3 + // queuedAllocateAction3.deploymentID = subgraphDeployment1 + + // const inputActions = [ + // queuedAllocateAction, + // queuedAllocateAction1, + // queuedAllocateAction2, + // ] + // const expecteds = await Promise.all( + // inputActions.map(async (action, key) => { + // return await actionInputToExpected(action, key + 1) + // }), + // ) + + // await expect( + // client.mutation(QUEUE_ACTIONS_MUTATION, { actions: inputActions }).toPromise(), + // ).resolves.toHaveProperty('data.queueActions', expecteds) + + // await expect( + // client + // .query(ACTIONS_QUERY, { + // filter: { + // status: ActionStatus.QUEUED, + // type: ActionType.ALLOCATE, + // source: 'indexerAgent', + // }, + // orderBy: 'adonut', + // orderDirection: OrderDirection.DESC, + // }) + // .toPromise(), + // ).resolves.toHaveProperty( + // 'error', + // new CombinedError({ + // graphQLErrors: [ + // new GraphQLError( + // 'Variable "$orderBy" got invalid value "adonut"; Value "adonut" does not exist in "ActionParams" enum. Did you mean the enum value "amount"?', + // ), + // ], + // }), + // ) + // }) + + // test('Cancel all actions in queue', async () => { + // const queuedAllocateAction1 = { ...queuedAllocateAction } + // const queuedAllocateAction2 = { ...queuedAllocateAction } + // queuedAllocateAction1.deploymentID = subgraphDeployment2 + // queuedAllocateAction2.deploymentID = subgraphDeployment3 + + // const inputActions = [ + // queuedAllocateAction, + // queuedAllocateAction1, + // queuedAllocateAction2, + // ] + // const expecteds = await Promise.all( + // inputActions.map(async (action, key) => { + // return await actionInputToExpected(action, key + 1) + // }), + // ) + + // await expect( + // client.mutation(QUEUE_ACTIONS_MUTATION, { actions: inputActions }).toPromise(), + // ).resolves.toHaveProperty('data.queueActions', expecteds) + + // // Cancel all actions + // const toCancel = expecteds.map((action) => action.id) + + // const expectedCancels = expecteds.map((action) => { + // action.status = ActionStatus.CANCELED + // return action + // }) + + // await expect( + // client.mutation(CANCEL_ACTIONS_MUTATION, { actionIDs: toCancel }).toPromise(), + // ).resolves.toHaveProperty('data.cancelActions', expectedCancels) + + // await expect( + // client + // .query(ACTIONS_QUERY, { + // filter: { + // status: ActionStatus.CANCELED, + // source: 'indexerAgent', + // }, + // orderBy: ActionParams.ID, + // orderDirection: OrderDirection.ASC, + // }) + // .toPromise(), + // ).resolves.toHaveProperty('data.actions', expectedCancels) + // }) + + // test('Approve action in queue', async () => { + // const queuedAllocateAction1 = { ...queuedAllocateAction } + // const queuedAllocateAction2 = { ...queuedAllocateAction } + // queuedAllocateAction1.deploymentID = subgraphDeployment2 + // queuedAllocateAction2.deploymentID = subgraphDeployment3 + + // const inputActions = [ + // queuedAllocateAction, + // queuedAllocateAction1, + // queuedAllocateAction2, + // ] + // const expecteds = await Promise.all( + // inputActions.map(async (action, key) => { + // return await actionInputToExpected(action, key + 1) + // }), + // ) + + // await expect( + // client.mutation(QUEUE_ACTIONS_MUTATION, { actions: inputActions }).toPromise(), + // ).resolves.toHaveProperty('data.queueActions', expecteds) + + // const actions = await client + // .query(ACTIONS_QUERY, { filter: { type: ActionType.ALLOCATE } }) + // .toPromise() + // const subgraph1ActionID = actions.data.actions + // // eslint-disable-next-line @typescript-eslint/no-explicit-any + // .filter((action: any) => action.deploymentID === subgraphDeployment2) + // // eslint-disable-next-line @typescript-eslint/no-explicit-any + // .map((action: any) => action.id) + + // const expectedApprovedAction = expecteds.find( + // (action) => action.deploymentID === subgraphDeployment2, + // ) + // /* eslint-disable @typescript-eslint/no-non-null-assertion */ + // expectedApprovedAction!['status'] = ActionStatus.APPROVED + + // await expect( + // client + // .mutation(APPROVE_ACTIONS_MUTATION, { actionIDs: subgraph1ActionID }) + // .toPromise(), + // ).resolves.toHaveProperty('data.approveActions', [expectedApprovedAction]) + + // await expect( + // client + // .query(ACTIONS_QUERY, { + // filter: { + // status: ActionStatus.APPROVED, + // source: 'indexerAgent', + // }, + // }) + // .toPromise(), + // ).resolves.toHaveProperty('data.actions', [expectedApprovedAction]) + // }) + + // test('Delete action in queue', async () => { + // const queuedAllocateAction1 = { ...queuedAllocateAction } + // const queuedAllocateAction2 = { ...queuedAllocateAction } + // queuedAllocateAction1.deploymentID = subgraphDeployment2 + // queuedAllocateAction2.deploymentID = subgraphDeployment3 + + // const inputActions = [ + // queuedAllocateAction, + // queuedAllocateAction1, + // queuedAllocateAction2, + // ] + // const expecteds = await Promise.all( + // inputActions.map(async (action, key) => { + // return await actionInputToExpected(action, key + 1) + // }), + // ) + + // await expect( + // client.mutation(QUEUE_ACTIONS_MUTATION, { actions: inputActions }).toPromise(), + // ).resolves.toHaveProperty('data.queueActions', expecteds) + + // const actions = await client + // .query(ACTIONS_QUERY, { filter: { type: ActionType.ALLOCATE } }) + // .toPromise() + // const actionIDs = actions.data.actions.map((action: any) => action.id) + + // await expect( + // client.mutation(DELETE_ACTIONS_MUTATION, { actionIDs }).toPromise(), + // ).resolves.toHaveProperty('data.deleteActions', 3) + // }) + + // test('Delete non-existent action in queue', async () => { + // const actionIDs = [0] + + // await expect( + // client.mutation(DELETE_ACTIONS_MUTATION, { actionIDs }).toPromise(), + // ).resolves.toHaveProperty( + // 'error', + // new CombinedError({ + // graphQLErrors: [ + // new GraphQLError('Delete action failed: No action items found with id in [0]'), + // ], + // }), + // ) + // }) + + // test('Reject empty action input', async () => { + // const expectedFieldNamesAndTypes: [string, string][] = [ + // ['status', 'ActionStatus'], + // ['type', 'ActionType'], + // ['source', 'String'], + // ['reason', 'String'], + // ['priority', 'Int'], + // ['protocolNetwork', 'String'], + // ] + // const graphQLErrors = expectedFieldNamesAndTypes.map( + // ([fieldName, fieldType]) => + // new GraphQLError( + // `Variable "$actions" got invalid value {} at "actions[0]"; Field "${fieldName}" of required type "${fieldType}!" was not provided.`, + // ), + // ) + // const expected = new CombinedError({ graphQLErrors }) + + // await expect( + // client.mutation(QUEUE_ACTIONS_MUTATION, { actions: [{}] }).toPromise(), + // ).resolves.toHaveProperty('error', expected) + // }) + + // test('Reject action with invalid params for action type', async () => { + // const inputAction = invalidReallocateAction + // const expected = { ...inputAction, protocolNetwork: 'eip155:5' } + // const fields = JSON.stringify(expected) + // await expect( + // client.mutation(QUEUE_ACTIONS_MUTATION, { actions: [inputAction] }).toPromise(), + // ).resolves.toHaveProperty( + // 'error', + // new CombinedError({ + // graphQLErrors: [ + // new GraphQLError( + // `Failed to queue action: Invalid action input, actionInput: ${fields}`, + // ), + // ], + // }), + // ) + + // await expect( + // client + // .query(ACTIONS_QUERY, { + // filter: { status: ActionStatus.QUEUED, source: 'indexerAgent' }, + // }) + // .toPromise(), + // ).resolves.toHaveProperty('data.actions', []) + // }) + + // test('Reject duplicate queued action from different source', async () => { + // const inputAction = queuedAllocateAction + // const expected = await actionInputToExpected(inputAction, 1) + + // await expect( + // client.mutation(QUEUE_ACTIONS_MUTATION, { actions: [inputAction] }).toPromise(), + // ).resolves.toHaveProperty('data.queueActions', [expected]) + + // await expect( + // client + // .query(ACTIONS_QUERY, { + // filter: { status: ActionStatus.QUEUED, source: 'indexerAgent' }, + // }) + // .toPromise(), + // ).resolves.toHaveProperty( + // 'data.actions', + // [expected].sort((a, b) => (a.id > b.id ? -1 : 1)), + // ) + + // const differentSourceSameTarget = { ...inputAction } + // differentSourceSameTarget.source = 'different' + + // await expect( + // client + // .mutation(QUEUE_ACTIONS_MUTATION, { actions: [differentSourceSameTarget] }) + // .toPromise(), + // ).resolves.toHaveProperty( + // 'error', + // new CombinedError({ + // graphQLErrors: [ + // new GraphQLError( + // `Duplicate action found in queue that effects 'Qmew9PZUJCoDzXqqU6vGyTENTKHrrN4dy5h94kertfudqy' but NOT overwritten because it has a different source and/or status. If you ` + + // `would like to replace the item currently in the queue please cancel it and then queue the proposed action`, + // ), + // ], + // }), + // ) + // }) + + // test('Update duplicate approved action (effects deployment already targeted by approved action)', async () => { + // const inputAction = queuedAllocateAction + // const expected = await actionInputToExpected(inputAction, 1) + + // await expect( + // client.mutation(QUEUE_ACTIONS_MUTATION, { actions: [inputAction] }).toPromise(), + // ).resolves.toHaveProperty('data.queueActions', [expected]) + + // const actions = await client + // .query(ACTIONS_QUERY, { filter: { type: ActionType.ALLOCATE } }) + // .toPromise() + // const subgraph1ActionID = actions.data.actions + // // eslint-disable-next-line @typescript-eslint/no-explicit-any + // .filter((action: any) => action.deploymentID === queuedAllocateAction.deploymentID) + // // eslint-disable-next-line @typescript-eslint/no-explicit-any + // .map((action: any) => action.id) + + // const expectedApprovedAction = { ...expected } + // /* eslint-disable @typescript-eslint/no-non-null-assertion */ + // expectedApprovedAction!['status'] = ActionStatus.APPROVED + + // await expect( + // client + // .mutation(APPROVE_ACTIONS_MUTATION, { actionIDs: subgraph1ActionID }) + // .toPromise(), + // ).resolves.toHaveProperty('data.approveActions', [expectedApprovedAction]) + + // await expect( + // client + // .query(ACTIONS_QUERY, { + // filter: { + // status: ActionStatus.APPROVED, + // source: 'indexerAgent', + // }, + // }) + // .toPromise(), + // ).resolves.toHaveProperty('data.actions', [expectedApprovedAction]) + + // const updateAction = { ...inputAction } + // updateAction.amount = '25000' + // updateAction.status = ActionStatus.APPROVED + + // const expectedUpdated = { ...expectedApprovedAction } + // expectedUpdated.amount = '25000' + + // await expect( + // client.mutation(QUEUE_ACTIONS_MUTATION, { actions: [updateAction] }).toPromise(), + // ).resolves.toHaveProperty('data.queueActions', [expectedUpdated]) + + // await expect( + // client + // .query(ACTIONS_QUERY, { + // filter: { status: ActionStatus.APPROVED, source: 'indexerAgent' }, + // }) + // .toPromise(), + // ).resolves.toHaveProperty('data.actions', [expectedUpdated]) + // }) + + // test('Reject unallocate action with inactive allocationID', async () => { + // // This allocation has been closed on chain + // const closedAllocation = '0x0001572b5fde192fc1c65630fabb5e13d3ad173e' + + // // Reuse a valid inputAction but use an allocationID dedicated to this test purpose, + // // as the previously used allocationID does not exist on chain. + // const inputActions = [{ ...invalidUnallocateAction, allocationID: closedAllocation }] + + // await expect( + // client.mutation(QUEUE_ACTIONS_MUTATION, { actions: inputActions }).toPromise(), + // ).resolves.toHaveProperty( + // 'error', + // new CombinedError({ + // graphQLErrors: [ + // new GraphQLError( + // `An active allocation does not exist with id = '${closedAllocation}'`, + // ), + // ], + // }), + // ) + // }) + + // test('Reject approve request with nonexistent actionID ', async () => { + // const queuedAllocateAction1 = { ...queuedAllocateAction } + // const queuedAllocateAction2 = { ...queuedAllocateAction } + // queuedAllocateAction1.deploymentID = subgraphDeployment2 + // queuedAllocateAction2.deploymentID = subgraphDeployment3 + + // const inputActions = [ + // queuedAllocateAction, + // queuedAllocateAction1, + // queuedAllocateAction2, + // ] + // const expecteds = await Promise.all( + // inputActions.map(async (action, key) => { + // return await actionInputToExpected(action, key + 1) + // }), + // ) + + // await expect( + // client.mutation(QUEUE_ACTIONS_MUTATION, { actions: inputActions }).toPromise(), + // ).resolves.toHaveProperty('data.queueActions', expecteds) + + // await expect( + // client.mutation(APPROVE_ACTIONS_MUTATION, { actionIDs: [100, 200] }).toPromise(), + // ).resolves.toHaveProperty( + // 'error', + // new CombinedError({ + // graphQLErrors: [ + // new GraphQLError( + // `Approve action failed: No action items found with id in [100,200]`, + // ), + // ], + // }), + // ) + + // await expect( + // client + // .query(ACTIONS_QUERY, { + // filter: { + // status: ActionStatus.APPROVED, + // source: 'indexerAgent', + // }, + // }) + // .toPromise(), + // ).resolves.toHaveProperty('data.actions', []) + // }) + + // test('Reject queueing for action that has recently failed', async () => { + // const failedAction = { + // status: ActionStatus.FAILED, + // type: ActionType.ALLOCATE, + // deploymentID: subgraphDeployment1, + // amount: '10000', + // force: false, + // source: 'indexerAgent', + // reason: 'indexingRule', + // priority: 0, + // // When writing directly to the database, `protocolNetwork` must be in the CAIP2-ID format. + // protocolNetwork: 'eip155:5', + // } as ActionInput + + // const proposedAction = { + // status: ActionStatus.QUEUED, + // type: ActionType.ALLOCATE, + // deploymentID: subgraphDeployment1, + // amount: '10000', + // source: 'indexerAgent', + // reason: 'indexingRule', + // priority: 0, + // protocolNetwork: 'goerli', + // } as ActionInput + + // await managementModels.Action.create(failedAction, { + // validate: true, + // returning: true, + // }) + + // const result = await client + // .mutation(QUEUE_ACTIONS_MUTATION, { actions: [proposedAction] }) + // .toPromise() + + // expect(result).toHaveProperty( + // 'error', + // new CombinedError({ + // graphQLErrors: [ + // new GraphQLError( + // `Recently executed 'allocate' action found in queue targeting '${subgraphDeployment1}', ignoring.`, + // ), + // ], + // }), + // ) + // await expect( + // client + // .query(ACTIONS_QUERY, { + // filter: { source: 'indexerAgent' }, + // }) + // .toPromise(), + // ).resolves.toHaveProperty('data.actions', [ + // await actionInputToExpected(failedAction, 1), + // ]) + // }) + + // test('Reject queueing for action that has recently succeeded', async () => { + // const successfulAction = { + // status: ActionStatus.SUCCESS, + // type: ActionType.ALLOCATE, + // deploymentID: subgraphDeployment1, + // amount: '10000', + // force: false, + // source: 'indexerAgent', + // reason: 'indexingRule', + // priority: 0, + // // When writing directly to the database, `protocolNetwork` must be in the CAIP2-ID format. + // protocolNetwork: 'eip155:5', + // } as ActionInput + + // const proposedAction = { + // status: ActionStatus.QUEUED, + // type: ActionType.ALLOCATE, + // deploymentID: subgraphDeployment1, + // amount: '10000', + // source: 'indexerAgent', + // reason: 'indexingRule', + // priority: 0, + // protocolNetwork: 'goerli', + // } as ActionInput + + // await managementModels.Action.create(successfulAction, { + // validate: true, + // returning: true, + // }) + + // await expect( + // client.mutation(QUEUE_ACTIONS_MUTATION, { actions: [proposedAction] }).toPromise(), + // ).resolves.toHaveProperty( + // 'error', + // new CombinedError({ + // graphQLErrors: [ + // new GraphQLError( + // `Recently executed 'allocate' action found in queue targeting '${subgraphDeployment1}', ignoring.`, + // ), + // ], + // }), + // ) + // await expect( + // client + // .query(ACTIONS_QUERY, { + // filter: { source: 'indexerAgent' }, + // }) + // .toPromise(), + // ).resolves.toHaveProperty('data.actions', [ + // await actionInputToExpected(successfulAction, 1), + // ]) + // }) + + // test('Update all queued unallocate actions', async () => { + // const queuedUnallocateAction = { + // status: ActionStatus.QUEUED, + // type: ActionType.UNALLOCATE, + // deploymentID: subgraphDeployment1, + // amount: '10000', + // force: false, + // source: 'indexerAgent', + // reason: 'indexingRule', + // priority: 0, + // // When writing directly to the database, `protocolNetwork` must be in the CAIP2-ID format. + // protocolNetwork: 'eip155:5', + // } as ActionInput + + // const queuedAllocateAction = { + // status: ActionStatus.QUEUED, + // type: ActionType.ALLOCATE, + // deploymentID: subgraphDeployment1, + // force: false, + // amount: '10000', + // source: 'indexerAgent', + // reason: 'indexingRule', + // priority: 0, + // protocolNetwork: 'goerli', + // } as ActionInput + + // await managementModels.Action.create(queuedUnallocateAction, { + // validate: true, + // returning: true, + // }) + + // const queuedAllocateAction1 = { ...queuedAllocateAction } + // const queuedAllocateAction2 = { ...queuedAllocateAction } + // queuedAllocateAction2.deploymentID = subgraphDeployment2 + + // const inputActions = [queuedAllocateAction1, queuedAllocateAction2] + // const expecteds = ( + // await Promise.all( + // inputActions.sort().map(async (action, key) => { + // return await actionInputToExpected(action, key + 1) + // }), + // ) + // ).sort((a, b) => a.id - b.id) + + // await expect( + // client.mutation(QUEUE_ACTIONS_MUTATION, { actions: inputActions }).toPromise(), + // ).resolves.toHaveProperty('data.queueActions', expecteds) + + // const updatedExpecteds = expecteds.map((value) => { + // value.force = true + // return value + // }) + + // await expect( + // client + // .mutation(UPDATE_ACTIONS_MUTATION, { + // filter: { type: 'allocate' }, + // action: { + // force: true, + // }, + // }) + // .toPromise(), + // ).resolves.toHaveProperty('data.updateActions', updatedExpecteds) + // }) }) diff --git a/packages/indexer-common/src/indexer-management/__tests__/util.ts b/packages/indexer-common/src/indexer-management/__tests__/util.ts index 99ce92b51..5cf11603f 100644 --- a/packages/indexer-common/src/indexer-management/__tests__/util.ts +++ b/packages/indexer-common/src/indexer-management/__tests__/util.ts @@ -3,6 +3,7 @@ import { ActionStatus, ActionType, createIndexerManagementClient, + createIndexerManagementYogaClient, defineIndexerManagementModels, defineQueryFeeModels, GraphNode, @@ -62,7 +63,7 @@ export const createTestManagementClient = async ( injectDai: boolean, metrics: Metrics, networkIdentifierOverride?: string, -): Promise => { +) => { // Clearing the registry prevents duplicate metric registration in the default registry. metrics.registry.clear() @@ -111,7 +112,7 @@ export const createTestManagementClient = async ( (n: Network) => n.specification.networkIdentifier, ) - return await createIndexerManagementClient({ + return createIndexerManagementYogaClient({ models: managementModels, graphNode, indexNodeIDs, diff --git a/packages/indexer-common/src/indexer-management/actions.ts b/packages/indexer-common/src/indexer-management/actions.ts index fff309c34..b4db9447a 100644 --- a/packages/indexer-common/src/indexer-management/actions.ts +++ b/packages/indexer-common/src/indexer-management/actions.ts @@ -327,6 +327,7 @@ export class ActionManager { ) } return models.Action.update( + // @ts-expect-error need to improve { ...action }, { where: actionFilterToWhereOptions(filter), diff --git a/packages/indexer-common/src/indexer-management/index.ts b/packages/indexer-common/src/indexer-management/index.ts index 1aeddfe92..6c17663d8 100644 --- a/packages/indexer-common/src/indexer-management/index.ts +++ b/packages/indexer-common/src/indexer-management/index.ts @@ -7,3 +7,4 @@ export * from './server' export * from './rules' export * from './types' export * from './context' +export * from './yoga' diff --git a/packages/indexer-common/src/indexer-management/models/cost-model.ts b/packages/indexer-common/src/indexer-management/models/cost-model.ts index dffd0fc2e..fea16a3a3 100644 --- a/packages/indexer-common/src/indexer-management/models/cost-model.ts +++ b/packages/indexer-common/src/indexer-management/models/cost-model.ts @@ -6,11 +6,6 @@ import { CostModel as GraphQLCostModelType, CostModelInput as GraphQLCostModelInput, } from '../../schema/types.generated' -interface GraphQLCostModel { - deployment: string - model: string | null | undefined - variables: string | null | undefined -} export const parseGraphQLCostModel = ( costModel: GraphQLCostModelInput, diff --git a/packages/indexer-common/src/indexer-management/models/indexing-rule.ts b/packages/indexer-common/src/indexer-management/models/indexing-rule.ts index 7646f7f3b..8753724da 100644 --- a/packages/indexer-common/src/indexer-management/models/indexing-rule.ts +++ b/packages/indexer-common/src/indexer-management/models/indexing-rule.ts @@ -88,8 +88,8 @@ export class IndexingRule public createdAt!: Date public updatedAt!: Date - // eslint-disable-next-line @typescript-eslint/ban-types public toGraphQL(): GraphQLIndexingRuleType { + // @ts-expect-error find a way to use `Maybe` with `T | null` return { ...this.toJSON(), __typename: 'IndexingRule' } } diff --git a/packages/indexer-common/src/indexer-management/resolvers/actions.ts b/packages/indexer-common/src/indexer-management/resolvers/actions.ts index 08518e20e..4d6b3008c 100644 --- a/packages/indexer-common/src/indexer-management/resolvers/actions.ts +++ b/packages/indexer-common/src/indexer-management/resolvers/actions.ts @@ -3,7 +3,6 @@ import { IndexerManagementResolverContext } from '../context' import { Logger } from '@graphprotocol/common-ts' import { Action, - ActionFilter, ActionInput, ActionParams, ActionResult, @@ -20,6 +19,7 @@ import { import { literal, Op, Transaction } from 'sequelize' import { ActionManager } from '../actions' import groupBy from 'lodash.groupby' +import { ActionFilter } from 'indexer-common/src/schema/types.generated' // Perform insert, update, or no-op depending on existing queue data // INSERT - No item in the queue yet targeting this deploymentID @@ -176,12 +176,20 @@ export default { validateActionInputs(actions, network.networkMonitor, logger), ) - const alreadyQueuedActions = await ActionManager.fetchActions(models, { - status: ActionStatus.QUEUED, - }) - const alreadyApprovedActions = await ActionManager.fetchActions(models, { - status: ActionStatus.APPROVED, - }) + const alreadyQueuedActions = await ActionManager.fetchActions( + models, + { + status: ActionStatus.QUEUED, + }, + undefined, + ) + const alreadyApprovedActions = await ActionManager.fetchActions( + models, + { + status: ActionStatus.APPROVED, + }, + undefined, + ) const actionsAwaitingExecution = alreadyQueuedActions.concat(alreadyApprovedActions) // Fetch recently attempted actions @@ -189,15 +197,23 @@ export default { [Op.gte]: literal("NOW() - INTERVAL '15m'"), } - const recentlyFailedActions = await ActionManager.fetchActions(models, { - status: ActionStatus.FAILED, - updatedAt: last15Minutes, - }) + const recentlyFailedActions = await ActionManager.fetchActions( + models, + { + status: ActionStatus.FAILED, + updatedAt: last15Minutes, + }, + undefined, + ) - const recentlySuccessfulActions = await ActionManager.fetchActions(models, { - status: ActionStatus.SUCCESS, - updatedAt: last15Minutes, - }) + const recentlySuccessfulActions = await ActionManager.fetchActions( + models, + { + status: ActionStatus.SUCCESS, + updatedAt: last15Minutes, + }, + undefined, + ) logger.trace('Recently attempted actions', { recentlySuccessfulActions, diff --git a/packages/indexer-common/src/indexer-management/resolvers/cost-models.ts b/packages/indexer-common/src/indexer-management/resolvers/cost-models.ts index 67cfdd367..c05581532 100644 --- a/packages/indexer-common/src/indexer-management/resolvers/cost-models.ts +++ b/packages/indexer-common/src/indexer-management/resolvers/cost-models.ts @@ -1,14 +1,10 @@ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ /* eslint-disable @typescript-eslint/ban-types */ -import { - CostModelVariables, - COST_MODEL_GLOBAL, - GraphQLCostModel, - parseGraphQLCostModel, -} from '../models' +import { CostModelVariables, COST_MODEL_GLOBAL, parseGraphQLCostModel } from '../models' import { IndexerManagementResolverContext } from '../context' import { compileAsync } from '@graphprotocol/cost-model' +import { CostModel as GraphQLCostModelType } from '../../schema/types.generated' // eslint-disable-next-line @typescript-eslint/no-explicit-any const getVariable = (vars: CostModelVariables | null, name: string): any | undefined => { @@ -94,7 +90,7 @@ export default { }, setCostModel: async ( - { costModel }: { deployment: string; costModel: GraphQLCostModel }, + { costModel }: { deployment: string; costModel: GraphQLCostModelType }, { models, multiNetworks, dai }: IndexerManagementResolverContext, ): Promise => { if (!multiNetworks) { diff --git a/packages/indexer-common/src/indexer-management/schema.graphql b/packages/indexer-common/src/indexer-management/schema.graphql index 416cf5724..e235be6af 100644 --- a/packages/indexer-common/src/indexer-management/schema.graphql +++ b/packages/indexer-common/src/indexer-management/schema.graphql @@ -41,6 +41,9 @@ type Allocation { createdAtEpoch: Int! closedAtEpoch: Int ageInEpochs: Int! + closeDeadlineEpoch: Int! + closeDeadlineBlocksRemaining: Int! + closeDeadlineTimeRemaining: Int! indexingRewards: String! queryFeesCollected: String! signalledTokens: BigInt! diff --git a/packages/indexer-common/src/indexer-management/yoga.ts b/packages/indexer-common/src/indexer-management/yoga.ts index b069784c8..263a5bf11 100644 --- a/packages/indexer-common/src/indexer-management/yoga.ts +++ b/packages/indexer-common/src/indexer-management/yoga.ts @@ -2,8 +2,31 @@ import { createYoga, createSchema } from 'graphql-yoga' import { typeDefs } from '../schema/typeDefs.generated' import { resolvers } from '../schema/resolvers.generated' import { IndexerManagementResolverContext } from './context' +import { WritableEventual, mutable } from '@graphprotocol/common-ts' +import { ActionManager } from './actions' +import { IndexerManagementClientOptions } from './client' -const yoga = createYoga({ - schema: createSchema({ typeDefs, resolvers }), - context: (req) => {}, -}) +export const createIndexerManagementYogaClient = async ( + options: IndexerManagementClientOptions, +) => { + const { models, graphNode, logger, defaults, multiNetworks } = options + + const dai: WritableEventual = mutable() + + const actionManager = multiNetworks + ? await ActionManager.create(multiNetworks, logger, models, graphNode) + : undefined + + return createYoga({ + schema: createSchema({ typeDefs, resolvers }), + context: { + models, + graphNode, + defaults, + logger: logger.child({ component: 'IndexerManagementClient' }), + dai, + multiNetworks, + actionManager, + }, + }) +} diff --git a/packages/indexer-common/src/operator.ts b/packages/indexer-common/src/operator.ts index 1769d5b16..f4eec090c 100644 --- a/packages/indexer-common/src/operator.ts +++ b/packages/indexer-common/src/operator.ts @@ -1,5 +1,4 @@ import { - ActionFilter, ActionItem, ActionResult, ActionStatus, @@ -22,6 +21,7 @@ import { BigNumber, utils } from 'ethers' import gql from 'graphql-tag' import pMap from 'p-map' import { CombinedError } from '@urql/core' +import { ActionFilter } from './schema/types.generated' const POI_DISPUTES_CONVERTERS_FROM_GRAPHQL: Record< keyof POIDisputeAttributes, diff --git a/yarn.lock b/yarn.lock index 421077f1d..2c7d2ec06 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1612,6 +1612,19 @@ tslib "^2.4.0" value-or-promise "^1.0.12" +"@graphql-tools/executor-http@^1.0.9": + version "1.0.9" + resolved "https://registry.yarnpkg.com/@graphql-tools/executor-http/-/executor-http-1.0.9.tgz#87ca8b99a32241eb0cc30a9c500d2672e92d58b7" + integrity sha512-+NXaZd2MWbbrWHqU4EhXcrDbogeiCDmEbrAN+rMn4Nu2okDjn2MTFDbTIab87oEubQCH4Te1wDkWPKrzXup7+Q== + dependencies: + "@graphql-tools/utils" "^10.0.13" + "@repeaterjs/repeater" "^3.0.4" + "@whatwg-node/fetch" "^0.9.0" + extract-files "^11.0.0" + meros "^1.2.1" + tslib "^2.4.0" + value-or-promise "^1.0.12" + "@graphql-tools/executor-legacy-ws@^1.0.0": version "1.0.3" resolved "https://registry.npmjs.org/@graphql-tools/executor-legacy-ws/-/executor-legacy-ws-1.0.3.tgz" From 87acf8590c4d7abd26da124aae4f10de6aac92e8 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Mon, 25 Mar 2024 16:52:56 -0400 Subject: [PATCH 15/48] finally some tests start to run --- packages/indexer-common/jest.config.js | 6 +++ .../__tests__/resolvers/actions.test.ts | 38 +++++-------------- .../src/indexer-management/__tests__/util.ts | 10 ++--- .../src/indexer-management/index.ts | 1 - .../indexer-management/resolvers/actions.ts | 2 +- .../src/indexer-management/yoga.ts | 4 +- .../resolvers/Mutation/approveActions.ts | 1 + .../resolvers/Mutation/cancelActions.ts | 3 +- .../resolvers/Mutation/closeAllocation.ts | 18 ++++----- .../resolvers/Mutation/createAllocation.ts | 12 +++--- .../resolvers/Mutation/deleteDisputes.ts | 2 +- .../resolvers/Mutation/deleteIndexingRule.ts | 6 +-- .../resolvers/Mutation/deleteIndexingRules.ts | 6 +-- .../resolvers/Mutation/queueActions.ts | 6 +-- .../Mutation/reallocateAllocation.ts | 16 ++++---- .../resolvers/Mutation/setCostModel.ts | 2 +- .../resolvers/Mutation/setIndexingRule.ts | 4 +- .../resolvers/Mutation/storeDisputes.ts | 2 +- .../resolvers/Mutation/updateActions.ts | 2 +- .../resolvers/Query/actions.ts | 2 +- .../resolvers/Query/allocations.ts | 4 +- .../resolvers/Query/costModel.ts | 2 +- .../resolvers/Query/costModels.ts | 2 +- .../resolvers/Query/disputes.ts | 2 +- .../resolvers/Query/indexerAllocations.ts | 4 +- .../resolvers/Query/indexerEndpoints.ts | 4 +- .../resolvers/Query/indexerRegistration.ts | 2 +- .../resolvers/Query/indexingRule.ts | 6 +-- .../resolvers/Query/indexingRules.ts | 4 +- 29 files changed, 79 insertions(+), 94 deletions(-) diff --git a/packages/indexer-common/jest.config.js b/packages/indexer-common/jest.config.js index 4e770bbc4..8cd71ff28 100644 --- a/packages/indexer-common/jest.config.js +++ b/packages/indexer-common/jest.config.js @@ -9,6 +9,12 @@ module.exports = { testEnvironment: 'node', testPathIgnorePatterns: ['/node_modules/', '/dist/', '/.yalc', 'util.ts'], transformIgnorePatterns: ['!node_modules/'], + transform:{ '^.+\\.tsx?$': [ + 'ts-jest', + { + isolatedModules: true, + }, + ],}, globals: { __DATABASE__: { host: process.env.POSTGRES_TEST_HOST || bail('POSTGRES_TEST_HOST is not defined'), diff --git a/packages/indexer-common/src/indexer-management/__tests__/resolvers/actions.test.ts b/packages/indexer-common/src/indexer-management/__tests__/resolvers/actions.test.ts index c370983a0..6cf7c88c7 100644 --- a/packages/indexer-common/src/indexer-management/__tests__/resolvers/actions.test.ts +++ b/packages/indexer-common/src/indexer-management/__tests__/resolvers/actions.test.ts @@ -17,25 +17,10 @@ import { } from '../../models' import { ActionInput, - ActionParams, - ActionStatus, - ActionType, - createIndexerManagementYogaClient, defineQueryFeeModels, - OrderDirection, QueryFeeModels, } from '@graphprotocol/indexer-common' -import { CombinedError } from '@urql/core' -import { GraphQLError } from 'graphql' -import { - createTestManagementClient, - invalidReallocateAction, - invalidUnallocateAction, - queuedAllocateAction, - subgraphDeployment1, - subgraphDeployment2, - subgraphDeployment3, -} from '../util' +import { createTestManagementClient, queuedAllocateAction } from '../util' import { buildHTTPExecutor } from '@graphql-tools/executor-http' const QUEUE_ACTIONS_MUTATION = gql` @@ -239,19 +224,14 @@ describe('Actions', () => { const inputAction = queuedAllocateAction const expected = await actionInputToExpected(inputAction, 1) - const result = executor({ - document: QUEUE_ACTIONS_MUTATION, - variables: { - actions: [inputAction], - }, - }) - - console.log('result', result) - - // await expect( - // executor({document:QUEUE_ACTIONS_MUTATION, variables:{ - // { actions: [inputAction]}}) - // ).resolves.toHaveProperty('data.queueActions', [expected]) + await expect( + executor({ + document: QUEUE_ACTIONS_MUTATION, + variables: { + actions: [inputAction], + }, + }), + ).resolves.toHaveProperty('data.queueActions', [expected]) // await expect( // client diff --git a/packages/indexer-common/src/indexer-management/__tests__/util.ts b/packages/indexer-common/src/indexer-management/__tests__/util.ts index 91b9918b7..fa22c4150 100644 --- a/packages/indexer-common/src/indexer-management/__tests__/util.ts +++ b/packages/indexer-common/src/indexer-management/__tests__/util.ts @@ -2,18 +2,16 @@ import { ActionInput, ActionStatus, ActionType, - createIndexerManagementClient, - createIndexerManagementYogaClient, defineIndexerManagementModels, defineQueryFeeModels, GraphNode, - IndexerManagementClient, IndexerManagementDefaults, MultiNetworks, Network, specification, } from '@graphprotocol/indexer-common' import { connectDatabase, Metrics, Logger, parseGRT } from '@graphprotocol/common-ts' +import { createIndexerManagementYogaClient } from '../../indexer-management/yoga' const PUBLIC_JSON_RPC_ENDPOINT = 'https://ethereum-sepolia.publicnode.com' @@ -56,14 +54,14 @@ export const testNetworkSpecification: specification.NetworkSpecification = }, }) -export const createTestManagementClient = async ( +export async function createTestManagementClient( // eslint-disable-next-line @typescript-eslint/no-explicit-any databaseOptions: any, logger: Logger, injectDai: boolean, metrics: Metrics, networkIdentifierOverride?: string, -) => { +) { // Clearing the registry prevents duplicate metric registration in the default registry. metrics.registry.clear() @@ -112,7 +110,7 @@ export const createTestManagementClient = async ( (n: Network) => n.specification.networkIdentifier, ) - return createIndexerManagementYogaClient({ + return await createIndexerManagementYogaClient({ models: managementModels, graphNode, indexNodeIDs, diff --git a/packages/indexer-common/src/indexer-management/index.ts b/packages/indexer-common/src/indexer-management/index.ts index 6c17663d8..1aeddfe92 100644 --- a/packages/indexer-common/src/indexer-management/index.ts +++ b/packages/indexer-common/src/indexer-management/index.ts @@ -7,4 +7,3 @@ export * from './server' export * from './rules' export * from './types' export * from './context' -export * from './yoga' diff --git a/packages/indexer-common/src/indexer-management/resolvers/actions.ts b/packages/indexer-common/src/indexer-management/resolvers/actions.ts index 4d6b3008c..41567caac 100644 --- a/packages/indexer-common/src/indexer-management/resolvers/actions.ts +++ b/packages/indexer-common/src/indexer-management/resolvers/actions.ts @@ -19,7 +19,7 @@ import { import { literal, Op, Transaction } from 'sequelize' import { ActionManager } from '../actions' import groupBy from 'lodash.groupby' -import { ActionFilter } from 'indexer-common/src/schema/types.generated' +import { ActionFilter } from "../../schema/types.generated" // Perform insert, update, or no-op depending on existing queue data // INSERT - No item in the queue yet targeting this deploymentID diff --git a/packages/indexer-common/src/indexer-management/yoga.ts b/packages/indexer-common/src/indexer-management/yoga.ts index 263a5bf11..d9fe61a39 100644 --- a/packages/indexer-common/src/indexer-management/yoga.ts +++ b/packages/indexer-common/src/indexer-management/yoga.ts @@ -6,9 +6,9 @@ import { WritableEventual, mutable } from '@graphprotocol/common-ts' import { ActionManager } from './actions' import { IndexerManagementClientOptions } from './client' -export const createIndexerManagementYogaClient = async ( +export async function createIndexerManagementYogaClient( options: IndexerManagementClientOptions, -) => { +) { const { models, graphNode, logger, defaults, multiNetworks } = options const dai: WritableEventual = mutable() diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/approveActions.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/approveActions.ts index 57c3833b2..a25b46f74 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/approveActions.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/approveActions.ts @@ -1,6 +1,7 @@ import { ActionStatus } from '@graphprotocol/indexer-common' import type { MutationResolvers } from './../../../types.generated' +// @ts-expect-error it be like that export const approveActions: NonNullable = async ( _parent, { actionIDs }, diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/cancelActions.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/cancelActions.ts index 10b2b9b36..52bbead15 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/cancelActions.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/cancelActions.ts @@ -1,6 +1,7 @@ -import { ActionStatus } from 'indexer-common/src/actions' +import { ActionStatus } from '@graphprotocol/indexer-common' import type { MutationResolvers } from './../../../types.generated' +// @ts-expect-error need to fix export const cancelActions: NonNullable = async ( _parent, { actionIDs }, diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/closeAllocation.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/closeAllocation.ts index 842709f74..360a75797 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/closeAllocation.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/closeAllocation.ts @@ -1,13 +1,13 @@ -import { extractNetwork } from 'indexer-common/src/indexer-management/resolvers/utils' +import { extractNetwork } from "../../../../indexer-management/resolvers/utils" import type { MutationResolvers } from './../../../types.generated' import { BigNumber, utils } from 'ethers' -import { IndexerErrorCode, indexerError } from 'indexer-common/src/errors' -import { NetworkMonitor } from 'indexer-common/src/indexer-management/monitor' -import { GraphNode } from 'indexer-common/src/graph-node' +import { IndexerErrorCode, indexerError } from "../../../../errors" +import { NetworkMonitor } from '../../../../indexer-management/monitor' +import { GraphNode } from '../../../../graph-node' import { formatGRT } from '@graphprotocol/common-ts' -import { SubgraphIdentifierType } from 'indexer-common/src/subgraphs' -import { IndexingDecisionBasis } from 'indexer-common/src/indexer-management/models/indexing-rule' -import { Allocation } from 'indexer-common/src/allocations/types' +import { SubgraphIdentifierType } from '../../../../subgraphs' +import { IndexingDecisionBasis } from '../../../../indexer-management/models/indexing-rule' +import { Allocation } from '../../../../allocations/types' async function resolvePOI( networkMonitor: NetworkMonitor, @@ -109,8 +109,8 @@ export const closeAllocation: NonNullable ) } - poi = await resolvePOI(networkMonitor, graphNode, allocationData, poi, force) - + poi = await resolvePOI(networkMonitor, graphNode, allocationData, poi || undefined, Boolean(force)) + // Double-check whether the allocation is still active on chain, to // avoid unnecessary transactions. // Note: We're checking the allocation state here, which is defined as diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/createAllocation.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/createAllocation.ts index 3d759ba17..65a6620dc 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/createAllocation.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/createAllocation.ts @@ -1,15 +1,15 @@ -import { extractNetwork } from 'indexer-common/src/indexer-management/resolvers/utils' +import { extractNetwork } from "../../../../indexer-management/resolvers/utils" import type { MutationResolvers } from './../../../types.generated' import { SubgraphDeploymentID, formatGRT, parseGRT } from '@graphprotocol/common-ts' -import { AllocationStatus } from 'indexer-common/src/allocations/types' -import { IndexerErrorCode, indexerError } from 'indexer-common/src/errors' +import { AllocationStatus } from '../../../../allocations/types' +import { IndexerErrorCode, indexerError } from "../../../../errors" import { allocationIdProof, uniqueAllocationID, -} from 'indexer-common/src/allocations/keys' +} from "../../../../allocations/keys" import { utils } from 'ethers' -import { SubgraphIdentifierType } from 'indexer-common/src/subgraphs' -import { IndexingDecisionBasis } from 'indexer-common/src/indexer-management/models/indexing-rule' +import { SubgraphIdentifierType } from '../../../../subgraphs' +import { IndexingDecisionBasis } from '../../../../indexer-management/models/indexing-rule' export const createAllocation: NonNullable< MutationResolvers['createAllocation'] diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteDisputes.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteDisputes.ts index b242e8300..b25a2141b 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteDisputes.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteDisputes.ts @@ -1,4 +1,4 @@ -import { validateNetworkIdentifier } from 'indexer-common/src/parsers/validators' +import { validateNetworkIdentifier } from "../../../../parsers/validators" import type { MutationResolvers } from './../../../types.generated' import groupBy from 'lodash.groupby' diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRule.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRule.ts index 47baf6f06..a3e57a8e9 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRule.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRule.ts @@ -1,7 +1,7 @@ -import { processIdentifier } from 'indexer-common/src/subgraphs' +import { processIdentifier } from "../../../../subgraphs" import type { MutationResolvers } from './../../../types.generated' -import { validateNetworkIdentifier } from 'indexer-common/src/parsers/validators' -import { resetGlobalRule } from 'indexer-common/src/indexer-management/resolvers/indexing-rules' +import { validateNetworkIdentifier } from '../../../../parsers/validators' +import { resetGlobalRule } from '../../../../indexer-management/resolvers/indexing-rules' export const deleteIndexingRule: NonNullable< MutationResolvers['deleteIndexingRule'] diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRules.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRules.ts index 8ee981f70..d12a9a04b 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRules.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRules.ts @@ -1,8 +1,8 @@ -import { validateNetworkIdentifier } from 'indexer-common/src/parsers/validators' +import { validateNetworkIdentifier } from '../../../../parsers/validators' import type { MutationResolvers } from './../../../types.generated' import groupBy from 'lodash.groupby' -import { processIdentifier } from 'indexer-common/src/subgraphs' -import { resetGlobalRule } from 'indexer-common/src/indexer-management/resolvers/indexing-rules' +import { processIdentifier } from '../../../../subgraphs' +import { resetGlobalRule } from '../../../../indexer-management/resolvers/indexing-rules' export const deleteIndexingRules: NonNullable< MutationResolvers['deleteIndexingRules'] diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/queueActions.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/queueActions.ts index 48bb5395a..8731638ff 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/queueActions.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/queueActions.ts @@ -1,4 +1,4 @@ -import { validateNetworkIdentifier } from 'indexer-common/src/parsers/validators' +import { validateNetworkIdentifier } from '../../../../parsers/validators' import type { Action, ActionInput, @@ -10,8 +10,8 @@ import { ActionStatus, ActionType, validateActionInputs, -} from 'indexer-common/src/actions' -import { ActionManager } from 'indexer-common/src/indexer-management/actions' +} from '../../../../actions' +import { ActionManager } from '../../../../indexer-management/actions' import { Op, Transaction, literal } from 'sequelize' import { Logger } from '@graphprotocol/common-ts' import { IndexerManagementModels } from '@graphprotocol/indexer-common' diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/reallocateAllocation.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/reallocateAllocation.ts index 168a94fdc..6606867a7 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/reallocateAllocation.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/reallocateAllocation.ts @@ -1,17 +1,17 @@ -import { extractNetwork } from 'indexer-common/src/indexer-management/resolvers/utils' +import { extractNetwork } from "../../../../indexer-management/resolvers/utils" import type { MutationResolvers } from './../../../types.generated' import { formatGRT, parseGRT, toAddress } from '@graphprotocol/common-ts' -import { Allocation, AllocationStatus } from 'indexer-common/src/allocations/types' -import { IndexerErrorCode, indexerError } from 'indexer-common/src/errors' +import { Allocation, AllocationStatus } from '../../../../allocations/types' +import { IndexerErrorCode, indexerError } from "../../../../errors" import { BigNumber, utils } from 'ethers' -import { NetworkMonitor } from 'indexer-common/src/indexer-management/monitor' -import { GraphNode } from 'indexer-common/src/graph-node' +import { NetworkMonitor } from '../../../../indexer-management/monitor' +import { GraphNode } from '../../../../graph-node' import { allocationIdProof, uniqueAllocationID, -} from 'indexer-common/src/allocations/keys' -import { SubgraphIdentifierType } from 'indexer-common/src/subgraphs' -import { IndexingDecisionBasis } from 'indexer-common/src/indexer-management/models/indexing-rule' +} from '../../../../allocations/keys' +import { SubgraphIdentifierType } from "../../../../subgraphs" +import { IndexingDecisionBasis } from '../../../../indexer-management/models/indexing-rule' async function resolvePOI( networkMonitor: NetworkMonitor, diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setCostModel.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setCostModel.ts index 2c9043248..dead39605 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setCostModel.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setCostModel.ts @@ -1,7 +1,7 @@ import { CostModelVariables, parseGraphQLCostModel, -} from 'indexer-common/src/indexer-management/models/cost-model' +} from '../../../../indexer-management/models/cost-model' import type { MutationResolvers } from './../../../types.generated' import { compileAsync } from '@graphprotocol/cost-model' diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setIndexingRule.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setIndexingRule.ts index f47aa3f7e..21745ebd2 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setIndexingRule.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setIndexingRule.ts @@ -1,6 +1,6 @@ -import { validateNetworkIdentifier } from 'indexer-common/src/parsers/validators' +import { validateNetworkIdentifier } from '../../../../parsers/validators' import type { MutationResolvers } from './../../../types.generated' -import { processIdentifier } from 'indexer-common/src/subgraphs' +import { processIdentifier } from '../../../../subgraphs' export const setIndexingRule: NonNullable = async ( _parent, diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/storeDisputes.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/storeDisputes.ts index 95d0e7914..8e7620e6b 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/storeDisputes.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/storeDisputes.ts @@ -1,4 +1,4 @@ -import { validateNetworkIdentifier } from 'indexer-common/src/parsers/validators' +import { validateNetworkIdentifier } from '../../../../parsers/validators' import type { MutationResolvers } from './../../../types.generated' export const storeDisputes: NonNullable = async ( diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/updateActions.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/updateActions.ts index dadd59530..32d839266 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/updateActions.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/updateActions.ts @@ -1,4 +1,4 @@ -import { ActionManager } from 'indexer-common/src/indexer-management/actions' +import { ActionManager } from '../../../../indexer-management/actions' import type { MutationResolvers } from './../../../types.generated' export const updateActions: NonNullable = async ( diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/actions.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/actions.ts index fee230793..f3b98941d 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/actions.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/actions.ts @@ -1,5 +1,5 @@ import type { QueryResolvers } from './../../../types.generated' -import { actionFilterToWhereOptions } from 'indexer-common/src/actions' +import { actionFilterToWhereOptions } from '../../../../actions' import { Order } from 'sequelize' export const actions: NonNullable = async ( diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/allocations.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/allocations.ts index 11526cafd..591a68ac0 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/allocations.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/allocations.ts @@ -1,7 +1,7 @@ -import { queryAllocations } from 'indexer-common/src/indexer-management/resolvers/allocations' +import { queryAllocations } from '../../../../indexer-management/resolvers/allocations' import type { QueryResolvers } from './../../../types.generated' import { toAddress } from '@graphprotocol/common-ts' -import { epochElapsedBlocks } from 'indexer-common/src/indexer-management' +import { epochElapsedBlocks } from '../../../../indexer-management' export const allocations: NonNullable = async ( _parent, diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/costModel.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/costModel.ts index 4790276c9..68add89cd 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/costModel.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/costModel.ts @@ -1,4 +1,4 @@ -import { COST_MODEL_GLOBAL } from 'indexer-common/src/indexer-management/models' +import { COST_MODEL_GLOBAL } from '../../../../indexer-management/models' import type { QueryResolvers } from './../../../types.generated' export const costModel: NonNullable = async ( diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/costModels.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/costModels.ts index 863cf796e..b0b4bb5a3 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/costModels.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/costModels.ts @@ -1,4 +1,4 @@ -import { COST_MODEL_GLOBAL } from 'indexer-common/src/indexer-management/models' +import { COST_MODEL_GLOBAL } from '../../../../indexer-management/models' import type { QueryResolvers } from './../../../types.generated' export const costModels: NonNullable = async ( diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/disputes.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/disputes.ts index 7a7252527..89d3b5cd4 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/disputes.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/disputes.ts @@ -1,6 +1,6 @@ import { Op, WhereOptions } from 'sequelize' import type { QueryResolvers } from './../../../types.generated' -import { validateNetworkIdentifier } from 'indexer-common/src/parsers/validators' +import { validateNetworkIdentifier } from '../../../../parsers/validators' export const disputes: NonNullable = async ( _parent, diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerAllocations.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerAllocations.ts index 0b8b3a16e..4fd7006d8 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerAllocations.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerAllocations.ts @@ -1,8 +1,8 @@ -import { extractNetwork } from 'indexer-common/src/indexer-management/resolvers/utils' +import { extractNetwork } from "../../../../indexer-management/resolvers/utils" import type { QueryResolvers } from './../../../types.generated' import gql from 'graphql-tag' import { SubgraphDeploymentID } from '@graphprotocol/common-ts' -import { IndexerErrorCode, indexerError } from 'indexer-common/src/errors' +import { IndexerErrorCode, indexerError } from "../../../../errors" export const indexerAllocations: NonNullable< QueryResolvers['indexerAllocations'] diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerEndpoints.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerEndpoints.ts index bf26098e1..fc5781ae3 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerEndpoints.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerEndpoints.ts @@ -1,6 +1,6 @@ -import { validateNetworkIdentifier } from 'indexer-common/src/parsers/validators' +import { validateNetworkIdentifier } from '../../../../parsers/validators' import type { QueryResolvers } from './../../../types.generated' -import { Network } from 'indexer-common/src/network' +import { Network } from '../../../../network' const URL_VALIDATION_TEST = { // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerRegistration.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerRegistration.ts index aab4fa692..70d9e4927 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerRegistration.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerRegistration.ts @@ -1,4 +1,4 @@ -import { extractNetwork } from 'indexer-common/src/indexer-management/resolvers/utils' +import { extractNetwork } from "../../../../indexer-management/resolvers/utils" import geohash from 'ngeohash' import type { QueryResolvers } from './../../../types.generated' diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRule.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRule.ts index 25a180bdf..42ab8c6dc 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRule.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRule.ts @@ -1,7 +1,7 @@ -import { processIdentifier } from 'indexer-common/src/subgraphs' +import { processIdentifier } from "../../../../subgraphs" import type { QueryResolvers } from './../../../types.generated' -import { validateNetworkIdentifier } from 'indexer-common/src/parsers/validators' -import { INDEXING_RULE_GLOBAL } from 'indexer-common/src/indexer-management/models/indexing-rule' +import { validateNetworkIdentifier } from "../../../../parsers/validators" +import { INDEXING_RULE_GLOBAL } from '../../../../indexer-management/models/indexing-rule' export const indexingRule: NonNullable = async ( _parent, diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRules.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRules.ts index aa3565e35..2f11e8f0e 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRules.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRules.ts @@ -1,5 +1,5 @@ -import { validateNetworkIdentifier } from 'indexer-common/src/parsers/validators' -import { fetchIndexingRules } from 'indexer-common/src/indexer-management/rules' +import { validateNetworkIdentifier } from '../../../../parsers/validators' +import { fetchIndexingRules } from '../../../../indexer-management/rules' import type { QueryResolvers } from './../../../types.generated' export const indexingRules: NonNullable = async ( From a84aa2fde6379c515d51fbcda2b31d10734acdf5 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Tue, 26 Mar 2024 13:17:54 -0400 Subject: [PATCH 16/48] fix actions test --- .../__tests__/resolvers/actions.test.ts | 1327 +++++++++-------- .../src/indexer-management/yoga.ts | 1 + 2 files changed, 694 insertions(+), 634 deletions(-) diff --git a/packages/indexer-common/src/indexer-management/__tests__/resolvers/actions.test.ts b/packages/indexer-common/src/indexer-management/__tests__/resolvers/actions.test.ts index 6cf7c88c7..d64005376 100644 --- a/packages/indexer-common/src/indexer-management/__tests__/resolvers/actions.test.ts +++ b/packages/indexer-common/src/indexer-management/__tests__/resolvers/actions.test.ts @@ -17,11 +17,23 @@ import { } from '../../models' import { ActionInput, + ActionStatus, + ActionType, defineQueryFeeModels, QueryFeeModels, } from '@graphprotocol/indexer-common' -import { createTestManagementClient, queuedAllocateAction } from '../util' +import { + createTestManagementClient, + invalidReallocateAction, + invalidUnallocateAction, + queuedAllocateAction, + subgraphDeployment1, + subgraphDeployment2, + subgraphDeployment3, +} from '../util' import { buildHTTPExecutor } from '@graphql-tools/executor-http' +import { GraphQLError } from 'graphql' +import { isAsyncIterable } from 'graphql-yoga' const QUEUE_ACTIONS_MUTATION = gql` mutation queueActions($actions: [ActionInput!]!) { @@ -45,7 +57,7 @@ const QUEUE_ACTIONS_MUTATION = gql` ` const APPROVE_ACTIONS_MUTATION = gql` - mutation approveActions($actionIDs: [Int!]!) { + mutation approveActions($actionIDs: [String!]!) { approveActions(actionIDs: $actionIDs) { id type @@ -66,7 +78,7 @@ const APPROVE_ACTIONS_MUTATION = gql` ` const CANCEL_ACTIONS_MUTATION = gql` - mutation cancelActions($actionIDs: [Int!]!) { + mutation cancelActions($actionIDs: [String!]!) { cancelActions(actionIDs: $actionIDs) { id type @@ -133,7 +145,7 @@ const ACTIONS_QUERY = gql` ` const DELETE_ACTIONS_MUTATION = gql` - mutation deleteActions($actionIDs: [Int!]!) { + mutation deleteActions($actionIDs: [String!]!) { deleteActions(actionIDs: $actionIDs) } ` @@ -220,7 +232,7 @@ describe('Actions', () => { afterEach(teardownEach) afterAll(teardownAll) - test.only('Queue and retrieve action', async () => { + test('Queue and retrieve action', async () => { const inputAction = queuedAllocateAction const expected = await actionInputToExpected(inputAction, 1) @@ -233,635 +245,682 @@ describe('Actions', () => { }), ).resolves.toHaveProperty('data.queueActions', [expected]) - // await expect( - // client - // .query(ACTIONS_QUERY, { - // filter: { status: ActionStatus.QUEUED, source: 'indexerAgent' }, - // }) - // .toPromise(), - // ).resolves.toHaveProperty('data.actions', [expected]) + await expect( + executor({ + document: ACTIONS_QUERY, + variables: { filter: { status: ActionStatus.QUEUED, source: 'indexerAgent' } }, + }), + ).resolves.toHaveProperty('data.actions', [expected]) + }) + + test('Queue many actions and retrieve all of a certain status with certain ordering', async () => { + const queuedAllocateAction1 = { ...queuedAllocateAction } + const queuedAllocateAction2 = { ...queuedAllocateAction } + const queuedAllocateAction3 = { ...queuedAllocateAction } + queuedAllocateAction1.deploymentID = subgraphDeployment2 + queuedAllocateAction1.source = '1' + queuedAllocateAction2.deploymentID = subgraphDeployment3 + queuedAllocateAction2.source = '2' + queuedAllocateAction3.deploymentID = subgraphDeployment1 + queuedAllocateAction3.source = '3' + + const inputActions = [ + queuedAllocateAction, + queuedAllocateAction1, + queuedAllocateAction2, + ] + const expecteds = await Promise.all( + inputActions.map(async (action, key) => { + return await actionInputToExpected(action, key + 1) + }), + ) + + await expect( + executor({ + document: QUEUE_ACTIONS_MUTATION, + variables: { actions: inputActions }, + }), + ).resolves.toHaveProperty('data.queueActions', expecteds) + + await expect( + executor({ + document: ACTIONS_QUERY, + variables: { + filter: { + status: ActionStatus.QUEUED, + type: ActionType.ALLOCATE, + }, + orderBy: 'source', + orderDirection: 'desc', + }, + }), + ).resolves.toHaveProperty( + 'data.actions', + expecteds.sort((a, b) => (a.source > b.source ? -1 : 1)), + ) + }) + + test('Queue many actions and retrieve all of a certain status with invalid ordering', async () => { + const queuedAllocateAction1 = { ...queuedAllocateAction } + const queuedAllocateAction2 = { ...queuedAllocateAction } + const queuedAllocateAction3 = { ...queuedAllocateAction } + queuedAllocateAction1.deploymentID = subgraphDeployment2 + queuedAllocateAction2.deploymentID = subgraphDeployment3 + queuedAllocateAction3.deploymentID = subgraphDeployment1 + + const inputActions = [ + queuedAllocateAction, + queuedAllocateAction1, + queuedAllocateAction2, + ] + const expecteds = await Promise.all( + inputActions.map(async (action, key) => { + return await actionInputToExpected(action, key + 1) + }), + ) + + await expect( + executor({ + document: QUEUE_ACTIONS_MUTATION, + variables: { actions: inputActions }, + }), + ).resolves.toHaveProperty('data.queueActions', expecteds) + + await expect( + executor({ + document: ACTIONS_QUERY, + variables: { + filter: { + status: ActionStatus.QUEUED, + type: ActionType.ALLOCATE, + source: 'indexerAgent', + }, + orderBy: 'adonut', + orderDirection: 'desc', + }, + }), + ).resolves.toHaveProperty('errors', [ + { + locations: [ + { + column: 39, + line: 1, + }, + ], + message: + 'Variable "$orderBy" got invalid value "adonut"; Value "adonut" does not exist in "ActionParams" enum. Did you mean the enum value "amount"?', + }, + ]) + }) + + test('Cancel all actions in queue', async () => { + const queuedAllocateAction1 = { ...queuedAllocateAction } + const queuedAllocateAction2 = { ...queuedAllocateAction } + queuedAllocateAction1.deploymentID = subgraphDeployment2 + queuedAllocateAction2.deploymentID = subgraphDeployment3 + + const inputActions = [ + queuedAllocateAction, + queuedAllocateAction1, + queuedAllocateAction2, + ] + const expecteds = await Promise.all( + inputActions.map(async (action, key) => { + return await actionInputToExpected(action, key + 1) + }), + ) + + await expect( + executor({ + document: QUEUE_ACTIONS_MUTATION, + variables: { actions: inputActions }, + }), + ).resolves.toHaveProperty('data.queueActions', expecteds) + + // Cancel all actions + const toCancel = expecteds.map((action) => action.id.toString()) + + const expectedCancels = expecteds.map((action) => { + action.status = ActionStatus.CANCELED + return action + }) + + await expect( + executor({ document: CANCEL_ACTIONS_MUTATION, variables: { actionIDs: toCancel } }), + ).resolves.toHaveProperty('data.cancelActions', expectedCancels) + + await expect( + executor({ + document: ACTIONS_QUERY, + variables: { + filter: { + status: ActionStatus.CANCELED, + source: 'indexerAgent', + }, + orderBy: 'id', + orderDirection: 'asc', + }, + }), + ).resolves.toHaveProperty('data.actions', expectedCancels) + }) + + test('Approve action in queue', async () => { + const queuedAllocateAction1 = { ...queuedAllocateAction } + const queuedAllocateAction2 = { ...queuedAllocateAction } + queuedAllocateAction1.deploymentID = subgraphDeployment2 + queuedAllocateAction2.deploymentID = subgraphDeployment3 + + const inputActions = [ + queuedAllocateAction, + queuedAllocateAction1, + queuedAllocateAction2, + ] + const expecteds = await Promise.all( + inputActions.map(async (action, key) => { + return await actionInputToExpected(action, key + 1) + }), + ) + + await expect( + executor({ + document: QUEUE_ACTIONS_MUTATION, + variables: { actions: inputActions }, + }), + ).resolves.toHaveProperty('data.queueActions', expecteds) + + const actions = await executor({ + document: ACTIONS_QUERY, + variables: { + filter: { type: ActionType.ALLOCATE }, + }, + }) + + if (isAsyncIterable(actions)) { + throw new Error('Expected actions to be an array') + } + + const subgraph1ActionID = actions.data.actions + // eslint-disable-next-line @typescript-eslint/no-explicit-any + .filter((action: any) => action.deploymentID === subgraphDeployment2) + // eslint-disable-next-line @typescript-eslint/no-explicit-any + .map((action: any) => action.id.toString()) + + const expectedApprovedAction = expecteds.find( + (action) => action.deploymentID === subgraphDeployment2, + ) + /* eslint-disable @typescript-eslint/no-non-null-assertion */ + expectedApprovedAction!['status'] = ActionStatus.APPROVED + + await expect( + executor({ + document: APPROVE_ACTIONS_MUTATION, + variables: { actionIDs: subgraph1ActionID }, + }), + ).resolves.toHaveProperty('data.approveActions', [expectedApprovedAction]) + + await expect( + executor({ + document: ACTIONS_QUERY, + variables: { + filter: { + status: ActionStatus.APPROVED, + source: 'indexerAgent', + }, + }, + }), + ).resolves.toHaveProperty('data.actions', [expectedApprovedAction]) + }) + + test('Delete action in queue', async () => { + const queuedAllocateAction1 = { ...queuedAllocateAction } + const queuedAllocateAction2 = { ...queuedAllocateAction } + queuedAllocateAction1.deploymentID = subgraphDeployment2 + queuedAllocateAction2.deploymentID = subgraphDeployment3 + + const inputActions = [ + queuedAllocateAction, + queuedAllocateAction1, + queuedAllocateAction2, + ] + const expecteds = await Promise.all( + inputActions.map(async (action, key) => { + return await actionInputToExpected(action, key + 1) + }), + ) + + await expect( + executor({ + document: QUEUE_ACTIONS_MUTATION, + variables: { actions: inputActions }, + }), + ).resolves.toHaveProperty('data.queueActions', expecteds) + + const actions = await executor({ + document: ACTIONS_QUERY, + variables: { filter: { type: ActionType.ALLOCATE } }, + }) + if (isAsyncIterable(actions)) { + throw new Error('Expected actions to be an array') + } + + const actionIDs = actions.data.actions.map((action: any) => action.id.toString()) + + await expect( + executor({ document: DELETE_ACTIONS_MUTATION, variables: { actionIDs } }), + ).resolves.toHaveProperty('data.deleteActions', 3) + }) + + test('Delete non-existent action in queue', async () => { + const actionIDs = ['0'] + + await expect( + executor({ document: DELETE_ACTIONS_MUTATION, variables: { actionIDs } }), + ).resolves.toHaveProperty('errors', [ + { + path: ['deleteActions'], + locations: [{ line: 2, column: 3 }], + message: 'Delete action failed: No action items found with id in [0]', + }, + ]) + }) + + test('Reject empty action input', async () => { + const expectedFieldNamesAndTypes: [string, string][] = [ + ['status', 'ActionStatus'], + ['type', 'ActionType'], + ['source', 'String'], + ['reason', 'String'], + ['priority', 'Int'], + ['protocolNetwork', 'String'], + ] + const graphQLErrors = expectedFieldNamesAndTypes.map( + ([fieldName, fieldType]) => + new GraphQLError( + `Variable "$actions" got invalid value {} at "actions[0]"; Field "${fieldName}" of required type "${fieldType}!" was not provided.`, + ), + ) + const result = await executor({ + document: QUEUE_ACTIONS_MUTATION, + variables: { actions: [{}] }, + }) + if (isAsyncIterable(result)) { + throw new Error('Expected result to be an async iterable') + } + expect(result).toHaveProperty('errors') + expect(result.errors).toHaveLength(graphQLErrors.length) + }) + + test('Reject action with invalid params for action type', async () => { + const inputAction = invalidReallocateAction + + await expect( + executor({ + document: QUEUE_ACTIONS_MUTATION, + variables: { actions: [inputAction] }, + }), + ).resolves.toHaveProperty('errors') + + await expect( + executor({ + document: ACTIONS_QUERY, + variables: { + filter: { status: ActionStatus.QUEUED, source: 'indexerAgent' }, + }, + }), + ).resolves.toHaveProperty('data.actions', []) + }) + + test('Reject duplicate queued action from different source', async () => { + const inputAction = queuedAllocateAction + const expected = await actionInputToExpected(inputAction, 1) + + await expect( + executor({ + document: QUEUE_ACTIONS_MUTATION, + variables: { actions: [inputAction] }, + }), + ).resolves.toHaveProperty('data.queueActions', [expected]) + + await expect( + executor({ + document: ACTIONS_QUERY, + variables: { + filter: { status: ActionStatus.QUEUED, source: 'indexerAgent' }, + }, + }), + ).resolves.toHaveProperty( + 'data.actions', + [expected].sort((a, b) => (a.id > b.id ? -1 : 1)), + ) + + const differentSourceSameTarget = { ...inputAction } + differentSourceSameTarget.source = 'different' + + await expect( + executor({ + document: QUEUE_ACTIONS_MUTATION, + variables: { actions: [differentSourceSameTarget] }, + }), + ).resolves.toHaveProperty('errors') + }) + + test('Update duplicate approved action (effects deployment already targeted by approved action)', async () => { + const inputAction = queuedAllocateAction + const expected = await actionInputToExpected(inputAction, 1) + + await expect( + executor({ + document: QUEUE_ACTIONS_MUTATION, + variables: { actions: [inputAction] }, + }), + ).resolves.toHaveProperty('data.queueActions', [expected]) + + const actions = await executor({ + document: ACTIONS_QUERY, + variables: { filter: { type: ActionType.ALLOCATE } }, + }) + + if (isAsyncIterable(actions)) { + throw new Error('Expected actions to be an array') + } + + const subgraph1ActionID = actions.data.actions + // eslint-disable-next-line @typescript-eslint/no-explicit-any + .filter((action: any) => action.deploymentID === queuedAllocateAction.deploymentID) + // eslint-disable-next-line @typescript-eslint/no-explicit-any + .map((action: any) => action.id.toString()) + + const expectedApprovedAction = { ...expected } + /* eslint-disable @typescript-eslint/no-non-null-assertion */ + expectedApprovedAction!['status'] = ActionStatus.APPROVED + + await expect( + executor({ + document: APPROVE_ACTIONS_MUTATION, + variables: { actionIDs: subgraph1ActionID }, + }), + ).resolves.toHaveProperty('data.approveActions', [expectedApprovedAction]) + + await expect( + executor({ + document: ACTIONS_QUERY, + variables: { + filter: { + status: ActionStatus.APPROVED, + source: 'indexerAgent', + }, + }, + }), + ).resolves.toHaveProperty('data.actions', [expectedApprovedAction]) + + const updateAction = { ...inputAction } + updateAction.amount = '25000' + updateAction.status = ActionStatus.APPROVED + + const expectedUpdated = { ...expectedApprovedAction } + expectedUpdated.amount = '25000' + + await expect( + executor({ + document: QUEUE_ACTIONS_MUTATION, + variables: { actions: [updateAction] }, + }), + ).resolves.toHaveProperty('data.queueActions', [expectedUpdated]) + + await expect( + executor({ + document: ACTIONS_QUERY, + variables: { + filter: { status: ActionStatus.APPROVED, source: 'indexerAgent' }, + }, + }), + ).resolves.toHaveProperty('data.actions', [expectedUpdated]) }) - // test('Queue many actions and retrieve all of a certain status with certain ordering', async () => { - // const queuedAllocateAction1 = { ...queuedAllocateAction } - // const queuedAllocateAction2 = { ...queuedAllocateAction } - // const queuedAllocateAction3 = { ...queuedAllocateAction } - // queuedAllocateAction1.deploymentID = subgraphDeployment2 - // queuedAllocateAction1.source = '1' - // queuedAllocateAction2.deploymentID = subgraphDeployment3 - // queuedAllocateAction2.source = '2' - // queuedAllocateAction3.deploymentID = subgraphDeployment1 - // queuedAllocateAction3.source = '3' - - // const inputActions = [ - // queuedAllocateAction, - // queuedAllocateAction1, - // queuedAllocateAction2, - // ] - // const expecteds = await Promise.all( - // inputActions.map(async (action, key) => { - // return await actionInputToExpected(action, key + 1) - // }), - // ) - - // await expect( - // client.mutation(QUEUE_ACTIONS_MUTATION, { actions: inputActions }).toPromise(), - // ).resolves.toHaveProperty('data.queueActions', expecteds) - - // await expect( - // client - // .query(ACTIONS_QUERY, { - // filter: { - // status: ActionStatus.QUEUED, - // type: ActionType.ALLOCATE, - // }, - // orderBy: ActionParams.SOURCE, - // orderDirection: OrderDirection.DESC, - // }) - // .toPromise(), - // ).resolves.toHaveProperty( - // 'data.actions', - // expecteds.sort((a, b) => (a.source > b.source ? -1 : 1)), - // ) - // }) - - // test('Queue many actions and retrieve all of a certain status with invalid ordering', async () => { - // const queuedAllocateAction1 = { ...queuedAllocateAction } - // const queuedAllocateAction2 = { ...queuedAllocateAction } - // const queuedAllocateAction3 = { ...queuedAllocateAction } - // queuedAllocateAction1.deploymentID = subgraphDeployment2 - // queuedAllocateAction2.deploymentID = subgraphDeployment3 - // queuedAllocateAction3.deploymentID = subgraphDeployment1 - - // const inputActions = [ - // queuedAllocateAction, - // queuedAllocateAction1, - // queuedAllocateAction2, - // ] - // const expecteds = await Promise.all( - // inputActions.map(async (action, key) => { - // return await actionInputToExpected(action, key + 1) - // }), - // ) - - // await expect( - // client.mutation(QUEUE_ACTIONS_MUTATION, { actions: inputActions }).toPromise(), - // ).resolves.toHaveProperty('data.queueActions', expecteds) - - // await expect( - // client - // .query(ACTIONS_QUERY, { - // filter: { - // status: ActionStatus.QUEUED, - // type: ActionType.ALLOCATE, - // source: 'indexerAgent', - // }, - // orderBy: 'adonut', - // orderDirection: OrderDirection.DESC, - // }) - // .toPromise(), - // ).resolves.toHaveProperty( - // 'error', - // new CombinedError({ - // graphQLErrors: [ - // new GraphQLError( - // 'Variable "$orderBy" got invalid value "adonut"; Value "adonut" does not exist in "ActionParams" enum. Did you mean the enum value "amount"?', - // ), - // ], - // }), - // ) - // }) - - // test('Cancel all actions in queue', async () => { - // const queuedAllocateAction1 = { ...queuedAllocateAction } - // const queuedAllocateAction2 = { ...queuedAllocateAction } - // queuedAllocateAction1.deploymentID = subgraphDeployment2 - // queuedAllocateAction2.deploymentID = subgraphDeployment3 - - // const inputActions = [ - // queuedAllocateAction, - // queuedAllocateAction1, - // queuedAllocateAction2, - // ] - // const expecteds = await Promise.all( - // inputActions.map(async (action, key) => { - // return await actionInputToExpected(action, key + 1) - // }), - // ) - - // await expect( - // client.mutation(QUEUE_ACTIONS_MUTATION, { actions: inputActions }).toPromise(), - // ).resolves.toHaveProperty('data.queueActions', expecteds) - - // // Cancel all actions - // const toCancel = expecteds.map((action) => action.id) - - // const expectedCancels = expecteds.map((action) => { - // action.status = ActionStatus.CANCELED - // return action - // }) - - // await expect( - // client.mutation(CANCEL_ACTIONS_MUTATION, { actionIDs: toCancel }).toPromise(), - // ).resolves.toHaveProperty('data.cancelActions', expectedCancels) - - // await expect( - // client - // .query(ACTIONS_QUERY, { - // filter: { - // status: ActionStatus.CANCELED, - // source: 'indexerAgent', - // }, - // orderBy: ActionParams.ID, - // orderDirection: OrderDirection.ASC, - // }) - // .toPromise(), - // ).resolves.toHaveProperty('data.actions', expectedCancels) - // }) - - // test('Approve action in queue', async () => { - // const queuedAllocateAction1 = { ...queuedAllocateAction } - // const queuedAllocateAction2 = { ...queuedAllocateAction } - // queuedAllocateAction1.deploymentID = subgraphDeployment2 - // queuedAllocateAction2.deploymentID = subgraphDeployment3 - - // const inputActions = [ - // queuedAllocateAction, - // queuedAllocateAction1, - // queuedAllocateAction2, - // ] - // const expecteds = await Promise.all( - // inputActions.map(async (action, key) => { - // return await actionInputToExpected(action, key + 1) - // }), - // ) - - // await expect( - // client.mutation(QUEUE_ACTIONS_MUTATION, { actions: inputActions }).toPromise(), - // ).resolves.toHaveProperty('data.queueActions', expecteds) - - // const actions = await client - // .query(ACTIONS_QUERY, { filter: { type: ActionType.ALLOCATE } }) - // .toPromise() - // const subgraph1ActionID = actions.data.actions - // // eslint-disable-next-line @typescript-eslint/no-explicit-any - // .filter((action: any) => action.deploymentID === subgraphDeployment2) - // // eslint-disable-next-line @typescript-eslint/no-explicit-any - // .map((action: any) => action.id) - - // const expectedApprovedAction = expecteds.find( - // (action) => action.deploymentID === subgraphDeployment2, - // ) - // /* eslint-disable @typescript-eslint/no-non-null-assertion */ - // expectedApprovedAction!['status'] = ActionStatus.APPROVED - - // await expect( - // client - // .mutation(APPROVE_ACTIONS_MUTATION, { actionIDs: subgraph1ActionID }) - // .toPromise(), - // ).resolves.toHaveProperty('data.approveActions', [expectedApprovedAction]) - - // await expect( - // client - // .query(ACTIONS_QUERY, { - // filter: { - // status: ActionStatus.APPROVED, - // source: 'indexerAgent', - // }, - // }) - // .toPromise(), - // ).resolves.toHaveProperty('data.actions', [expectedApprovedAction]) - // }) - - // test('Delete action in queue', async () => { - // const queuedAllocateAction1 = { ...queuedAllocateAction } - // const queuedAllocateAction2 = { ...queuedAllocateAction } - // queuedAllocateAction1.deploymentID = subgraphDeployment2 - // queuedAllocateAction2.deploymentID = subgraphDeployment3 - - // const inputActions = [ - // queuedAllocateAction, - // queuedAllocateAction1, - // queuedAllocateAction2, - // ] - // const expecteds = await Promise.all( - // inputActions.map(async (action, key) => { - // return await actionInputToExpected(action, key + 1) - // }), - // ) - - // await expect( - // client.mutation(QUEUE_ACTIONS_MUTATION, { actions: inputActions }).toPromise(), - // ).resolves.toHaveProperty('data.queueActions', expecteds) - - // const actions = await client - // .query(ACTIONS_QUERY, { filter: { type: ActionType.ALLOCATE } }) - // .toPromise() - // const actionIDs = actions.data.actions.map((action: any) => action.id) - - // await expect( - // client.mutation(DELETE_ACTIONS_MUTATION, { actionIDs }).toPromise(), - // ).resolves.toHaveProperty('data.deleteActions', 3) - // }) - - // test('Delete non-existent action in queue', async () => { - // const actionIDs = [0] - - // await expect( - // client.mutation(DELETE_ACTIONS_MUTATION, { actionIDs }).toPromise(), - // ).resolves.toHaveProperty( - // 'error', - // new CombinedError({ - // graphQLErrors: [ - // new GraphQLError('Delete action failed: No action items found with id in [0]'), - // ], - // }), - // ) - // }) - - // test('Reject empty action input', async () => { - // const expectedFieldNamesAndTypes: [string, string][] = [ - // ['status', 'ActionStatus'], - // ['type', 'ActionType'], - // ['source', 'String'], - // ['reason', 'String'], - // ['priority', 'Int'], - // ['protocolNetwork', 'String'], - // ] - // const graphQLErrors = expectedFieldNamesAndTypes.map( - // ([fieldName, fieldType]) => - // new GraphQLError( - // `Variable "$actions" got invalid value {} at "actions[0]"; Field "${fieldName}" of required type "${fieldType}!" was not provided.`, - // ), - // ) - // const expected = new CombinedError({ graphQLErrors }) - - // await expect( - // client.mutation(QUEUE_ACTIONS_MUTATION, { actions: [{}] }).toPromise(), - // ).resolves.toHaveProperty('error', expected) - // }) - - // test('Reject action with invalid params for action type', async () => { - // const inputAction = invalidReallocateAction - // const expected = { ...inputAction, protocolNetwork: 'eip155:5' } - // const fields = JSON.stringify(expected) - // await expect( - // client.mutation(QUEUE_ACTIONS_MUTATION, { actions: [inputAction] }).toPromise(), - // ).resolves.toHaveProperty( - // 'error', - // new CombinedError({ - // graphQLErrors: [ - // new GraphQLError( - // `Failed to queue action: Invalid action input, actionInput: ${fields}`, - // ), - // ], - // }), - // ) - - // await expect( - // client - // .query(ACTIONS_QUERY, { - // filter: { status: ActionStatus.QUEUED, source: 'indexerAgent' }, - // }) - // .toPromise(), - // ).resolves.toHaveProperty('data.actions', []) - // }) - - // test('Reject duplicate queued action from different source', async () => { - // const inputAction = queuedAllocateAction - // const expected = await actionInputToExpected(inputAction, 1) - - // await expect( - // client.mutation(QUEUE_ACTIONS_MUTATION, { actions: [inputAction] }).toPromise(), - // ).resolves.toHaveProperty('data.queueActions', [expected]) - - // await expect( - // client - // .query(ACTIONS_QUERY, { - // filter: { status: ActionStatus.QUEUED, source: 'indexerAgent' }, - // }) - // .toPromise(), - // ).resolves.toHaveProperty( - // 'data.actions', - // [expected].sort((a, b) => (a.id > b.id ? -1 : 1)), - // ) - - // const differentSourceSameTarget = { ...inputAction } - // differentSourceSameTarget.source = 'different' - - // await expect( - // client - // .mutation(QUEUE_ACTIONS_MUTATION, { actions: [differentSourceSameTarget] }) - // .toPromise(), - // ).resolves.toHaveProperty( - // 'error', - // new CombinedError({ - // graphQLErrors: [ - // new GraphQLError( - // `Duplicate action found in queue that effects 'Qmew9PZUJCoDzXqqU6vGyTENTKHrrN4dy5h94kertfudqy' but NOT overwritten because it has a different source and/or status. If you ` + - // `would like to replace the item currently in the queue please cancel it and then queue the proposed action`, - // ), - // ], - // }), - // ) - // }) - - // test('Update duplicate approved action (effects deployment already targeted by approved action)', async () => { - // const inputAction = queuedAllocateAction - // const expected = await actionInputToExpected(inputAction, 1) - - // await expect( - // client.mutation(QUEUE_ACTIONS_MUTATION, { actions: [inputAction] }).toPromise(), - // ).resolves.toHaveProperty('data.queueActions', [expected]) - - // const actions = await client - // .query(ACTIONS_QUERY, { filter: { type: ActionType.ALLOCATE } }) - // .toPromise() - // const subgraph1ActionID = actions.data.actions - // // eslint-disable-next-line @typescript-eslint/no-explicit-any - // .filter((action: any) => action.deploymentID === queuedAllocateAction.deploymentID) - // // eslint-disable-next-line @typescript-eslint/no-explicit-any - // .map((action: any) => action.id) - - // const expectedApprovedAction = { ...expected } - // /* eslint-disable @typescript-eslint/no-non-null-assertion */ - // expectedApprovedAction!['status'] = ActionStatus.APPROVED - - // await expect( - // client - // .mutation(APPROVE_ACTIONS_MUTATION, { actionIDs: subgraph1ActionID }) - // .toPromise(), - // ).resolves.toHaveProperty('data.approveActions', [expectedApprovedAction]) - - // await expect( - // client - // .query(ACTIONS_QUERY, { - // filter: { - // status: ActionStatus.APPROVED, - // source: 'indexerAgent', - // }, - // }) - // .toPromise(), - // ).resolves.toHaveProperty('data.actions', [expectedApprovedAction]) - - // const updateAction = { ...inputAction } - // updateAction.amount = '25000' - // updateAction.status = ActionStatus.APPROVED - - // const expectedUpdated = { ...expectedApprovedAction } - // expectedUpdated.amount = '25000' - - // await expect( - // client.mutation(QUEUE_ACTIONS_MUTATION, { actions: [updateAction] }).toPromise(), - // ).resolves.toHaveProperty('data.queueActions', [expectedUpdated]) - - // await expect( - // client - // .query(ACTIONS_QUERY, { - // filter: { status: ActionStatus.APPROVED, source: 'indexerAgent' }, - // }) - // .toPromise(), - // ).resolves.toHaveProperty('data.actions', [expectedUpdated]) - // }) - - // test('Reject unallocate action with inactive allocationID', async () => { - // // This allocation has been closed on chain - // const closedAllocation = '0x0641209ae448c710ab8d04a8c8a13053d138d8c6' - - // // Reuse a valid inputAction but use an allocationID dedicated to this test purpose, - // // as the previously used allocationID does not exist on chain. - // const inputActions = [{ ...invalidUnallocateAction, allocationID: closedAllocation }] - - // await expect( - // client.mutation(QUEUE_ACTIONS_MUTATION, { actions: inputActions }).toPromise(), - // ).resolves.toHaveProperty( - // 'error', - // new CombinedError({ - // graphQLErrors: [ - // new GraphQLError( - // `An active allocation does not exist with id = '${closedAllocation}'`, - // ), - // ], - // }), - // ) - // }) - - // test('Reject approve request with nonexistent actionID ', async () => { - // const queuedAllocateAction1 = { ...queuedAllocateAction } - // const queuedAllocateAction2 = { ...queuedAllocateAction } - // queuedAllocateAction1.deploymentID = subgraphDeployment2 - // queuedAllocateAction2.deploymentID = subgraphDeployment3 - - // const inputActions = [ - // queuedAllocateAction, - // queuedAllocateAction1, - // queuedAllocateAction2, - // ] - // const expecteds = await Promise.all( - // inputActions.map(async (action, key) => { - // return await actionInputToExpected(action, key + 1) - // }), - // ) - - // await expect( - // client.mutation(QUEUE_ACTIONS_MUTATION, { actions: inputActions }).toPromise(), - // ).resolves.toHaveProperty('data.queueActions', expecteds) - - // await expect( - // client.mutation(APPROVE_ACTIONS_MUTATION, { actionIDs: [100, 200] }).toPromise(), - // ).resolves.toHaveProperty( - // 'error', - // new CombinedError({ - // graphQLErrors: [ - // new GraphQLError( - // `Approve action failed: No action items found with id in [100,200]`, - // ), - // ], - // }), - // ) - - // await expect( - // client - // .query(ACTIONS_QUERY, { - // filter: { - // status: ActionStatus.APPROVED, - // source: 'indexerAgent', - // }, - // }) - // .toPromise(), - // ).resolves.toHaveProperty('data.actions', []) - // }) - - // test('Reject queueing for action that has recently failed', async () => { - // const failedAction = { - // status: ActionStatus.FAILED, - // type: ActionType.ALLOCATE, - // deploymentID: subgraphDeployment1, - // amount: '10000', - // force: false, - // source: 'indexerAgent', - // reason: 'indexingRule', - // priority: 0, - // // When writing directly to the database, `protocolNetwork` must be in the CAIP2-ID format. - // protocolNetwork: 'eip155:5', - // } as ActionInput - - // const proposedAction = { - // status: ActionStatus.QUEUED, - // type: ActionType.ALLOCATE, - // deploymentID: subgraphDeployment1, - // amount: '10000', - // source: 'indexerAgent', - // reason: 'indexingRule', - // priority: 0, - // protocolNetwork: 'goerli', - // } as ActionInput - - // await managementModels.Action.create(failedAction, { - // validate: true, - // returning: true, - // }) - - // const result = await client - // .mutation(QUEUE_ACTIONS_MUTATION, { actions: [proposedAction] }) - // .toPromise() - - // expect(result).toHaveProperty( - // 'error', - // new CombinedError({ - // graphQLErrors: [ - // new GraphQLError( - // `Recently executed 'allocate' action found in queue targeting '${subgraphDeployment1}', ignoring.`, - // ), - // ], - // }), - // ) - // await expect( - // client - // .query(ACTIONS_QUERY, { - // filter: { source: 'indexerAgent' }, - // }) - // .toPromise(), - // ).resolves.toHaveProperty('data.actions', [ - // await actionInputToExpected(failedAction, 1), - // ]) - // }) - - // test('Reject queueing for action that has recently succeeded', async () => { - // const successfulAction = { - // status: ActionStatus.SUCCESS, - // type: ActionType.ALLOCATE, - // deploymentID: subgraphDeployment1, - // amount: '10000', - // force: false, - // source: 'indexerAgent', - // reason: 'indexingRule', - // priority: 0, - // // When writing directly to the database, `protocolNetwork` must be in the CAIP2-ID format. - // protocolNetwork: 'eip155:5', - // } as ActionInput - - // const proposedAction = { - // status: ActionStatus.QUEUED, - // type: ActionType.ALLOCATE, - // deploymentID: subgraphDeployment1, - // amount: '10000', - // source: 'indexerAgent', - // reason: 'indexingRule', - // priority: 0, - // protocolNetwork: 'goerli', - // } as ActionInput - - // await managementModels.Action.create(successfulAction, { - // validate: true, - // returning: true, - // }) - - // await expect( - // client.mutation(QUEUE_ACTIONS_MUTATION, { actions: [proposedAction] }).toPromise(), - // ).resolves.toHaveProperty( - // 'error', - // new CombinedError({ - // graphQLErrors: [ - // new GraphQLError( - // `Recently executed 'allocate' action found in queue targeting '${subgraphDeployment1}', ignoring.`, - // ), - // ], - // }), - // ) - // await expect( - // client - // .query(ACTIONS_QUERY, { - // filter: { source: 'indexerAgent' }, - // }) - // .toPromise(), - // ).resolves.toHaveProperty('data.actions', [ - // await actionInputToExpected(successfulAction, 1), - // ]) - // }) - - // test('Update all queued unallocate actions', async () => { - // const queuedUnallocateAction = { - // status: ActionStatus.QUEUED, - // type: ActionType.UNALLOCATE, - // deploymentID: subgraphDeployment1, - // amount: '10000', - // force: false, - // source: 'indexerAgent', - // reason: 'indexingRule', - // priority: 0, - // // When writing directly to the database, `protocolNetwork` must be in the CAIP2-ID format. - // protocolNetwork: 'eip155:5', - // } as ActionInput - - // const queuedAllocateAction = { - // status: ActionStatus.QUEUED, - // type: ActionType.ALLOCATE, - // deploymentID: subgraphDeployment1, - // force: false, - // amount: '10000', - // source: 'indexerAgent', - // reason: 'indexingRule', - // priority: 0, - // protocolNetwork: 'goerli', - // } as ActionInput - - // await managementModels.Action.create(queuedUnallocateAction, { - // validate: true, - // returning: true, - // }) - - // const queuedAllocateAction1 = { ...queuedAllocateAction } - // const queuedAllocateAction2 = { ...queuedAllocateAction } - // queuedAllocateAction2.deploymentID = subgraphDeployment2 - - // const inputActions = [queuedAllocateAction1, queuedAllocateAction2] - // const expecteds = ( - // await Promise.all( - // inputActions.sort().map(async (action, key) => { - // return await actionInputToExpected(action, key + 1) - // }), - // ) - // ).sort((a, b) => a.id - b.id) - - // await expect( - // client.mutation(QUEUE_ACTIONS_MUTATION, { actions: inputActions }).toPromise(), - // ).resolves.toHaveProperty('data.queueActions', expecteds) - - // const updatedExpecteds = expecteds.map((value) => { - // value.force = true - // return value - // }) - - // await expect( - // client - // .mutation(UPDATE_ACTIONS_MUTATION, { - // filter: { type: 'allocate' }, - // action: { - // force: true, - // }, - // }) - // .toPromise(), - // ).resolves.toHaveProperty('data.updateActions', updatedExpecteds) - // }) + test('Reject unallocate action with inactive allocationID', async () => { + // This allocation has been closed on chain + const closedAllocation = '0x0641209ae448c710ab8d04a8c8a13053d138d8c6' + + // Reuse a valid inputAction but use an allocationID dedicated to this test purpose, + // as the previously used allocationID does not exist on chain. + const inputActions = [{ ...invalidUnallocateAction, allocationID: closedAllocation }] + + await expect( + executor({ + document: QUEUE_ACTIONS_MUTATION, + variables: { actions: inputActions }, + }), + ).resolves.toHaveProperty('errors', [ + { + path: ['queueActions'], + locations: [{ line: 2, column: 3 }], + message: `An active allocation does not exist with id = '${closedAllocation}'`, + }, + ]) + }) + + test('Reject approve request with nonexistent actionID ', async () => { + const queuedAllocateAction1 = { ...queuedAllocateAction } + const queuedAllocateAction2 = { ...queuedAllocateAction } + queuedAllocateAction1.deploymentID = subgraphDeployment2 + queuedAllocateAction2.deploymentID = subgraphDeployment3 + + const inputActions = [ + queuedAllocateAction, + queuedAllocateAction1, + queuedAllocateAction2, + ] + const expecteds = await Promise.all( + inputActions.map(async (action, key) => { + return await actionInputToExpected(action, key + 1) + }), + ) + + await expect( + executor({ + document: QUEUE_ACTIONS_MUTATION, + variables: { actions: inputActions }, + }), + ).resolves.toHaveProperty('data.queueActions', expecteds) + + await expect( + executor({ + document: APPROVE_ACTIONS_MUTATION, + variables: { actionIDs: ['100', '200'] }, + }), + ).resolves.toHaveProperty('errors', [ + { + path: ['approveActions'], + locations: [{ line: 2, column: 3 }], + message: 'Approve action failed: No action items found with id in [100,200]', + }, + ]) + + await expect( + executor({ + document: ACTIONS_QUERY, + variables: { + filter: { + status: ActionStatus.APPROVED, + source: 'indexerAgent', + }, + }, + }), + ).resolves.toHaveProperty('data.actions', []) + }) + + test('Reject queueing for action that has recently failed', async () => { + const failedAction = { + status: ActionStatus.FAILED, + type: ActionType.ALLOCATE, + deploymentID: subgraphDeployment1, + amount: '10000', + force: false, + source: 'indexerAgent', + reason: 'indexingRule', + priority: 0, + // When writing directly to the database, `protocolNetwork` must be in the CAIP2-ID format. + protocolNetwork: 'eip155:11155111', + } as ActionInput + + const proposedAction = { + status: ActionStatus.QUEUED, + type: ActionType.ALLOCATE, + deploymentID: subgraphDeployment1, + amount: '10000', + source: 'indexerAgent', + reason: 'indexingRule', + priority: 0, + protocolNetwork: 'sepolia', + } as ActionInput + + await managementModels.Action.create(failedAction, { + validate: true, + returning: true, + }) + + await expect( + executor({ + document: QUEUE_ACTIONS_MUTATION, + variables: { actions: [proposedAction] }, + }), + ).resolves.toHaveProperty('errors', [ + { + path: ['queueActions'], + locations: [{ line: 2, column: 3 }], + message: `Recently executed 'allocate' action found in queue targeting '${subgraphDeployment1}', ignoring.`, + }, + ]) + await expect( + executor({ + document: ACTIONS_QUERY, + variables: { + filter: { source: 'indexerAgent' }, + }, + }), + ).resolves.toHaveProperty('data.actions', [ + await actionInputToExpected(failedAction, 1), + ]) + }) + + test('Reject queueing for action that has recently succeeded', async () => { + const successfulAction = { + status: ActionStatus.SUCCESS, + type: ActionType.ALLOCATE, + deploymentID: subgraphDeployment1, + amount: '10000', + force: false, + source: 'indexerAgent', + reason: 'indexingRule', + priority: 0, + // When writing directly to the database, `protocolNetwork` must be in the CAIP2-ID format. + protocolNetwork: 'eip155:11155111', + } as ActionInput + + const proposedAction = { + status: ActionStatus.QUEUED, + type: ActionType.ALLOCATE, + deploymentID: subgraphDeployment1, + amount: '10000', + source: 'indexerAgent', + reason: 'indexingRule', + priority: 0, + protocolNetwork: 'sepolia', + } as ActionInput + + await managementModels.Action.create(successfulAction, { + validate: true, + returning: true, + }) + + await expect( + executor({ + document: QUEUE_ACTIONS_MUTATION, + variables: { actions: [proposedAction] }, + }), + ).resolves.toHaveProperty('errors', [ + { + path: ['queueActions'], + locations: [{ line: 2, column: 3 }], + message: `Recently executed 'allocate' action found in queue targeting '${subgraphDeployment1}', ignoring.`, + }, + ]) + await expect( + executor({ + document: ACTIONS_QUERY, + variables: { filter: { source: 'indexerAgent' } }, + }), + ).resolves.toHaveProperty('data.actions', [ + await actionInputToExpected(successfulAction, 1), + ]) + }) + + test('Update all queued unallocate actions', async () => { + const queuedUnallocateAction = { + status: ActionStatus.QUEUED, + type: ActionType.UNALLOCATE, + deploymentID: subgraphDeployment1, + amount: '10000', + force: false, + source: 'indexerAgent', + reason: 'indexingRule', + priority: 0, + // When writing directly to the database, `protocolNetwork` must be in the CAIP2-ID format. + protocolNetwork: 'eip155:11155111', + } as ActionInput + + const queuedAllocateAction = { + status: ActionStatus.QUEUED, + type: ActionType.ALLOCATE, + deploymentID: subgraphDeployment1, + force: false, + amount: '10000', + source: 'indexerAgent', + reason: 'indexingRule', + priority: 0, + protocolNetwork: 'sepolia', + } as ActionInput + + await managementModels.Action.create(queuedUnallocateAction, { + validate: true, + returning: true, + }) + + const queuedAllocateAction1 = { ...queuedAllocateAction } + const queuedAllocateAction2 = { ...queuedAllocateAction } + queuedAllocateAction2.deploymentID = subgraphDeployment2 + + const inputActions = [queuedAllocateAction1, queuedAllocateAction2] + const expecteds = ( + await Promise.all( + inputActions.sort().map(async (action, key) => { + return await actionInputToExpected(action, key + 1) + }), + ) + ).sort((a, b) => a.id - b.id) + + await expect( + executor({ + document: QUEUE_ACTIONS_MUTATION, + variables: { actions: inputActions }, + }), + ).resolves.toHaveProperty('data.queueActions', expecteds) + + const updatedExpecteds = expecteds.map((value) => { + value.force = true + return value + }) + + await expect( + executor({ + document: UPDATE_ACTIONS_MUTATION, + variables: { + filter: { type: 'allocate' }, + action: { + force: true, + }, + }, + }), + ).resolves.toHaveProperty('data.updateActions', updatedExpecteds) + }) }) diff --git a/packages/indexer-common/src/indexer-management/yoga.ts b/packages/indexer-common/src/indexer-management/yoga.ts index d9fe61a39..1ec96433d 100644 --- a/packages/indexer-common/src/indexer-management/yoga.ts +++ b/packages/indexer-common/src/indexer-management/yoga.ts @@ -19,6 +19,7 @@ export async function createIndexerManagementYogaClient( return createYoga({ schema: createSchema({ typeDefs, resolvers }), + maskedErrors: false, context: { models, graphNode, From 504543d119a4a916c24f830c75b2dac890b5894a Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Tue, 26 Mar 2024 16:15:17 -0400 Subject: [PATCH 17/48] more tests --- .../__tests__/resolvers/cost-models.test.ts | 389 ++++++++++-------- .../src/indexer-management/yoga.ts | 58 ++- 2 files changed, 272 insertions(+), 175 deletions(-) diff --git a/packages/indexer-common/src/indexer-management/__tests__/resolvers/cost-models.test.ts b/packages/indexer-common/src/indexer-management/__tests__/resolvers/cost-models.test.ts index 06013d733..1042abbef 100644 --- a/packages/indexer-common/src/indexer-management/__tests__/resolvers/cost-models.test.ts +++ b/packages/indexer-common/src/indexer-management/__tests__/resolvers/cost-models.test.ts @@ -6,12 +6,10 @@ import { connectDatabase, createMetrics, } from '@graphprotocol/common-ts' -import { IndexerManagementClient } from '../../client' import { defineIndexerManagementModels, IndexerManagementModels } from '../../models' -import { CombinedError } from '@urql/core' -import { GraphQLError } from 'graphql' import { createTestManagementClient } from '../util' import { defineQueryFeeModels } from '../../../query-fees/models' +import { buildHTTPExecutor } from '@graphql-tools/executor-http' // Make global Jest variable available // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -71,8 +69,9 @@ const GET_COST_MODELS_DEPLOYMENTS_QUERY = gql` let sequelize: Sequelize let models: IndexerManagementModels let logger: Logger -let client: IndexerManagementClient +let executor: ReturnType const metrics = createMetrics() +let setDai: (dai: string) => Promise const setupAll = async () => { logger = createLogger({ @@ -92,13 +91,18 @@ const setupAll = async () => { level: __LOG_LEVEL__ ?? 'error', }) - client = await createTestManagementClient( + const client = await createTestManagementClient( __DATABASE__, logger, true, metrics, 'eip155:1', // Override with mainnet to enable the Cost Model feature ) + + setDai = client.setDai + executor = buildHTTPExecutor({ + fetch: client.yoga.fetch, + }) } const teardownAll = async () => { @@ -133,11 +137,10 @@ describe('Cost models', () => { const expected = { ...input } await expect( - client - .mutation(SET_COST_MODEL_MUTATION, { - costModel: input, - }) - .toPromise(), + executor({ + document: SET_COST_MODEL_MUTATION, + variables: { costModel: input }, + }), ).resolves.toHaveProperty('data.setCostModel', expected) }) @@ -154,11 +157,12 @@ describe('Cost models', () => { } await expect( - client - .mutation(SET_COST_MODEL_MUTATION, { + executor({ + document: SET_COST_MODEL_MUTATION, + variables: { costModel: input, - }) - .toPromise(), + }, + }), ).resolves.toHaveProperty('data.setCostModel', expected) }) @@ -175,11 +179,12 @@ describe('Cost models', () => { } await expect( - client - .mutation(SET_COST_MODEL_MUTATION, { + executor({ + document: SET_COST_MODEL_MUTATION, + variables: { costModel: input, - }) - .toPromise(), + }, + }), ).resolves.toHaveProperty('data.setCostModel', expected) }) @@ -193,49 +198,50 @@ describe('Cost models', () => { const expected = { ...input } await expect( - client - .mutation(SET_COST_MODEL_MUTATION, { - costModel: input, - }) - .toPromise(), + executor({ + document: SET_COST_MODEL_MUTATION, + variables: { costModel: input }, + }), ).resolves.toHaveProperty('data.setCostModel', expected) //Double check await expect( - client - .query(GET_COST_MODEL_QUERY, { + executor({ + document: GET_COST_MODEL_QUERY, + variables: { deployment: 'global', - }) - .toPromise(), + }, + }), ).resolves.toHaveProperty('data.costModel', expected) //Check non-existent const expectFallback = expected expectFallback.deployment = 'blah' await expect( - client - .query(GET_COST_MODEL_QUERY, { + executor({ + document: GET_COST_MODEL_QUERY, + variables: { deployment: 'blah', - }) - .toPromise(), + }, + }), ).resolves.toHaveProperty('data.costModel', expected) //Delete global cost model await expect( - client - .mutation(DELETE_COST_MODELS_MUTATION, { + executor({ + document: DELETE_COST_MODELS_MUTATION, + variables: { deployments: [input.deployment], - }) - .toPromise(), + }, + }), ).resolves.toHaveProperty('data.deleteCostModels', 1) //Check non-existent without global cost model await expect( - client - .query(GET_COST_MODEL_QUERY, { - deployment: 'blah', - }) - .toPromise(), + executor({ + document: GET_COST_MODEL_QUERY, + variables: { deployment: 'blah' }, + }), ).resolves.toHaveProperty('data.costModel', null) }) @@ -291,23 +297,25 @@ describe('Cost models', () => { for (const update of updates) { await expect( - client - .mutation(SET_COST_MODEL_MUTATION, { + executor({ + document: SET_COST_MODEL_MUTATION, + variables: { costModel: update.input, - }) - .toPromise(), + }, + }), ).resolves.toHaveProperty('data.setCostModel', update.expected) } }) test('Get non-existent model', async () => { await expect( - client - .query(GET_COST_MODEL_QUERY, { + executor({ + document: GET_COST_MODEL_QUERY, + variables: { deployment: '0x0000000000000000000000000000000000000000000000000000000000000000', - }) - .toPromise(), + }, + }), ).resolves.toHaveProperty('data.costModel', null) }) @@ -315,11 +323,10 @@ describe('Cost models', () => { const deployment = 'QmTBxvMF6YnbT1eYeRx9XQpH4WvxTV53vdptCCZFiZSprg' // Model doesn't exist when global is not set await expect( - client - .query(GET_COST_MODEL_QUERY, { - deployment, - }) - .toPromise(), + executor({ + document: GET_COST_MODEL_QUERY, + variables: { deployment }, + }), ).resolves.toHaveProperty('data.costModel', null) // Set global model @@ -333,22 +340,24 @@ describe('Cost models', () => { // Global model set await expect( - client - .mutation(SET_COST_MODEL_MUTATION, { + executor({ + document: SET_COST_MODEL_MUTATION, + variables: { costModel: input, - }) - .toPromise(), + }, + }), ).resolves.toHaveProperty('data.setCostModel', expected) // Global fallback to non-existent model const expectFallback = expected expectFallback.deployment = deployment await expect( - client - .query(GET_COST_MODEL_QUERY, { + executor({ + document: GET_COST_MODEL_QUERY, + variables: { deployment, - }) - .toPromise(), + }, + }), ).resolves.toHaveProperty('data.costModel', expectFallback) }) @@ -367,12 +376,18 @@ describe('Cost models', () => { ] for (const input of inputs) { - await client.mutation(SET_COST_MODEL_MUTATION, { costModel: input }).toPromise() + await executor({ + document: SET_COST_MODEL_MUTATION, + variables: { costModel: input }, + }) } for (const input of inputs) { await expect( - client.query(GET_COST_MODEL_QUERY, { deployment: input.deployment }).toPromise(), + executor({ + document: GET_COST_MODEL_QUERY, + variables: { deployment: input.deployment }, + }), ).resolves.toHaveProperty('data.costModel', input) } }) @@ -392,13 +407,15 @@ describe('Cost models', () => { ] for (const input of inputs) { - await client.mutation(SET_COST_MODEL_MUTATION, { costModel: input }).toPromise() + await executor({ + document: SET_COST_MODEL_MUTATION, + variables: { costModel: input }, + }) } - await expect(client.query(GET_COST_MODELS_QUERY).toPromise()).resolves.toHaveProperty( - 'data.costModels', - inputs, - ) + await expect( + executor({ document: GET_COST_MODELS_QUERY }).toPromise(), + ).resolves.toHaveProperty('data.costModels', inputs) }) test('Get cost models with defined global models', async () => { @@ -418,16 +435,20 @@ describe('Cost models', () => { '0x2222222222222222222222222222222222222222222222222222222222222222' for (const input of inputs) { - await client.mutation(SET_COST_MODEL_MUTATION, { costModel: input }).toPromise() + await executor({ + document: SET_COST_MODEL_MUTATION, + variables: { costModel: input }, + }) } // only defined cost models are returned await expect( - client - .query(GET_COST_MODELS_DEPLOYMENTS_QUERY, { + executor({ + document: GET_COST_MODELS_DEPLOYMENTS_QUERY, + variables: { deployments: inputs.map((model) => model.deployment).concat([nonexisting]), - }) - .toPromise(), + }, + }), ).resolves.toHaveProperty('data.costModels', inputs) // Set global model @@ -438,21 +459,23 @@ describe('Cost models', () => { } const expected = { ...global_input } await expect( - client - .mutation(SET_COST_MODEL_MUTATION, { + executor({ + document: SET_COST_MODEL_MUTATION, + variables: { costModel: global_input, - }) - .toPromise(), + }, + }), ).resolves.toHaveProperty('data.setCostModel', expected) // Global fallback global_input.deployment = nonexisting await expect( - client - .query(GET_COST_MODELS_DEPLOYMENTS_QUERY, { + executor({ + document: GET_COST_MODELS_DEPLOYMENTS_QUERY, + variables: { deployments: inputs.map((model) => model.deployment).concat([nonexisting]), - }) - .toPromise(), + }, + }), ).resolves.toHaveProperty('data.costModels', inputs.concat([global_input])) }) @@ -463,7 +486,7 @@ describe('Cost models', () => { variables: JSON.stringify({ n: 100 }), } - await client.mutation(SET_COST_MODEL_MUTATION, { costModel: input }).toPromise() + await executor({ document: SET_COST_MODEL_MUTATION, variables: { costModel: input } }) input = { deployment: '0x0000000000000000000000000000000000000000000000000000000000000000', @@ -476,9 +499,9 @@ describe('Cost models', () => { variables: JSON.stringify({}), } - await client.mutation(SET_COST_MODEL_MUTATION, { costModel: input }).toPromise() + await executor({ document: SET_COST_MODEL_MUTATION, variables: { costModel: input } }) - await expect(client.query(GET_COST_MODELS_QUERY).toPromise()).resolves.toHaveProperty( + await expect(executor({ document: GET_COST_MODELS_QUERY })).resolves.toHaveProperty( 'data.costModels', [expected], ) @@ -499,20 +522,27 @@ describe('Cost models', () => { ] for (const input of inputs) { - await client.mutation(SET_COST_MODEL_MUTATION, { costModel: input }).toPromise() + await executor({ + document: SET_COST_MODEL_MUTATION, + variables: { costModel: input }, + }) } for (const input of inputs) { await expect( - client.query(GET_COST_MODEL_QUERY, { deployment: input.deployment }).toPromise(), + executor({ + document: GET_COST_MODEL_QUERY, + variables: { deployment: input.deployment }, + }), ).resolves.toHaveProperty('data.costModel', input) } for (const input of inputs) { await expect( - client - .mutation(DELETE_COST_MODELS_MUTATION, { deployments: [input.deployment] }) - .toPromise(), + executor({ + document: DELETE_COST_MODELS_MUTATION, + variables: { deployments: [input.deployment] }, + }), ).resolves.toHaveProperty('data.deleteCostModels', 1) } }) @@ -532,21 +562,28 @@ describe('Cost models', () => { ] for (const input of inputs) { - await client.mutation(SET_COST_MODEL_MUTATION, { costModel: input }).toPromise() + await executor({ + document: SET_COST_MODEL_MUTATION, + variables: { costModel: input }, + }) } for (const input of inputs) { await expect( - client.query(GET_COST_MODEL_QUERY, { deployment: input.deployment }).toPromise(), + executor({ + document: GET_COST_MODEL_QUERY, + variables: { deployment: input.deployment }, + }), ).resolves.toHaveProperty('data.costModel', input) } await expect( - client - .mutation(DELETE_COST_MODELS_MUTATION, { + executor({ + document: DELETE_COST_MODELS_MUTATION, + variables: { deployments: inputs.map((d) => d.deployment), - }) - .toPromise(), + }, + }), ).resolves.toHaveProperty('data.deleteCostModels', 2) }) @@ -565,15 +602,19 @@ describe('Cost models', () => { ] for (const input of inputs) { - await client.mutation(SET_COST_MODEL_MUTATION, { costModel: input }).toPromise() + await executor({ + document: SET_COST_MODEL_MUTATION, + variables: { costModel: input }, + }) } await expect( - client - .mutation(DELETE_COST_MODELS_MUTATION, { + executor({ + document: DELETE_COST_MODELS_MUTATION, + variables: { deployments: inputs.map((d) => d.deployment), - }) - .toPromise(), + }, + }), ).resolves.toHaveProperty('data.deleteCostModels', 2) }) }) @@ -588,16 +629,22 @@ describe('Feature: Inject $DAI variable', () => { model: 'query { votes } => 10 * $n;', variables: JSON.stringify({ DAI: '10.0' }), } - await client.mutation(SET_COST_MODEL_MUTATION, { costModel: initial }).toPromise() + await executor({ + document: SET_COST_MODEL_MUTATION, + variables: { costModel: initial }, + }) const update = { deployment: '0x0000000000000000000000000000000000000000000000000000000000000000', model: null, variables: JSON.stringify({}), } - await client.mutation(SET_COST_MODEL_MUTATION, { costModel: update }).toPromise() + await executor({ + document: SET_COST_MODEL_MUTATION, + variables: { costModel: update }, + }) - await expect(client.query(GET_COST_MODELS_QUERY).toPromise()).resolves.toHaveProperty( + await expect(executor({ document: GET_COST_MODELS_QUERY })).resolves.toHaveProperty( 'data.costModels', [initial], ) @@ -609,17 +656,24 @@ describe('Feature: Inject $DAI variable', () => { model: 'query { votes } => 10 * $n;', variables: JSON.stringify({ DAI: '10.0' }), } - await client.mutation(SET_COST_MODEL_MUTATION, { costModel: initial }).toPromise() + await executor({ + variables: { costModel: initial }, + document: SET_COST_MODEL_MUTATION, + }) const update = { deployment: '0x0000000000000000000000000000000000000000000000000000000000000000', model: initial.model, variables: JSON.stringify({ DAI: '15.0' }), } - await client.mutation(SET_COST_MODEL_MUTATION, { costModel: update }).toPromise() - await expect(client.query(GET_COST_MODELS_QUERY).toPromise()).resolves.toHaveProperty( - 'data.costModels', - [update], - ) + await executor({ + document: SET_COST_MODEL_MUTATION, + variables: { costModel: update }, + }) + await expect( + executor({ + document: GET_COST_MODELS_QUERY, + }), + ).resolves.toHaveProperty('data.costModels', [update]) }) test('$DAI updates are applied to all cost models', async () => { @@ -637,12 +691,15 @@ describe('Feature: Inject $DAI variable', () => { ] for (const input of inputs) { - await client.mutation(SET_COST_MODEL_MUTATION, { costModel: input }).toPromise() + await executor({ + variables: { costModel: input }, + document: SET_COST_MODEL_MUTATION, + }) } - await client.setDai('15.3') + await setDai('15.3') - await expect(client.query(GET_COST_MODELS_QUERY).toPromise()).resolves.toHaveProperty( + await expect(executor({ document: GET_COST_MODELS_QUERY })).resolves.toHaveProperty( 'data.costModels', [ { @@ -674,28 +731,32 @@ describe('Feature: Inject $DAI variable', () => { ] // This time, set the DAI value first - await client.setDai('15.3') + await setDai('15.3') // THEN add new cost models for (const input of inputs) { - await client.mutation(SET_COST_MODEL_MUTATION, { costModel: input }).toPromise() + await executor({ + document: SET_COST_MODEL_MUTATION, + variables: { costModel: input }, + }) } - await expect(client.query(GET_COST_MODELS_QUERY).toPromise()).resolves.toHaveProperty( - 'data.costModels', - [ - { - ...inputs[0], - // DAI was replaced here - variables: JSON.stringify({ n: 100, DAI: '15.3' }), - }, - { - ...inputs[1], - // DAI was added here - variables: JSON.stringify({ n: 10, DAI: '15.3' }), - }, - ], - ) + await expect( + executor({ + document: GET_COST_MODELS_QUERY, + }), + ).resolves.toHaveProperty('data.costModels', [ + { + ...inputs[0], + // DAI was replaced here + variables: JSON.stringify({ n: 100, DAI: '15.3' }), + }, + { + ...inputs[1], + // DAI was added here + variables: JSON.stringify({ n: 10, DAI: '15.3' }), + }, + ]) }) test('$DAI is preserved when cost model is updated', async () => { @@ -705,14 +766,20 @@ describe('Feature: Inject $DAI variable', () => { variables: JSON.stringify({ n: 5, DAI: '10.0' }), } - await client.mutation(SET_COST_MODEL_MUTATION, { costModel: initial }).toPromise() + await executor({ + document: SET_COST_MODEL_MUTATION, + variables: { costModel: initial }, + }) const update = { deployment: '0x0000000000000000000000000000000000000000000000000000000000000000', model: 'default => 1;', variables: null, } - await client.mutation(SET_COST_MODEL_MUTATION, { costModel: update }).toPromise() - await expect(client.query(GET_COST_MODELS_QUERY).toPromise()).resolves.toHaveProperty( + await executor({ + document: SET_COST_MODEL_MUTATION, + variables: { costModel: update }, + }) + await expect(executor({ document: GET_COST_MODELS_QUERY })).resolves.toHaveProperty( 'data.costModels', [ { @@ -737,19 +804,25 @@ describe('Feature: Inject $DAI variable', () => { model: 'query { votes } => 10 * $n;', variables: JSON.stringify({ n: 5, DAI: '10.0' }), } - await clientNoInjectDai - .mutation(SET_COST_MODEL_MUTATION, { costModel: initial }) - .toPromise() + + await buildHTTPExecutor({ + fetch: clientNoInjectDai.yoga.fetch, + })({ document: SET_COST_MODEL_MUTATION, variables: { costModel: initial } }) + const update = { deployment: '0x0000000000000000000000000000000000000000000000000000000000000000', model: initial.model, variables: JSON.stringify({}), } - await clientNoInjectDai - .mutation(SET_COST_MODEL_MUTATION, { costModel: update }) - .toPromise() + + const a = await buildHTTPExecutor({ + fetch: clientNoInjectDai.yoga.fetch, + })({ document: SET_COST_MODEL_MUTATION, variables: { costModel: update } }) +console.log(a) await expect( - clientNoInjectDai.query(GET_COST_MODELS_QUERY).toPromise(), + buildHTTPExecutor({ + fetch: clientNoInjectDai.yoga.fetch, + })({ document: GET_COST_MODELS_QUERY }), ).resolves.toHaveProperty('data.costModels', [update]) }) }) @@ -763,17 +836,14 @@ describe('Cost model validation', () => { } await expect( - client.mutation(SET_COST_MODEL_MUTATION, { costModel }).toPromise(), - ).resolves.toHaveProperty( - 'error', - new CombinedError({ - graphQLErrors: [ - new GraphQLError( - 'Invalid cost model or variables: Failed to compile cost model', - ), - ], - }), - ) + executor({ document: SET_COST_MODEL_MUTATION, variables: { costModel } }), + ).resolves.toHaveProperty('errors', [ + { + path: ['setCostModel'], + locations: [{ line: 2, column: 3 }], + message: 'Invalid cost model or variables: Failed to compile cost model', + }, + ]) }) test('Invalid cost model variables are rejected', async () => { @@ -784,16 +854,13 @@ describe('Cost model validation', () => { } await expect( - client.mutation(SET_COST_MODEL_MUTATION, { costModel }).toPromise(), - ).resolves.toHaveProperty( - 'error', - new CombinedError({ - graphQLErrors: [ - new GraphQLError( - 'Invalid cost model or variables: Failed to compile cost model', - ), - ], - }), - ) + executor({ document: SET_COST_MODEL_MUTATION, variables: { costModel } }), + ).resolves.toHaveProperty('errors', [ + { + path: ['setCostModel'], + locations: [{ line: 2, column: 3 }], + message: 'Invalid cost model or variables: Failed to compile cost model', + }, + ]) }) }) diff --git a/packages/indexer-common/src/indexer-management/yoga.ts b/packages/indexer-common/src/indexer-management/yoga.ts index 1ec96433d..c5b355661 100644 --- a/packages/indexer-common/src/indexer-management/yoga.ts +++ b/packages/indexer-common/src/indexer-management/yoga.ts @@ -2,9 +2,10 @@ import { createYoga, createSchema } from 'graphql-yoga' import { typeDefs } from '../schema/typeDefs.generated' import { resolvers } from '../schema/resolvers.generated' import { IndexerManagementResolverContext } from './context' -import { WritableEventual, mutable } from '@graphprotocol/common-ts' +import { WritableEventual, equal, mutable } from '@graphprotocol/common-ts' import { ActionManager } from './actions' import { IndexerManagementClientOptions } from './client' +import { Op, Sequelize } from 'sequelize' export async function createIndexerManagementYogaClient( options: IndexerManagementClientOptions, @@ -17,17 +18,46 @@ export async function createIndexerManagementYogaClient( ? await ActionManager.create(multiNetworks, logger, models, graphNode) : undefined - return createYoga({ - schema: createSchema({ typeDefs, resolvers }), - maskedErrors: false, - context: { - models, - graphNode, - defaults, - logger: logger.child({ component: 'IndexerManagementClient' }), - dai, - multiNetworks, - actionManager, - }, - }) + async function setDai(value: string): Promise { + // Get current value + const oldValue = dai.valueReady ? await dai.value() : undefined + + // Don't do anything if there is no change + if (equal(oldValue, value)) { + return + } + + // Notify others of the new value + dai.push(value) + + // Update DAI in all cost models + const update = `'${JSON.stringify({ DAI: value })}'::jsonb` + await models.CostModel.update( + { + // This merges DAI into the variables, overwriting existing values + variables: Sequelize.literal(`coalesce(variables, '{}'::jsonb) || ${update}`), + }, + { + // TODO: update to match all rows?? + where: { model: { [Op.not]: null } }, + }, + ) + } + + return { + setDai, + yoga: createYoga({ + schema: createSchema({ typeDefs, resolvers }), + maskedErrors: false, + context: { + models, + graphNode, + defaults, + logger: logger.child({ component: 'IndexerManagementClient' }), + dai, + multiNetworks, + actionManager, + }, + }), + } } From 229561a9cadd6c00609ddc33afb59915b179230f Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Tue, 26 Mar 2024 16:25:59 -0400 Subject: [PATCH 18/48] fix install --- packages/indexer-common/.eslintignore | 3 ++- packages/indexer-common/codegen.ts | 2 +- .../__tests__/resolvers/actions.test.ts | 2 +- .../__tests__/resolvers/cost-models.test.ts | 2 +- .../src/indexer-management/resolvers/actions.ts | 2 +- .../resolvers/Mutation/closeAllocation.ts | 14 ++++++++++---- .../resolvers/Mutation/createAllocation.ts | 9 +++------ .../resolvers/Mutation/deleteDisputes.ts | 2 +- .../resolvers/Mutation/deleteIndexingRule.ts | 2 +- .../resolvers/Mutation/queueActions.ts | 6 +----- .../resolvers/Mutation/reallocateAllocation.ts | 11 ++++------- .../resolvers/Query/indexerAllocations.ts | 4 ++-- .../resolvers/Query/indexerRegistration.ts | 2 +- .../resolvers/Query/indexingRule.ts | 4 ++-- 14 files changed, 31 insertions(+), 34 deletions(-) diff --git a/packages/indexer-common/.eslintignore b/packages/indexer-common/.eslintignore index 5a19e8ace..105b88eef 100644 --- a/packages/indexer-common/.eslintignore +++ b/packages/indexer-common/.eslintignore @@ -1,3 +1,4 @@ node_modules dist -coverage \ No newline at end of file +coverage +src/schema/*.generated.ts diff --git a/packages/indexer-common/codegen.ts b/packages/indexer-common/codegen.ts index 18152d49e..f0ef2c5f8 100644 --- a/packages/indexer-common/codegen.ts +++ b/packages/indexer-common/codegen.ts @@ -7,7 +7,7 @@ const config: CodegenConfig = { 'src/schema': defineConfig({ typesPluginsConfig: { contextType: '@graphprotocol/indexer-common#IndexerManagementResolverContext', - enumsAsTypes: true, + enumsAsTypes: true, }, }), }, diff --git a/packages/indexer-common/src/indexer-management/__tests__/resolvers/actions.test.ts b/packages/indexer-common/src/indexer-management/__tests__/resolvers/actions.test.ts index d64005376..1ee856cc1 100644 --- a/packages/indexer-common/src/indexer-management/__tests__/resolvers/actions.test.ts +++ b/packages/indexer-common/src/indexer-management/__tests__/resolvers/actions.test.ts @@ -199,7 +199,7 @@ const setup = async () => { }) const client = await createTestManagementClient(__DATABASE__, logger, true, metrics) executor = buildHTTPExecutor({ - fetch: client.fetch, + fetch: client.yoga.fetch, }) } diff --git a/packages/indexer-common/src/indexer-management/__tests__/resolvers/cost-models.test.ts b/packages/indexer-common/src/indexer-management/__tests__/resolvers/cost-models.test.ts index 1042abbef..f4c04e54f 100644 --- a/packages/indexer-common/src/indexer-management/__tests__/resolvers/cost-models.test.ts +++ b/packages/indexer-common/src/indexer-management/__tests__/resolvers/cost-models.test.ts @@ -818,7 +818,7 @@ describe('Feature: Inject $DAI variable', () => { const a = await buildHTTPExecutor({ fetch: clientNoInjectDai.yoga.fetch, })({ document: SET_COST_MODEL_MUTATION, variables: { costModel: update } }) -console.log(a) + console.log(a) await expect( buildHTTPExecutor({ fetch: clientNoInjectDai.yoga.fetch, diff --git a/packages/indexer-common/src/indexer-management/resolvers/actions.ts b/packages/indexer-common/src/indexer-management/resolvers/actions.ts index 41567caac..85c5d5ae9 100644 --- a/packages/indexer-common/src/indexer-management/resolvers/actions.ts +++ b/packages/indexer-common/src/indexer-management/resolvers/actions.ts @@ -19,7 +19,7 @@ import { import { literal, Op, Transaction } from 'sequelize' import { ActionManager } from '../actions' import groupBy from 'lodash.groupby' -import { ActionFilter } from "../../schema/types.generated" +import { ActionFilter } from '../../schema/types.generated' // Perform insert, update, or no-op depending on existing queue data // INSERT - No item in the queue yet targeting this deploymentID diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/closeAllocation.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/closeAllocation.ts index 360a75797..596e88ccd 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/closeAllocation.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/closeAllocation.ts @@ -1,7 +1,7 @@ -import { extractNetwork } from "../../../../indexer-management/resolvers/utils" +import { extractNetwork } from '../../../../indexer-management/resolvers/utils' import type { MutationResolvers } from './../../../types.generated' import { BigNumber, utils } from 'ethers' -import { IndexerErrorCode, indexerError } from "../../../../errors" +import { IndexerErrorCode, indexerError } from '../../../../errors' import { NetworkMonitor } from '../../../../indexer-management/monitor' import { GraphNode } from '../../../../graph-node' import { formatGRT } from '@graphprotocol/common-ts' @@ -109,8 +109,14 @@ export const closeAllocation: NonNullable ) } - poi = await resolvePOI(networkMonitor, graphNode, allocationData, poi || undefined, Boolean(force)) - + poi = await resolvePOI( + networkMonitor, + graphNode, + allocationData, + poi || undefined, + Boolean(force), + ) + // Double-check whether the allocation is still active on chain, to // avoid unnecessary transactions. // Note: We're checking the allocation state here, which is defined as diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/createAllocation.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/createAllocation.ts index 65a6620dc..28dfe3513 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/createAllocation.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/createAllocation.ts @@ -1,12 +1,9 @@ -import { extractNetwork } from "../../../../indexer-management/resolvers/utils" +import { extractNetwork } from '../../../../indexer-management/resolvers/utils' import type { MutationResolvers } from './../../../types.generated' import { SubgraphDeploymentID, formatGRT, parseGRT } from '@graphprotocol/common-ts' import { AllocationStatus } from '../../../../allocations/types' -import { IndexerErrorCode, indexerError } from "../../../../errors" -import { - allocationIdProof, - uniqueAllocationID, -} from "../../../../allocations/keys" +import { IndexerErrorCode, indexerError } from '../../../../errors' +import { allocationIdProof, uniqueAllocationID } from '../../../../allocations/keys' import { utils } from 'ethers' import { SubgraphIdentifierType } from '../../../../subgraphs' import { IndexingDecisionBasis } from '../../../../indexer-management/models/indexing-rule' diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteDisputes.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteDisputes.ts index b25a2141b..51485ea18 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteDisputes.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteDisputes.ts @@ -1,4 +1,4 @@ -import { validateNetworkIdentifier } from "../../../../parsers/validators" +import { validateNetworkIdentifier } from '../../../../parsers/validators' import type { MutationResolvers } from './../../../types.generated' import groupBy from 'lodash.groupby' diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRule.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRule.ts index a3e57a8e9..4df93307e 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRule.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRule.ts @@ -1,4 +1,4 @@ -import { processIdentifier } from "../../../../subgraphs" +import { processIdentifier } from '../../../../subgraphs' import type { MutationResolvers } from './../../../types.generated' import { validateNetworkIdentifier } from '../../../../parsers/validators' import { resetGlobalRule } from '../../../../indexer-management/resolvers/indexing-rules' diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/queueActions.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/queueActions.ts index 8731638ff..974a9a93b 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/queueActions.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/queueActions.ts @@ -6,11 +6,7 @@ import type { MutationResolvers, } from './../../../types.generated' import groupBy from 'lodash.groupby' -import { - ActionStatus, - ActionType, - validateActionInputs, -} from '../../../../actions' +import { ActionStatus, ActionType, validateActionInputs } from '../../../../actions' import { ActionManager } from '../../../../indexer-management/actions' import { Op, Transaction, literal } from 'sequelize' import { Logger } from '@graphprotocol/common-ts' diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/reallocateAllocation.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/reallocateAllocation.ts index 6606867a7..95d1a840f 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/reallocateAllocation.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/reallocateAllocation.ts @@ -1,16 +1,13 @@ -import { extractNetwork } from "../../../../indexer-management/resolvers/utils" +import { extractNetwork } from '../../../../indexer-management/resolvers/utils' import type { MutationResolvers } from './../../../types.generated' import { formatGRT, parseGRT, toAddress } from '@graphprotocol/common-ts' import { Allocation, AllocationStatus } from '../../../../allocations/types' -import { IndexerErrorCode, indexerError } from "../../../../errors" +import { IndexerErrorCode, indexerError } from '../../../../errors' import { BigNumber, utils } from 'ethers' import { NetworkMonitor } from '../../../../indexer-management/monitor' import { GraphNode } from '../../../../graph-node' -import { - allocationIdProof, - uniqueAllocationID, -} from '../../../../allocations/keys' -import { SubgraphIdentifierType } from "../../../../subgraphs" +import { allocationIdProof, uniqueAllocationID } from '../../../../allocations/keys' +import { SubgraphIdentifierType } from '../../../../subgraphs' import { IndexingDecisionBasis } from '../../../../indexer-management/models/indexing-rule' async function resolvePOI( diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerAllocations.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerAllocations.ts index 4fd7006d8..d2d9a6dd9 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerAllocations.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerAllocations.ts @@ -1,8 +1,8 @@ -import { extractNetwork } from "../../../../indexer-management/resolvers/utils" +import { extractNetwork } from '../../../../indexer-management/resolvers/utils' import type { QueryResolvers } from './../../../types.generated' import gql from 'graphql-tag' import { SubgraphDeploymentID } from '@graphprotocol/common-ts' -import { IndexerErrorCode, indexerError } from "../../../../errors" +import { IndexerErrorCode, indexerError } from '../../../../errors' export const indexerAllocations: NonNullable< QueryResolvers['indexerAllocations'] diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerRegistration.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerRegistration.ts index 70d9e4927..1db3c0d7e 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerRegistration.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerRegistration.ts @@ -1,4 +1,4 @@ -import { extractNetwork } from "../../../../indexer-management/resolvers/utils" +import { extractNetwork } from '../../../../indexer-management/resolvers/utils' import geohash from 'ngeohash' import type { QueryResolvers } from './../../../types.generated' diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRule.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRule.ts index 42ab8c6dc..1ec7cc510 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRule.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRule.ts @@ -1,6 +1,6 @@ -import { processIdentifier } from "../../../../subgraphs" +import { processIdentifier } from '../../../../subgraphs' import type { QueryResolvers } from './../../../types.generated' -import { validateNetworkIdentifier } from "../../../../parsers/validators" +import { validateNetworkIdentifier } from '../../../../parsers/validators' import { INDEXING_RULE_GLOBAL } from '../../../../indexer-management/models/indexing-rule' export const indexingRule: NonNullable = async ( From d4a39579cf06ba00889823f1e9c9a97fcc527c90 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Tue, 26 Mar 2024 16:30:55 -0400 Subject: [PATCH 19/48] fix cost model tests --- .../__tests__/resolvers/cost-models.test.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/packages/indexer-common/src/indexer-management/__tests__/resolvers/cost-models.test.ts b/packages/indexer-common/src/indexer-management/__tests__/resolvers/cost-models.test.ts index f4c04e54f..13daa0f01 100644 --- a/packages/indexer-common/src/indexer-management/__tests__/resolvers/cost-models.test.ts +++ b/packages/indexer-common/src/indexer-management/__tests__/resolvers/cost-models.test.ts @@ -28,11 +28,7 @@ const SET_COST_MODEL_MUTATION = gql` const DELETE_COST_MODELS_MUTATION = gql` mutation deleteCostModels($deployments: [String!]!) { - deleteCostModels(deployments: $deployments) { - deployment - model - variables - } + deleteCostModels(deployments: $deployments) } ` @@ -413,9 +409,10 @@ describe('Cost models', () => { }) } - await expect( - executor({ document: GET_COST_MODELS_QUERY }).toPromise(), - ).resolves.toHaveProperty('data.costModels', inputs) + await expect(executor({ document: GET_COST_MODELS_QUERY })).resolves.toHaveProperty( + 'data.costModels', + inputs, + ) }) test('Get cost models with defined global models', async () => { From 1192c13a03cf795be2f3038eb3155e7c3c433a8c Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Tue, 26 Mar 2024 17:01:38 -0400 Subject: [PATCH 20/48] fix indexing rule test --- .grit/.gitignore | 2 + .../resolvers/indexing-rules.test.ts | 316 ++++++++++-------- 2 files changed, 187 insertions(+), 131 deletions(-) create mode 100644 .grit/.gitignore diff --git a/.grit/.gitignore b/.grit/.gitignore new file mode 100644 index 000000000..e4fdfb17c --- /dev/null +++ b/.grit/.gitignore @@ -0,0 +1,2 @@ +.gritmodules* +*.log diff --git a/packages/indexer-common/src/indexer-management/__tests__/resolvers/indexing-rules.test.ts b/packages/indexer-common/src/indexer-management/__tests__/resolvers/indexing-rules.test.ts index 930bc1523..d0597b613 100644 --- a/packages/indexer-common/src/indexer-management/__tests__/resolvers/indexing-rules.test.ts +++ b/packages/indexer-common/src/indexer-management/__tests__/resolvers/indexing-rules.test.ts @@ -6,7 +6,7 @@ import { Logger, createMetrics, } from '@graphprotocol/common-ts' -import { IndexerManagementClient } from '../../client' +import { buildHTTPExecutor } from '@graphql-tools/executor-http' import { defineIndexerManagementModels, IndexerManagementModels, @@ -110,7 +110,7 @@ const INDEXING_RULES_QUERY = gql` let sequelize: Sequelize let models: IndexerManagementModels let logger: Logger -let client: IndexerManagementClient +let executor: ReturnType const metrics = createMetrics() const setupAll = async () => { @@ -124,7 +124,10 @@ const setupAll = async () => { async: false, level: __LOG_LEVEL__ ?? 'error', }) - client = await createTestManagementClient(__DATABASE__, logger, true, metrics) + const client = await createTestManagementClient(__DATABASE__, logger, true, metrics) + executor = buildHTTPExecutor({ + fetch: client.yoga.fetch, + }) } const teardownAll = async () => { @@ -153,7 +156,7 @@ describe('Indexing rules', () => { const input = { identifier: INDEXING_RULE_GLOBAL, identifierType: SubgraphIdentifierType.GROUP, - allocationAmount: '1000', + allocationAmount: 1000, protocolNetwork: 'sepolia', } @@ -176,7 +179,7 @@ describe('Indexing rules', () => { // Update the rule and ensure the right data is returned await expect( - client.mutation(SET_INDEXING_RULE_MUTATION, { rule: input }).toPromise(), + executor({ variables: { rule: input }, document: SET_INDEXING_RULE_MUTATION }), ).resolves.toHaveProperty('data.setIndexingRule', expected) // Query the rule to make sure it's updated in the db @@ -185,25 +188,27 @@ describe('Indexing rules', () => { protocolNetwork: 'sepolia', } - const result = await client - .query(INDEXING_RULE_QUERY, { identifier: ruleIdentifier, merged: false }) - .toPromise() - expect(result).toHaveProperty('data.indexingRule', expected) + await expect( + executor({ + document: INDEXING_RULE_QUERY, + variables: { identifier: ruleIdentifier, merged: false }, + }), + ).resolves.toHaveProperty('data.indexingRule', expected) }) test('Set and get global rule (complete)', async () => { const input = { identifier: INDEXING_RULE_GLOBAL, identifierType: SubgraphIdentifierType.GROUP, - allocationAmount: '1', + allocationAmount: 1, allocationLifetime: 10, autoRenewal: true, parallelAllocations: 1, maxAllocationPercentage: 0.5, - minSignal: '2', - maxSignal: '3', - minStake: '4', - minAverageQueryFees: '5', + minSignal: 2, + maxSignal: 3, + minStake: 4, + minAverageQueryFees: 5, custom: JSON.stringify({ foo: 'bar' }), decisionBasis: IndexingDecisionBasis.RULES, requireSupported: true, @@ -218,7 +223,7 @@ describe('Indexing rules', () => { // Update the rule await expect( - client.mutation(SET_INDEXING_RULE_MUTATION, { rule: input }).toPromise(), + executor({ document: SET_INDEXING_RULE_MUTATION, variables: { rule: input } }), ).resolves.toHaveProperty('data.setIndexingRule', expected) // Query the rule to make sure it's updated in the db @@ -226,10 +231,12 @@ describe('Indexing rules', () => { identifier: INDEXING_RULE_GLOBAL, protocolNetwork: 'sepolia', } + await expect( - client - .query(INDEXING_RULE_QUERY, { identifier: ruleIdentifier, merged: false }) - .toPromise(), + executor({ + document: INDEXING_RULE_QUERY, + variables: { identifier: ruleIdentifier, merged: false }, + }), ).resolves.toHaveProperty('data.indexingRule', expected) }) @@ -237,8 +244,8 @@ describe('Indexing rules', () => { const originalInput = { identifier: INDEXING_RULE_GLOBAL, identifierType: SubgraphIdentifierType.GROUP, - allocationAmount: '1', - minSignal: '2', + allocationAmount: 1, + minSignal: 2, protocolNetwork: 'sepolia', } @@ -260,14 +267,17 @@ describe('Indexing rules', () => { // Write the original await expect( - client.mutation(SET_INDEXING_RULE_MUTATION, { rule: originalInput }).toPromise(), + executor({ + document: SET_INDEXING_RULE_MUTATION, + variables: { rule: originalInput }, + }), ).resolves.toHaveProperty('data.setIndexingRule', original) const update = { identifier: INDEXING_RULE_GLOBAL, identifierType: SubgraphIdentifierType.GROUP, allocationAmount: null, - maxSignal: '3', + maxSignal: 3, decisionBasis: IndexingDecisionBasis.OFFCHAIN, autoRenewal: true, safety: false, @@ -282,7 +292,7 @@ describe('Indexing rules', () => { // Update the rule await expect( - client.mutation(SET_INDEXING_RULE_MUTATION, { rule: update }).toPromise(), + executor({ document: SET_INDEXING_RULE_MUTATION, variables: { rule: update } }), ).resolves.toHaveProperty('data.setIndexingRule', expected) // Query the rule to make sure it's updated in the db @@ -291,9 +301,10 @@ describe('Indexing rules', () => { protocolNetwork: 'sepolia', } await expect( - client - .query(INDEXING_RULE_QUERY, { identifier: ruleIdentifier, merged: false }) - .toPromise(), + executor({ + document: INDEXING_RULE_QUERY, + variables: { identifier: ruleIdentifier, merged: false }, + }), ).resolves.toHaveProperty('data.indexingRule', expected) }) @@ -302,8 +313,8 @@ describe('Indexing rules', () => { const originalInput = { identifier: originalIdentifier, identifierType: SubgraphIdentifierType.DEPLOYMENT, - allocationAmount: '1', - minSignal: '2', + allocationAmount: 1, + minSignal: 1, decisionBasis: IndexingDecisionBasis.OFFCHAIN, protocolNetwork: 'sepolia', } @@ -326,14 +337,17 @@ describe('Indexing rules', () => { // Write the original await expect( - client.mutation(SET_INDEXING_RULE_MUTATION, { rule: originalInput }).toPromise(), + executor({ + document: SET_INDEXING_RULE_MUTATION, + variables: { rule: originalInput }, + }), ).resolves.toHaveProperty('data.setIndexingRule', original) const update = { identifier: originalIdentifier, identifierType: SubgraphIdentifierType.DEPLOYMENT, allocationAmount: null, - maxSignal: '3', + maxSignal: 3, decisionBasis: IndexingDecisionBasis.ALWAYS, allocationLifetime: 2, autoRenewal: false, @@ -350,7 +364,7 @@ describe('Indexing rules', () => { // Update the rule await expect( - client.mutation(SET_INDEXING_RULE_MUTATION, { rule: update }).toPromise(), + executor({ document: SET_INDEXING_RULE_MUTATION, variables: { rule: update } }), ).resolves.toHaveProperty('data.setIndexingRule', expected) // Query the rule to make sure it's updated in the db @@ -359,12 +373,13 @@ describe('Indexing rules', () => { protocolNetwork: update.protocolNetwork, } await expect( - client - .query(INDEXING_RULE_QUERY, { + executor({ + document: INDEXING_RULE_QUERY, + variables: { identifier: ruleIdentifier, merged: false, - }) - .toPromise(), + }, + }), ).resolves.toHaveProperty('data.indexingRule', expected) const updateAgain = { @@ -386,7 +401,10 @@ describe('Indexing rules', () => { // Update the rule await expect( - client.mutation(SET_INDEXING_RULE_MUTATION, { rule: updateAgain }).toPromise(), + executor({ + document: SET_INDEXING_RULE_MUTATION, + variables: { rule: updateAgain }, + }), ).resolves.toHaveProperty('data.setIndexingRule', expectedAgain) // Query the rule to make sure it's updated in the db @@ -395,12 +413,13 @@ describe('Indexing rules', () => { protocolNetwork: updateAgain.protocolNetwork, } await expect( - client - .query(INDEXING_RULE_QUERY, { + executor({ + document: INDEXING_RULE_QUERY, + variables: { identifier: ruleIdentifierAgain, merged: false, - }) - .toPromise(), + }, + }), ).resolves.toHaveProperty('data.indexingRule', expectedAgain) }) @@ -408,8 +427,8 @@ describe('Indexing rules', () => { const globalInput = { identifier: INDEXING_RULE_GLOBAL, identifierType: SubgraphIdentifierType.GROUP, - allocationAmount: '1', - minSignal: '1', + allocationAmount: 1, + minSignal: 1, decisionBasis: IndexingDecisionBasis.NEVER, protocolNetwork: 'sepolia', } @@ -417,8 +436,8 @@ describe('Indexing rules', () => { const deploymentInput = { identifier: '0xa4e311bfa7edabed7b31d93e0b3e751659669852ef46adbedd44dc2454db4bf3', identifierType: SubgraphIdentifierType.DEPLOYMENT, - allocationAmount: '1', - minSignal: '2', + allocationAmount: 1, + minSignal: 2, decisionBasis: IndexingDecisionBasis.OFFCHAIN, requireSupported: false, autoRenewal: false, @@ -461,10 +480,16 @@ describe('Indexing rules', () => { // Write the orginals await expect( - client.mutation(SET_INDEXING_RULE_MUTATION, { rule: globalInput }).toPromise(), + executor({ + document: SET_INDEXING_RULE_MUTATION, + variables: { rule: globalInput }, + }), ).resolves.toHaveProperty('data.setIndexingRule', globalExpected) await expect( - client.mutation(SET_INDEXING_RULE_MUTATION, { rule: deploymentInput }).toPromise(), + executor({ + document: SET_INDEXING_RULE_MUTATION, + variables: { rule: deploymentInput }, + }), ).resolves.toHaveProperty('data.setIndexingRule', deploymentExpected) // Query the global rule @@ -473,12 +498,10 @@ describe('Indexing rules', () => { protocolNetwork: 'sepolia', } await expect( - client - .query(INDEXING_RULE_QUERY, { - identifier: globalRuleIdentifier, - merged: false, - }) - .toPromise(), + executor({ + document: INDEXING_RULE_QUERY, + variables: { identifier: globalRuleIdentifier, merged: false }, + }), ).resolves.toHaveProperty('data.indexingRule', globalExpected) // Query the rule for the deployment @@ -487,19 +510,21 @@ describe('Indexing rules', () => { protocolNetwork: 'sepolia', } await expect( - client - .query(INDEXING_RULE_QUERY, { + executor({ + document: INDEXING_RULE_QUERY, + variables: { identifier: deploymentRuleIdentifier, merged: false, - }) - .toPromise(), + }, + }), ).resolves.toHaveProperty('data.indexingRule', deploymentExpected) // Query all rules together await expect( - client - .query(INDEXING_RULES_QUERY, { merged: false, protocolNetwork: 'sepolia' }) - .toPromise(), + executor({ + document: INDEXING_RULES_QUERY, + variables: { merged: false, protocolNetwork: 'sepolia' }, + }), ).resolves.toHaveProperty('data.indexingRules', [globalExpected, deploymentExpected]) }) @@ -507,8 +532,8 @@ describe('Indexing rules', () => { const input = { identifier: 'QmZSJPm74tvhgr8uzhqvyQm2J6YSbUEj4nF6j8WxxUQLsC', identifierType: SubgraphIdentifierType.DEPLOYMENT, - allocationAmount: '1', - minSignal: '2', + allocationAmount: 1, + minSignal: 2, allocationLifetime: 20, autoRenewal: false, protocolNetwork: 'sepolia', @@ -532,31 +557,34 @@ describe('Indexing rules', () => { // Write the rule await expect( - client.mutation(SET_INDEXING_RULE_MUTATION, { rule: input }).toPromise(), + executor({ document: SET_INDEXING_RULE_MUTATION, variables: { rule: input } }), ).resolves.toHaveProperty('data.setIndexingRule', expected) // Query all rules await expect( - client - .query(INDEXING_RULES_QUERY, { merged: false, protocolNetwork: 'sepolia' }) - .toPromise(), + executor({ + document: INDEXING_RULES_QUERY, + variables: { merged: false, protocolNetwork: 'sepolia' }, + }), ).resolves.toHaveProperty('data.indexingRules', [expected]) // Delete the rule const ruleIdentifier = { identifier: expected.identifier, protocolNetwork: 'sepolia' } await expect( - client - .mutation(DELETE_INDEXING_RULE_MUTATION, { + executor({ + document: DELETE_INDEXING_RULE_MUTATION, + variables: { identifier: ruleIdentifier, - }) - .toPromise(), + }, + }), ).resolves.toHaveProperty('data.deleteIndexingRule', true) // Query all rules together await expect( - client - .query(INDEXING_RULES_QUERY, { merged: false, protocolNetwork: 'sepolia' }) - .toPromise(), + executor({ + document: INDEXING_RULES_QUERY, + variables: { merged: false, protocolNetwork: 'sepolia' }, + }), ).resolves.toHaveProperty('data.indexingRules', []) }) @@ -564,7 +592,7 @@ describe('Indexing rules', () => { const input = { identifier: 'QmZSJPm74tvhgr8uzhqvyQm2J6YSbUEj4nF6j8WxxUQLsC', identifierType: SubgraphIdentifierType.DEPLOYMENT, - allocationAmount: '1', + allocationAmount: 1, requireSupported: true, safety: true, protocolNetwork: 'sepolia', @@ -587,23 +615,25 @@ describe('Indexing rules', () => { // Write the rule await expect( - client.mutation(SET_INDEXING_RULE_MUTATION, { rule: input }).toPromise(), + executor({ document: SET_INDEXING_RULE_MUTATION, variables: { rule: input } }), ).resolves.toHaveProperty('data.setIndexingRule', expectedBefore) // Query all rules await expect( - client - .query(INDEXING_RULES_QUERY, { merged: false, protocolNetwork: 'sepolia' }) - .toPromise(), + executor({ + document: INDEXING_RULES_QUERY, + variables: { merged: false, protocolNetwork: 'sepolia' }, + }), ).resolves.toHaveProperty('data.indexingRules', [expectedBefore]) // Clear the allocationAmount field await expect( - client - .mutation(SET_INDEXING_RULE_MUTATION, { + executor({ + document: SET_INDEXING_RULE_MUTATION, + variables: { rule: { ...expectedBefore, allocationAmount: null }, - }) - .toPromise(), + }, + }), ).resolves.toHaveProperty('data.setIndexingRule', { ...expectedBefore, allocationAmount: null, @@ -611,9 +641,10 @@ describe('Indexing rules', () => { // Query the rules again to see that the update went through await expect( - client - .query(INDEXING_RULES_QUERY, { merged: false, protocolNetwork: 'sepolia' }) - .toPromise(), + executor({ + document: INDEXING_RULES_QUERY, + variables: { merged: false, protocolNetwork: 'sepolia' }, + }), ).resolves.toHaveProperty('data.indexingRules', [ { ...expectedBefore, allocationAmount: null }, ]) @@ -623,10 +654,10 @@ describe('Indexing rules', () => { const globalInput = { identifier: INDEXING_RULE_GLOBAL, identifierType: SubgraphIdentifierType.GROUP, - allocationAmount: '1', - minSignal: '1', + allocationAmount: 1, + minSignal: 1, decisionBasis: IndexingDecisionBasis.NEVER, - minAverageQueryFees: '1', + minAverageQueryFees: 1, allocationLifetime: 15, requireSupported: true, autoRenewal: true, @@ -637,8 +668,8 @@ describe('Indexing rules', () => { const deploymentInput = { identifier: 'QmZSJPm74tvhgr8uzhqvyQm2J6YSbUEj4nF6j8WxxUQLsC', identifierType: SubgraphIdentifierType.DEPLOYMENT, - allocationAmount: '1', - minSignal: '2', + allocationAmount: 1, + minSignal: 2, decisionBasis: IndexingDecisionBasis.OFFCHAIN, allocationLifetime: 10, autoRenewal: false, @@ -686,7 +717,7 @@ describe('Indexing rules', () => { maxAllocationPercentage: null, maxSignal: null, minStake: null, - minAverageQueryFees: '1', + minAverageQueryFees: 1, custom: null, decisionBasis: IndexingDecisionBasis.OFFCHAIN, requireSupported: false, @@ -696,10 +727,16 @@ describe('Indexing rules', () => { // Write the orginals await expect( - client.mutation(SET_INDEXING_RULE_MUTATION, { rule: globalInput }).toPromise(), + executor({ + document: SET_INDEXING_RULE_MUTATION, + variables: { rule: globalInput }, + }), ).resolves.toHaveProperty('data.setIndexingRule', globalExpected) await expect( - client.mutation(SET_INDEXING_RULE_MUTATION, { rule: deploymentInput }).toPromise(), + executor({ + document: SET_INDEXING_RULE_MUTATION, + variables: { rule: deploymentInput }, + }), ).resolves.toHaveProperty('data.setIndexingRule', deploymentExpected) // Query the global rule @@ -708,12 +745,13 @@ describe('Indexing rules', () => { protocolNetwork: 'sepolia', } await expect( - client - .query(INDEXING_RULE_QUERY, { + executor({ + document: INDEXING_RULE_QUERY, + variables: { identifier: globalRuleIdentifier, merged: false, - }) - .toPromise(), + }, + }), ).resolves.toHaveProperty('data.indexingRule', globalExpected) // Query the rule for the deployment merged with the global rule @@ -722,26 +760,29 @@ describe('Indexing rules', () => { protocolNetwork: 'sepolia', } await expect( - client - .query(INDEXING_RULE_QUERY, { + executor({ + document: INDEXING_RULE_QUERY, + variables: { identifier: ruleIdentifier, merged: true, - }) - .toPromise(), + }, + }), ).resolves.toHaveProperty('data.indexingRule', deploymentMergedExpected) // Query all rules together (without merging) await expect( - client - .query(INDEXING_RULES_QUERY, { merged: false, protocolNetwork: 'sepolia' }) - .toPromise(), + executor({ + document: INDEXING_RULES_QUERY, + variables: { merged: false, protocolNetwork: 'sepolia' }, + }), ).resolves.toHaveProperty('data.indexingRules', [globalExpected, deploymentExpected]) // Query all rules together (with merging) await expect( - client - .query(INDEXING_RULES_QUERY, { merged: true, protocolNetwork: 'sepolia' }) - .toPromise(), + executor({ + document: INDEXING_RULES_QUERY, + variables: { merged: true, protocolNetwork: 'sepolia' }, + }), ).resolves.toHaveProperty('data.indexingRules', [ globalExpected, deploymentMergedExpected, @@ -759,24 +800,29 @@ describe('Indexing rules', () => { protocolNetwork: 'sepolia', } - await client.mutation(SET_INDEXING_RULE_MUTATION, { rule: globalInput }).toPromise() + await executor({ + document: SET_INDEXING_RULE_MUTATION, + variables: { rule: globalInput }, + }) const globalRuleIdentifier = { identifier: INDEXING_RULE_GLOBAL, protocolNetwork: 'sepolia', } await expect( - client - .mutation(DELETE_INDEXING_RULE_MUTATION, { + executor({ + document: DELETE_INDEXING_RULE_MUTATION, + variables: { identifier: globalRuleIdentifier, - }) - .toPromise(), + }, + }), ).resolves.toHaveProperty('data.deleteIndexingRule', true) await expect( - client - .query(INDEXING_RULES_QUERY, { merged: false, protocolNetwork: 'sepolia' }) - .toPromise(), + executor({ + document: INDEXING_RULES_QUERY, + variables: { merged: false, protocolNetwork: 'sepolia' }, + }), ).resolves.toHaveProperty('data.indexingRules', [ { ...defaults.globalIndexingRule, @@ -820,10 +866,14 @@ describe('Indexing rules', () => { protocolNetwork: 'sepolia', } - await client.mutation(SET_INDEXING_RULE_MUTATION, { rule: globalInput }).toPromise() - await client - .mutation(SET_INDEXING_RULE_MUTATION, { rule: deploymentInput }) - .toPromise() + await executor({ + document: SET_INDEXING_RULE_MUTATION, + variables: { rule: globalInput }, + }) + await executor({ + document: SET_INDEXING_RULE_MUTATION, + variables: { rule: deploymentInput }, + }) const globalRuleIdentifier = { identifier: INDEXING_RULE_GLOBAL, @@ -835,17 +885,19 @@ describe('Indexing rules', () => { } await expect( - client - .mutation(DELETE_INDEXING_RULES_MUTATION, { + executor({ + document: DELETE_INDEXING_RULES_MUTATION, + variables: { identifiers: [globalRuleIdentifier, deploymentRuleIdentifier], - }) - .toPromise(), + }, + }), ).resolves.toHaveProperty('data.deleteIndexingRules', true) await expect( - client - .query(INDEXING_RULES_QUERY, { merged: false, protocolNetwork: 'sepolia' }) - .toPromise(), + executor({ + document: INDEXING_RULES_QUERY, + variables: { merged: false, protocolNetwork: 'sepolia' }, + }), ).resolves.toHaveProperty('data.indexingRules', [ { ...defaults.globalIndexingRule, @@ -878,18 +930,20 @@ describe('Indexing rules', () => { protocolNetwork: 'unsupported', } - const result = await client - .mutation(SET_INDEXING_RULE_MUTATION, { rule: deploymentInput }) - .toPromise() + const result = await executor({ + document: SET_INDEXING_RULE_MUTATION, + variables: { rule: deploymentInput }, + }) // Mutation must not succeed expect(result).toHaveProperty('data', null) // Must not create any Rule in the database - const rows = await client - .query(INDEXING_RULES_QUERY, { merged: false, protocolNetwork: 'sepolia' }) - .toPromise() + const rows = await executor({ + document: INDEXING_RULES_QUERY, + variables: { merged: false, protocolNetwork: 'sepolia' }, + }) expect(rows.data.indexingRules).toEqual([]) }) }) From 5e568f5d79ef883a18087fc6dfd23dbc4896837b Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Tue, 26 Mar 2024 17:07:20 -0400 Subject: [PATCH 21/48] fix poi disputes tests --- .../__tests__/resolvers/poi-disputes.test.ts | 94 ++++++++++++------- 1 file changed, 59 insertions(+), 35 deletions(-) diff --git a/packages/indexer-common/src/indexer-management/__tests__/resolvers/poi-disputes.test.ts b/packages/indexer-common/src/indexer-management/__tests__/resolvers/poi-disputes.test.ts index 1d83562d4..f30335700 100644 --- a/packages/indexer-common/src/indexer-management/__tests__/resolvers/poi-disputes.test.ts +++ b/packages/indexer-common/src/indexer-management/__tests__/resolvers/poi-disputes.test.ts @@ -6,7 +6,7 @@ import { createLogger, Logger, } from '@graphprotocol/common-ts' -import { IndexerManagementClient } from '../../client' +import { buildHTTPExecutor } from '@graphql-tools/executor-http' import { defineIndexerManagementModels, IndexerManagementModels, @@ -181,7 +181,7 @@ function toObjectArray(disputes: POIDisputeAttributes[]): Record[] let sequelize: Sequelize let models: IndexerManagementModels let logger: Logger -let client: IndexerManagementClient +let executor: ReturnType const metrics = createMetrics() const setupAll = async () => { @@ -195,7 +195,10 @@ const setupAll = async () => { async: false, level: __LOG_LEVEL__ ?? 'error', }) - client = await createTestManagementClient(__DATABASE__, logger, true, metrics) + const client = await createTestManagementClient(__DATABASE__, logger, true, metrics) + executor = buildHTTPExecutor({ + fetch: client.yoga.fetch, + }) logger.info('Finished setting up Test Indexer Management Client') } @@ -226,11 +229,12 @@ describe('POI disputes', () => { const expected = toObjectArray(disputes) await expect( - client - .mutation(STORE_POI_DISPUTES_MUTATION, { + executor({ + document: STORE_POI_DISPUTES_MUTATION, + variables: { disputes: disputes, - }) - .toPromise(), + }, + }), ).resolves.toHaveProperty('data.storeDisputes', expected) }) @@ -240,14 +244,17 @@ describe('POI disputes', () => { protocolNetwork: 'sepolia', } await expect( - client.query(GET_POI_DISPUTE_QUERY, { identifier }).toPromise(), + executor({ document: GET_POI_DISPUTE_QUERY, variables: { identifier } }), ).resolves.toHaveProperty('data.dispute', null) }) test('Get one dispute at a time', async () => { const disputes = TEST_DISPUTES_ARRAY - await client.mutation(STORE_POI_DISPUTES_MUTATION, { disputes: disputes }).toPromise() + await executor({ + document: STORE_POI_DISPUTES_MUTATION, + variables: { disputes: disputes }, + }) for (const dispute of disputes) { const identifier = { @@ -256,7 +263,7 @@ describe('POI disputes', () => { } const expected = { ...dispute, protocolNetwork: 'eip155:11155111' } await expect( - client.query(GET_POI_DISPUTE_QUERY, { identifier }).toPromise(), + executor({ document: GET_POI_DISPUTE_QUERY, variables: { identifier } }), ).resolves.toHaveProperty('data.dispute', expected) } }) @@ -264,7 +271,10 @@ describe('POI disputes', () => { test('Get all potential disputes', async () => { const disputes = TEST_DISPUTES_ARRAY - await client.mutation(STORE_POI_DISPUTES_MUTATION, { disputes: disputes }).toPromise() + await executor({ + document: STORE_POI_DISPUTES_MUTATION, + variables: { disputes: disputes }, + }) // Once persisted, the protocol network identifier assumes the CAIP2-ID format const expected = disputes.map((dispute) => ({ @@ -273,39 +283,47 @@ describe('POI disputes', () => { })) await expect( - client - .query(GET_POI_DISPUTES_QUERY, { + executor({ + document: GET_POI_DISPUTES_QUERY, + variables: { status: 'potential', minClosedEpoch: 0, protocolNetwork: 'sepolia', - }) - .toPromise(), + }, + }), ).resolves.toHaveProperty('data.disputes', expected) }) test('Get disputes with closed epoch greater than', async () => { const disputes = TEST_DISPUTES_ARRAY - await client.mutation(STORE_POI_DISPUTES_MUTATION, { disputes: disputes }).toPromise() + await executor({ + document: STORE_POI_DISPUTES_MUTATION, + variables: { disputes: disputes }, + }) // Once persisted, the protocol network identifier assumes the CAIP2-ID format const expected = [{ ...TEST_DISPUTE_2, protocolNetwork: 'eip155:11155111' }] await expect( - client - .query(GET_POI_DISPUTES_QUERY, { + executor({ + document: GET_POI_DISPUTES_QUERY, + variables: { status: 'potential', minClosedEpoch: 205, protocolNetwork: 'sepolia', - }) - .toPromise(), + }, + }), ).resolves.toHaveProperty('data.disputes', expected) }) test('Remove dispute from store', async () => { const disputes = TEST_DISPUTES_ARRAY - await client.mutation(STORE_POI_DISPUTES_MUTATION, { disputes: disputes }).toPromise() + await executor({ + document: STORE_POI_DISPUTES_MUTATION, + variables: { disputes: disputes }, + }) const identifiers = [ { @@ -314,11 +332,12 @@ describe('POI disputes', () => { }, ] await expect( - client - .mutation(DELETE_POI_DISPUTES_QUERY, { + executor({ + document: DELETE_POI_DISPUTES_QUERY, + variables: { identifiers, - }) - .toPromise(), + }, + }), ).resolves.toHaveProperty('data.deleteDisputes', 1) disputes.splice(0, 1) @@ -329,20 +348,24 @@ describe('POI disputes', () => { })) await expect( - client - .query(GET_POI_DISPUTES_QUERY, { + executor({ + document: GET_POI_DISPUTES_QUERY, + variables: { status: 'potential', minClosedEpoch: 0, protocolNetwork: 'sepolia', - }) - .toPromise(), + }, + }), ).resolves.toHaveProperty('data.disputes', expected) }) test('Remove multiple disputes from store', async () => { const disputes = [TEST_DISPUTE_1, TEST_DISPUTE_2, TEST_DISPUTE_3] - await client.mutation(STORE_POI_DISPUTES_MUTATION, { disputes: disputes }).toPromise() + await executor({ + document: STORE_POI_DISPUTES_MUTATION, + variables: { disputes: disputes }, + }) const identifiers = [ { @@ -356,7 +379,7 @@ describe('POI disputes', () => { ] await expect( - client.mutation(DELETE_POI_DISPUTES_QUERY, { identifiers }).toPromise(), + executor({ document: DELETE_POI_DISPUTES_QUERY, variables: { identifiers } }), ).resolves.toHaveProperty('data.deleteDisputes', 2) disputes.splice(0, 2) @@ -367,13 +390,14 @@ describe('POI disputes', () => { })) await expect( - client - .query(GET_POI_DISPUTES_QUERY, { + executor({ + document: GET_POI_DISPUTES_QUERY, + variables: { status: 'potential', minClosedEpoch: 0, protocolNetwork: 'sepolia', - }) - .toPromise(), + }, + }), ).resolves.toHaveProperty('data.disputes', expected) }) }) From 06afc5e0c14f8f97ab6ba8a7dc462d8d8dcad981 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Tue, 26 Mar 2024 17:09:43 -0400 Subject: [PATCH 22/48] remove grit --- .grit/.gitignore | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 .grit/.gitignore diff --git a/.grit/.gitignore b/.grit/.gitignore deleted file mode 100644 index e4fdfb17c..000000000 --- a/.grit/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.gritmodules* -*.log From 35aacefcd474e76a477fae9e0cf4d573cc670d8a Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Wed, 27 Mar 2024 11:42:02 -0400 Subject: [PATCH 23/48] fix some ts issues --- .../__tests__/helpers.test.ts | 44 ++++++++++++------- .../resolvers/indexing-rules.test.ts | 6 +++ .../resolvers/Mutation/createAllocation.ts | 4 +- .../resolvers/Mutation/deleteCostModels.ts | 4 +- .../resolvers/Mutation/deleteIndexingRule.ts | 4 +- .../resolvers/Mutation/deleteIndexingRules.ts | 4 +- .../Mutation/executeApprovedActions.ts | 4 +- .../Mutation/reallocateAllocation.ts | 4 +- .../resolvers/Query/indexerAllocations.ts | 4 +- .../resolvers/Query/indexerDeployments.ts | 4 +- .../resolvers/Query/indexerRegistration.ts | 4 +- 11 files changed, 43 insertions(+), 43 deletions(-) diff --git a/packages/indexer-common/src/indexer-management/__tests__/helpers.test.ts b/packages/indexer-common/src/indexer-management/__tests__/helpers.test.ts index 641e3b6dc..3300b06f9 100644 --- a/packages/indexer-common/src/indexer-management/__tests__/helpers.test.ts +++ b/packages/indexer-common/src/indexer-management/__tests__/helpers.test.ts @@ -251,28 +251,40 @@ describe('Actions', () => { [Op.and]: [{ status: 'failed' }, { type: 'allocate' }], }) - await expect(ActionManager.fetchActions(models, filterOptions)).resolves.toHaveLength( - 1, - ) + await expect( + ActionManager.fetchActions(models, filterOptions, undefined, undefined, undefined), + ).resolves.toHaveLength(1) - await expect(ActionManager.fetchActions(models, filterOptions)).resolves.toHaveLength( - 1, - ) + await expect( + ActionManager.fetchActions(models, filterOptions, undefined, undefined, undefined), + ).resolves.toHaveLength(1) await expect( - ActionManager.fetchActions(models, { - status: ActionStatus.FAILED, - type: ActionType.ALLOCATE, - updatedAt: { [Op.gte]: literal("NOW() - INTERVAL '1d'") }, - }), + ActionManager.fetchActions( + models, + { + status: ActionStatus.FAILED, + type: ActionType.ALLOCATE, + updatedAt: { [Op.gte]: literal("NOW() - INTERVAL '1d'") }, + }, + undefined, + undefined, + undefined, + ), ).resolves.toHaveLength(1) await expect( - ActionManager.fetchActions(models, { - status: ActionStatus.FAILED, - type: ActionType.ALLOCATE, - updatedAt: { [Op.lte]: literal("NOW() - INTERVAL '1d'") }, - }), + ActionManager.fetchActions( + models, + { + status: ActionStatus.FAILED, + type: ActionType.ALLOCATE, + updatedAt: { [Op.lte]: literal("NOW() - INTERVAL '1d'") }, + }, + undefined, + undefined, + undefined, + ), ).resolves.toHaveLength(0) }) }) diff --git a/packages/indexer-common/src/indexer-management/__tests__/resolvers/indexing-rules.test.ts b/packages/indexer-common/src/indexer-management/__tests__/resolvers/indexing-rules.test.ts index d0597b613..26df8f22b 100644 --- a/packages/indexer-common/src/indexer-management/__tests__/resolvers/indexing-rules.test.ts +++ b/packages/indexer-common/src/indexer-management/__tests__/resolvers/indexing-rules.test.ts @@ -19,6 +19,7 @@ import { } from '@graphprotocol/indexer-common' import { createTestManagementClient, defaults } from '../util' +import { isAsyncIterable } from 'graphql-yoga' // Make global Jest variable available // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -944,6 +945,11 @@ describe('Indexing rules', () => { document: INDEXING_RULES_QUERY, variables: { merged: false, protocolNetwork: 'sepolia' }, }) + + if (isAsyncIterable(rows)) { + throw new Error('Expected rows to be an array, but it is an async iterable') + } + expect(rows.data.indexingRules).toEqual([]) }) }) diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/createAllocation.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/createAllocation.ts index 28dfe3513..778cbffc3 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/createAllocation.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/createAllocation.ts @@ -8,9 +8,7 @@ import { utils } from 'ethers' import { SubgraphIdentifierType } from '../../../../subgraphs' import { IndexingDecisionBasis } from '../../../../indexer-management/models/indexing-rule' -export const createAllocation: NonNullable< - MutationResolvers['createAllocation'] -> = async ( +export const createAllocation: NonNullable = async ( _parent, { deployment, amount, protocolNetwork }, { logger, multiNetworks, graphNode, models }, diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteCostModels.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteCostModels.ts index f948637e9..5bc1d0953 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteCostModels.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteCostModels.ts @@ -1,8 +1,6 @@ import type { MutationResolvers } from './../../../types.generated' -export const deleteCostModels: NonNullable< - MutationResolvers['deleteCostModels'] -> = async (_parent, { deployments }, { models }) => { +export const deleteCostModels: NonNullable = async (_parent, { deployments }, { models }) => { return await models.CostModel.sequelize!.transaction(async (transaction) => { return await models.CostModel.destroy({ where: { diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRule.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRule.ts index 4df93307e..5480e8215 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRule.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRule.ts @@ -3,9 +3,7 @@ import type { MutationResolvers } from './../../../types.generated' import { validateNetworkIdentifier } from '../../../../parsers/validators' import { resetGlobalRule } from '../../../../indexer-management/resolvers/indexing-rules' -export const deleteIndexingRule: NonNullable< - MutationResolvers['deleteIndexingRule'] -> = async (_parent, { identifier: indexingRuleIdentifier }, { models, defaults }) => { +export const deleteIndexingRule: NonNullable = async (_parent, { identifier: indexingRuleIdentifier }, { models, defaults }) => { const [identifier] = await processIdentifier(indexingRuleIdentifier.identifier, { all: false, global: true, diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRules.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRules.ts index d12a9a04b..f1538a8e9 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRules.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRules.ts @@ -4,9 +4,7 @@ import groupBy from 'lodash.groupby' import { processIdentifier } from '../../../../subgraphs' import { resetGlobalRule } from '../../../../indexer-management/resolvers/indexing-rules' -export const deleteIndexingRules: NonNullable< - MutationResolvers['deleteIndexingRules'] -> = async (_parent, { identifiers: indexingRuleIdentifiers }, { models, defaults }) => { +export const deleteIndexingRules: NonNullable = async (_parent, { identifiers: indexingRuleIdentifiers }, { models, defaults }) => { let totalNumDeleted = 0 // Sanitize protocol network identifiers diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/executeApprovedActions.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/executeApprovedActions.ts index f23c26504..8ab6b2f46 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/executeApprovedActions.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/executeApprovedActions.ts @@ -1,8 +1,6 @@ import type { MutationResolvers } from './../../../types.generated' -export const executeApprovedActions: NonNullable< - MutationResolvers['executeApprovedActions'] -> = async (_parent, _arg, { logger: parentLogger, actionManager }) => { +export const executeApprovedActions: NonNullable = async (_parent, _arg, { logger: parentLogger, actionManager }) => { const logger = parentLogger.child({ function: 'executeApprovedActions' }) logger.trace(`Begin executing 'executeApprovedActions' mutation`) if (!actionManager) { diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/reallocateAllocation.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/reallocateAllocation.ts index 95d1a840f..468f8b613 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/reallocateAllocation.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/reallocateAllocation.ts @@ -80,9 +80,7 @@ async function resolvePOI( } } -export const reallocateAllocation: NonNullable< - MutationResolvers['reallocateAllocation'] -> = async ( +export const reallocateAllocation: NonNullable = async ( _parent, { allocation, poi, amount, force, protocolNetwork }, { logger, graphNode, models, multiNetworks }, diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerAllocations.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerAllocations.ts index d2d9a6dd9..f73150f64 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerAllocations.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerAllocations.ts @@ -4,9 +4,7 @@ import gql from 'graphql-tag' import { SubgraphDeploymentID } from '@graphprotocol/common-ts' import { IndexerErrorCode, indexerError } from '../../../../errors' -export const indexerAllocations: NonNullable< - QueryResolvers['indexerAllocations'] -> = async (_parent, { protocolNetwork }, { multiNetworks, logger }) => { +export const indexerAllocations: NonNullable = async (_parent, { protocolNetwork }, { multiNetworks, logger }) => { if (!multiNetworks) { throw Error( 'IndexerManagementClient must be in `network` mode to fetch indexer allocations', diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerDeployments.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerDeployments.ts index 9fe7d652c..7f3d56b5b 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerDeployments.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerDeployments.ts @@ -1,8 +1,6 @@ import type { QueryResolvers } from './../../../types.generated' -export const indexerDeployments: NonNullable< - QueryResolvers['indexerDeployments'] -> = async (_parent, _arg, { graphNode }) => { +export const indexerDeployments: NonNullable = async (_parent, _arg, { graphNode }) => { const result = await graphNode.indexingStatus([]) return result.map((status) => ({ ...status, diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerRegistration.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerRegistration.ts index 1db3c0d7e..a9679fb01 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerRegistration.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerRegistration.ts @@ -2,9 +2,7 @@ import { extractNetwork } from '../../../../indexer-management/resolvers/utils' import geohash from 'ngeohash' import type { QueryResolvers } from './../../../types.generated' -export const indexerRegistration: NonNullable< - QueryResolvers['indexerRegistration'] -> = async ( +export const indexerRegistration: NonNullable = async ( _parent, { protocolNetwork: unvalidatedProtocolNetwork }, { multiNetworks }, From abf875798d83f7a88d5d9f1c0b9236344cbcb886 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Wed, 27 Mar 2024 11:42:35 -0400 Subject: [PATCH 24/48] style prettier --- .../indexer-management/resolvers/Mutation/createAllocation.ts | 4 +++- .../indexer-management/resolvers/Mutation/deleteCostModels.ts | 4 +++- .../resolvers/Mutation/deleteIndexingRule.ts | 4 +++- .../resolvers/Mutation/deleteIndexingRules.ts | 4 +++- .../resolvers/Mutation/executeApprovedActions.ts | 4 +++- .../resolvers/Mutation/reallocateAllocation.ts | 4 +++- .../indexer-management/resolvers/Query/indexerAllocations.ts | 4 +++- .../indexer-management/resolvers/Query/indexerDeployments.ts | 4 +++- .../indexer-management/resolvers/Query/indexerRegistration.ts | 4 +++- 9 files changed, 27 insertions(+), 9 deletions(-) diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/createAllocation.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/createAllocation.ts index 778cbffc3..28dfe3513 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/createAllocation.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/createAllocation.ts @@ -8,7 +8,9 @@ import { utils } from 'ethers' import { SubgraphIdentifierType } from '../../../../subgraphs' import { IndexingDecisionBasis } from '../../../../indexer-management/models/indexing-rule' -export const createAllocation: NonNullable = async ( +export const createAllocation: NonNullable< + MutationResolvers['createAllocation'] +> = async ( _parent, { deployment, amount, protocolNetwork }, { logger, multiNetworks, graphNode, models }, diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteCostModels.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteCostModels.ts index 5bc1d0953..f948637e9 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteCostModels.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteCostModels.ts @@ -1,6 +1,8 @@ import type { MutationResolvers } from './../../../types.generated' -export const deleteCostModels: NonNullable = async (_parent, { deployments }, { models }) => { +export const deleteCostModels: NonNullable< + MutationResolvers['deleteCostModels'] +> = async (_parent, { deployments }, { models }) => { return await models.CostModel.sequelize!.transaction(async (transaction) => { return await models.CostModel.destroy({ where: { diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRule.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRule.ts index 5480e8215..4df93307e 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRule.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRule.ts @@ -3,7 +3,9 @@ import type { MutationResolvers } from './../../../types.generated' import { validateNetworkIdentifier } from '../../../../parsers/validators' import { resetGlobalRule } from '../../../../indexer-management/resolvers/indexing-rules' -export const deleteIndexingRule: NonNullable = async (_parent, { identifier: indexingRuleIdentifier }, { models, defaults }) => { +export const deleteIndexingRule: NonNullable< + MutationResolvers['deleteIndexingRule'] +> = async (_parent, { identifier: indexingRuleIdentifier }, { models, defaults }) => { const [identifier] = await processIdentifier(indexingRuleIdentifier.identifier, { all: false, global: true, diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRules.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRules.ts index f1538a8e9..d12a9a04b 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRules.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRules.ts @@ -4,7 +4,9 @@ import groupBy from 'lodash.groupby' import { processIdentifier } from '../../../../subgraphs' import { resetGlobalRule } from '../../../../indexer-management/resolvers/indexing-rules' -export const deleteIndexingRules: NonNullable = async (_parent, { identifiers: indexingRuleIdentifiers }, { models, defaults }) => { +export const deleteIndexingRules: NonNullable< + MutationResolvers['deleteIndexingRules'] +> = async (_parent, { identifiers: indexingRuleIdentifiers }, { models, defaults }) => { let totalNumDeleted = 0 // Sanitize protocol network identifiers diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/executeApprovedActions.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/executeApprovedActions.ts index 8ab6b2f46..f23c26504 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/executeApprovedActions.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/executeApprovedActions.ts @@ -1,6 +1,8 @@ import type { MutationResolvers } from './../../../types.generated' -export const executeApprovedActions: NonNullable = async (_parent, _arg, { logger: parentLogger, actionManager }) => { +export const executeApprovedActions: NonNullable< + MutationResolvers['executeApprovedActions'] +> = async (_parent, _arg, { logger: parentLogger, actionManager }) => { const logger = parentLogger.child({ function: 'executeApprovedActions' }) logger.trace(`Begin executing 'executeApprovedActions' mutation`) if (!actionManager) { diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/reallocateAllocation.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/reallocateAllocation.ts index 468f8b613..95d1a840f 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/reallocateAllocation.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/reallocateAllocation.ts @@ -80,7 +80,9 @@ async function resolvePOI( } } -export const reallocateAllocation: NonNullable = async ( +export const reallocateAllocation: NonNullable< + MutationResolvers['reallocateAllocation'] +> = async ( _parent, { allocation, poi, amount, force, protocolNetwork }, { logger, graphNode, models, multiNetworks }, diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerAllocations.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerAllocations.ts index f73150f64..d2d9a6dd9 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerAllocations.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerAllocations.ts @@ -4,7 +4,9 @@ import gql from 'graphql-tag' import { SubgraphDeploymentID } from '@graphprotocol/common-ts' import { IndexerErrorCode, indexerError } from '../../../../errors' -export const indexerAllocations: NonNullable = async (_parent, { protocolNetwork }, { multiNetworks, logger }) => { +export const indexerAllocations: NonNullable< + QueryResolvers['indexerAllocations'] +> = async (_parent, { protocolNetwork }, { multiNetworks, logger }) => { if (!multiNetworks) { throw Error( 'IndexerManagementClient must be in `network` mode to fetch indexer allocations', diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerDeployments.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerDeployments.ts index 7f3d56b5b..9fe7d652c 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerDeployments.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerDeployments.ts @@ -1,6 +1,8 @@ import type { QueryResolvers } from './../../../types.generated' -export const indexerDeployments: NonNullable = async (_parent, _arg, { graphNode }) => { +export const indexerDeployments: NonNullable< + QueryResolvers['indexerDeployments'] +> = async (_parent, _arg, { graphNode }) => { const result = await graphNode.indexingStatus([]) return result.map((status) => ({ ...status, diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerRegistration.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerRegistration.ts index a9679fb01..1db3c0d7e 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerRegistration.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerRegistration.ts @@ -2,7 +2,9 @@ import { extractNetwork } from '../../../../indexer-management/resolvers/utils' import geohash from 'ngeohash' import type { QueryResolvers } from './../../../types.generated' -export const indexerRegistration: NonNullable = async ( +export const indexerRegistration: NonNullable< + QueryResolvers['indexerRegistration'] +> = async ( _parent, { protocolNetwork: unvalidatedProtocolNetwork }, { multiNetworks }, From d677bcea6c270e92fdf366a7a047360ea53249ab Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Wed, 27 Mar 2024 16:02:04 -0400 Subject: [PATCH 25/48] make tsc happy --- packages/indexer-common/codegen.ts | 3 +- packages/indexer-common/src/actions.ts | 67 ++++---------- .../__tests__/allocations.test.ts | 8 +- .../__tests__/helpers.test.ts | 43 +++++---- .../__tests__/resolvers/actions.test.ts | 83 +++++++++--------- .../resolvers/indexing-rules.test.ts | 87 +++++++++---------- .../src/indexer-management/__tests__/util.ts | 16 ++-- .../src/indexer-management/actions.ts | 13 +-- .../src/indexer-management/allocations.ts | 30 +++---- .../src/indexer-management/models/action.ts | 40 +++++---- .../indexer-management/models/cost-model.ts | 1 - .../models/indexing-rule.ts | 32 ++++--- .../indexer-management/models/poi-dispute.ts | 7 +- .../indexer-management/resolvers/actions.ts | 53 +++++++---- .../resolvers/allocations.ts | 20 +++-- .../src/indexer-management/rules.ts | 2 +- .../src/indexer-management/schema.graphql | 2 +- packages/indexer-common/src/operator.ts | 24 ++--- packages/indexer-common/src/rules.ts | 3 +- .../resolvers/Mutation/approveActions.ts | 5 +- .../resolvers/Mutation/cancelActions.ts | 3 +- .../resolvers/Mutation/closeAllocation.ts | 12 +-- .../resolvers/Mutation/createAllocation.ts | 12 +-- .../resolvers/Mutation/queueActions.ts | 58 ++++++++----- .../Mutation/reallocateAllocation.ts | 12 +-- .../resolvers/Mutation/setIndexingRule.ts | 13 ++- .../resolvers/Mutation/storeDisputes.ts | 26 +++--- .../resolvers/Mutation/updateActions.ts | 2 +- .../resolvers/Query/action.ts | 6 +- .../resolvers/Query/actions.ts | 4 +- .../resolvers/Query/indexingRules.ts | 3 +- packages/indexer-common/src/subgraphs.ts | 45 ++++------ 32 files changed, 384 insertions(+), 351 deletions(-) diff --git a/packages/indexer-common/codegen.ts b/packages/indexer-common/codegen.ts index f0ef2c5f8..000ffcd8d 100644 --- a/packages/indexer-common/codegen.ts +++ b/packages/indexer-common/codegen.ts @@ -7,7 +7,8 @@ const config: CodegenConfig = { 'src/schema': defineConfig({ typesPluginsConfig: { contextType: '@graphprotocol/indexer-common#IndexerManagementResolverContext', - enumsAsTypes: true, + enumsAsConst: true, + enumsAsTypes: false, }, }), }, diff --git a/packages/indexer-common/src/actions.ts b/packages/indexer-common/src/actions.ts index 01e72e3ad..92694bdc9 100644 --- a/packages/indexer-common/src/actions.ts +++ b/packages/indexer-common/src/actions.ts @@ -5,40 +5,25 @@ import { WhereOptions } from 'sequelize' import { Op } from 'sequelize' import { WhereAttributeHashValue } from 'sequelize/types/model' import { validateNetworkIdentifier } from './parsers' -import { ActionFilter, ActionUpdateInput, ActionParams } from './schema/types.generated' +import { + ActionFilter, + ActionUpdateInput, + ActionParams, + ActionInput, + ActionType, + ActionStatus, +} from './schema/types.generated' export { ActionUpdateInput, ActionParams } -export interface ActionParamsInput { - deploymentID?: string - allocationID?: string - amount?: string - poi?: string - force?: boolean -} - export interface ActionItem { - params: ActionParamsInput + params: ActionUpdateInput type: ActionType reason: string status?: ActionStatus protocolNetwork: string } -export interface ActionInput { - type: ActionType - deploymentID: string - allocationID?: string - amount?: string - poi?: string - force?: boolean - source: string - reason: string - status: ActionStatus - priority: number | undefined - protocolNetwork: string -} - export const isValidActionInput = ( /* eslint-disable @typescript-eslint/no-explicit-any */ variableToCheck: any, @@ -48,14 +33,14 @@ export const isValidActionInput = ( } let hasActionParams = false switch (variableToCheck.type) { - case ActionType.ALLOCATE: + case ActionType.allocate: hasActionParams = 'deploymentID' in variableToCheck && 'amount' in variableToCheck break - case ActionType.UNALLOCATE: + case ActionType.unallocate: hasActionParams = 'deploymentID' in variableToCheck && 'allocationID' in variableToCheck break - case ActionType.REALLOCATE: + case ActionType.reallocate: hasActionParams = 'deploymentID' in variableToCheck && 'allocationID' in variableToCheck && @@ -101,12 +86,10 @@ export const validateActionInputs = async ( // Must have status QUEUED or APPROVED if ( - [ - ActionStatus.FAILED, - ActionStatus.SUCCESS, - ActionStatus.PENDING, - ActionStatus.CANCELED, - ].includes(action.status) + action.status === 'failed' || + action.status === 'success' || + action.status === 'pending' || + action.status === 'canceled' ) { throw Error( `Cannot queue action with status ${action.status}, must be one of ['APPROVED', 'QUEUED']`, @@ -115,6 +98,7 @@ export const validateActionInputs = async ( // Action must target an existing subgraph deployment const subgraphDeployment = await networkMonitor.subgraphDeployment( + // @ts-expect-error - deploymentID should be here action.deploymentID, ) if (!subgraphDeployment) { @@ -124,7 +108,7 @@ export const validateActionInputs = async ( } // Unallocate & reallocate actions must target an active allocationID - if ([ActionType.UNALLOCATE, ActionType.REALLOCATE].includes(action.type)) { + if (action.type === 'unallocate' || action.type === 'reallocate') { // allocationID must belong to active allocation // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const allocation = await networkMonitor.allocation(action.allocationID!) @@ -174,18 +158,3 @@ export interface ActionResult { transaction: string | null protocolNetwork: string } - -export enum ActionType { - ALLOCATE = 'allocate', - UNALLOCATE = 'unallocate', - REALLOCATE = 'reallocate', -} - -export enum ActionStatus { - QUEUED = 'queued', - APPROVED = 'approved', - PENDING = 'pending', - SUCCESS = 'success', - FAILED = 'failed', - CANCELED = 'canceled', -} diff --git a/packages/indexer-common/src/indexer-management/__tests__/allocations.test.ts b/packages/indexer-common/src/indexer-management/__tests__/allocations.test.ts index d9f62b4ac..eee83793e 100644 --- a/packages/indexer-common/src/indexer-management/__tests__/allocations.test.ts +++ b/packages/indexer-common/src/indexer-management/__tests__/allocations.test.ts @@ -1,6 +1,5 @@ import { Action, - ActionType, AllocationManager, defineIndexerManagementModels, defineQueryFeeModels, @@ -24,6 +23,7 @@ import { testNetworkSpecification, } from './util' import { Sequelize } from 'sequelize' +import { ActionType } from '../../schema/types.generated' // Make global Jest variables available // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -137,14 +137,14 @@ describe('Allocation Manager', () => { const reallocate = balances[2] // Allocate test action - expect(allocate.action.type).toBe(ActionType.ALLOCATE) + expect(allocate.action.type).toBe(ActionType.allocate) expect(allocate.allocates).toStrictEqual(parseGRT('10000')) expect(allocate.rewards.isZero()).toBeTruthy() expect(allocate.unallocates.isZero()).toBeTruthy() expect(allocate.balance).toStrictEqual(parseGRT('10000')) // Unallocate test action - expect(unallocate.action.type).toBe(ActionType.UNALLOCATE) + expect(unallocate.action.type).toBe(ActionType.unallocate) expect(unallocate.allocates.isZero()).toBeTruthy() expect(unallocate.rewards.isZero()).toBeFalsy() expect(unallocate.unallocates).toStrictEqual(parseGRT('250')) @@ -153,7 +153,7 @@ describe('Allocation Manager', () => { ) // This Reallocate test Action intentionally uses a null or zeroed POI, so it should not accrue rewards. - expect(reallocate.action.type).toBe(ActionType.REALLOCATE) + expect(reallocate.action.type).toBe(ActionType.reallocate) expect(reallocate.allocates).toStrictEqual(parseGRT('10000')) expect(reallocate.rewards.isZero()).toBeTruthy() expect(reallocate.unallocates).toStrictEqual(parseGRT('250')) diff --git a/packages/indexer-common/src/indexer-management/__tests__/helpers.test.ts b/packages/indexer-common/src/indexer-management/__tests__/helpers.test.ts index 3300b06f9..9f96e6ae5 100644 --- a/packages/indexer-common/src/indexer-management/__tests__/helpers.test.ts +++ b/packages/indexer-common/src/indexer-management/__tests__/helpers.test.ts @@ -10,15 +10,14 @@ import { import { defineIndexerManagementModels, IndexerManagementModels, - IndexingDecisionBasis, IndexingRuleAttributes, } from '../models' import { defineQueryFeeModels, specification as spec } from '../../index' import { networkIsL1, networkIsL2 } from '../types' import { fetchIndexingRules, upsertIndexingRule } from '../rules' -import { SubgraphFreshnessChecker, SubgraphIdentifierType } from '../../subgraphs' +import { SubgraphFreshnessChecker } from '../../subgraphs' import { ActionManager } from '../actions' -import { actionFilterToWhereOptions, ActionStatus, ActionType } from '../../actions' +import { actionFilterToWhereOptions } from '../../actions' import { literal, Op, Sequelize } from 'sequelize' import { Allocation, @@ -35,6 +34,12 @@ import { getTestProvider, } from '@graphprotocol/indexer-common' import { mockLogger, mockProvider } from '../../__tests__/subgraph.test' +import { + ActionStatus, + ActionType, + IdentifierType, + IndexingDecisionBasis, +} from '../../schema/types.generated' import { BigNumber, ethers, utils } from 'ethers' // Make global Jest variable available @@ -164,8 +169,8 @@ describe('Indexing Rules', () => { const indexingRule = { identifier: deployment, allocationAmount: '5000', - identifierType: SubgraphIdentifierType.DEPLOYMENT, - decisionBasis: IndexingDecisionBasis.ALWAYS, + identifierType: IdentifierType.deployment, + decisionBasis: IndexingDecisionBasis.always, protocolNetwork: 'sepolia', } as Partial const setIndexingRuleResult = await upsertIndexingRule(logger, models, indexingRule) @@ -176,11 +181,11 @@ describe('Indexing Rules', () => { expect(setIndexingRuleResult).toHaveProperty('identifier', deployment) expect(setIndexingRuleResult).toHaveProperty( 'identifierType', - SubgraphIdentifierType.DEPLOYMENT.toString(), + IdentifierType.deployment.toString(), ) expect(setIndexingRuleResult).toHaveProperty( 'decisionBasis', - IndexingDecisionBasis.ALWAYS, + IndexingDecisionBasis.always, ) // When reading directly to the database, `protocolNetwork` must be in the CAIP2-ID format. @@ -195,8 +200,8 @@ describe('Actions', () => { test('Generate where options', async () => { const ActionFilter = { - status: ActionStatus.FAILED, - type: ActionType.ALLOCATE, + status: ActionStatus.failed, + type: ActionType.allocate, } expect(actionFilterToWhereOptions(ActionFilter)).toEqual({ [Op.and]: [{ status: 'failed' }, { type: 'allocate' }], @@ -204,8 +209,8 @@ describe('Actions', () => { const yesterday = literal("NOW() - INTERVAL '1d'") const ActionFilter2 = { - status: ActionStatus.FAILED, - type: ActionType.ALLOCATE, + status: ActionStatus.failed, + type: ActionType.allocate, updatedAt: { [Op.gte]: yesterday }, } @@ -227,8 +232,8 @@ describe('Actions', () => { test('Insert and fetch actions', async () => { const action = { - status: ActionStatus.FAILED, - type: ActionType.ALLOCATE, + status: ActionStatus.failed, + type: ActionType.allocate, deploymentID: 'QmQ44hgrWWt3Qf2X9XEX2fPyTbmQbChxwNm5c1t4mhKpGt', amount: '10000', force: false, @@ -242,8 +247,8 @@ describe('Actions', () => { await models.Action.upsert(action) const filterOptions = { - status: ActionStatus.FAILED, - type: ActionType.ALLOCATE, + status: ActionStatus.failed, + type: ActionType.allocate, } const whereOptions = actionFilterToWhereOptions(filterOptions) @@ -263,8 +268,8 @@ describe('Actions', () => { ActionManager.fetchActions( models, { - status: ActionStatus.FAILED, - type: ActionType.ALLOCATE, + status: ActionStatus.failed, + type: ActionType.allocate, updatedAt: { [Op.gte]: literal("NOW() - INTERVAL '1d'") }, }, undefined, @@ -277,8 +282,8 @@ describe('Actions', () => { ActionManager.fetchActions( models, { - status: ActionStatus.FAILED, - type: ActionType.ALLOCATE, + status: ActionStatus.failed, + type: ActionType.allocate, updatedAt: { [Op.lte]: literal("NOW() - INTERVAL '1d'") }, }, undefined, diff --git a/packages/indexer-common/src/indexer-management/__tests__/resolvers/actions.test.ts b/packages/indexer-common/src/indexer-management/__tests__/resolvers/actions.test.ts index 1ee856cc1..6175c0bd6 100644 --- a/packages/indexer-common/src/indexer-management/__tests__/resolvers/actions.test.ts +++ b/packages/indexer-common/src/indexer-management/__tests__/resolvers/actions.test.ts @@ -15,13 +15,7 @@ import { defineIndexerManagementModels, IndexerManagementModels, } from '../../models' -import { - ActionInput, - ActionStatus, - ActionType, - defineQueryFeeModels, - QueryFeeModels, -} from '@graphprotocol/indexer-common' +import { defineQueryFeeModels, QueryFeeModels } from '@graphprotocol/indexer-common' import { createTestManagementClient, invalidReallocateAction, @@ -34,6 +28,7 @@ import { import { buildHTTPExecutor } from '@graphql-tools/executor-http' import { GraphQLError } from 'graphql' import { isAsyncIterable } from 'graphql-yoga' +import { ActionStatus, ActionType, ActionInput } from '../../../schema/types.generated' const QUEUE_ACTIONS_MUTATION = gql` mutation queueActions($actions: [ActionInput!]!) { @@ -248,7 +243,7 @@ describe('Actions', () => { await expect( executor({ document: ACTIONS_QUERY, - variables: { filter: { status: ActionStatus.QUEUED, source: 'indexerAgent' } }, + variables: { filter: { status: ActionStatus.queued, source: 'indexerAgent' } }, }), ).resolves.toHaveProperty('data.actions', [expected]) }) @@ -287,8 +282,8 @@ describe('Actions', () => { document: ACTIONS_QUERY, variables: { filter: { - status: ActionStatus.QUEUED, - type: ActionType.ALLOCATE, + status: ActionStatus.queued, + type: ActionType.allocate, }, orderBy: 'source', orderDirection: 'desc', @@ -331,8 +326,8 @@ describe('Actions', () => { document: ACTIONS_QUERY, variables: { filter: { - status: ActionStatus.QUEUED, - type: ActionType.ALLOCATE, + status: ActionStatus.queued, + type: ActionType.allocate, source: 'indexerAgent', }, orderBy: 'adonut', @@ -381,7 +376,7 @@ describe('Actions', () => { const toCancel = expecteds.map((action) => action.id.toString()) const expectedCancels = expecteds.map((action) => { - action.status = ActionStatus.CANCELED + action.status = ActionStatus.canceled return action }) @@ -394,7 +389,7 @@ describe('Actions', () => { document: ACTIONS_QUERY, variables: { filter: { - status: ActionStatus.CANCELED, + status: ActionStatus.canceled, source: 'indexerAgent', }, orderBy: 'id', @@ -431,7 +426,7 @@ describe('Actions', () => { const actions = await executor({ document: ACTIONS_QUERY, variables: { - filter: { type: ActionType.ALLOCATE }, + filter: { type: ActionType.allocate }, }, }) @@ -449,7 +444,7 @@ describe('Actions', () => { (action) => action.deploymentID === subgraphDeployment2, ) /* eslint-disable @typescript-eslint/no-non-null-assertion */ - expectedApprovedAction!['status'] = ActionStatus.APPROVED + expectedApprovedAction!['status'] = ActionStatus.approved await expect( executor({ @@ -463,7 +458,7 @@ describe('Actions', () => { document: ACTIONS_QUERY, variables: { filter: { - status: ActionStatus.APPROVED, + status: ActionStatus.approved, source: 'indexerAgent', }, }, @@ -497,7 +492,7 @@ describe('Actions', () => { const actions = await executor({ document: ACTIONS_QUERY, - variables: { filter: { type: ActionType.ALLOCATE } }, + variables: { filter: { type: ActionType.allocate } }, }) if (isAsyncIterable(actions)) { throw new Error('Expected actions to be an array') @@ -564,7 +559,7 @@ describe('Actions', () => { executor({ document: ACTIONS_QUERY, variables: { - filter: { status: ActionStatus.QUEUED, source: 'indexerAgent' }, + filter: { status: ActionStatus.queued, source: 'indexerAgent' }, }, }), ).resolves.toHaveProperty('data.actions', []) @@ -585,7 +580,7 @@ describe('Actions', () => { executor({ document: ACTIONS_QUERY, variables: { - filter: { status: ActionStatus.QUEUED, source: 'indexerAgent' }, + filter: { status: ActionStatus.queued, source: 'indexerAgent' }, }, }), ).resolves.toHaveProperty( @@ -617,7 +612,7 @@ describe('Actions', () => { const actions = await executor({ document: ACTIONS_QUERY, - variables: { filter: { type: ActionType.ALLOCATE } }, + variables: { filter: { type: ActionType.allocate } }, }) if (isAsyncIterable(actions)) { @@ -632,7 +627,7 @@ describe('Actions', () => { const expectedApprovedAction = { ...expected } /* eslint-disable @typescript-eslint/no-non-null-assertion */ - expectedApprovedAction!['status'] = ActionStatus.APPROVED + expectedApprovedAction!['status'] = ActionStatus.approved await expect( executor({ @@ -646,7 +641,7 @@ describe('Actions', () => { document: ACTIONS_QUERY, variables: { filter: { - status: ActionStatus.APPROVED, + status: ActionStatus.approved, source: 'indexerAgent', }, }, @@ -655,7 +650,7 @@ describe('Actions', () => { const updateAction = { ...inputAction } updateAction.amount = '25000' - updateAction.status = ActionStatus.APPROVED + updateAction.status = ActionStatus.approved const expectedUpdated = { ...expectedApprovedAction } expectedUpdated.amount = '25000' @@ -671,7 +666,7 @@ describe('Actions', () => { executor({ document: ACTIONS_QUERY, variables: { - filter: { status: ActionStatus.APPROVED, source: 'indexerAgent' }, + filter: { status: ActionStatus.approved, source: 'indexerAgent' }, }, }), ).resolves.toHaveProperty('data.actions', [expectedUpdated]) @@ -741,7 +736,7 @@ describe('Actions', () => { document: ACTIONS_QUERY, variables: { filter: { - status: ActionStatus.APPROVED, + status: ActionStatus.approved, source: 'indexerAgent', }, }, @@ -751,8 +746,8 @@ describe('Actions', () => { test('Reject queueing for action that has recently failed', async () => { const failedAction = { - status: ActionStatus.FAILED, - type: ActionType.ALLOCATE, + status: ActionStatus.failed, + type: ActionType.allocate, deploymentID: subgraphDeployment1, amount: '10000', force: false, @@ -761,18 +756,18 @@ describe('Actions', () => { priority: 0, // When writing directly to the database, `protocolNetwork` must be in the CAIP2-ID format. protocolNetwork: 'eip155:11155111', - } as ActionInput + } satisfies ActionInput const proposedAction = { - status: ActionStatus.QUEUED, - type: ActionType.ALLOCATE, + status: ActionStatus.queued, + type: ActionType.allocate, deploymentID: subgraphDeployment1, amount: '10000', source: 'indexerAgent', reason: 'indexingRule', priority: 0, protocolNetwork: 'sepolia', - } as ActionInput + } satisfies ActionInput await managementModels.Action.create(failedAction, { validate: true, @@ -805,8 +800,8 @@ describe('Actions', () => { test('Reject queueing for action that has recently succeeded', async () => { const successfulAction = { - status: ActionStatus.SUCCESS, - type: ActionType.ALLOCATE, + status: ActionStatus.success, + type: ActionType.allocate, deploymentID: subgraphDeployment1, amount: '10000', force: false, @@ -815,18 +810,18 @@ describe('Actions', () => { priority: 0, // When writing directly to the database, `protocolNetwork` must be in the CAIP2-ID format. protocolNetwork: 'eip155:11155111', - } as ActionInput + } satisfies ActionInput const proposedAction = { - status: ActionStatus.QUEUED, - type: ActionType.ALLOCATE, + status: ActionStatus.queued, + type: ActionType.allocate, deploymentID: subgraphDeployment1, amount: '10000', source: 'indexerAgent', reason: 'indexingRule', priority: 0, protocolNetwork: 'sepolia', - } as ActionInput + } satisfies ActionInput await managementModels.Action.create(successfulAction, { validate: true, @@ -857,8 +852,8 @@ describe('Actions', () => { test('Update all queued unallocate actions', async () => { const queuedUnallocateAction = { - status: ActionStatus.QUEUED, - type: ActionType.UNALLOCATE, + status: ActionStatus.queued, + type: ActionType.unallocate, deploymentID: subgraphDeployment1, amount: '10000', force: false, @@ -867,11 +862,11 @@ describe('Actions', () => { priority: 0, // When writing directly to the database, `protocolNetwork` must be in the CAIP2-ID format. protocolNetwork: 'eip155:11155111', - } as ActionInput + } satisfies ActionInput const queuedAllocateAction = { - status: ActionStatus.QUEUED, - type: ActionType.ALLOCATE, + status: ActionStatus.queued, + type: ActionType.allocate, deploymentID: subgraphDeployment1, force: false, amount: '10000', @@ -879,7 +874,7 @@ describe('Actions', () => { reason: 'indexingRule', priority: 0, protocolNetwork: 'sepolia', - } as ActionInput + } satisfies ActionInput await managementModels.Action.create(queuedUnallocateAction, { validate: true, diff --git a/packages/indexer-common/src/indexer-management/__tests__/resolvers/indexing-rules.test.ts b/packages/indexer-common/src/indexer-management/__tests__/resolvers/indexing-rules.test.ts index 26df8f22b..c08d5b34f 100644 --- a/packages/indexer-common/src/indexer-management/__tests__/resolvers/indexing-rules.test.ts +++ b/packages/indexer-common/src/indexer-management/__tests__/resolvers/indexing-rules.test.ts @@ -10,16 +10,13 @@ import { buildHTTPExecutor } from '@graphql-tools/executor-http' import { defineIndexerManagementModels, IndexerManagementModels, - IndexingDecisionBasis, INDEXING_RULE_GLOBAL, } from '../../models' -import { - SubgraphIdentifierType, - defineQueryFeeModels, -} from '@graphprotocol/indexer-common' +import { defineQueryFeeModels } from '@graphprotocol/indexer-common' import { createTestManagementClient, defaults } from '../util' import { isAsyncIterable } from 'graphql-yoga' +import { IdentifierType, IndexingDecisionBasis } from '../../../schema/types.generated' // Make global Jest variable available // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -156,7 +153,7 @@ describe('Indexing rules', () => { test('Set and get global rule (partial)', async () => { const input = { identifier: INDEXING_RULE_GLOBAL, - identifierType: SubgraphIdentifierType.GROUP, + identifierType: IdentifierType.group, allocationAmount: 1000, protocolNetwork: 'sepolia', } @@ -172,7 +169,7 @@ describe('Indexing rules', () => { minStake: null, minAverageQueryFees: null, custom: null, - decisionBasis: IndexingDecisionBasis.RULES, + decisionBasis: IndexingDecisionBasis.rules, requireSupported: true, safety: true, protocolNetwork: 'eip155:11155111', @@ -200,7 +197,7 @@ describe('Indexing rules', () => { test('Set and get global rule (complete)', async () => { const input = { identifier: INDEXING_RULE_GLOBAL, - identifierType: SubgraphIdentifierType.GROUP, + identifierType: IdentifierType.group, allocationAmount: 1, allocationLifetime: 10, autoRenewal: true, @@ -211,7 +208,7 @@ describe('Indexing rules', () => { minStake: 4, minAverageQueryFees: 5, custom: JSON.stringify({ foo: 'bar' }), - decisionBasis: IndexingDecisionBasis.RULES, + decisionBasis: IndexingDecisionBasis.rules, requireSupported: true, safety: true, protocolNetwork: 'sepolia', @@ -244,7 +241,7 @@ describe('Indexing rules', () => { test('Set and get global rule (partial update)', async () => { const originalInput = { identifier: INDEXING_RULE_GLOBAL, - identifierType: SubgraphIdentifierType.GROUP, + identifierType: IdentifierType.group, allocationAmount: 1, minSignal: 2, protocolNetwork: 'sepolia', @@ -260,7 +257,7 @@ describe('Indexing rules', () => { minStake: null, minAverageQueryFees: null, custom: null, - decisionBasis: IndexingDecisionBasis.RULES, + decisionBasis: IndexingDecisionBasis.rules, requireSupported: true, safety: true, protocolNetwork: 'eip155:11155111', @@ -276,10 +273,10 @@ describe('Indexing rules', () => { const update = { identifier: INDEXING_RULE_GLOBAL, - identifierType: SubgraphIdentifierType.GROUP, + identifierType: IdentifierType.group, allocationAmount: null, maxSignal: 3, - decisionBasis: IndexingDecisionBasis.OFFCHAIN, + decisionBasis: IndexingDecisionBasis.offchain, autoRenewal: true, safety: false, protocolNetwork: 'sepolia', @@ -313,10 +310,10 @@ describe('Indexing rules', () => { const originalIdentifier = 'QmZSJPm74tvhgr8uzhqvyQm2J6YSbUEj4nF6j8WxxUQLsC' const originalInput = { identifier: originalIdentifier, - identifierType: SubgraphIdentifierType.DEPLOYMENT, + identifierType: IdentifierType.deployment, allocationAmount: 1, minSignal: 1, - decisionBasis: IndexingDecisionBasis.OFFCHAIN, + decisionBasis: IndexingDecisionBasis.offchain, protocolNetwork: 'sepolia', } @@ -330,7 +327,7 @@ describe('Indexing rules', () => { minStake: null, minAverageQueryFees: null, custom: null, - decisionBasis: IndexingDecisionBasis.OFFCHAIN, + decisionBasis: IndexingDecisionBasis.offchain, requireSupported: true, safety: true, protocolNetwork: 'eip155:11155111', @@ -346,10 +343,10 @@ describe('Indexing rules', () => { const update = { identifier: originalIdentifier, - identifierType: SubgraphIdentifierType.DEPLOYMENT, + identifierType: IdentifierType.deployment, allocationAmount: null, maxSignal: 3, - decisionBasis: IndexingDecisionBasis.ALWAYS, + decisionBasis: IndexingDecisionBasis.always, allocationLifetime: 2, autoRenewal: false, requireSupported: false, @@ -385,9 +382,9 @@ describe('Indexing rules', () => { const updateAgain = { identifier: '0xa4e311bfa7edabed7b31d93e0b3e751659669852ef46adbedd44dc2454db4bf3', - identifierType: SubgraphIdentifierType.DEPLOYMENT, + identifierType: IdentifierType.deployment, allocationLifetime: null, - decisionBasis: IndexingDecisionBasis.NEVER, + decisionBasis: IndexingDecisionBasis.never, autoRenewal: true, protocolNetwork: 'sepolia', } @@ -427,19 +424,19 @@ describe('Indexing rules', () => { test('Set and get global and deployment rule', async () => { const globalInput = { identifier: INDEXING_RULE_GLOBAL, - identifierType: SubgraphIdentifierType.GROUP, + identifierType: IdentifierType.group, allocationAmount: 1, minSignal: 1, - decisionBasis: IndexingDecisionBasis.NEVER, + decisionBasis: IndexingDecisionBasis.never, protocolNetwork: 'sepolia', } const deploymentInput = { identifier: '0xa4e311bfa7edabed7b31d93e0b3e751659669852ef46adbedd44dc2454db4bf3', - identifierType: SubgraphIdentifierType.DEPLOYMENT, + identifierType: IdentifierType.deployment, allocationAmount: 1, minSignal: 2, - decisionBasis: IndexingDecisionBasis.OFFCHAIN, + decisionBasis: IndexingDecisionBasis.offchain, requireSupported: false, autoRenewal: false, safety: true, @@ -456,7 +453,7 @@ describe('Indexing rules', () => { minStake: null, minAverageQueryFees: null, custom: null, - decisionBasis: IndexingDecisionBasis.NEVER, + decisionBasis: IndexingDecisionBasis.never, requireSupported: true, safety: true, protocolNetwork: 'eip155:11155111', @@ -472,7 +469,7 @@ describe('Indexing rules', () => { minStake: null, minAverageQueryFees: null, custom: null, - decisionBasis: IndexingDecisionBasis.OFFCHAIN, + decisionBasis: IndexingDecisionBasis.offchain, requireSupported: false, safety: true, protocolNetwork: 'eip155:11155111', @@ -532,7 +529,7 @@ describe('Indexing rules', () => { test('Set, delete and get rule', async () => { const input = { identifier: 'QmZSJPm74tvhgr8uzhqvyQm2J6YSbUEj4nF6j8WxxUQLsC', - identifierType: SubgraphIdentifierType.DEPLOYMENT, + identifierType: IdentifierType.deployment, allocationAmount: 1, minSignal: 2, allocationLifetime: 20, @@ -550,7 +547,7 @@ describe('Indexing rules', () => { minStake: null, minAverageQueryFees: null, custom: null, - decisionBasis: IndexingDecisionBasis.RULES, + decisionBasis: IndexingDecisionBasis.rules, requireSupported: true, safety: true, protocolNetwork: 'eip155:11155111', @@ -592,7 +589,7 @@ describe('Indexing rules', () => { test('Clear a parameter', async () => { const input = { identifier: 'QmZSJPm74tvhgr8uzhqvyQm2J6YSbUEj4nF6j8WxxUQLsC', - identifierType: SubgraphIdentifierType.DEPLOYMENT, + identifierType: IdentifierType.deployment, allocationAmount: 1, requireSupported: true, safety: true, @@ -610,7 +607,7 @@ describe('Indexing rules', () => { minStake: null, minAverageQueryFees: null, custom: null, - decisionBasis: IndexingDecisionBasis.RULES, + decisionBasis: IndexingDecisionBasis.rules, protocolNetwork: 'eip155:11155111', } @@ -654,10 +651,10 @@ describe('Indexing rules', () => { test('Set and get global and deployment rule (merged)', async () => { const globalInput = { identifier: INDEXING_RULE_GLOBAL, - identifierType: SubgraphIdentifierType.GROUP, + identifierType: IdentifierType.group, allocationAmount: 1, minSignal: 1, - decisionBasis: IndexingDecisionBasis.NEVER, + decisionBasis: IndexingDecisionBasis.never, minAverageQueryFees: 1, allocationLifetime: 15, requireSupported: true, @@ -668,10 +665,10 @@ describe('Indexing rules', () => { const deploymentInput = { identifier: 'QmZSJPm74tvhgr8uzhqvyQm2J6YSbUEj4nF6j8WxxUQLsC', - identifierType: SubgraphIdentifierType.DEPLOYMENT, + identifierType: IdentifierType.deployment, allocationAmount: 1, minSignal: 2, - decisionBasis: IndexingDecisionBasis.OFFCHAIN, + decisionBasis: IndexingDecisionBasis.offchain, allocationLifetime: 10, autoRenewal: false, requireSupported: false, @@ -688,7 +685,7 @@ describe('Indexing rules', () => { maxSignal: null, minStake: null, custom: null, - decisionBasis: IndexingDecisionBasis.NEVER, + decisionBasis: IndexingDecisionBasis.never, requireSupported: true, safety: false, protocolNetwork: 'eip155:11155111', @@ -704,7 +701,7 @@ describe('Indexing rules', () => { minStake: null, minAverageQueryFees: null, custom: null, - decisionBasis: IndexingDecisionBasis.OFFCHAIN, + decisionBasis: IndexingDecisionBasis.offchain, requireSupported: false, safety: true, protocolNetwork: 'eip155:11155111', @@ -720,7 +717,7 @@ describe('Indexing rules', () => { minStake: null, minAverageQueryFees: 1, custom: null, - decisionBasis: IndexingDecisionBasis.OFFCHAIN, + decisionBasis: IndexingDecisionBasis.offchain, requireSupported: false, safety: true, protocolNetwork: 'eip155:11155111', @@ -793,10 +790,10 @@ describe('Indexing rules', () => { test('Delete global rules (which should reset)', async () => { const globalInput = { identifier: INDEXING_RULE_GLOBAL, - identifierType: SubgraphIdentifierType.GROUP, + identifierType: IdentifierType.group, allocationAmount: '1', minSignal: '1', - decisionBasis: IndexingDecisionBasis.NEVER, + decisionBasis: IndexingDecisionBasis.never, minAverageQueryFees: '1', protocolNetwork: 'sepolia', } @@ -831,7 +828,7 @@ describe('Indexing rules', () => { custom: null, decisionBasis: 'rules', identifier: INDEXING_RULE_GLOBAL, - identifierType: SubgraphIdentifierType.GROUP, + identifierType: IdentifierType.group, allocationLifetime: null, autoRenewal: true, maxAllocationPercentage: null, @@ -847,10 +844,10 @@ describe('Indexing rules', () => { test('Delete multiple rules, including global (which should reset)', async () => { const globalInput = { identifier: INDEXING_RULE_GLOBAL, - identifierType: SubgraphIdentifierType.GROUP, + identifierType: IdentifierType.group, allocationAmount: '1', minSignal: '1', - decisionBasis: IndexingDecisionBasis.NEVER, + decisionBasis: IndexingDecisionBasis.never, minAverageQueryFees: '1', requireSupported: false, safety: false, @@ -859,7 +856,7 @@ describe('Indexing rules', () => { const deploymentInput = { identifier: 'QmZSJPm74tvhgr8uzhqvyQm2J6YSbUEj4nF6j8WxxUQLsC', - identifierType: SubgraphIdentifierType.DEPLOYMENT, + identifierType: IdentifierType.deployment, allocationAmount: '1', minSignal: '2', requireSupported: true, @@ -906,7 +903,7 @@ describe('Indexing rules', () => { custom: null, decisionBasis: 'rules', identifier: INDEXING_RULE_GLOBAL, - identifierType: SubgraphIdentifierType.GROUP, + identifierType: IdentifierType.group, allocationLifetime: null, autoRenewal: true, maxAllocationPercentage: null, @@ -923,7 +920,7 @@ describe('Indexing rules', () => { test('Invalid protocolNetwork value prevents rule creation', async () => { const deploymentInput = { identifier: 'QmZSJPm74tvhgr8uzhqvyQm2J6YSbUEj4nF6j8WxxUQLsC', - identifierType: SubgraphIdentifierType.DEPLOYMENT, + identifierType: IdentifierType.deployment, allocationAmount: '1', minSignal: '2', requireSupported: true, diff --git a/packages/indexer-common/src/indexer-management/__tests__/util.ts b/packages/indexer-common/src/indexer-management/__tests__/util.ts index fa22c4150..8568f3cc8 100644 --- a/packages/indexer-common/src/indexer-management/__tests__/util.ts +++ b/packages/indexer-common/src/indexer-management/__tests__/util.ts @@ -1,7 +1,4 @@ import { - ActionInput, - ActionStatus, - ActionType, defineIndexerManagementModels, defineQueryFeeModels, GraphNode, @@ -12,6 +9,7 @@ import { } from '@graphprotocol/indexer-common' import { connectDatabase, Metrics, Logger, parseGRT } from '@graphprotocol/common-ts' import { createIndexerManagementYogaClient } from '../../indexer-management/yoga' +import { ActionInput, ActionStatus, ActionType } from '../../schema/types.generated' const PUBLIC_JSON_RPC_ENDPOINT = 'https://ethereum-sepolia.publicnode.com' @@ -134,8 +132,8 @@ export const subgraphDeployment2 = 'QmWq1pmnhEvx25qxpYYj9Yp6E1xMKMVoUjXVQBxUJmre export const subgraphDeployment3 = 'QmRhH2nhNibDVPZmYqq3TUZZARZ77vgjYCvPNiGBCogtgM' export const queuedAllocateAction = { - status: ActionStatus.QUEUED, - type: ActionType.ALLOCATE, + status: ActionStatus.queued, + type: ActionType.allocate, deploymentID: subgraphDeployment1, amount: '10000', force: false, @@ -146,8 +144,8 @@ export const queuedAllocateAction = { } as ActionInput export const invalidUnallocateAction = { - status: ActionStatus.QUEUED, - type: ActionType.UNALLOCATE, + status: ActionStatus.queued, + type: ActionType.unallocate, allocationID: '0x8f63930129e585c69482b56390a09b6b176f4a4c', deploymentID: subgraphDeployment1, amount: undefined, @@ -160,8 +158,8 @@ export const invalidUnallocateAction = { } as ActionInput export const invalidReallocateAction = { - status: ActionStatus.QUEUED, - type: ActionType.REALLOCATE, + status: ActionStatus.queued, + type: ActionType.reallocate, deploymentID: subgraphDeployment1, allocationID: '0x000009a610d8b4fd4d1e020e22cc55a623fe7d2a', poi: '0x0000000000000000000000000000000000000000000000000000000000000000', diff --git a/packages/indexer-common/src/indexer-management/actions.ts b/packages/indexer-common/src/indexer-management/actions.ts index b4db9447a..be47f862c 100644 --- a/packages/indexer-common/src/indexer-management/actions.ts +++ b/packages/indexer-common/src/indexer-management/actions.ts @@ -2,7 +2,6 @@ import { Action, actionFilterToWhereOptions, ActionParams, - ActionStatus, ActionUpdateInput, AllocationManager, AllocationManagementMode, @@ -22,7 +21,11 @@ import { import { Order, Transaction, WhereOperators } from 'sequelize' import { Eventual, join, Logger, timer } from '@graphprotocol/common-ts' import groupBy from 'lodash.groupby' -import { ActionFilter as GraphQLActionFilter, Maybe } from '../schema/types.generated' +import { + ActionStatus, + ActionFilter as GraphQLActionFilter, + Maybe, +} from '../schema/types.generated' type ActionFilter = GraphQLActionFilter & { updatedAt?: WhereOperators @@ -128,7 +131,7 @@ export class ActionManager { actions = await ActionManager.fetchActions( this.models, { - status: ActionStatus.APPROVED, + status: ActionStatus.approved, }, null, ) @@ -213,7 +216,7 @@ export class ActionManager { ): Promise { let updatedActions: Action[] = [] for (const result of results) { - const status = isActionFailure(result) ? ActionStatus.FAILED : ActionStatus.SUCCESS + const status = isActionFailure(result) ? ActionStatus.failed : ActionStatus.success const [, updatedAction] = await this.models.Action.update( { status: status, @@ -255,7 +258,7 @@ export class ActionManager { approvedActions = ( await this.models.Action.findAll({ where: { - status: ActionStatus.APPROVED, + status: ActionStatus.approved, protocolNetwork, }, order: [['priority', 'ASC']], diff --git a/packages/indexer-common/src/indexer-management/allocations.ts b/packages/indexer-common/src/indexer-management/allocations.ts index 1fd78e540..f4482bab8 100644 --- a/packages/indexer-common/src/indexer-management/allocations.ts +++ b/packages/indexer-common/src/indexer-management/allocations.ts @@ -8,7 +8,6 @@ import { import { Action, ActionFailure, - ActionType, Allocation, allocationIdProof, AllocationResult, @@ -21,14 +20,12 @@ import { IndexerError, IndexerErrorCode, IndexerManagementModels, - IndexingDecisionBasis, IndexingRuleAttributes, IndexingStatus, isActionFailure, isDeploymentWorthAllocatingTowards, Network, ReallocateAllocationResult, - SubgraphIdentifierType, uniqueAllocationID, upsertIndexingRule, } from '@graphprotocol/indexer-common' @@ -43,6 +40,7 @@ import { import { BytesLike } from '@ethersproject/bytes' import pMap from 'p-map' +import { IdentifierType, IndexingDecisionBasis } from '../schema/types.generated' export interface TransactionPreparationContext { activeAllocations: Allocation[] @@ -209,7 +207,7 @@ export class AllocationManager { } switch (action.type) { - case ActionType.ALLOCATE: + case 'allocate': return await this.confirmAllocate( action.id, // eslint-disable-next-line @typescript-eslint/no-non-null-assertion @@ -218,14 +216,14 @@ export class AllocationManager { action.amount!, receipt, ) - case ActionType.UNALLOCATE: + case 'unallocate': return await this.confirmUnallocate( action.id, // eslint-disable-next-line @typescript-eslint/no-non-null-assertion action.allocationID!, receipt, ) - case ActionType.REALLOCATE: + case 'reallocate': return await this.confirmReallocate( action.id, // eslint-disable-next-line @typescript-eslint/no-non-null-assertion @@ -262,7 +260,7 @@ export class AllocationManager { }) try { switch (action.type) { - case ActionType.ALLOCATE: + case 'allocate': return await this.prepareAllocate( logger, context, @@ -271,7 +269,7 @@ export class AllocationManager { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion parseGRT(action.amount!), ) - case ActionType.UNALLOCATE: + case 'unallocate': return await this.prepareUnallocate( logger, context, @@ -280,7 +278,7 @@ export class AllocationManager { action.poi === null ? undefined : action.poi, action.force === null ? false : action.force, ) - case ActionType.REALLOCATE: + case 'reallocate': return await this.prepareReallocate( logger, context, @@ -463,8 +461,8 @@ export class AllocationManager { const indexingRule = { identifier: deployment, allocationAmount: amount, - identifierType: SubgraphIdentifierType.DEPLOYMENT, - decisionBasis: IndexingDecisionBasis.ALWAYS, + identifierType: IdentifierType.deployment, + decisionBasis: IndexingDecisionBasis.always, protocolNetwork: this.network.specification.networkIdentifier, } as Partial @@ -629,8 +627,8 @@ export class AllocationManager { const offchainIndexingRule = { identifier: allocation.subgraphDeployment.id.ipfsHash, protocolNetwork: this.network.specification.networkIdentifier, - identifierType: SubgraphIdentifierType.DEPLOYMENT, - decisionBasis: IndexingDecisionBasis.OFFCHAIN, + identifierType: IdentifierType.deployment, + decisionBasis: IndexingDecisionBasis.offchain, } as Partial await upsertIndexingRule(logger, this.models, offchainIndexingRule) @@ -932,8 +930,8 @@ export class AllocationManager { const indexingRule = { identifier: allocation.subgraphDeployment.id.ipfsHash, allocationAmount: formatGRT(createAllocationEventLogs.tokens), - identifierType: SubgraphIdentifierType.DEPLOYMENT, - decisionBasis: IndexingDecisionBasis.ALWAYS, + identifierType: IdentifierType.deployment, + decisionBasis: IndexingDecisionBasis.always, protocolNetwork: this.network.specification.networkIdentifier, } as Partial @@ -1024,7 +1022,7 @@ export class AllocationManager { // We intentionally don't check if the allocation is active now because it will be checked // later, when we prepare the transaction. - if (action.type === ActionType.UNALLOCATE || action.type === ActionType.REALLOCATE) { + if (action.type === 'unallocate' || action.type === 'reallocate') { // Ensure this Action have a valid allocationID if (action.allocationID === null || action.allocationID === undefined) { throw Error( diff --git a/packages/indexer-common/src/indexer-management/models/action.ts b/packages/indexer-common/src/indexer-management/models/action.ts index 642a9fbca..131b1f249 100644 --- a/packages/indexer-common/src/indexer-management/models/action.ts +++ b/packages/indexer-common/src/indexer-management/models/action.ts @@ -9,7 +9,11 @@ import { Sequelize, } from 'sequelize' import { caip2IdRegex } from '../../parsers' -import { ActionStatus, ActionType } from '@graphprotocol/indexer-common' +import { + Action as GraphQLAction, + ActionType, + ActionStatus, +} from '../../schema/types.generated' export class Action extends Model< InferAttributes, @@ -37,9 +41,13 @@ export class Action extends Model< declare protocolNetwork: string - // eslint-disable-next-line @typescript-eslint/ban-types - public toGraphQL(): object { - return { ...this.toJSON(), __typename: 'Action' } + public toGraphQL(): GraphQLAction { + return { + ...this.toJSON(), + __typename: 'Action', + createdAt: BigInt(this.createdAt.getMilliseconds()), + updatedAt: BigInt(this.updatedAt.getMilliseconds()), + } } } @@ -58,9 +66,9 @@ export const defineActionModels = (sequelize: Sequelize): ActionModels => { }, type: { type: DataTypes.ENUM( - ActionType.ALLOCATE, - ActionType.UNALLOCATE, - ActionType.REALLOCATE, + ActionType.allocate, + ActionType.unallocate, + ActionType.reallocate, ), allowNull: false, validate: { @@ -76,12 +84,12 @@ export const defineActionModels = (sequelize: Sequelize): ActionModels => { }, status: { type: DataTypes.ENUM( - ActionStatus.SUCCESS, - ActionStatus.FAILED, - ActionStatus.QUEUED, - ActionStatus.APPROVED, - ActionStatus.PENDING, - ActionStatus.CANCELED, + ActionStatus.success, + ActionStatus.failed, + ActionStatus.queued, + ActionStatus.approved, + ActionStatus.pending, + ActionStatus.canceled, ), allowNull: false, defaultValue: 'queued', @@ -158,21 +166,21 @@ export const defineActionModels = (sequelize: Sequelize): ActionModels => { validate: { requiredActionParams() { switch (this.type) { - case ActionType.ALLOCATE: + case ActionType.allocate: if (this.deploymentID === null || this.amount === null) { throw new Error( `ActionType.ALLOCATE action must have required params: ['deploymentID','amount']`, ) } break - case ActionType.UNALLOCATE: + case ActionType.unallocate: if (this.deploymentID === null || this.allocationID === null) { throw new Error( `ActionType.UNALLOCATE action must have required params: ['deploymentID','allocationID']`, ) } break - case ActionType.REALLOCATE: + case ActionType.reallocate: if ( this.deploymentID === null || this.allocationID === null || diff --git a/packages/indexer-common/src/indexer-management/models/cost-model.ts b/packages/indexer-common/src/indexer-management/models/cost-model.ts index fea16a3a3..008fa9ab6 100644 --- a/packages/indexer-common/src/indexer-management/models/cost-model.ts +++ b/packages/indexer-common/src/indexer-management/models/cost-model.ts @@ -52,7 +52,6 @@ export class CostModel public createdAt!: Date public updatedAt!: Date - // eslint-disable-next-line @typescript-eslint/ban-types public toGraphQL(): GraphQLCostModelType { return { ...this.toJSON(), diff --git a/packages/indexer-common/src/indexer-management/models/indexing-rule.ts b/packages/indexer-common/src/indexer-management/models/indexing-rule.ts index 8753724da..420c2cc1c 100644 --- a/packages/indexer-common/src/indexer-management/models/indexing-rule.ts +++ b/packages/indexer-common/src/indexer-management/models/indexing-rule.ts @@ -1,23 +1,20 @@ /* eslint-disable @typescript-eslint/no-empty-interface */ import { DataTypes, Model, Optional, Sequelize } from 'sequelize' -import { processIdentifier, SubgraphIdentifierType } from '../../subgraphs' +import { processIdentifier } from '../../subgraphs' import { caip2IdRegex } from '../../parsers' -import { IndexingRule as GraphQLIndexingRuleType } from '../../schema/types.generated' - -export enum IndexingDecisionBasis { - RULES = 'rules', - NEVER = 'never', - ALWAYS = 'always', - OFFCHAIN = 'offchain', -} +import { + IndexingRule as GraphQLIndexingRuleType, + IdentifierType, + IndexingDecisionBasis, +} from '../../schema/types.generated' export const INDEXING_RULE_GLOBAL = 'global' export interface IndexingRuleAttributes { id: number identifier: string - identifierType: SubgraphIdentifierType + identifierType: IdentifierType allocationAmount: string | null allocationLifetime: number | null autoRenewal: boolean @@ -69,7 +66,7 @@ export class IndexingRule { public id!: number public identifier!: string - public identifierType!: SubgraphIdentifierType + public identifierType!: IdentifierType public allocationAmount!: string | null public allocationLifetime!: number | null public autoRenewal!: boolean @@ -167,7 +164,11 @@ export const defineIndexingRuleModels = (sequelize: Sequelize): IndexingRuleMode }, }, identifierType: { - type: DataTypes.ENUM('deployment', 'subgraph', 'group'), + type: DataTypes.ENUM( + IdentifierType.deployment, + IdentifierType.subgraph, + IdentifierType.group, + ), defaultValue: 'group', }, allocationAmount: { @@ -247,7 +248,12 @@ export const defineIndexingRuleModels = (sequelize: Sequelize): IndexingRuleMode allowNull: true, }, decisionBasis: { - type: DataTypes.ENUM('rules', 'never', 'always', 'offchain'), + type: DataTypes.ENUM( + IndexingDecisionBasis.rules, + IndexingDecisionBasis.never, + IndexingDecisionBasis.always, + IndexingDecisionBasis.offchain, + ), allowNull: false, defaultValue: 'rules', }, diff --git a/packages/indexer-common/src/indexer-management/models/poi-dispute.ts b/packages/indexer-common/src/indexer-management/models/poi-dispute.ts index d11322d63..fbd6b9551 100644 --- a/packages/indexer-common/src/indexer-management/models/poi-dispute.ts +++ b/packages/indexer-common/src/indexer-management/models/poi-dispute.ts @@ -69,9 +69,12 @@ export class POIDispute public createdAt!: Date public updatedAt!: Date - // eslint-disable-next-line @typescript-eslint/ban-types public toGraphQL(): GraphQLPOIDispute { - return { ...this.toJSON(), __typename: 'POIDispute' } + return { + ...this.toJSON(), + __typename: 'POIDispute', + allocationAmount: BigInt(this.allocationAmount), + } } } diff --git a/packages/indexer-common/src/indexer-management/resolvers/actions.ts b/packages/indexer-common/src/indexer-management/resolvers/actions.ts index 85c5d5ae9..2ad32b5fd 100644 --- a/packages/indexer-common/src/indexer-management/resolvers/actions.ts +++ b/packages/indexer-common/src/indexer-management/resolvers/actions.ts @@ -3,11 +3,8 @@ import { IndexerManagementResolverContext } from '../context' import { Logger } from '@graphprotocol/common-ts' import { Action, - ActionInput, ActionParams, ActionResult, - ActionStatus, - ActionType, ActionUpdateInput, IndexerManagementModels, Network, @@ -19,7 +16,12 @@ import { import { literal, Op, Transaction } from 'sequelize' import { ActionManager } from '../actions' import groupBy from 'lodash.groupby' -import { ActionFilter } from '../../schema/types.generated' +import { + ActionFilter, + ActionInput, + ActionStatus, + ActionType, +} from '../../schema/types.generated' // Perform insert, update, or no-op depending on existing queue data // INSERT - No item in the queue yet targeting this deploymentID @@ -58,11 +60,18 @@ async function executeQueueOperation( if (duplicateActions.length === 0) { logger.trace('Inserting Action in database', { action }) return [ - await models.Action.create(action, { - validate: true, - returning: true, - transaction, - }), + await models.Action.create( + { + ...action, + // @ts-expect-error once we upgrade to latest TS types will get asserted with the filter + deploymentID: action.deploymentID, + }, + { + validate: true, + returning: true, + transaction, + }, + ), ] } else if (duplicateActions.length === 1) { if ( @@ -80,7 +89,11 @@ async function executeQueueOperation( }, ) const [, updatedAction] = await models.Action.update( - { ...action }, + { + ...action, + // @ts-expect-error once we upgrade to latest TS types will get asserted with the filter + deploymentID: action.deploymentID, + }, { where: { id: duplicateActions[0].id }, returning: true, @@ -179,14 +192,14 @@ export default { const alreadyQueuedActions = await ActionManager.fetchActions( models, { - status: ActionStatus.QUEUED, + status: ActionStatus.queued, }, undefined, ) const alreadyApprovedActions = await ActionManager.fetchActions( models, { - status: ActionStatus.APPROVED, + status: ActionStatus.approved, }, undefined, ) @@ -200,7 +213,7 @@ export default { const recentlyFailedActions = await ActionManager.fetchActions( models, { - status: ActionStatus.FAILED, + status: ActionStatus.failed, updatedAt: last15Minutes, }, undefined, @@ -209,7 +222,7 @@ export default { const recentlySuccessfulActions = await ActionManager.fetchActions( models, { - status: ActionStatus.SUCCESS, + status: ActionStatus.success, updatedAt: last15Minutes, }, undefined, @@ -252,7 +265,7 @@ export default { actionIDs, }) const [, canceledActions] = await models.Action.update( - { status: ActionStatus.CANCELED }, + { status: ActionStatus.canceled }, { where: { id: actionIDs }, returning: true }, ) @@ -341,7 +354,7 @@ export default { actionIDs, }) const [, updatedActions] = await models.Action.update( - { status: ActionStatus.APPROVED }, + { status: ActionStatus.approved }, { where: { id: actionIDs }, returning: true }, ) @@ -404,11 +417,13 @@ function compareActions(enqueued: Action, proposed: ActionInput): boolean { const poi = enqueued.poi == proposed.poi const force = enqueued.force == proposed.force switch (proposed.type) { - case ActionType.ALLOCATE: + case ActionType.allocate: return amount - case ActionType.UNALLOCATE: + case ActionType.unallocate: return poi && force - case ActionType.REALLOCATE: + case ActionType.reallocate: return amount && poi && force + default: + return false } } diff --git a/packages/indexer-common/src/indexer-management/resolvers/allocations.ts b/packages/indexer-common/src/indexer-management/resolvers/allocations.ts index a93638a68..214bf617a 100644 --- a/packages/indexer-common/src/indexer-management/resolvers/allocations.ts +++ b/packages/indexer-common/src/indexer-management/resolvers/allocations.ts @@ -5,7 +5,11 @@ import { } from '@graphprotocol/indexer-common' /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ /* eslint-disable @typescript-eslint/ban-types */ -import { Allocation as AllocationInfo } from '../../schema/types.generated' +import { + Allocation as AllocationInfo, + IdentifierType, + IndexingDecisionBasis, +} from '../../schema/types.generated' import pMap from 'p-map' import gql from 'graphql-tag' import { BigNumber, utils } from 'ethers' @@ -27,12 +31,10 @@ import { indexerError, IndexerErrorCode, IndexerManagementResolverContext, - IndexingDecisionBasis, IndexingRuleAttributes, GraphNode, NetworkSubgraph, ReallocateAllocationResult, - SubgraphIdentifierType, uniqueAllocationID, } from '@graphprotocol/indexer-common' import { extractNetwork } from './utils' @@ -585,8 +587,8 @@ export default { const indexingRule = { identifier: subgraphDeployment.ipfsHash, allocationAmount: allocationAmount.toString(), - identifierType: SubgraphIdentifierType.DEPLOYMENT, - decisionBasis: IndexingDecisionBasis.ALWAYS, + identifierType: IdentifierType.deployment, + decisionBasis: IndexingDecisionBasis.always, protocolNetwork, } as Partial @@ -756,8 +758,8 @@ export default { const offchainIndexingRule = { protocolNetwork: network.specification.networkIdentifier, identifier: allocationData.subgraphDeployment.id.ipfsHash, - identifierType: SubgraphIdentifierType.DEPLOYMENT, - decisionBasis: IndexingDecisionBasis.OFFCHAIN, + identifierType: IdentifierType.deployment, + decisionBasis: IndexingDecisionBasis.offchain, } as Partial await models.IndexingRule.upsert(offchainIndexingRule) @@ -1078,8 +1080,8 @@ export default { const indexingRule = { identifier: allocationData.subgraphDeployment.id.ipfsHash, allocationAmount: allocationAmount.toString(), - identifierType: SubgraphIdentifierType.DEPLOYMENT, - decisionBasis: IndexingDecisionBasis.ALWAYS, + identifierType: IdentifierType.deployment, + decisionBasis: IndexingDecisionBasis.always, protocolNetwork, } as Partial diff --git a/packages/indexer-common/src/indexer-management/rules.ts b/packages/indexer-common/src/indexer-management/rules.ts index 656dd532b..a0397d66d 100644 --- a/packages/indexer-common/src/indexer-management/rules.ts +++ b/packages/indexer-common/src/indexer-management/rules.ts @@ -12,7 +12,7 @@ export const fetchIndexingRules = async ( models: IndexerManagementModels, merged: boolean, protocolNetwork?: string, -): Promise => { +) => { // If unspecified, select indexing rules from all protocol networks const whereClause = protocolNetwork ? { protocolNetwork } : {} const rules = await models.IndexingRule.findAll({ diff --git a/packages/indexer-common/src/indexer-management/schema.graphql b/packages/indexer-common/src/indexer-management/schema.graphql index e235be6af..fea46fcae 100644 --- a/packages/indexer-common/src/indexer-management/schema.graphql +++ b/packages/indexer-common/src/indexer-management/schema.graphql @@ -128,7 +128,7 @@ input ActionUpdateInput { id: Int deploymentID: String allocationID: String - amount: Int + amount: String poi: String force: Boolean type: ActionType diff --git a/packages/indexer-common/src/operator.ts b/packages/indexer-common/src/operator.ts index f4eec090c..bb602c77b 100644 --- a/packages/indexer-common/src/operator.ts +++ b/packages/indexer-common/src/operator.ts @@ -1,8 +1,6 @@ import { ActionItem, ActionResult, - ActionStatus, - ActionType, Allocation, AllocationDecision, AllocationManagementMode, @@ -10,7 +8,6 @@ import { IndexerErrorCode, IndexerManagementClient, IndexingRuleAttributes, - SubgraphIdentifierType, indexerError, specification as spec, Action, @@ -21,7 +18,12 @@ import { BigNumber, utils } from 'ethers' import gql from 'graphql-tag' import pMap from 'p-map' import { CombinedError } from '@urql/core' -import { ActionFilter } from './schema/types.generated' +import { + ActionFilter, + ActionStatus, + ActionType, + IdentifierType, +} from './schema/types.generated' const POI_DISPUTES_CONVERTERS_FROM_GRAPHQL: Record< keyof POIDisputeAttributes, @@ -167,7 +169,7 @@ export class Operator { const defaults = { ...identifier, - identifierType: SubgraphIdentifierType.GROUP, + identifierType: IdentifierType.group, allocationAmount: this.specification.indexerOptions.defaultAllocationAmount.toString(), parallelAllocations: 1, @@ -259,15 +261,15 @@ export class Operator { } async queueAction(action: ActionItem): Promise { - let status = ActionStatus.QUEUED + let status: ActionStatus = ActionStatus.queued switch (this.specification.indexerOptions.allocationManagementMode) { case AllocationManagementMode.MANUAL: throw Error(`Cannot queue actions when AllocationManagementMode = 'MANUAL'`) case AllocationManagementMode.AUTO: - status = ActionStatus.APPROVED + status = ActionStatus.approved break case AllocationManagementMode.OVERSIGHT: - status = ActionStatus.QUEUED + status = ActionStatus.queued } const actionInput = { @@ -369,7 +371,7 @@ export class Operator { deploymentID: deploymentAllocationDecision.deployment.ipfsHash, amount: formatGRT(desiredAllocationAmount), }, - type: ActionType.ALLOCATE, + type: ActionType.allocate, reason: deploymentAllocationDecision.reasonString(), protocolNetwork: deploymentAllocationDecision.protocolNetwork, }) @@ -408,7 +410,7 @@ export class Operator { poi: undefined, force: false, }, - type: ActionType.UNALLOCATE, + type: ActionType.unallocate, reason: deploymentAllocationDecision.reasonString(), protocolNetwork: deploymentAllocationDecision.protocolNetwork, } as ActionItem) @@ -444,7 +446,7 @@ export class Operator { deploymentID: deploymentAllocationDecision.deployment.ipfsHash, amount: formatGRT(desiredAllocationAmount), }, - type: ActionType.REALLOCATE, + type: ActionType.reallocate, reason: `${deploymentAllocationDecision.reasonString()}:allocationExpiring`, // Need to update to include 'ExpiringSoon' protocolNetwork: deploymentAllocationDecision.protocolNetwork, }) diff --git a/packages/indexer-common/src/rules.ts b/packages/indexer-common/src/rules.ts index e03bfd40e..5140ca5ae 100644 --- a/packages/indexer-common/src/rules.ts +++ b/packages/indexer-common/src/rules.ts @@ -1,7 +1,8 @@ -import { IndexingDecisionBasis, IndexingRuleAttributes } from './indexer-management' +import { IndexingRuleAttributes } from './indexer-management' import { nullPassThrough, parseBoolean } from './utils' import { parseGRT } from '@graphprotocol/common-ts' import { validateNetworkIdentifier } from './parsers' +import { IndexingDecisionBasis } from './schema/types.generated' export const parseDecisionBasis = (s: string): IndexingDecisionBasis => { if (!['always', 'never', 'rules', 'offchain'].includes(s)) { diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/approveActions.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/approveActions.ts index a25b46f74..bfd15e252 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/approveActions.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/approveActions.ts @@ -1,5 +1,4 @@ -import { ActionStatus } from '@graphprotocol/indexer-common' -import type { MutationResolvers } from './../../../types.generated' +import { type MutationResolvers } from './../../../types.generated' // @ts-expect-error it be like that export const approveActions: NonNullable = async ( @@ -11,7 +10,7 @@ export const approveActions: NonNullable = actionIDs, }) const [, updatedActions] = await models.Action.update( - { status: ActionStatus.APPROVED }, + { status: 'approved' }, { where: { id: actionIDs }, returning: true }, ) diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/cancelActions.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/cancelActions.ts index 52bbead15..2ea8eb60e 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/cancelActions.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/cancelActions.ts @@ -1,4 +1,3 @@ -import { ActionStatus } from '@graphprotocol/indexer-common' import type { MutationResolvers } from './../../../types.generated' // @ts-expect-error need to fix @@ -11,7 +10,7 @@ export const cancelActions: NonNullable = as actionIDs, }) const [, canceledActions] = await models.Action.update( - { status: ActionStatus.CANCELED }, + { status: 'canceled' }, { where: { id: actionIDs }, returning: true }, ) diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/closeAllocation.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/closeAllocation.ts index 596e88ccd..046447f75 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/closeAllocation.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/closeAllocation.ts @@ -1,12 +1,14 @@ import { extractNetwork } from '../../../../indexer-management/resolvers/utils' -import type { MutationResolvers } from './../../../types.generated' +import { + IdentifierType, + IndexingDecisionBasis, + type MutationResolvers, +} from './../../../types.generated' import { BigNumber, utils } from 'ethers' import { IndexerErrorCode, indexerError } from '../../../../errors' import { NetworkMonitor } from '../../../../indexer-management/monitor' import { GraphNode } from '../../../../graph-node' import { formatGRT } from '@graphprotocol/common-ts' -import { SubgraphIdentifierType } from '../../../../subgraphs' -import { IndexingDecisionBasis } from '../../../../indexer-management/models/indexing-rule' import { Allocation } from '../../../../allocations/types' async function resolvePOI( @@ -207,8 +209,8 @@ export const closeAllocation: NonNullable const offchainIndexingRule = { protocolNetwork: network.specification.networkIdentifier, identifier: allocationData.subgraphDeployment.id.ipfsHash, - identifierType: SubgraphIdentifierType.DEPLOYMENT, - decisionBasis: IndexingDecisionBasis.OFFCHAIN, + identifierType: IdentifierType.deployment, + decisionBasis: IndexingDecisionBasis.offchain, } await models.IndexingRule.upsert(offchainIndexingRule) diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/createAllocation.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/createAllocation.ts index 28dfe3513..747a310d4 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/createAllocation.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/createAllocation.ts @@ -1,12 +1,14 @@ import { extractNetwork } from '../../../../indexer-management/resolvers/utils' -import type { MutationResolvers } from './../../../types.generated' +import { + IdentifierType, + IndexingDecisionBasis, + type MutationResolvers, +} from './../../../types.generated' import { SubgraphDeploymentID, formatGRT, parseGRT } from '@graphprotocol/common-ts' import { AllocationStatus } from '../../../../allocations/types' import { IndexerErrorCode, indexerError } from '../../../../errors' import { allocationIdProof, uniqueAllocationID } from '../../../../allocations/keys' import { utils } from 'ethers' -import { SubgraphIdentifierType } from '../../../../subgraphs' -import { IndexingDecisionBasis } from '../../../../indexer-management/models/indexing-rule' export const createAllocation: NonNullable< MutationResolvers['createAllocation'] @@ -202,8 +204,8 @@ export const createAllocation: NonNullable< const indexingRule = { identifier: subgraphDeployment.ipfsHash, allocationAmount: allocationAmount.toString(), - identifierType: SubgraphIdentifierType.DEPLOYMENT, - decisionBasis: IndexingDecisionBasis.ALWAYS, + identifierType: IdentifierType.deployment, + decisionBasis: IndexingDecisionBasis.always, protocolNetwork, } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/queueActions.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/queueActions.ts index 974a9a93b..40ebd8fa8 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/queueActions.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/queueActions.ts @@ -1,12 +1,12 @@ import { validateNetworkIdentifier } from '../../../../parsers/validators' -import type { - Action, - ActionInput, - ActionResult, - MutationResolvers, +import { + ActionStatus, + type Action, + type ActionInput, + type MutationResolvers, } from './../../../types.generated' import groupBy from 'lodash.groupby' -import { ActionStatus, ActionType, validateActionInputs } from '../../../../actions' +import { validateActionInputs } from '../../../../actions' import { ActionManager } from '../../../../indexer-management/actions' import { Op, Transaction, literal } from 'sequelize' import { Logger } from '@graphprotocol/common-ts' @@ -33,11 +33,11 @@ function compareActions(enqueued: Action, proposed: ActionInput): boolean { const poi = enqueued.poi == proposed.poi const force = enqueued.force == proposed.force switch (proposed.type) { - case ActionType.ALLOCATE: + case 'allocate': return amount - case ActionType.UNALLOCATE: + case 'unallocate': return poi && force - case ActionType.REALLOCATE: + case 'reallocate': return amount && poi && force default: return false @@ -80,13 +80,19 @@ async function executeQueueOperation( ) if (duplicateActions.length === 0) { logger.trace('Inserting Action in database', { action }) - return [ - await models.Action.create(action, { + const createdAction = await models.Action.create( + { + ...action, + // @ts-expect-error - at this point we have a deploymentID. With new TS upgrade the filter check will make it assert the type + deploymentID: action.deploymentID, + }, + { validate: true, returning: true, transaction, - }), - ] + }, + ) + return [createdAction.toGraphQL()] } else if (duplicateActions.length === 1) { if ( duplicateActions[0].source === action.source && @@ -103,7 +109,11 @@ async function executeQueueOperation( }, ) const [, updatedAction] = await models.Action.update( - { ...action }, + { + ...action, + // @ts-expect-error - at this point we have a deploymentID. With new TS upgrade the filter check will make it assert the type + deploymentID: action.deploymentID, + }, { where: { id: duplicateActions[0].id }, returning: true, @@ -111,7 +121,7 @@ async function executeQueueOperation( transaction, }, ) - return updatedAction + return updatedAction.map((a) => a.toGraphQL()) } else { const message = `Duplicate action found in queue that effects '${action.deploymentID}' but NOT overwritten because it has a different source and/or status. If you ` + @@ -160,18 +170,20 @@ export const queueActions: NonNullable = asyn const alreadyQueuedActions = await ActionManager.fetchActions( models, { - status: ActionStatus.QUEUED, + status: ActionStatus.queued, }, null, ) const alreadyApprovedActions = await ActionManager.fetchActions( models, { - status: ActionStatus.APPROVED, + status: ActionStatus.approved, }, null, ) - const actionsAwaitingExecution = alreadyQueuedActions.concat(alreadyApprovedActions) + const actionsAwaitingExecution = alreadyQueuedActions + .concat(alreadyApprovedActions) + .map((a) => a.toGraphQL()) // Fetch recently attempted actions const last15Minutes = { @@ -181,7 +193,7 @@ export const queueActions: NonNullable = asyn const recentlyFailedActions = await ActionManager.fetchActions( models, { - status: ActionStatus.FAILED, + status: ActionStatus.failed, updatedAt: last15Minutes, }, null, @@ -190,7 +202,7 @@ export const queueActions: NonNullable = asyn const recentlySuccessfulActions = await ActionManager.fetchActions( models, { - status: ActionStatus.SUCCESS, + status: ActionStatus.success, updatedAt: last15Minutes, }, null, @@ -201,9 +213,11 @@ export const queueActions: NonNullable = asyn recentlyFailedActions, }) - const recentlyAttemptedActions = recentlyFailedActions.concat(recentlySuccessfulActions) + const recentlyAttemptedActions = recentlyFailedActions + .concat(recentlySuccessfulActions) + .map((a) => a.toGraphQL()) - let results: ActionResult[] = [] + let results: Action[] = [] // eslint-disable-next-line @typescript-eslint/no-non-null-assertion await models.Action.sequelize!.transaction(async (transaction) => { diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/reallocateAllocation.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/reallocateAllocation.ts index 95d1a840f..64301f49e 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/reallocateAllocation.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/reallocateAllocation.ts @@ -1,5 +1,9 @@ import { extractNetwork } from '../../../../indexer-management/resolvers/utils' -import type { MutationResolvers } from './../../../types.generated' +import { + IdentifierType, + IndexingDecisionBasis, + type MutationResolvers, +} from './../../../types.generated' import { formatGRT, parseGRT, toAddress } from '@graphprotocol/common-ts' import { Allocation, AllocationStatus } from '../../../../allocations/types' import { IndexerErrorCode, indexerError } from '../../../../errors' @@ -7,8 +11,6 @@ import { BigNumber, utils } from 'ethers' import { NetworkMonitor } from '../../../../indexer-management/monitor' import { GraphNode } from '../../../../graph-node' import { allocationIdProof, uniqueAllocationID } from '../../../../allocations/keys' -import { SubgraphIdentifierType } from '../../../../subgraphs' -import { IndexingDecisionBasis } from '../../../../indexer-management/models/indexing-rule' async function resolvePOI( networkMonitor: NetworkMonitor, @@ -359,8 +361,8 @@ export const reallocateAllocation: NonNullable< const indexingRule = { identifier: allocationData.subgraphDeployment.id.ipfsHash, allocationAmount: allocationAmount.toString(), - identifierType: SubgraphIdentifierType.DEPLOYMENT, - decisionBasis: IndexingDecisionBasis.ALWAYS, + identifierType: IdentifierType.deployment, + decisionBasis: IndexingDecisionBasis.always, protocolNetwork, } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setIndexingRule.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setIndexingRule.ts index 21745ebd2..196932831 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setIndexingRule.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setIndexingRule.ts @@ -28,6 +28,17 @@ export const setIndexingRule: NonNullable rule.identifier = identifier // eslint-disable-next-line @typescript-eslint/no-unused-vars - const [updatedRule, _created] = await models.IndexingRule.upsert(rule) + const [updatedRule, _created] = await models.IndexingRule.upsert({ + ...rule, + allocationAmount: rule.allocationAmount?.toString(), + autoRenewal: Boolean(rule.autoRenewal), + minSignal: rule.minSignal?.toString(), + maxSignal: rule.maxSignal?.toString(), + minStake: rule.minStake?.toString(), + minAverageQueryFees: rule.minAverageQueryFees?.toString(), + decisionBasis: rule.decisionBasis || undefined, + requireSupported: Boolean(rule.requireSupported), + safety: Boolean(rule.safety), + }) return updatedRule.toGraphQL() } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/storeDisputes.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/storeDisputes.ts index 8e7620e6b..939cf9a4d 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/storeDisputes.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/storeDisputes.ts @@ -14,15 +14,21 @@ export const storeDisputes: NonNullable = as dispute.protocolNetwork = validateNetworkIdentifier(dispute.protocolNetwork) } - const createdDisputes = await models.POIDispute.bulkCreate(disputes, { - returning: true, - validate: true, - updateOnDuplicate: [ - 'closedEpochReferenceProof', - 'previousEpochReferenceProof', - 'status', - ], - conflictAttributes: ['allocationID', 'protocolNetwork'], - }) + const createdDisputes = await models.POIDispute.bulkCreate( + disputes.map((dispute) => ({ + ...dispute, + allocationAmount: dispute.allocationAmount.toString(), + })), + { + returning: true, + validate: true, + updateOnDuplicate: [ + 'closedEpochReferenceProof', + 'previousEpochReferenceProof', + 'status', + ], + conflictAttributes: ['allocationID', 'protocolNetwork'], + }, + ) return createdDisputes.map((dispute) => dispute.toGraphQL()) } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/updateActions.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/updateActions.ts index 32d839266..8779ad4c3 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/updateActions.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/updateActions.ts @@ -23,5 +23,5 @@ export const updateActions: NonNullable = as logger.info(`'${results[0]}' actions updated`) const response = results[1] - return response + return response.map((action) => action.toGraphQL()) } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/action.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/action.ts index da7d85f49..60e9669c1 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/action.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/action.ts @@ -1,4 +1,5 @@ import type { QueryResolvers } from './../../../types.generated' + export const action: NonNullable = async ( _parent, { actionID }, @@ -7,7 +8,10 @@ export const action: NonNullable = async ( logger.debug(`Execute 'action' query`, { actionID, }) - return models.Action.findOne({ + + const action = await models.Action.findOne({ where: { id: actionID }, }) + + return action?.toGraphQL() ?? null } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/actions.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/actions.ts index f3b98941d..5b93c38c5 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/actions.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/actions.ts @@ -18,9 +18,11 @@ export const actions: NonNullable = async ( ? [[orderBy.toString(), orderDirection ?? 'desc']] : [['id', 'desc']] - return models.Action.findAll({ + const actions = await models.Action.findAll({ where: actionFilterToWhereOptions(filter || {}), order: orderObject, limit: first || undefined, }) + + return actions.map((action) => action.toGraphQL()) } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRules.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRules.ts index 2f11e8f0e..5d17af987 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRules.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRules.ts @@ -11,5 +11,6 @@ export const indexingRules: NonNullable = async const protocolNetwork = uncheckedProtocolNetwork ? validateNetworkIdentifier(uncheckedProtocolNetwork) : undefined - return fetchIndexingRules(models, merged, protocolNetwork) + const rules = await fetchIndexingRules(models, merged, protocolNetwork) + return rules.map((r) => r.toGraphQL()) } diff --git a/packages/indexer-common/src/subgraphs.ts b/packages/indexer-common/src/subgraphs.ts index 0854c670e..9be80fb61 100644 --- a/packages/indexer-common/src/subgraphs.ts +++ b/packages/indexer-common/src/subgraphs.ts @@ -2,26 +2,15 @@ import { base58 } from 'ethers/lib/utils' import { BigNumber, utils } from 'ethers' import { Logger, SubgraphDeploymentID } from '@graphprotocol/common-ts' import { SubgraphDeployment } from './types' -import { - INDEXING_RULE_GLOBAL, - IndexingDecisionBasis, - IndexingRuleAttributes, -} from './indexer-management' +import { INDEXING_RULE_GLOBAL, IndexingRuleAttributes } from './indexer-management' import { DocumentNode, print } from 'graphql' import gql from 'graphql-tag' import { QueryResult } from './network-subgraph' import { mergeSelectionSets, sleep } from './utils' +import { IdentifierType } from './schema/types.generated' -export enum SubgraphIdentifierType { - DEPLOYMENT = 'deployment', - SUBGRAPH = 'subgraph', - GROUP = 'group', -} - -export async function validateSubgraphID( - s: string | undefined, -): Promise { - const type = SubgraphIdentifierType.SUBGRAPH +export async function validateSubgraphID(s: string | undefined): Promise { + const type = IdentifierType.subgraph // Case 1: undefined if (s === undefined) { throw new Error(`No subgraph ID provided. Must be a valid subgraph ID`) @@ -47,8 +36,8 @@ export async function validateSubgraphID( export async function validateDeploymentID( s: string | undefined, -): Promise { - const type = SubgraphIdentifierType.DEPLOYMENT +): Promise { + const type = IdentifierType.deployment // Case 1: undefined if (s === undefined) { throw new Error(`No deployment ID provided. Must be a valid deployment ID`) @@ -83,8 +72,8 @@ export async function validateDeploymentID( export async function validateSubgraphGroupID( s: string | undefined, { all, global }: { all?: boolean; global?: boolean }, -): Promise { - const type = SubgraphIdentifierType.GROUP +): Promise { + const type = IdentifierType.group // Case 1: undefined if (s === undefined) { throw new Error( @@ -110,8 +99,8 @@ export async function validateSubgraphGroupID( export async function processIdentifier( identifier: string, { all, global }: { all?: boolean; global?: boolean }, -): Promise<[string, SubgraphIdentifierType]> { - let type = SubgraphIdentifierType.GROUP +): Promise<[string, IdentifierType]> { + let type: IdentifierType = IdentifierType.group const validationActions = [ validateDeploymentID(identifier), validateSubgraphID(identifier), @@ -123,7 +112,7 @@ export async function processIdentifier( ) as PromiseRejectedResult[] const fulfilled = results.filter( (result) => result.status === 'fulfilled', - ) as PromiseFulfilledResult[] + ) as PromiseFulfilledResult[] if (rejected.length > 2 || fulfilled.length !== 1) { throw new Error( `Invalid subgraph identifier "${identifier}". Subgraph identifier should match 1 type of [deployment ID, subgraph ID, group identifier].`, @@ -132,7 +121,7 @@ export async function processIdentifier( type = fulfilled[0].value return [ - type == SubgraphIdentifierType.DEPLOYMENT + type == IdentifierType.deployment ? new SubgraphDeploymentID(identifier).ipfsHash : identifier, type, @@ -210,7 +199,7 @@ export function isDeploymentWorthAllocatingTowards( const globalRule = rules.find((rule) => rule.identifier === INDEXING_RULE_GLOBAL) const deploymentRule = rules - .filter((rule) => rule.identifierType == SubgraphIdentifierType.DEPLOYMENT) + .filter((rule) => rule.identifierType == 'deployment') .find( (rule) => new SubgraphDeploymentID(rule.identifier).bytes32 === deployment.id.bytes32, @@ -256,7 +245,7 @@ export function isDeploymentWorthAllocatingTowards( deployment.protocolNetwork, ) - case IndexingDecisionBasis.ALWAYS: + case 'always': return new AllocationDecision( deployment.id, deploymentRule, @@ -264,7 +253,7 @@ export function isDeploymentWorthAllocatingTowards( ActivationCriteria.ALWAYS, deployment.protocolNetwork, ) - case IndexingDecisionBasis.NEVER: + case 'never': return new AllocationDecision( deployment.id, deploymentRule, @@ -272,7 +261,7 @@ export function isDeploymentWorthAllocatingTowards( ActivationCriteria.NEVER, deployment.protocolNetwork, ) - case IndexingDecisionBasis.OFFCHAIN: + case 'offchain': return new AllocationDecision( deployment.id, deploymentRule, @@ -280,7 +269,7 @@ export function isDeploymentWorthAllocatingTowards( ActivationCriteria.OFFCHAIN, deployment.protocolNetwork, ) - case IndexingDecisionBasis.RULES: { + case 'rules': { const stakedTokens = BigNumber.from(deployment.stakedTokens) const signalledTokens = BigNumber.from(deployment.signalledTokens) const avgQueryFees = BigNumber.from(deployment.queryFeesAmount) From 50270d33045a6451bf9ac750b2ba482172f7956d Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Wed, 27 Mar 2024 16:13:33 -0400 Subject: [PATCH 26/48] enable typechecking in tests --- packages/indexer-common/jest.config.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/indexer-common/jest.config.js b/packages/indexer-common/jest.config.js index 8cd71ff28..b98c55c5b 100644 --- a/packages/indexer-common/jest.config.js +++ b/packages/indexer-common/jest.config.js @@ -9,12 +9,7 @@ module.exports = { testEnvironment: 'node', testPathIgnorePatterns: ['/node_modules/', '/dist/', '/.yalc', 'util.ts'], transformIgnorePatterns: ['!node_modules/'], - transform:{ '^.+\\.tsx?$': [ - 'ts-jest', - { - isolatedModules: true, - }, - ],}, + transform: { '^.+\\.tsx?$': ['ts-jest'] }, globals: { __DATABASE__: { host: process.env.POSTGRES_TEST_HOST || bail('POSTGRES_TEST_HOST is not defined'), From ade172d6fa552f217b036cb9e0095a49f05f3e12 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Wed, 27 Mar 2024 16:28:57 -0400 Subject: [PATCH 27/48] fix tests --- .../indexer-common/src/indexer-management/rules.ts | 5 +++-- .../resolvers/Mutation/setIndexingRule.ts | 10 +++++----- .../resolvers/Query/indexingRules.ts | 3 +-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/indexer-common/src/indexer-management/rules.ts b/packages/indexer-common/src/indexer-management/rules.ts index a0397d66d..51ad23fbc 100644 --- a/packages/indexer-common/src/indexer-management/rules.ts +++ b/packages/indexer-common/src/indexer-management/rules.ts @@ -22,6 +22,7 @@ export const fetchIndexingRules = async ( ['identifier', 'ASC'], ], }) + if (merged) { // Merge rules by protocol network return Object.entries(groupBy(rules, (rule) => rule.protocolNetwork)) @@ -30,11 +31,11 @@ export const fetchIndexingRules = async ( if (!global) { throw Error(`Could not find global rule for network '${protocolNetwork}'`) } - return rules.map((rule) => rule.mergeGlobal(global)) + return rules.map((rule) => rule.mergeToGraphQL(global)) }) .flat() } else { - return rules + return rules.map((rule) => rule.toGraphQL()) } } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setIndexingRule.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setIndexingRule.ts index 196932831..cc9e44fc9 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setIndexingRule.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setIndexingRule.ts @@ -30,15 +30,15 @@ export const setIndexingRule: NonNullable // eslint-disable-next-line @typescript-eslint/no-unused-vars const [updatedRule, _created] = await models.IndexingRule.upsert({ ...rule, - allocationAmount: rule.allocationAmount?.toString(), - autoRenewal: Boolean(rule.autoRenewal), + allocationAmount: rule.allocationAmount?.toString() ?? null, + autoRenewal: rule.autoRenewal === null ? undefined : rule.autoRenewal, minSignal: rule.minSignal?.toString(), maxSignal: rule.maxSignal?.toString(), minStake: rule.minStake?.toString(), minAverageQueryFees: rule.minAverageQueryFees?.toString(), - decisionBasis: rule.decisionBasis || undefined, - requireSupported: Boolean(rule.requireSupported), - safety: Boolean(rule.safety), + decisionBasis: rule.decisionBasis === null ? undefined : rule.decisionBasis, + requireSupported: rule.requireSupported === null ? undefined : rule.requireSupported, + safety: rule.safety === null ? undefined : rule.safety, }) return updatedRule.toGraphQL() } diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRules.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRules.ts index 5d17af987..2f11e8f0e 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRules.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexingRules.ts @@ -11,6 +11,5 @@ export const indexingRules: NonNullable = async const protocolNetwork = uncheckedProtocolNetwork ? validateNetworkIdentifier(uncheckedProtocolNetwork) : undefined - const rules = await fetchIndexingRules(models, merged, protocolNetwork) - return rules.map((r) => r.toGraphQL()) + return fetchIndexingRules(models, merged, protocolNetwork) } From 37c62ae8088bd08046ea54764ffed5c0242d22c2 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Wed, 27 Mar 2024 16:43:44 -0400 Subject: [PATCH 28/48] fix more type issues --- .../indexer-common/src/indexer-management/rules.ts | 4 ++-- packages/indexer-common/src/subgraphs.ts | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/indexer-common/src/indexer-management/rules.ts b/packages/indexer-common/src/indexer-management/rules.ts index 51ad23fbc..642862bc9 100644 --- a/packages/indexer-common/src/indexer-management/rules.ts +++ b/packages/indexer-common/src/indexer-management/rules.ts @@ -2,11 +2,11 @@ import { Logger } from '@graphprotocol/common-ts' import { IndexerManagementModels, INDEXING_RULE_GLOBAL, - IndexingRule, IndexingRuleAttributes, } from '@graphprotocol/indexer-common' import { parseIndexingRule } from '../rules' import groupBy from 'lodash.groupby' +import { IndexingRule } from '../schema/types.generated' export const fetchIndexingRules = async ( models: IndexerManagementModels, @@ -55,5 +55,5 @@ export const upsertIndexingRule = async ( }, ) // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - return updatedRule! + return updatedRule.toGraphQL()! } diff --git a/packages/indexer-common/src/subgraphs.ts b/packages/indexer-common/src/subgraphs.ts index 9be80fb61..e3e95f5e0 100644 --- a/packages/indexer-common/src/subgraphs.ts +++ b/packages/indexer-common/src/subgraphs.ts @@ -2,12 +2,12 @@ import { base58 } from 'ethers/lib/utils' import { BigNumber, utils } from 'ethers' import { Logger, SubgraphDeploymentID } from '@graphprotocol/common-ts' import { SubgraphDeployment } from './types' -import { INDEXING_RULE_GLOBAL, IndexingRuleAttributes } from './indexer-management' +import { INDEXING_RULE_GLOBAL } from './indexer-management' import { DocumentNode, print } from 'graphql' import gql from 'graphql-tag' import { QueryResult } from './network-subgraph' import { mergeSelectionSets, sleep } from './utils' -import { IdentifierType } from './schema/types.generated' +import { IdentifierType, IndexingRule } from './schema/types.generated' export async function validateSubgraphID(s: string | undefined): Promise { const type = IdentifierType.subgraph @@ -149,7 +149,7 @@ export enum ActivationCriteria { } interface RuleMatch { - rule: IndexingRuleAttributes | undefined + rule: IndexingRule | undefined activationCriteria: ActivationCriteria } @@ -161,7 +161,7 @@ export class AllocationDecision { constructor( deployment: SubgraphDeploymentID, - matchingRule: IndexingRuleAttributes | undefined, + matchingRule: IndexingRule | undefined, toAllocate: boolean, ruleActivator: ActivationCriteria, protocolNetwork: string, @@ -184,7 +184,7 @@ export class AllocationDecision { export function evaluateDeployments( logger: Logger, networkDeployments: SubgraphDeployment[], - rules: IndexingRuleAttributes[], + rules: IndexingRule[], ): AllocationDecision[] { return networkDeployments.map((deployment) => isDeploymentWorthAllocatingTowards(logger, deployment, rules), @@ -194,7 +194,7 @@ export function evaluateDeployments( export function isDeploymentWorthAllocatingTowards( logger: Logger, deployment: SubgraphDeployment, - rules: IndexingRuleAttributes[], + rules: IndexingRule[], ): AllocationDecision { const globalRule = rules.find((rule) => rule.identifier === INDEXING_RULE_GLOBAL) const deploymentRule = From ea7c70451b5ee3977efad83da644f58b191de08b Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Thu, 28 Mar 2024 14:21:05 -0400 Subject: [PATCH 29/48] format command --- packages/indexer-common/codegen.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/indexer-common/codegen.ts b/packages/indexer-common/codegen.ts index 000ffcd8d..4ead36a49 100644 --- a/packages/indexer-common/codegen.ts +++ b/packages/indexer-common/codegen.ts @@ -3,6 +3,9 @@ import { defineConfig } from '@eddeee888/gcg-typescript-resolver-files' const config: CodegenConfig = { schema: 'src/indexer-management/schema.graphql', + hooks: { + afterOneFileWrite: ['yarn format'], + }, generates: { 'src/schema': defineConfig({ typesPluginsConfig: { From 98f669884c98ee7d269b95268bd7e295332f11f8 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Mon, 1 Apr 2024 18:32:44 -0400 Subject: [PATCH 30/48] fix some --- packages/indexer-agent/src/agent.ts | 23 ++++++++--------------- packages/indexer-common/src/index.ts | 1 + 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/packages/indexer-agent/src/agent.ts b/packages/indexer-agent/src/agent.ts index 870637d53..f5a0a67dd 100644 --- a/packages/indexer-agent/src/agent.ts +++ b/packages/indexer-agent/src/agent.ts @@ -9,14 +9,13 @@ import { } from '@graphprotocol/common-ts' import { ActivationCriteria, - ActionStatus, + GeneratedGraphQLTypes, Allocation, AllocationManagementMode, allocationRewardsPool, AllocationStatus, indexerError, IndexerErrorCode, - IndexingDecisionBasis, IndexerManagementClient, IndexingRuleAttributes, Network, @@ -24,7 +23,6 @@ import { RewardsPool, Subgraph, SubgraphDeployment, - SubgraphIdentifierType, evaluateDeployments, AllocationDecision, GraphNode, @@ -58,7 +56,7 @@ const deploymentRuleInList = ( ): boolean => list.find( rule => - rule.identifierType == SubgraphIdentifierType.DEPLOYMENT && + rule.identifierType == 'deployment' && new SubgraphDeploymentID(rule.identifier).toString() == deployment.toString(), ) !== undefined @@ -80,7 +78,7 @@ export const convertSubgraphBasedRulesToDeploymentBased = ( ): IndexingRuleAttributes[] => { const toAdd: IndexingRuleAttributes[] = [] rules.map(rule => { - if (rule.identifierType !== SubgraphIdentifierType.SUBGRAPH) { + if (rule.identifierType !== 'subgraph') { return rule } const ruleSubgraph = subgraphs.find( @@ -94,7 +92,7 @@ export const convertSubgraphBasedRulesToDeploymentBased = ( if (latestDeploymentVersion) { if (!deploymentRuleInList(rules, latestDeploymentVersion!.deployment)) { rule.identifier = latestDeploymentVersion!.deployment.toString() - rule.identifierType = SubgraphIdentifierType.DEPLOYMENT + rule.identifierType = 'deployment' } const currentTimestamp = Math.floor(Date.now() / 1000) @@ -112,8 +110,7 @@ export const convertSubgraphBasedRulesToDeploymentBased = ( const previousDeploymentRule = { ...rule } previousDeploymentRule.identifier = previousDeploymentVersion!.deployment.toString() - previousDeploymentRule.identifierType = - SubgraphIdentifierType.DEPLOYMENT + previousDeploymentRule.identifierType = 'deployment' toAdd.push(previousDeploymentRule) } } @@ -302,9 +299,7 @@ export class Agent { }) let rules = await operator.indexingRules(true) const subgraphRuleIds = rules - .filter( - rule => rule.identifierType == SubgraphIdentifierType.SUBGRAPH, - ) + .filter(rule => rule.identifierType == 'subgraph') .map(rule => rule.identifier!) const subgraphsMatchingRules = await network.networkMonitor.subgraphs(subgraphRuleIds) @@ -546,9 +541,7 @@ export class Agent { // Add offchain subgraphs to the deployment list from rules Object.values(indexingRules) .flat() - .filter( - rule => rule?.decisionBasis === IndexingDecisionBasis.OFFCHAIN, - ) + .filter(rule => rule?.decisionBasis === 'offchain') .forEach(rule => { targetDeploymentIDs.add(new SubgraphDeploymentID(rule.identifier)) }) @@ -1208,7 +1201,7 @@ export class Agent { ) => { // Do nothing if there are already approved actions in the queue awaiting execution const approvedActions = await operator.fetchActions({ - status: ActionStatus.APPROVED, + status: GeneratedGraphQLTypes.ActionStatus.approved, protocolNetwork: network.specification.networkIdentifier, }) if (approvedActions.length > 0) { diff --git a/packages/indexer-common/src/index.ts b/packages/indexer-common/src/index.ts index 0090cad0d..a282863c7 100644 --- a/packages/indexer-common/src/index.ts +++ b/packages/indexer-common/src/index.ts @@ -17,3 +17,4 @@ export * from './utils' export * from './parsers' export * as specification from './network-specification' export * from './multi-networks' +export * as GeneratedGraphQLTypes from "./schema/types.generated" \ No newline at end of file From cffb378ded7e12a4b24ba10faa25be71edca8f31 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Mon, 1 Apr 2024 18:45:23 -0400 Subject: [PATCH 31/48] fix more --- packages/indexer-agent/src/__tests__/agent.ts | 90 ++++++++++++------- packages/indexer-agent/src/agent.ts | 81 ++++++++--------- packages/indexer-common/src/operator.ts | 3 +- 3 files changed, 101 insertions(+), 73 deletions(-) diff --git a/packages/indexer-agent/src/__tests__/agent.ts b/packages/indexer-agent/src/__tests__/agent.ts index 700e15f98..ce3845bca 100644 --- a/packages/indexer-agent/src/__tests__/agent.ts +++ b/packages/indexer-agent/src/__tests__/agent.ts @@ -3,10 +3,8 @@ import { consolidateAllocationDecisions, } from '../agent' import { + GeneratedGraphQLTypes, INDEXING_RULE_GLOBAL, - IndexingDecisionBasis, - IndexingRuleAttributes, - SubgraphIdentifierType, SubgraphVersion, } from '@graphprotocol/indexer-common' import { SubgraphDeploymentID } from '@graphprotocol/common-ts' @@ -16,8 +14,8 @@ describe('Agent convenience function tests', () => { const inputRules = [ { identifier: INDEXING_RULE_GLOBAL, - identifierType: SubgraphIdentifierType.GROUP, - allocationAmount: '2300', + identifierType: 'group', + allocationAmount: BigInt(2300), parallelAllocations: null, maxAllocationPercentage: null, minSignal: null, @@ -25,12 +23,16 @@ describe('Agent convenience function tests', () => { minStake: null, minAverageQueryFees: null, custom: null, - decisionBasis: IndexingDecisionBasis.RULES, + decisionBasis: 'rules', + autoRenewal: false, + requireSupported: false, + safety: false, + protocolNetwork: 'sepolia', }, { identifier: '0x0000000000000000000000000000000000000000-0', - identifierType: SubgraphIdentifierType.SUBGRAPH, - allocationAmount: '3000', + identifierType: 'subgraph', + allocationAmount: BigInt(3000), parallelAllocations: null, maxAllocationPercentage: null, minSignal: null, @@ -38,12 +40,16 @@ describe('Agent convenience function tests', () => { minStake: null, minAverageQueryFees: null, custom: null, - decisionBasis: IndexingDecisionBasis.RULES, + decisionBasis: 'rules', + autoRenewal: false, + requireSupported: false, + safety: false, + protocolNetwork: 'sepolia', }, { identifier: 'QmZZtzZkfzCWMNrajxBf22q7BC9HzoT5iJUK3S8qA6zNZr', - identifierType: SubgraphIdentifierType.DEPLOYMENT, - allocationAmount: '12000', + identifierType: 'deployment', + allocationAmount: BigInt(12000), parallelAllocations: null, maxAllocationPercentage: null, minSignal: null, @@ -51,9 +57,13 @@ describe('Agent convenience function tests', () => { minStake: null, minAverageQueryFees: null, custom: null, - decisionBasis: IndexingDecisionBasis.RULES, + decisionBasis: 'rules', + protocolNetwork: 'sepolia', + autoRenewal: false, + requireSupported: false, + safety: false, }, - ] as IndexingRuleAttributes[] + ] satisfies GeneratedGraphQLTypes.IndexingRule[] const subgraphs = [ { @@ -73,8 +83,8 @@ describe('Agent convenience function tests', () => { const expectedRules = [ { identifier: INDEXING_RULE_GLOBAL, - identifierType: SubgraphIdentifierType.GROUP, - allocationAmount: '2300', + identifierType: 'group', + allocationAmount: BigInt(2300), parallelAllocations: null, maxAllocationPercentage: null, minSignal: null, @@ -82,13 +92,17 @@ describe('Agent convenience function tests', () => { minStake: null, minAverageQueryFees: null, custom: null, - decisionBasis: IndexingDecisionBasis.RULES, + decisionBasis: 'rules', + protocolNetwork: 'sepolia', + autoRenewal: false, + requireSupported: false, + safety: false, }, { identifier: '0xc9d18c59e4aaf2c1f86dfef16fbdc0f81eae8ada58d87a23d2666c45704b8823', - identifierType: SubgraphIdentifierType.DEPLOYMENT, - allocationAmount: '3000', + identifierType: 'deployment', + allocationAmount: BigInt(3000), parallelAllocations: null, maxAllocationPercentage: null, minSignal: null, @@ -96,12 +110,16 @@ describe('Agent convenience function tests', () => { minStake: null, minAverageQueryFees: null, custom: null, - decisionBasis: IndexingDecisionBasis.RULES, + decisionBasis: 'rules', + protocolNetwork: 'sepolia', + autoRenewal: false, + requireSupported: false, + safety: false, }, { identifier: 'QmZZtzZkfzCWMNrajxBf22q7BC9HzoT5iJUK3S8qA6zNZr', - identifierType: SubgraphIdentifierType.DEPLOYMENT, - allocationAmount: '12000', + identifierType: 'deployment', + allocationAmount: BigInt(12000), parallelAllocations: null, maxAllocationPercentage: null, minSignal: null, @@ -109,9 +127,13 @@ describe('Agent convenience function tests', () => { minStake: null, minAverageQueryFees: null, custom: null, - decisionBasis: IndexingDecisionBasis.RULES, + decisionBasis: 'rules', + protocolNetwork: 'sepolia', + autoRenewal: false, + requireSupported: false, + safety: false, }, - ] as IndexingRuleAttributes[] + ] satisfies GeneratedGraphQLTypes.IndexingRule[] expect( convertSubgraphBasedRulesToDeploymentBased(inputRules, subgraphs, 1000), @@ -122,8 +144,8 @@ describe('Agent convenience function tests', () => { const inputRules = [ { identifier: INDEXING_RULE_GLOBAL, - identifierType: SubgraphIdentifierType.GROUP, - allocationAmount: '2300', + identifierType: 'group', + allocationAmount: BigInt(2300), parallelAllocations: null, maxAllocationPercentage: null, minSignal: null, @@ -131,12 +153,16 @@ describe('Agent convenience function tests', () => { minStake: null, minAverageQueryFees: null, custom: null, - decisionBasis: IndexingDecisionBasis.RULES, + decisionBasis: 'rules', + protocolNetwork: 'sepolia', + autoRenewal: false, + requireSupported: false, + safety: false, }, { identifier: 'QmZZtzZkfzCWMNrajxBf22q7BC9HzoT5iJUK3S8qA6zNZr', - identifierType: SubgraphIdentifierType.DEPLOYMENT, - allocationAmount: '12000', + identifierType: 'deployment', + allocationAmount: BigInt(12000), parallelAllocations: null, maxAllocationPercentage: null, minSignal: null, @@ -144,9 +170,13 @@ describe('Agent convenience function tests', () => { minStake: null, minAverageQueryFees: null, custom: null, - decisionBasis: IndexingDecisionBasis.RULES, + decisionBasis: 'rules', + protocolNetwork: 'sepolia', + autoRenewal: false, + requireSupported: false, + safety: false, }, - ] as IndexingRuleAttributes[] + ] satisfies GeneratedGraphQLTypes.IndexingRule[] const subgraphs = [ { diff --git a/packages/indexer-agent/src/agent.ts b/packages/indexer-agent/src/agent.ts index f5a0a67dd..e1f7fa578 100644 --- a/packages/indexer-agent/src/agent.ts +++ b/packages/indexer-agent/src/agent.ts @@ -17,7 +17,6 @@ import { indexerError, IndexerErrorCode, IndexerManagementClient, - IndexingRuleAttributes, Network, POIDisputeAttributes, RewardsPool, @@ -51,7 +50,7 @@ const deploymentInList = ( list.find(item => item.bytes32 === deployment.bytes32) !== undefined const deploymentRuleInList = ( - list: IndexingRuleAttributes[], + list: GeneratedGraphQLTypes.IndexingRule[], deployment: SubgraphDeploymentID, ): boolean => list.find( @@ -72,11 +71,11 @@ const uniqueDeployments = ( ): SubgraphDeploymentID[] => deployments.filter(uniqueDeploymentsOnly) export const convertSubgraphBasedRulesToDeploymentBased = ( - rules: IndexingRuleAttributes[], + rules: GeneratedGraphQLTypes.IndexingRule[], subgraphs: Subgraph[], previousVersionBuffer: number, -): IndexingRuleAttributes[] => { - const toAdd: IndexingRuleAttributes[] = [] +): GeneratedGraphQLTypes.IndexingRule[] => { + const toAdd: GeneratedGraphQLTypes.IndexingRule[] = [] rules.map(rule => { if (rule.identifierType !== 'subgraph') { return rule @@ -290,40 +289,41 @@ export class Agent { }, ) - const indexingRules: Eventual> = - timer(20_000).tryMap( - async () => { - return this.multiNetworks.map(async ({ network, operator }) => { - logger.trace('Fetching indexing rules', { - protocolNetwork: network.specification.networkIdentifier, - }) - let rules = await operator.indexingRules(true) - const subgraphRuleIds = rules - .filter(rule => rule.identifierType == 'subgraph') - .map(rule => rule.identifier!) - const subgraphsMatchingRules = - await network.networkMonitor.subgraphs(subgraphRuleIds) - if (subgraphsMatchingRules.length >= 1) { - const epochLength = - await network.contracts.epochManager.epochLength() - const blockPeriod = 15 - const bufferPeriod = epochLength.toNumber() * blockPeriod * 100 // 100 epochs - rules = convertSubgraphBasedRulesToDeploymentBased( - rules, - subgraphsMatchingRules, - bufferPeriod, - ) - } - return rules + const indexingRules: Eventual< + NetworkMapped + > = timer(20_000).tryMap( + async () => { + return this.multiNetworks.map(async ({ network, operator }) => { + logger.trace('Fetching indexing rules', { + protocolNetwork: network.specification.networkIdentifier, }) - }, - { - onError: error => - logger.warn(`Failed to obtain indexing rules, trying again later`, { - error, - }), - }, - ) + let rules = await operator.indexingRules(true) + const subgraphRuleIds = rules + .filter(rule => rule.identifierType == 'subgraph') + .map(rule => rule.identifier!) + const subgraphsMatchingRules = + await network.networkMonitor.subgraphs(subgraphRuleIds) + if (subgraphsMatchingRules.length >= 1) { + const epochLength = + await network.contracts.epochManager.epochLength() + const blockPeriod = 15 + const bufferPeriod = epochLength.toNumber() * blockPeriod * 100 // 100 epochs + rules = convertSubgraphBasedRulesToDeploymentBased( + rules, + subgraphsMatchingRules, + bufferPeriod, + ) + } + return rules + }) + }, + { + onError: error => + logger.warn(`Failed to obtain indexing rules, trying again later`, { + error, + }), + }, + ) const activeDeployments: Eventual = timer( 60_000, @@ -417,10 +417,7 @@ export class Agent { ({ indexingRules, networkDeployments }) => { return mapValues( this.multiNetworks.zip(indexingRules, networkDeployments), - ([indexingRules, networkDeployments]: [ - IndexingRuleAttributes[], - SubgraphDeployment[], - ]) => { + ([indexingRules, networkDeployments]) => { // Identify subgraph deployments on the network that are worth picking up; // these may overlap with the ones we're already indexing logger.trace('Evaluating which deployments are worth allocating to') diff --git a/packages/indexer-common/src/operator.ts b/packages/indexer-common/src/operator.ts index bb602c77b..a2848d9b2 100644 --- a/packages/indexer-common/src/operator.ts +++ b/packages/indexer-common/src/operator.ts @@ -12,6 +12,7 @@ import { specification as spec, Action, POIDisputeAttributes, + GeneratedGraphQLTypes, } from '@graphprotocol/indexer-common' import { Logger, formatGRT } from '@graphprotocol/common-ts' import { BigNumber, utils } from 'ethers' @@ -88,7 +89,7 @@ export class Operator { // * Indexing Rules // -------------------------------------------------------------------------------- // Retrieves the indexing rules from the indexer management API. - async indexingRules(merged: boolean): Promise { + async indexingRules(merged: boolean): Promise { try { this.logger.debug('Fetching indexing rules') const result = await this.indexerManagement From 94926f7b7bd3e4e8221361f1931f2ecd6bf0fbae Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Mon, 1 Apr 2024 18:58:14 -0400 Subject: [PATCH 32/48] mostly there --- packages/indexer-cli/src/actions.ts | 69 ++++++++++--------- .../src/commands/indexer/actions/approve.ts | 4 +- .../src/commands/indexer/actions/get.ts | 8 +-- .../src/commands/indexer/actions/queue.ts | 10 +-- .../src/commands/indexer/actions/update.ts | 4 +- .../commands/indexer/allocations/create.ts | 3 +- .../src/commands/indexer/allocations/get.ts | 6 +- .../src/commands/indexer/rules/maybe.ts | 4 +- .../src/commands/indexer/rules/offchain.ts | 4 +- .../src/commands/indexer/rules/start.ts | 4 +- .../src/commands/indexer/rules/stop.ts | 4 +- packages/indexer-cli/src/cost.ts | 4 +- packages/indexer-cli/src/rules.ts | 9 +-- 13 files changed, 63 insertions(+), 70 deletions(-) diff --git a/packages/indexer-cli/src/actions.ts b/packages/indexer-cli/src/actions.ts index b3815ebc0..d5922f4c7 100644 --- a/packages/indexer-cli/src/actions.ts +++ b/packages/indexer-cli/src/actions.ts @@ -1,16 +1,12 @@ import { - ActionFilter, - ActionInput, ActionParams, ActionResult, - ActionStatus, - ActionType, ActionUpdateInput, + GeneratedGraphQLTypes, IndexerManagementClient, nullPassThrough, OrderDirection, parseBoolean, - validateNetworkIdentifier, } from '@graphprotocol/indexer-common' import { validatePOI, validateRequiredParams } from './command-helpers' import gql from 'graphql-tag' @@ -27,17 +23,17 @@ export interface GenericActionInputParams { // Make separate functions for each action type parsing from generic? export async function buildActionInput( - type: ActionType, + type: GeneratedGraphQLTypes.ActionType, actionParams: GenericActionInputParams, source: string, reason: string, - status: ActionStatus, + status: GeneratedGraphQLTypes.ActionStatus, priority: number, protocolNetwork: string, -): Promise { +): Promise { await validateActionInput(type, actionParams) switch (type) { - case ActionType.ALLOCATE: + case 'allocate': return { deploymentID: actionParams.targetDeployment, amount: actionParams.param1?.toString(), @@ -48,7 +44,7 @@ export async function buildActionInput( priority, protocolNetwork, } - case ActionType.UNALLOCATE: { + case 'unallocate': { let poi = actionParams.param2 if (poi == '0' || poi == '0x0') { poi = utils.hexlify(Array(32).fill(0)) @@ -66,7 +62,7 @@ export async function buildActionInput( protocolNetwork, } } - case ActionType.REALLOCATE: { + case 'reallocate': { let poi = actionParams.param3 if (poi == '0' || poi == '0x0') { poi = utils.hexlify(Array(32).fill(0)) @@ -89,18 +85,18 @@ export async function buildActionInput( } export async function validateActionInput( - type: ActionType, + type: GeneratedGraphQLTypes.ActionType, actionParams: GenericActionInputParams, ): Promise { let requiredFields: string[] = [] switch (type) { - case ActionType.ALLOCATE: + case 'allocate': requiredFields = requiredFields.concat(['targetDeployment', 'param1']) break - case ActionType.UNALLOCATE: + case 'unallocate': requiredFields = requiredFields.concat(['targetDeployment', 'param1']) break - case ActionType.REALLOCATE: + case 'reallocate': requiredFields = requiredFields.concat(['targetDeployment', 'param1', 'param2']) } @@ -110,30 +106,34 @@ export async function validateActionInput( ) } -export function validateActionType(input: string): ActionType { - const validVariants = Object.keys(ActionType).map(variant => - variant.toLocaleLowerCase(), +export function validateActionType(input: string): GeneratedGraphQLTypes.ActionType { + const validVariants = Object.keys(GeneratedGraphQLTypes.ActionType).map(variant => + variant.toLowerCase(), ) - if (!validVariants.includes(input.toLocaleLowerCase())) { + if (!validVariants.includes(input.toLowerCase())) { throw Error( `Invalid 'ActionType' "${input}", must be one of ['${validVariants.join(`', '`)}']`, ) } - return ActionType[input.toUpperCase() as keyof typeof ActionType] + return GeneratedGraphQLTypes.ActionType[ + input.toLowerCase() as keyof typeof GeneratedGraphQLTypes.ActionType + ] } -export function validateActionStatus(input: string): ActionStatus { - const validVariants = Object.keys(ActionStatus).map(variant => - variant.toLocaleLowerCase(), +export function validateActionStatus(input: string): GeneratedGraphQLTypes.ActionStatus { + const validVariants = Object.keys(GeneratedGraphQLTypes.ActionStatus).map(variant => + variant.toLowerCase(), ) - if (!validVariants.includes(input.toLocaleLowerCase())) { + if (!validVariants.includes(input.toLowerCase())) { throw Error( `Invalid 'ActionStatus' "${input}", must be one of ['${validVariants.join( `', '`, )}']`, ) } - return ActionStatus[input.toUpperCase() as keyof typeof ActionStatus] + return GeneratedGraphQLTypes.ActionStatus[ + input.toUpperCase() as keyof typeof GeneratedGraphQLTypes.ActionStatus + ] } export function buildActionFilter( @@ -142,8 +142,8 @@ export function buildActionFilter( status: string | undefined, source: string | undefined, reason: string | undefined, -): ActionFilter { - const filter: ActionFilter = {} +): GeneratedGraphQLTypes.ActionFilter { + const filter: GeneratedGraphQLTypes.ActionFilter = {} if (id) { filter.id = +id } @@ -169,7 +169,7 @@ export function buildActionFilter( export async function queueActions( client: IndexerManagementClient, - actions: ActionInput[], + actions: GeneratedGraphQLTypes.ActionInput[], ): Promise { const result = await client .mutation( @@ -202,8 +202,11 @@ export async function queueActions( return result.data.queueActions } -// eslint-disable-next-line @typescript-eslint/no-explicit-any -const ACTION_PARAMS_PARSERS: Record any> = { +const ACTION_PARAMS_PARSERS: Record< + keyof GeneratedGraphQLTypes.ActionUpdateInput, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (x: never) => any +> = { deploymentID: x => nullPassThrough(x), allocationID: x => x, amount: nullPassThrough(parseGRT), @@ -212,7 +215,7 @@ const ACTION_PARAMS_PARSERS: Record any> type: x => validateActionType(x), status: x => validateActionStatus(x), reason: nullPassThrough, - protocolNetwork: x => validateNetworkIdentifier(x), + id: x => nullPassThrough(x), } /** @@ -374,7 +377,7 @@ export async function fetchAction( export async function fetchActions( client: IndexerManagementClient, - actionFilter: ActionFilter, + actionFilter: GeneratedGraphQLTypes.ActionFilter, first?: number, orderBy?: ActionParams, orderDirection?: OrderDirection, @@ -461,7 +464,7 @@ export async function deleteActions( export async function updateActions( client: IndexerManagementClient, - filter: ActionFilter, + filter: GeneratedGraphQLTypes.ActionFilter, action: ActionUpdateInput, ): Promise { const result = await client diff --git a/packages/indexer-cli/src/commands/indexer/actions/approve.ts b/packages/indexer-cli/src/commands/indexer/actions/approve.ts index 52e32f55c..800b50c7e 100644 --- a/packages/indexer-cli/src/commands/indexer/actions/approve.ts +++ b/packages/indexer-cli/src/commands/indexer/actions/approve.ts @@ -10,7 +10,7 @@ import { extractProtocolNetworkOption, } from '../../../command-helpers' import { approveActions, fetchActions } from '../../../actions' -import { ActionStatus, resolveChainAlias } from '@graphprotocol/indexer-common' +import { GeneratedGraphQLTypes, resolveChainAlias } from '@graphprotocol/indexer-common' const HELP = ` ${chalk.bold('graph indexer actions approve')} [options] [ ...] @@ -65,7 +65,7 @@ module.exports = { ) } const queuedActions = await fetchActions(client, { - status: ActionStatus.QUEUED, + status: GeneratedGraphQLTypes.ActionStatus.queued, protocolNetwork, }) diff --git a/packages/indexer-cli/src/commands/indexer/actions/get.ts b/packages/indexer-cli/src/commands/indexer/actions/get.ts index ce73d2740..bde8c4264 100644 --- a/packages/indexer-cli/src/commands/indexer/actions/get.ts +++ b/packages/indexer-cli/src/commands/indexer/actions/get.ts @@ -92,8 +92,8 @@ module.exports = { } = parameters.options const [action] = fixParameters(parameters, { h, help }) || [] - let orderByParam = ActionParams.ID - let orderDirectionValue = OrderDirection.DESC + let orderByParam = ActionParams.id + let orderDirectionValue = OrderDirection.desc const outputFormat = o || output || 'table' const protocolNetwork: string | undefined = extractProtocolNetworkOption( @@ -142,8 +142,8 @@ module.exports = { if (orderBy) { orderByParam = ActionParams[orderBy.toUpperCase() as keyof typeof ActionParams] orderDirectionValue = orderDirection - ? OrderDirection[orderDirection.toUpperCase() as keyof typeof OrderDirection] - : OrderDirection.DESC + ? OrderDirection[orderDirection.toLowerCase() as keyof typeof OrderDirection] + : OrderDirection.desc } if (!['undefined', 'number'].includes(typeof first)) { diff --git a/packages/indexer-cli/src/commands/indexer/actions/queue.ts b/packages/indexer-cli/src/commands/indexer/actions/queue.ts index f334b40ea..ca70e53c0 100644 --- a/packages/indexer-cli/src/commands/indexer/actions/queue.ts +++ b/packages/indexer-cli/src/commands/indexer/actions/queue.ts @@ -8,11 +8,7 @@ import { printObjectOrArray, } from '../../../command-helpers' import { buildActionInput, queueActions, validateActionType } from '../../../actions' -import { - ActionInput, - ActionStatus, - resolveChainAlias, -} from '@graphprotocol/indexer-common' +import { GeneratedGraphQLTypes, resolveChainAlias } from '@graphprotocol/indexer-common' const HELP = ` ${chalk.bold( @@ -65,7 +61,7 @@ module.exports = { const [type, targetDeployment, param1, param2, param3, param4] = parameters.array || [] - let actionInputParams: ActionInput + let actionInputParams: GeneratedGraphQLTypes.ActionInput try { if (!['json', 'yaml', 'table'].includes(outputFormat)) { throw Error( @@ -80,7 +76,7 @@ module.exports = { { targetDeployment, param1, param2, param3, param4 }, decisionSource, decisionReason, - ActionStatus.QUEUED, + 'queued', executionPriority, networkIdentifier, ) diff --git a/packages/indexer-cli/src/commands/indexer/actions/update.ts b/packages/indexer-cli/src/commands/indexer/actions/update.ts index 6ea470cac..961222e4b 100644 --- a/packages/indexer-cli/src/commands/indexer/actions/update.ts +++ b/packages/indexer-cli/src/commands/indexer/actions/update.ts @@ -3,8 +3,8 @@ import chalk from 'chalk' import { Action, - ActionFilter, ActionUpdateInput, + GeneratedGraphQLTypes, resolveChainAlias, } from '@graphprotocol/indexer-common' import { loadValidatedConfig } from '../../../config' @@ -44,7 +44,7 @@ module.exports = { const [...setValues] = fixParameters(parameters, { h, help }) || [] let updateActionInput: ActionUpdateInput = {} - let actionFilter: ActionFilter = {} + let actionFilter: GeneratedGraphQLTypes.ActionFilter = {} const outputFormat = o || output || 'table' diff --git a/packages/indexer-cli/src/commands/indexer/allocations/create.ts b/packages/indexer-cli/src/commands/indexer/allocations/create.ts index 6986bfbe2..2a9bf2391 100644 --- a/packages/indexer-cli/src/commands/indexer/allocations/create.ts +++ b/packages/indexer-cli/src/commands/indexer/allocations/create.ts @@ -7,7 +7,6 @@ import { BigNumber } from 'ethers' import { createAllocation } from '../../../allocations' import { processIdentifier, - SubgraphIdentifierType, validateNetworkIdentifier, } from '@graphprotocol/indexer-common' import { printObjectOrArray } from '../../../command-helpers' @@ -73,7 +72,7 @@ module.exports = { all: false, global: false, }) - if (type !== SubgraphIdentifierType.DEPLOYMENT) { + if (type !== 'deployment') { throw Error( `Invalid 'deploymentID' provided (${deploymentID}), must be bytes32 or base58 formatted)`, ) diff --git a/packages/indexer-cli/src/commands/indexer/allocations/get.ts b/packages/indexer-cli/src/commands/indexer/allocations/get.ts index 2ab707567..75655220e 100644 --- a/packages/indexer-cli/src/commands/indexer/allocations/get.ts +++ b/packages/indexer-cli/src/commands/indexer/allocations/get.ts @@ -6,7 +6,7 @@ import { createIndexerManagementClient } from '../../../client' import { extractProtocolNetworkOption, fixParameters } from '../../../command-helpers' import gql from 'graphql-tag' import { SubgraphDeploymentID } from '@graphprotocol/common-ts' -import { processIdentifier, SubgraphIdentifierType } from '@graphprotocol/indexer-common' +import { GeneratedGraphQLTypes, processIdentifier } from '@graphprotocol/indexer-common' import { IndexerAllocation, printIndexerAllocations } from '../../../allocations' import { utils } from 'ethers' @@ -75,14 +75,14 @@ module.exports = { } let deploymentString: string | undefined = undefined - let type: SubgraphIdentifierType + let type: GeneratedGraphQLTypes.IdentifierType if (deployment) { ;[deploymentString, type] = await processIdentifier(deployment, { all: true, global: false, }) - if (type !== SubgraphIdentifierType.DEPLOYMENT) { + if (type !== 'deployment') { throw Error( `Invalid '--deployment' must be a valid deployment ID (bytes32 or base58 formatted)`, ) diff --git a/packages/indexer-cli/src/commands/indexer/rules/maybe.ts b/packages/indexer-cli/src/commands/indexer/rules/maybe.ts index b23b5cb61..0f08b423b 100644 --- a/packages/indexer-cli/src/commands/indexer/rules/maybe.ts +++ b/packages/indexer-cli/src/commands/indexer/rules/maybe.ts @@ -8,7 +8,7 @@ import { fixParameters, parseOutputFormat, } from '../../../command-helpers' -import { IndexingDecisionBasis, processIdentifier } from '@graphprotocol/indexer-common' +import { processIdentifier } from '@graphprotocol/indexer-common' import { setIndexingRule, displayRules, parseIndexingRule } from '../../../rules' const HELP = ` @@ -54,7 +54,7 @@ module.exports = { const inputRule = parseIndexingRule({ identifier, identifierType, - decisionBasis: IndexingDecisionBasis.RULES, + decisionBasis: 'rules', protocolNetwork, }) diff --git a/packages/indexer-cli/src/commands/indexer/rules/offchain.ts b/packages/indexer-cli/src/commands/indexer/rules/offchain.ts index 0c43b3166..13d512da4 100644 --- a/packages/indexer-cli/src/commands/indexer/rules/offchain.ts +++ b/packages/indexer-cli/src/commands/indexer/rules/offchain.ts @@ -8,7 +8,7 @@ import { fixParameters, parseOutputFormat, } from '../../../command-helpers' -import { IndexingDecisionBasis, processIdentifier } from '@graphprotocol/indexer-common' +import { processIdentifier } from '@graphprotocol/indexer-common' import { setIndexingRule, displayRules, parseIndexingRule } from '../../../rules' const HELP = ` @@ -56,7 +56,7 @@ module.exports = { identifier, identifierType, protocolNetwork, - decisionBasis: IndexingDecisionBasis.OFFCHAIN, + decisionBasis: 'offchain', }) // Update the indexing rule according to the key/value pairs diff --git a/packages/indexer-cli/src/commands/indexer/rules/start.ts b/packages/indexer-cli/src/commands/indexer/rules/start.ts index e3e50b16c..20fe5ddd3 100644 --- a/packages/indexer-cli/src/commands/indexer/rules/start.ts +++ b/packages/indexer-cli/src/commands/indexer/rules/start.ts @@ -8,7 +8,7 @@ import { fixParameters, parseOutputFormat, } from '../../../command-helpers' -import { IndexingDecisionBasis, processIdentifier } from '@graphprotocol/indexer-common' +import { processIdentifier } from '@graphprotocol/indexer-common' import { setIndexingRule, displayRules, parseIndexingRule } from '../../../rules' const HELP = ` @@ -56,7 +56,7 @@ module.exports = { const inputRule = parseIndexingRule({ identifier, identifierType, - decisionBasis: IndexingDecisionBasis.ALWAYS, + decisionBasis: 'always', protocolNetwork, }) diff --git a/packages/indexer-cli/src/commands/indexer/rules/stop.ts b/packages/indexer-cli/src/commands/indexer/rules/stop.ts index 0816d689f..0fa83eab2 100644 --- a/packages/indexer-cli/src/commands/indexer/rules/stop.ts +++ b/packages/indexer-cli/src/commands/indexer/rules/stop.ts @@ -8,7 +8,7 @@ import { fixParameters, parseOutputFormat, } from '../../../command-helpers' -import { IndexingDecisionBasis, processIdentifier } from '@graphprotocol/indexer-common' +import { processIdentifier } from '@graphprotocol/indexer-common' import { setIndexingRule, displayRules, parseIndexingRule } from '../../../rules' const HELP = ` @@ -56,7 +56,7 @@ module.exports = { const inputRule = parseIndexingRule({ identifier, identifierType, - decisionBasis: IndexingDecisionBasis.NEVER, + decisionBasis: 'never', protocolNetwork, }) diff --git a/packages/indexer-cli/src/cost.ts b/packages/indexer-cli/src/cost.ts index af2fc51d8..18427c37c 100644 --- a/packages/indexer-cli/src/cost.ts +++ b/packages/indexer-cli/src/cost.ts @@ -1,7 +1,7 @@ import { SubgraphDeploymentID } from '@graphprotocol/common-ts' import { CostModelAttributes, - GraphQLCostModel, + GeneratedGraphQLTypes, IndexerManagementClient, } from '@graphprotocol/indexer-common' import gql from 'graphql-tag' @@ -68,7 +68,7 @@ const COST_MODEL_CONVERTERS_TO_GRAPHQL: Record< * Parses a user-provided cost model into a normalized form. */ export const parseCostModel = ( - cost: Partial, + cost: Partial, ): Partial => { // eslint-disable-next-line @typescript-eslint/no-explicit-any const obj = {} as any diff --git a/packages/indexer-cli/src/rules.ts b/packages/indexer-cli/src/rules.ts index e50027849..324347851 100644 --- a/packages/indexer-cli/src/rules.ts +++ b/packages/indexer-cli/src/rules.ts @@ -5,7 +5,6 @@ import { parseDecisionBasis, IndexerManagementClient, IndexingRuleAttributes, - IndexingDecisionBasis, IndexingRuleIdentifier, resolveChainAlias, } from '@graphprotocol/indexer-common' @@ -213,12 +212,8 @@ export const displayRules = ( // eslint-disable-next-line @typescript-eslint/no-explicit-any const rules = ruleOrRules.map(rule => formatIndexingRule(pickFields(rule, keys))) - const onchainRules = rules.filter( - rule => rule?.decisionBasis !== IndexingDecisionBasis.OFFCHAIN, - ) - const offchainRules = rules.filter( - rule => rule?.decisionBasis === IndexingDecisionBasis.OFFCHAIN, - ) + const onchainRules = rules.filter(rule => rule?.decisionBasis !== 'offchain') + const offchainRules = rules.filter(rule => rule?.decisionBasis === 'offchain') // Display indexing rules set to sync off-chain if any const offchainRulesDisplay = offchainRules.length From 16ae8b4d84c18deb325a95a8391cd88bbcee90f1 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Tue, 2 Apr 2024 09:18:13 -0400 Subject: [PATCH 33/48] fix --- packages/indexer-cli/src/commands/indexer/actions/get.ts | 6 +++--- packages/indexer-common/src/index.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/indexer-cli/src/commands/indexer/actions/get.ts b/packages/indexer-cli/src/commands/indexer/actions/get.ts index bde8c4264..15844757d 100644 --- a/packages/indexer-cli/src/commands/indexer/actions/get.ts +++ b/packages/indexer-cli/src/commands/indexer/actions/get.ts @@ -92,8 +92,8 @@ module.exports = { } = parameters.options const [action] = fixParameters(parameters, { h, help }) || [] - let orderByParam = ActionParams.id - let orderDirectionValue = OrderDirection.desc + let orderByParam: ActionParams = ActionParams.id + let orderDirectionValue: OrderDirection = OrderDirection.desc const outputFormat = o || output || 'table' const protocolNetwork: string | undefined = extractProtocolNetworkOption( @@ -140,7 +140,7 @@ module.exports = { } if (orderBy) { - orderByParam = ActionParams[orderBy.toUpperCase() as keyof typeof ActionParams] + orderByParam = ActionParams[orderBy as keyof typeof ActionParams] orderDirectionValue = orderDirection ? OrderDirection[orderDirection.toLowerCase() as keyof typeof OrderDirection] : OrderDirection.desc diff --git a/packages/indexer-common/src/index.ts b/packages/indexer-common/src/index.ts index a282863c7..c1d3dfa7a 100644 --- a/packages/indexer-common/src/index.ts +++ b/packages/indexer-common/src/index.ts @@ -17,4 +17,4 @@ export * from './utils' export * from './parsers' export * as specification from './network-specification' export * from './multi-networks' -export * as GeneratedGraphQLTypes from "./schema/types.generated" \ No newline at end of file +export * as GeneratedGraphQLTypes from './schema/types.generated' From a8c3e6ce234616aa03cb2839e00762897db9ed2d Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Tue, 2 Apr 2024 11:13:16 -0400 Subject: [PATCH 34/48] fix tests --- .../indexer-agent/src/__tests__/indexer.ts | 48 +- packages/indexer-agent/src/agent.ts | 6 +- packages/indexer-agent/src/commands/start.ts | 4 +- packages/indexer-agent/src/cost.ts | 9 +- packages/indexer-common/src/index.ts | 4 + .../src/indexer-management/yoga.ts | 4 + packages/indexer-common/src/operator.ts | 416 ++++++++++-------- 7 files changed, 264 insertions(+), 227 deletions(-) diff --git a/packages/indexer-agent/src/__tests__/indexer.ts b/packages/indexer-agent/src/__tests__/indexer.ts index 79dbc878e..d3a665159 100644 --- a/packages/indexer-agent/src/__tests__/indexer.ts +++ b/packages/indexer-agent/src/__tests__/indexer.ts @@ -258,34 +258,34 @@ describe('Indexer tests', () => { test('Store POI Disputes is idempotent', async () => { const disputes: POIDisputeAttributes[] = [TEST_DISPUTE_1, TEST_DISPUTE_2] - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const expectedResult = disputes.map((dispute: Record) => { - return disputeFromGraphQL(dispute) - }) - await expect(operator.storePoiDisputes(disputes)).resolves.toEqual( - expectedResult, - ) - await expect(operator.storePoiDisputes(disputes)).resolves.toEqual( - expectedResult, - ) - await expect(operator.storePoiDisputes(disputes)).resolves.toEqual( - expectedResult, - ) + const result1 = (await operator.storePoiDisputes(disputes)).map(a => ({ + ...a, + allocationAmount: a.allocationAmount.toString(), + })) + expect(result1).toEqual(disputes) + const result2 = (await operator.storePoiDisputes(disputes)).map(a => ({ + ...a, + allocationAmount: a.allocationAmount.toString(), + })) + expect(result2).toEqual(disputes) + const result3 = (await operator.storePoiDisputes(disputes)).map(a => ({ + ...a, + allocationAmount: a.allocationAmount.toString(), + })) + expect(result3).toEqual(disputes) }) test('Fetch POIDisputes', async () => { const disputes: POIDisputeAttributes[] = [TEST_DISPUTE_1, TEST_DISPUTE_2] - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const expectedResult = disputes.map((dispute: Record) => { - return disputeFromGraphQL(dispute) - }) - const expectedFilteredResult = [disputeFromGraphQL(TEST_DISPUTE_2)] - await expect(operator.storePoiDisputes(disputes)).resolves.toEqual( - expectedResult, - ) - await expect( - operator.fetchPOIDisputes('potential', 205, 'eip155:11155111'), - ).resolves.toEqual(expectedFilteredResult) + const result1 = (await operator.storePoiDisputes(disputes)).map(a => ({ + ...a, + allocationAmount: a.allocationAmount.toString(), + })) + expect(result1).toEqual(disputes) + const result2 = ( + await operator.fetchPOIDisputes('potential', 205, 'eip155:11155111') + ).map(a => ({ ...a, allocationAmount: a.allocationAmount.toString() })) + expect(result2).toEqual([TEST_DISPUTE_2]) }) }) diff --git a/packages/indexer-agent/src/agent.ts b/packages/indexer-agent/src/agent.ts index e1f7fa578..629485ca7 100644 --- a/packages/indexer-agent/src/agent.ts +++ b/packages/indexer-agent/src/agent.ts @@ -16,7 +16,6 @@ import { AllocationStatus, indexerError, IndexerErrorCode, - IndexerManagementClient, Network, POIDisputeAttributes, RewardsPool, @@ -33,6 +32,7 @@ import { networkIsL2, networkIsL1, DeploymentManagementMode, + IndexerManagementYogaClient, } from '@graphprotocol/indexer-common' import PQueue from 'p-queue' @@ -187,7 +187,7 @@ export class Agent { metrics: Metrics graphNode: GraphNode multiNetworks: MultiNetworks - indexerManagement: IndexerManagementClient + indexerManagement: IndexerManagementYogaClient offchainSubgraphs: SubgraphDeploymentID[] autoMigrationSupport: boolean deploymentManagement: DeploymentManagementMode @@ -197,7 +197,7 @@ export class Agent { metrics: Metrics, graphNode: GraphNode, operators: Operator[], - indexerManagement: IndexerManagementClient, + indexerManagement: IndexerManagementYogaClient, networks: Network[], offchainSubgraphs: SubgraphDeploymentID[], autoMigrationSupport: boolean, diff --git a/packages/indexer-agent/src/commands/start.ts b/packages/indexer-agent/src/commands/start.ts index e8fa64abf..861851650 100644 --- a/packages/indexer-agent/src/commands/start.ts +++ b/packages/indexer-agent/src/commands/start.ts @@ -11,8 +11,8 @@ import { SubgraphDeploymentID, } from '@graphprotocol/common-ts' import { - createIndexerManagementClient, createIndexerManagementServer, + createIndexerManagementYogaClient, defineIndexerManagementModels, defineQueryFeeModels, GraphNode, @@ -568,7 +568,7 @@ export async function run( (n: Network) => n.specification.networkIdentifier, ) - const indexerManagementClient = await createIndexerManagementClient({ + const indexerManagementClient = await createIndexerManagementYogaClient({ models: managementModels, graphNode, indexNodeIDs: argv.indexNodeIds, diff --git a/packages/indexer-agent/src/cost.ts b/packages/indexer-agent/src/cost.ts index a97677d91..368e0386a 100644 --- a/packages/indexer-agent/src/cost.ts +++ b/packages/indexer-agent/src/cost.ts @@ -8,7 +8,10 @@ import { timer, Address, } from '@graphprotocol/common-ts' -import { IndexerManagementClient, Network } from '@graphprotocol/indexer-common' +import { + IndexerManagementYogaClient, + Network, +} from '@graphprotocol/indexer-common' import { Contract, providers } from 'ethers' interface CostModelAutomationMetrics { @@ -34,7 +37,7 @@ const registerMetrics = (metrics: Metrics): CostModelAutomationMetrics => ({ export interface StartCostModelAutomationOptions { logger: Logger networks: Network[] - indexerManagement: IndexerManagementClient + indexerManagement: IndexerManagementYogaClient metrics: Metrics } @@ -43,7 +46,7 @@ interface CostModelAutomationOptions { logger: Logger ethereum: providers.BaseProvider contracts: NetworkContracts - indexerManagement: IndexerManagementClient + indexerManagement: IndexerManagementYogaClient daiContractAddress: Address metrics: CostModelAutomationMetrics } diff --git a/packages/indexer-common/src/index.ts b/packages/indexer-common/src/index.ts index c1d3dfa7a..4a2d508b9 100644 --- a/packages/indexer-common/src/index.ts +++ b/packages/indexer-common/src/index.ts @@ -18,3 +18,7 @@ export * from './parsers' export * as specification from './network-specification' export * from './multi-networks' export * as GeneratedGraphQLTypes from './schema/types.generated' +export { + createIndexerManagementYogaClient, + type IndexerManagementYogaClient, +} from './indexer-management/yoga' diff --git a/packages/indexer-common/src/indexer-management/yoga.ts b/packages/indexer-common/src/indexer-management/yoga.ts index c5b355661..8e1948968 100644 --- a/packages/indexer-common/src/indexer-management/yoga.ts +++ b/packages/indexer-common/src/indexer-management/yoga.ts @@ -61,3 +61,7 @@ export async function createIndexerManagementYogaClient( }), } } + +export type IndexerManagementYogaClient = Awaited< + ReturnType +> diff --git a/packages/indexer-common/src/operator.ts b/packages/indexer-common/src/operator.ts index a2848d9b2..04d8d454f 100644 --- a/packages/indexer-common/src/operator.ts +++ b/packages/indexer-common/src/operator.ts @@ -6,25 +6,26 @@ import { AllocationManagementMode, INDEXING_RULE_GLOBAL, IndexerErrorCode, - IndexerManagementClient, IndexingRuleAttributes, indexerError, specification as spec, Action, POIDisputeAttributes, GeneratedGraphQLTypes, + IndexerManagementYogaClient, } from '@graphprotocol/indexer-common' import { Logger, formatGRT } from '@graphprotocol/common-ts' import { BigNumber, utils } from 'ethers' import gql from 'graphql-tag' import pMap from 'p-map' -import { CombinedError } from '@urql/core' import { ActionFilter, ActionStatus, ActionType, IdentifierType, } from './schema/types.generated' +import { buildHTTPExecutor } from '@graphql-tools/executor-http' +import { isAsyncIterable } from 'graphql-yoga' const POI_DISPUTES_CONVERTERS_FROM_GRAPHQL: Record< keyof POIDisputeAttributes, @@ -69,12 +70,13 @@ const disputeFromGraphQL = ( // POI disputes. export class Operator { logger: Logger - indexerManagement: IndexerManagementClient + indexerManagement: IndexerManagementYogaClient specification: spec.NetworkSpecification + private executor: ReturnType constructor( logger: Logger, - indexerManagement: IndexerManagementClient, + indexerManagement: IndexerManagementYogaClient, specification: spec.NetworkSpecification, ) { this.logger = logger.child({ @@ -83,6 +85,9 @@ export class Operator { }) this.indexerManagement = indexerManagement this.specification = specification + this.executor = buildHTTPExecutor({ + fetch: this.indexerManagement.yoga.fetch, + }) } // -------------------------------------------------------------------------------- @@ -92,36 +97,39 @@ export class Operator { async indexingRules(merged: boolean): Promise { try { this.logger.debug('Fetching indexing rules') - const result = await this.indexerManagement - .query( - gql` - query indexingRules($merged: Boolean!, $protocolNetwork: String) { - indexingRules(merged: $merged, protocolNetwork: $protocolNetwork) { - identifier - identifierType - allocationAmount - allocationLifetime - autoRenewal - parallelAllocations - maxAllocationPercentage - minSignal - maxSignal - minStake - minAverageQueryFees - custom - decisionBasis - requireSupported - protocolNetwork - } + const result = await this.executor({ + document: gql` + query indexingRules($merged: Boolean!, $protocolNetwork: String) { + indexingRules(merged: $merged, protocolNetwork: $protocolNetwork) { + identifier + identifierType + allocationAmount + allocationLifetime + autoRenewal + parallelAllocations + maxAllocationPercentage + minSignal + maxSignal + minStake + minAverageQueryFees + custom + decisionBasis + requireSupported + protocolNetwork } - `, - { merged, protocolNetwork: this.specification.networkIdentifier }, - ) - .toPromise() + } + `, + variables: { merged, protocolNetwork: this.specification.networkIdentifier }, + }) + + if (isAsyncIterable(result)) { + throw Error('Result is an async iterable') + } - if (result.error) { - throw result.error + if (result.errors) { + throw result.errors } + this.logger.trace('Fetched indexing rules', { count: result.data.indexingRules.length, rules: result.data.indexingRules.map((rule: IndexingRuleAttributes) => { @@ -147,23 +155,25 @@ export class Operator { protocolNetwork: this.specification.networkIdentifier, } try { - const globalRule = await this.indexerManagement - .query( - gql` - query indexingRule($identifier: IndexingRuleIdentifier!) { - indexingRule(identifier: $identifier, merged: false) { - identifier - identifierType - allocationAmount - decisionBasis - requireSupported - protocolNetwork - } + const globalRule = await this.executor({ + document: gql` + query indexingRule($identifier: IndexingRuleIdentifier!) { + indexingRule(identifier: $identifier, merged: false) { + identifier + identifierType + allocationAmount + decisionBasis + requireSupported + protocolNetwork } - `, - { identifier }, - ) - .toPromise() + } + `, + variables: { identifier }, + }) + + if (isAsyncIterable(globalRule)) { + throw Error('Result is an async iterable') + } if (!globalRule.data.indexingRule) { this.logger.info(`Creating default "global" indexing rule`) @@ -179,36 +189,38 @@ export class Operator { safety: true, } - const defaultGlobalRule = await this.indexerManagement - .mutation( - gql` - mutation setIndexingRule($rule: IndexingRuleInput!) { - setIndexingRule(rule: $rule) { - identifier - identifierType - allocationAmount - allocationLifetime - autoRenewal - parallelAllocations - maxAllocationPercentage - minSignal - maxSignal - minStake - minAverageQueryFees - custom - decisionBasis - requireSupported - safety - protocolNetwork - } + const defaultGlobalRule = await this.executor({ + document: gql` + mutation setIndexingRule($rule: IndexingRuleInput!) { + setIndexingRule(rule: $rule) { + identifier + identifierType + allocationAmount + allocationLifetime + autoRenewal + parallelAllocations + maxAllocationPercentage + minSignal + maxSignal + minStake + minAverageQueryFees + custom + decisionBasis + requireSupported + safety + protocolNetwork } - `, - { rule: defaults }, - ) - .toPromise() + } + `, + variables: { rule: defaults }, + }) + + if (isAsyncIterable(defaultGlobalRule)) { + throw Error('Result is an async iterable') + } - if (defaultGlobalRule.error) { - throw defaultGlobalRule.error + if (defaultGlobalRule.errors) { + throw defaultGlobalRule.errors } this.logger.info(`Created default "global" indexing rule`, { @@ -229,33 +241,35 @@ export class Operator { // -------------------------------------------------------------------------------- async fetchActions(actionFilter: ActionFilter): Promise { - const result = await this.indexerManagement - .query( - gql` - query actions($filter: ActionFilter!) { - actions(filter: $filter) { - id - type - allocationID - deploymentID - amount - poi - force - source - reason - priority - transaction - status - failureReason - } + const result = await this.executor({ + document: gql` + query actions($filter: ActionFilter!) { + actions(filter: $filter) { + id + type + allocationID + deploymentID + amount + poi + force + source + reason + priority + transaction + status + failureReason } - `, - { filter: actionFilter }, - ) - .toPromise() + } + `, + variables: { filter: actionFilter }, + }) - if (result.error) { - throw result.error + if (isAsyncIterable(result)) { + throw Error('Result is an async iterable') + } + + if (result.errors) { + throw result.errors } return result.data.actions @@ -285,42 +299,50 @@ export class Operator { this.logger.trace(`Queueing action input`, { actionInput, }) - const actionResult = await this.indexerManagement - .mutation( - gql` - mutation queueActions($actions: [ActionInput!]!) { - queueActions(actions: $actions) { - id - type - deploymentID - source - reason - priority - status - protocolNetwork - } + + const actionResult = await this.executor({ + document: gql` + mutation queueActions($actions: [ActionInput!]!) { + queueActions(actions: $actions) { + id + type + deploymentID + source + reason + priority + status + protocolNetwork } - `, - { actions: [actionInput] }, - ) - .toPromise() - - if (actionResult.error) { - if (actionResult.error instanceof CombinedError) { - if (actionResult.error.message.includes('Duplicate')) { - this.logger.warn( - `Action not queued: Already a queued action targeting ${actionInput.deploymentID} from another source`, - { action }, - ) - } else if (actionResult.error.message.includes('Recently executed')) { - this.logger.warn( - `Action not queued: A recently executed action was found targeting ${actionInput.deploymentID}`, - { action }, - ) } + `, + variables: { actions: [actionInput] }, + }) + + if (isAsyncIterable(actionResult)) { + throw Error('Result is an async iterable') + } + + if (actionResult.errors) { + if (actionResult.errors.filter((e) => e.message.includes('Duplicate')).length > 0) { + this.logger.warn( + `Action not queued: Already a queued action targeting ${actionInput.deploymentID} from another source`, + { action }, + ) + return [] + } + + if ( + actionResult.errors.filter((e) => e.message.includes('Recently executed')) + .length > 0 + ) { + this.logger.warn( + `Action not queued: A recently executed action was found targeting ${actionInput.deploymentID}`, + { action }, + ) return [] } - throw actionResult.error + + throw actionResult.errors } if (actionResult.data.queueActions.length > 0) { @@ -476,34 +498,36 @@ export class Operator { disputes: POIDisputeAttributes[], ): Promise { try { - const result = await this.indexerManagement - .mutation( - gql` - mutation storeDisputes($disputes: [POIDisputeInput!]!) { - storeDisputes(disputes: $disputes) { - allocationID - subgraphDeploymentID - allocationIndexer - allocationAmount - allocationProof - closedEpoch - closedEpochStartBlockHash - closedEpochStartBlockNumber - closedEpochReferenceProof - previousEpochStartBlockHash - previousEpochStartBlockNumber - previousEpochReferenceProof - status - protocolNetwork - } + const result = await this.executor({ + document: gql` + mutation storeDisputes($disputes: [POIDisputeInput!]!) { + storeDisputes(disputes: $disputes) { + allocationID + subgraphDeploymentID + allocationIndexer + allocationAmount + allocationProof + closedEpoch + closedEpochStartBlockHash + closedEpochStartBlockNumber + closedEpochReferenceProof + previousEpochStartBlockHash + previousEpochStartBlockNumber + previousEpochReferenceProof + status + protocolNetwork } - `, - { disputes: disputes }, - ) - .toPromise() + } + `, + variables: { disputes: disputes }, + }) + + if (isAsyncIterable(result)) { + throw Error('Result is an async iterable') + } - if (result.error) { - throw result.error + if (result.errors) { + throw result.errors } return result.data.storeDisputes.map( @@ -527,46 +551,48 @@ export class Operator { protocolNetwork: string | undefined, ): Promise { try { - const result = await this.indexerManagement - .query( - gql` - query disputes( - $status: String! - $minClosedEpoch: Int! - $protocolNetwork: String! + const result = await this.executor({ + document: gql` + query disputes( + $status: String! + $minClosedEpoch: Int! + $protocolNetwork: String! + ) { + disputes( + status: $status + minClosedEpoch: $minClosedEpoch + protocolNetwork: $protocolNetwork ) { - disputes( - status: $status - minClosedEpoch: $minClosedEpoch - protocolNetwork: $protocolNetwork - ) { - allocationID - subgraphDeploymentID - allocationIndexer - allocationAmount - allocationProof - closedEpoch - closedEpochStartBlockHash - closedEpochStartBlockNumber - closedEpochReferenceProof - previousEpochStartBlockHash - previousEpochStartBlockNumber - previousEpochReferenceProof - status - protocolNetwork - } + allocationID + subgraphDeploymentID + allocationIndexer + allocationAmount + allocationProof + closedEpoch + closedEpochStartBlockHash + closedEpochStartBlockNumber + closedEpochReferenceProof + previousEpochStartBlockHash + previousEpochStartBlockNumber + previousEpochReferenceProof + status + protocolNetwork } - `, - { - status, - minClosedEpoch, - protocolNetwork, - }, - ) - .toPromise() + } + `, + variables: { + status, + minClosedEpoch, + protocolNetwork, + }, + }) + + if (isAsyncIterable(result)) { + throw Error('Result is an async iterable') + } - if (result.error) { - throw result.error + if (result.errors) { + throw result.errors } return result.data.disputes.map( From 463271bb241391315add2d69805a9d2424ea6077 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Tue, 2 Apr 2024 12:20:41 -0400 Subject: [PATCH 35/48] works --- .../indexer-agent/src/__tests__/indexer.ts | 40 ----------------- packages/indexer-cli/src/__tests__/util.ts | 44 +++++++++---------- .../src/indexer-management/server.ts | 16 ++----- .../src/indexer-management/yoga.ts | 1 + 4 files changed, 24 insertions(+), 77 deletions(-) diff --git a/packages/indexer-agent/src/__tests__/indexer.ts b/packages/indexer-agent/src/__tests__/indexer.ts index d3a665159..38c86a3fb 100644 --- a/packages/indexer-agent/src/__tests__/indexer.ts +++ b/packages/indexer-agent/src/__tests__/indexer.ts @@ -19,7 +19,6 @@ import { MultiNetworks, createIndexerManagementYogaClient, } from '@graphprotocol/indexer-common' -import { BigNumber } from 'ethers' import { Sequelize } from 'sequelize' const TEST_DISPUTE_1: POIDisputeAttributes = { @@ -65,45 +64,6 @@ const TEST_DISPUTE_2: POIDisputeAttributes = { protocolNetwork: 'eip155:11155111', } -const POI_DISPUTES_CONVERTERS_FROM_GRAPHQL: Record< - keyof POIDisputeAttributes, - (x: never) => string | BigNumber | number | undefined -> = { - allocationID: x => x, - subgraphDeploymentID: x => x, - allocationIndexer: x => x, - allocationAmount: x => x, - allocationProof: x => x, - closedEpoch: x => +x, - closedEpochStartBlockHash: x => x, - closedEpochStartBlockNumber: x => +x, - closedEpochReferenceProof: x => x, - previousEpochStartBlockHash: x => x, - previousEpochStartBlockNumber: x => +x, - previousEpochReferenceProof: x => x, - status: x => x, - protocolNetwork: x => x, -} - -/** - * Parses a POI dispute returned from the indexer management GraphQL - * API into normalized form. - */ -const disputeFromGraphQL = ( - dispute: Partial, -): POIDisputeAttributes => { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const obj = {} as any - for (const [key, value] of Object.entries(dispute)) { - if (key === '__typename') { - continue - } - // eslint-disable-next-line @typescript-eslint/no-explicit-any - obj[key] = (POI_DISPUTES_CONVERTERS_FROM_GRAPHQL as any)[key](value) - } - return obj as POIDisputeAttributes -} - declare const __DATABASE__: never let sequelize: Sequelize diff --git a/packages/indexer-cli/src/__tests__/util.ts b/packages/indexer-cli/src/__tests__/util.ts index 1a0bed9cb..9be4fc040 100644 --- a/packages/indexer-cli/src/__tests__/util.ts +++ b/packages/indexer-cli/src/__tests__/util.ts @@ -7,23 +7,19 @@ import path from 'path' import { Sequelize } from 'sequelize' import stripAnsi from 'strip-ansi' import { - ActionStatus, - ActionType, CostModelVariables, - createIndexerManagementClient, createIndexerManagementServer, + createIndexerManagementYogaClient, defineIndexerManagementModels, defineQueryFeeModels, GraphNode, - IndexerManagementClient, IndexerManagementDefaults, IndexerManagementModels, - IndexingDecisionBasis, MultiNetworks, Network, QueryFeeModels, specification, - SubgraphIdentifierType, + IndexerManagementYogaClient, } from '@graphprotocol/indexer-common' import { connectDatabase, @@ -48,7 +44,7 @@ let sequelize: Sequelize let models: IndexerManagementModels let queryFeeModels: QueryFeeModels let logger: Logger -let indexerManagementClient: IndexerManagementClient +let indexerManagementClient: IndexerManagementYogaClient let server: http.Server let sockets: Socket[] = [] let metrics: Metrics @@ -145,7 +141,7 @@ export const setup = async () => { }, } - indexerManagementClient = await createIndexerManagementClient({ + indexerManagementClient = await createIndexerManagementYogaClient({ models, graphNode, indexNodeIDs, @@ -197,9 +193,9 @@ export const seedIndexingRules = async () => { await models.IndexingRule.create({ id: 1, identifier: 'global', - identifierType: SubgraphIdentifierType.GROUP, + identifierType: 'group', protocolNetwork: 'eip155:11155111', - decisionBasis: IndexingDecisionBasis.RULES, + decisionBasis: 'rules', requireSupported: true, safety: true, autoRenewal: true, @@ -209,9 +205,9 @@ export const seedIndexingRules = async () => { await models.IndexingRule.create({ id: 2, identifier: 'QmSrf6VVPyg9NGdS1xhLmoosk3qZQaWhfoSTHE2H7sht6Q', - identifierType: SubgraphIdentifierType.DEPLOYMENT, + identifierType: 'deployment', protocolNetwork: 'eip155:11155111', - decisionBasis: IndexingDecisionBasis.RULES, + decisionBasis: 'rules', requireSupported: true, safety: true, autoRenewal: true, @@ -219,9 +215,9 @@ export const seedIndexingRules = async () => { await models.IndexingRule.create({ id: 3, identifier: 'QmZfeJYR86UARzp9HiXbURWunYgC9ywvPvoePNbuaATrEK', - identifierType: SubgraphIdentifierType.DEPLOYMENT, + identifierType: 'deployment', protocolNetwork: 'eip155:11155111', - decisionBasis: IndexingDecisionBasis.OFFCHAIN, + decisionBasis: 'offchain', requireSupported: true, safety: true, autoRenewal: true, @@ -229,9 +225,9 @@ export const seedIndexingRules = async () => { await models.IndexingRule.create({ id: 4, identifier: '0x0000000000000000000000000000000000000000-0', - identifierType: SubgraphIdentifierType.SUBGRAPH, + identifierType: 'subgraph', protocolNetwork: 'eip155:11155111', - decisionBasis: IndexingDecisionBasis.RULES, + decisionBasis: 'rules', requireSupported: true, safety: true, autoRenewal: true, @@ -240,9 +236,9 @@ export const seedIndexingRules = async () => { await models.IndexingRule.create({ id: 5, identifier: '0x0000000000000000000000000000000000000000-1', - identifierType: SubgraphIdentifierType.SUBGRAPH, + identifierType: 'subgraph', protocolNetwork: 'eip155:11155111', - decisionBasis: IndexingDecisionBasis.OFFCHAIN, + decisionBasis: 'offchain', requireSupported: true, safety: true, autoRenewal: true, @@ -250,11 +246,11 @@ export const seedIndexingRules = async () => { await models.IndexingRule.create({ id: 6, identifier: '0x0000000000000000000000000000000000000000-2', - identifierType: SubgraphIdentifierType.SUBGRAPH, + identifierType: 'subgraph', protocolNetwork: 'eip155:11155111', allocationAmount: parseGRT('1000').toString(), allocationLifetime: 12, - decisionBasis: IndexingDecisionBasis.OFFCHAIN, + decisionBasis: 'offchain', requireSupported: true, safety: true, autoRenewal: true, @@ -308,8 +304,8 @@ export const seedActions = async () => { logger.debug('Seed Actions') await models.Action.create({ id: 1, - type: ActionType.ALLOCATE, - status: ActionStatus.SUCCESS, + type: 'allocate', + status: 'success', deploymentID: 'QmSrf6VVPyg9NGdS1xhLmoosk3qZQaWhfoSTHE2H7sht6Q', source: 'test', reason: 'test', @@ -317,8 +313,8 @@ export const seedActions = async () => { }) await models.Action.create({ id: 2, - type: ActionType.UNALLOCATE, - status: ActionStatus.FAILED, + type: 'unallocate', + status: 'failed', deploymentID: 'QmSrf6VVPyg9NGdS1xhLmoosk3qZQaWhfoSTHE2H7sht6Q', source: 'test', reason: 'test', diff --git a/packages/indexer-common/src/indexer-management/server.ts b/packages/indexer-common/src/indexer-management/server.ts index c5c6d028d..c34d57c33 100644 --- a/packages/indexer-common/src/indexer-management/server.ts +++ b/packages/indexer-common/src/indexer-management/server.ts @@ -5,12 +5,12 @@ import bodyParser from 'body-parser' import morgan from 'morgan' import { Logger } from '@graphprotocol/common-ts' -import { IndexerManagementClient } from './client' import http from 'http' +import { IndexerManagementYogaClient } from './yoga' export interface CreateIndexerManagementServerOptions { logger: Logger - client: IndexerManagementClient + client: IndexerManagementYogaClient port: number } @@ -41,17 +41,7 @@ export const createIndexerManagementServer = async ({ // GraphQL endpoint app.post('/', bodyParser.json(), async (req, res) => { - const { query, variables } = req.body - - const result = query.startsWith('mutation') - ? await client.mutation(query, variables).toPromise() - : await client.query(query, variables).toPromise() - - res.status(200).send({ - data: result.data, - errors: result.error ? result.error.graphQLErrors : null, - extensions: result.extensions, - }) + return client.yoga.handle(req, res) }) const server = app.listen(port, () => { diff --git a/packages/indexer-common/src/indexer-management/yoga.ts b/packages/indexer-common/src/indexer-management/yoga.ts index 8e1948968..3c87cbeed 100644 --- a/packages/indexer-common/src/indexer-management/yoga.ts +++ b/packages/indexer-common/src/indexer-management/yoga.ts @@ -47,6 +47,7 @@ export async function createIndexerManagementYogaClient( return { setDai, yoga: createYoga({ + graphqlEndpoint: '/', schema: createSchema({ typeDefs, resolvers }), maskedErrors: false, context: { From cfd775a9e33a1e4ad36a7ba5ebfd97f1339710f7 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Tue, 2 Apr 2024 12:24:25 -0400 Subject: [PATCH 36/48] fix a test --- packages/indexer-common/src/indexer-management/yoga.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/indexer-common/src/indexer-management/yoga.ts b/packages/indexer-common/src/indexer-management/yoga.ts index 3c87cbeed..8e1948968 100644 --- a/packages/indexer-common/src/indexer-management/yoga.ts +++ b/packages/indexer-common/src/indexer-management/yoga.ts @@ -47,7 +47,6 @@ export async function createIndexerManagementYogaClient( return { setDai, yoga: createYoga({ - graphqlEndpoint: '/', schema: createSchema({ typeDefs, resolvers }), maskedErrors: false, context: { From a49e672314be41d68b53a4a003477f4607898b10 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Tue, 2 Apr 2024 15:35:22 -0400 Subject: [PATCH 37/48] fix test --- packages/indexer-common/src/indexer-management/yoga.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/indexer-common/src/indexer-management/yoga.ts b/packages/indexer-common/src/indexer-management/yoga.ts index 8e1948968..a7a604b64 100644 --- a/packages/indexer-common/src/indexer-management/yoga.ts +++ b/packages/indexer-common/src/indexer-management/yoga.ts @@ -47,6 +47,7 @@ export async function createIndexerManagementYogaClient( return { setDai, yoga: createYoga({ + graphqlEndpoint: '*', schema: createSchema({ typeDefs, resolvers }), maskedErrors: false, context: { From 4d0a0d3001689f256d88aacc4f8f5c26f5a1afe4 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Tue, 2 Apr 2024 15:37:08 -0400 Subject: [PATCH 38/48] remove console log --- .../indexer-management/__tests__/resolvers/cost-models.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/indexer-common/src/indexer-management/__tests__/resolvers/cost-models.test.ts b/packages/indexer-common/src/indexer-management/__tests__/resolvers/cost-models.test.ts index 13daa0f01..1d071b74f 100644 --- a/packages/indexer-common/src/indexer-management/__tests__/resolvers/cost-models.test.ts +++ b/packages/indexer-common/src/indexer-management/__tests__/resolvers/cost-models.test.ts @@ -815,7 +815,6 @@ describe('Feature: Inject $DAI variable', () => { const a = await buildHTTPExecutor({ fetch: clientNoInjectDai.yoga.fetch, })({ document: SET_COST_MODEL_MUTATION, variables: { costModel: update } }) - console.log(a) await expect( buildHTTPExecutor({ fetch: clientNoInjectDai.yoga.fetch, From 97666a218a6d45727bc2da089a3b6210344548fe Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Tue, 2 Apr 2024 15:58:06 -0400 Subject: [PATCH 39/48] fix issue --- .../indexer-management/__tests__/resolvers/cost-models.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/indexer-common/src/indexer-management/__tests__/resolvers/cost-models.test.ts b/packages/indexer-common/src/indexer-management/__tests__/resolvers/cost-models.test.ts index 1d071b74f..608d82bb4 100644 --- a/packages/indexer-common/src/indexer-management/__tests__/resolvers/cost-models.test.ts +++ b/packages/indexer-common/src/indexer-management/__tests__/resolvers/cost-models.test.ts @@ -812,7 +812,7 @@ describe('Feature: Inject $DAI variable', () => { variables: JSON.stringify({}), } - const a = await buildHTTPExecutor({ + await buildHTTPExecutor({ fetch: clientNoInjectDai.yoga.fetch, })({ document: SET_COST_MODEL_MUTATION, variables: { costModel: update } }) await expect( From bd7517568ac88cc7b75da84d049b57cbddc59378 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Tue, 2 Apr 2024 16:02:26 -0400 Subject: [PATCH 40/48] prettier --- .../indexer-management/__tests__/resolvers/cost-models.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/indexer-common/src/indexer-management/__tests__/resolvers/cost-models.test.ts b/packages/indexer-common/src/indexer-management/__tests__/resolvers/cost-models.test.ts index 608d82bb4..067b62468 100644 --- a/packages/indexer-common/src/indexer-management/__tests__/resolvers/cost-models.test.ts +++ b/packages/indexer-common/src/indexer-management/__tests__/resolvers/cost-models.test.ts @@ -812,7 +812,7 @@ describe('Feature: Inject $DAI variable', () => { variables: JSON.stringify({}), } - await buildHTTPExecutor({ + await buildHTTPExecutor({ fetch: clientNoInjectDai.yoga.fetch, })({ document: SET_COST_MODEL_MUTATION, variables: { costModel: update } }) await expect( From 5ce8a0cb3337ae78ecf0a2b5d07a12cef729e338 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Wed, 3 Apr 2024 10:07:32 -0400 Subject: [PATCH 41/48] remove urql client from indexer common --- packages/indexer-cli/src/actions.ts | 20 +- packages/indexer-cli/src/allocations.ts | 8 +- packages/indexer-cli/src/client.ts | 9 +- packages/indexer-cli/src/cost.ts | 15 +- packages/indexer-cli/src/disputes.ts | 4 +- packages/indexer-cli/src/rules.ts | 10 +- packages/indexer-common/package.json | 5 +- .../src/indexer-management/client.ts | 539 -------- .../src/indexer-management/context.ts | 15 +- .../src/indexer-management/index.ts | 3 +- .../indexer-management/resolvers/actions.ts | 429 ------- .../resolvers/allocations.ts | 1115 ----------------- .../resolvers/cost-models.ts | 165 --- .../resolvers/indexer-status.ts | 317 ----- .../resolvers/indexing-rules.ts | 198 --- .../resolvers/poi-disputes.ts | 104 -- .../src/indexer-management/yoga.ts | 21 +- .../resolvers/Mutation/closeAllocation.ts | 2 +- .../resolvers/Mutation/createAllocation.ts | 2 +- .../resolvers/Mutation/deleteIndexingRule.ts | 2 +- .../resolvers/Mutation/deleteIndexingRules.ts | 2 +- .../Mutation/reallocateAllocation.ts | 2 +- .../resolvers/Query/allocations.ts | 215 +++- .../resolvers/Query/indexerAllocations.ts | 2 +- .../resolvers/Query/indexerRegistration.ts | 2 +- .../indexer-management/resolvers/utils.ts | 20 + packages/indexer-service/package.json | 1 + .../indexer-service/src/commands/start.ts | 4 +- packages/indexer-service/src/server/cost.ts | 91 +- packages/indexer-service/src/server/index.ts | 4 +- 30 files changed, 358 insertions(+), 2968 deletions(-) delete mode 100644 packages/indexer-common/src/indexer-management/client.ts delete mode 100644 packages/indexer-common/src/indexer-management/resolvers/actions.ts delete mode 100644 packages/indexer-common/src/indexer-management/resolvers/allocations.ts delete mode 100644 packages/indexer-common/src/indexer-management/resolvers/cost-models.ts delete mode 100644 packages/indexer-common/src/indexer-management/resolvers/indexer-status.ts delete mode 100644 packages/indexer-common/src/indexer-management/resolvers/indexing-rules.ts delete mode 100644 packages/indexer-common/src/indexer-management/resolvers/poi-disputes.ts rename packages/indexer-common/src/{ => schema}/indexer-management/resolvers/utils.ts (56%) diff --git a/packages/indexer-cli/src/actions.ts b/packages/indexer-cli/src/actions.ts index d5922f4c7..48d60c26a 100644 --- a/packages/indexer-cli/src/actions.ts +++ b/packages/indexer-cli/src/actions.ts @@ -3,7 +3,6 @@ import { ActionResult, ActionUpdateInput, GeneratedGraphQLTypes, - IndexerManagementClient, nullPassThrough, OrderDirection, parseBoolean, @@ -12,6 +11,7 @@ import { validatePOI, validateRequiredParams } from './command-helpers' import gql from 'graphql-tag' import { utils } from 'ethers' import { parseGRT } from '@graphprotocol/common-ts' +import { Client } from '@urql/core' export interface GenericActionInputParams { targetDeployment: string @@ -168,7 +168,7 @@ export function buildActionFilter( } export async function queueActions( - client: IndexerManagementClient, + client: Client, actions: GeneratedGraphQLTypes.ActionInput[], ): Promise { const result = await client @@ -235,9 +235,7 @@ export const parseActionUpdateInput = (input: object): ActionUpdateInput => { return obj as ActionUpdateInput } -export async function executeApprovedActions( - client: IndexerManagementClient, -): Promise { +export async function executeApprovedActions(client: Client): Promise { const result = await client .mutation(gql` mutation executeApprovedActions { @@ -268,7 +266,7 @@ export async function executeApprovedActions( } export async function approveActions( - client: IndexerManagementClient, + client: Client, actionIDs: number[], ): Promise { const result = await client @@ -304,7 +302,7 @@ export async function approveActions( } export async function cancelActions( - client: IndexerManagementClient, + client: Client, actionIDs: number[], ): Promise { const result = await client @@ -340,7 +338,7 @@ export async function cancelActions( } export async function fetchAction( - client: IndexerManagementClient, + client: Client, actionID: number, ): Promise { const result = await client @@ -376,7 +374,7 @@ export async function fetchAction( } export async function fetchActions( - client: IndexerManagementClient, + client: Client, actionFilter: GeneratedGraphQLTypes.ActionFilter, first?: number, orderBy?: ActionParams, @@ -426,7 +424,7 @@ export async function fetchActions( } export async function deleteActions( - client: IndexerManagementClient, + client: Client, actionIDs: number[], ): Promise { const result = await client @@ -463,7 +461,7 @@ export async function deleteActions( } export async function updateActions( - client: IndexerManagementClient, + client: Client, filter: GeneratedGraphQLTypes.ActionFilter, action: ActionUpdateInput, ): Promise { diff --git a/packages/indexer-cli/src/allocations.ts b/packages/indexer-cli/src/allocations.ts index 1133746a8..dd712860e 100644 --- a/packages/indexer-cli/src/allocations.ts +++ b/packages/indexer-cli/src/allocations.ts @@ -4,7 +4,6 @@ import { GluegunPrint } from 'gluegun' import { table, getBorderCharacters } from 'table' import { BigNumber, utils } from 'ethers' import { OutputFormat, parseOutputFormat, pickFields } from './command-helpers' -import { IndexerManagementClient } from '@graphprotocol/indexer-common' import gql from 'graphql-tag' import { CloseAllocationResult, @@ -12,6 +11,7 @@ import { ReallocateAllocationResult, resolveChainAlias, } from '@graphprotocol/indexer-common' +import { Client } from '@urql/core' export interface IndexerAllocation { id: number @@ -171,7 +171,7 @@ function nullPassThrough(fn: (x: T) => U): (x: T | null) => U | null { } export const createAllocation = async ( - client: IndexerManagementClient, + client: Client, deployment: string, amount: BigNumber, indexNode: string | undefined, @@ -216,7 +216,7 @@ export const createAllocation = async ( } export const closeAllocation = async ( - client: IndexerManagementClient, + client: Client, allocationID: string, poi: string | undefined, force: boolean, @@ -262,7 +262,7 @@ export const closeAllocation = async ( } export const reallocateAllocation = async ( - client: IndexerManagementClient, + client: Client, allocationID: string, poi: string | undefined, amount: BigNumber, diff --git a/packages/indexer-cli/src/client.ts b/packages/indexer-cli/src/client.ts index 0896a71c2..abfbcc044 100644 --- a/packages/indexer-cli/src/client.ts +++ b/packages/indexer-cli/src/client.ts @@ -1,11 +1,6 @@ import { createClient } from '@urql/core' import fetch from 'isomorphic-fetch' -import { IndexerManagementClient } from '@graphprotocol/indexer-common' -export const createIndexerManagementClient = async ({ - url, -}: { - url: string -}): Promise => { - return createClient({ url, fetch }) as unknown as IndexerManagementClient +export const createIndexerManagementClient = async ({ url }: { url: string }) => { + return createClient({ url, fetch }) } diff --git a/packages/indexer-cli/src/cost.ts b/packages/indexer-cli/src/cost.ts index 18427c37c..cc9359278 100644 --- a/packages/indexer-cli/src/cost.ts +++ b/packages/indexer-cli/src/cost.ts @@ -1,14 +1,11 @@ import { SubgraphDeploymentID } from '@graphprotocol/common-ts' -import { - CostModelAttributes, - GeneratedGraphQLTypes, - IndexerManagementClient, -} from '@graphprotocol/indexer-common' +import { CostModelAttributes, GeneratedGraphQLTypes } from '@graphprotocol/indexer-common' import gql from 'graphql-tag' import yaml from 'yaml' import { GluegunPrint } from 'gluegun' import { table, getBorderCharacters } from 'table' import { OutputFormat, pickFields } from './command-helpers' +import { Client } from '@urql/core' export type SubgraphDeploymentIDIsh = SubgraphDeploymentID | 'all' | 'global' @@ -190,7 +187,7 @@ export const printCostModels = ( } export const costModels = async ( - client: IndexerManagementClient, + client: Client, ): Promise[]> => { const result = await client .query(gql` @@ -212,7 +209,7 @@ export const costModels = async ( } export const costModel = async ( - client: IndexerManagementClient, + client: Client, deployment: SubgraphDeploymentIDIsh, ): Promise | null> => { const result = await client @@ -242,7 +239,7 @@ export const costModel = async ( } export const setCostModel = async ( - client: IndexerManagementClient, + client: Client, costModel: Partial, ): Promise> => { const result = await client @@ -268,7 +265,7 @@ export const setCostModel = async ( } export const deleteCostModels = async ( - client: IndexerManagementClient, + client: Client, deployments: string[], ): Promise => { const result = await client diff --git a/packages/indexer-cli/src/disputes.ts b/packages/indexer-cli/src/disputes.ts index e3fa12bb4..2a4c29bbc 100644 --- a/packages/indexer-cli/src/disputes.ts +++ b/packages/indexer-cli/src/disputes.ts @@ -1,5 +1,4 @@ import { - IndexerManagementClient, POIDisputeAttributes, indexerError, IndexerErrorCode, @@ -10,6 +9,7 @@ import yaml from 'yaml' import { GluegunPrint } from 'gluegun' import { table, getBorderCharacters } from 'table' import { OutputFormat } from './command-helpers' +import { Client } from '@urql/core' const DISPUTE_FORMATTERS: Record string> = { allocationID: x => x, @@ -129,7 +129,7 @@ export const printDisputes = ( } export const disputes = async ( - client: IndexerManagementClient, + client: Client, status: string, minClosedEpoch: number, protocolNetwork: string | undefined, diff --git a/packages/indexer-cli/src/rules.ts b/packages/indexer-cli/src/rules.ts index 324347851..37d7c43e4 100644 --- a/packages/indexer-cli/src/rules.ts +++ b/packages/indexer-cli/src/rules.ts @@ -3,7 +3,6 @@ import { nullPassThrough, parseBoolean, parseDecisionBasis, - IndexerManagementClient, IndexingRuleAttributes, IndexingRuleIdentifier, resolveChainAlias, @@ -14,6 +13,7 @@ import { table, getBorderCharacters } from 'table' import { BigNumber, utils } from 'ethers' import { OutputFormat, pickFields } from './command-helpers' import chalk from 'chalk' +import { Client } from '@urql/core' export type SubgraphDeploymentIDIsh = SubgraphDeploymentID | 'global' | 'all' @@ -237,7 +237,7 @@ export const displayRules = ( } export const indexingRules = async ( - client: IndexerManagementClient, + client: Client, merged: boolean, protocolNetwork?: string, ): Promise[]> => { @@ -277,7 +277,7 @@ export const indexingRules = async ( } export const indexingRule = async ( - client: IndexerManagementClient, + client: Client, identifier: IndexingRuleIdentifier, merged: boolean, ): Promise | null> => { @@ -321,7 +321,7 @@ export const indexingRule = async ( } export const setIndexingRule = async ( - client: IndexerManagementClient, + client: Client, rule: Partial, ): Promise> => { const result = await client @@ -360,7 +360,7 @@ export const setIndexingRule = async ( } export const deleteIndexingRules = async ( - client: IndexerManagementClient, + client: Client, deployments: IndexingRuleIdentifier[], ): Promise => { const result = await client diff --git a/packages/indexer-common/package.json b/packages/indexer-common/package.json index 57a0de8be..724ab2bba 100644 --- a/packages/indexer-common/package.json +++ b/packages/indexer-common/package.json @@ -30,8 +30,6 @@ "@types/lodash.clonedeep": "^4.5.7", "@types/lodash.intersection": "^4.4.7", "@types/lodash.xor": "^4.5.7", - "@urql/core": "2.4.4", - "@urql/exchange-execute": "1.2.2", "axios": "1.6.2", "body-parser": "1.20.2", "cors": "2.8.5", @@ -86,8 +84,7 @@ "resolutions": { "ethers": "5.7.0", "sequelize": "6.33.0", - "@ethersproject/bignumber": "5.7.0", - "@urql/exchange-execute/@urql/core": "2.4.4" + "@ethersproject/bignumber": "5.7.0" }, "babel": { "presets": [], diff --git a/packages/indexer-common/src/indexer-management/client.ts b/packages/indexer-common/src/indexer-management/client.ts deleted file mode 100644 index c3ea4c9a7..000000000 --- a/packages/indexer-common/src/indexer-management/client.ts +++ /dev/null @@ -1,539 +0,0 @@ -import { buildSchema, print } from 'graphql' -import gql from 'graphql-tag' -import { executeExchange } from '@urql/exchange-execute' -import { Client, ClientOptions } from '@urql/core' -import { equal, Logger, mutable, WritableEventual } from '@graphprotocol/common-ts' - -import { IndexerManagementModels, IndexingRuleCreationAttributes } from './models' - -import actionResolvers from './resolvers/actions' -import allocationResolvers from './resolvers/allocations' -import costModelResolvers from './resolvers/cost-models' -import indexingRuleResolvers from './resolvers/indexing-rules' -import poiDisputeResolvers from './resolvers/poi-disputes' -import statusResolvers from './resolvers/indexer-status' -import { BigNumber } from 'ethers' -import { Op, Sequelize } from 'sequelize' -import { GraphNode } from '../graph-node' -import { ActionManager, MultiNetworks, Network } from '@graphprotocol/indexer-common' -import { IndexerManagementResolverContext } from './context' - -const SCHEMA_SDL = gql` - scalar BigInt - - enum OrderDirection { - asc - desc - } - - enum IndexingDecisionBasis { - rules - never - always - offchain - } - - enum IdentifierType { - deployment - subgraph - group - } - - input AllocationFilter { - status: String - allocation: String - subgraphDeployment: String - protocolNetwork: String - } - - enum AllocationStatus { - Null # == indexer == address(0) - Active # == not Null && tokens > 0 # - Closed # == Active && closedAtEpoch != 0. Still can collect, while you are waiting to be finalized. a.k.a settling - Finalized # == Closing && closedAtEpoch + channelDisputeEpochs > now(). Note, the subgraph has no way to return this value. it is implied - Claimed # == not Null && tokens == 0 - i.e. finalized, and all tokens withdrawn - } - - type Allocation { - id: String! - indexer: String! - subgraphDeployment: String! - allocatedTokens: String! - createdAtEpoch: Int! - closedAtEpoch: Int - ageInEpochs: Int! - indexingRewards: String! - queryFeesCollected: String! - signalledTokens: BigInt! - stakedTokens: BigInt! - status: AllocationStatus! - protocolNetwork: String! - } - - type CreateAllocationResult { - allocation: String! - deployment: String! - allocatedTokens: String! - protocolNetwork: String! - } - - type CloseAllocationResult { - allocation: String! - allocatedTokens: String! - indexingRewards: String! - receiptsWorthCollecting: Boolean! - protocolNetwork: String! - } - - type ReallocateAllocationResult { - closedAllocation: String! - indexingRewardsCollected: String! - receiptsWorthCollecting: Boolean! - createdAllocation: String! - createdAllocationStake: String! - protocolNetwork: String! - } - - enum ActionStatus { - queued - approved - pending - success - failed - canceled - } - - enum ActionType { - allocate - unallocate - reallocate - } - - type Action { - id: Int! - status: ActionStatus! - type: ActionType! - deploymentID: String - allocationID: String - amount: String - poi: String - force: Boolean - priority: Int! - source: String! - reason: String! - transaction: String - failureReason: String - createdAt: BigInt! - updatedAt: BigInt - protocolNetwork: String! - } - - input ActionInput { - status: ActionStatus! - type: ActionType! - deploymentID: String - allocationID: String - amount: String - poi: String - force: Boolean - source: String! - reason: String! - priority: Int! - protocolNetwork: String! - } - - input ActionUpdateInput { - id: Int - deploymentID: String - allocationID: String - amount: Int - poi: String - force: Boolean - type: ActionType - status: ActionStatus - reason: String - } - - enum ActionParams { - id - status - type - deploymentID - allocationID - transaction - amount - poi - force - source - reason - priority - createdAt - updatedAt - protocolNetwork - } - - type ActionResult { - id: Int! - type: ActionType! - deploymentID: String - allocationID: String - amount: String - poi: String - force: Boolean - source: String! - reason: String! - status: String! - transaction: String - failureReason: String - priority: Int - protocolNetwork: String! - } - - input ActionFilter { - id: Int - protocolNetwork: String - type: ActionType - status: String - source: String - reason: String - } - - input POIDisputeIdentifier { - allocationID: String! - protocolNetwork: String! - } - - type POIDispute { - allocationID: String! - subgraphDeploymentID: String! - allocationIndexer: String! - allocationAmount: BigInt! - allocationProof: String! - closedEpoch: Int! - closedEpochStartBlockHash: String! - closedEpochStartBlockNumber: Int! - closedEpochReferenceProof: String - previousEpochStartBlockHash: String! - previousEpochStartBlockNumber: Int! - previousEpochReferenceProof: String - status: String! - protocolNetwork: String! - } - - input POIDisputeInput { - allocationID: String! - subgraphDeploymentID: String! - allocationIndexer: String! - allocationAmount: BigInt! - allocationProof: String! - closedEpoch: Int! - closedEpochStartBlockHash: String! - closedEpochStartBlockNumber: Int! - closedEpochReferenceProof: String - previousEpochStartBlockHash: String! - previousEpochStartBlockNumber: Int! - previousEpochReferenceProof: String - status: String! - protocolNetwork: String! - } - - type IndexingRule { - identifier: String! - identifierType: IdentifierType! - allocationAmount: BigInt - allocationLifetime: Int - autoRenewal: Boolean! - parallelAllocations: Int - maxAllocationPercentage: Float - minSignal: BigInt - maxSignal: BigInt - minStake: BigInt - minAverageQueryFees: BigInt - custom: String - decisionBasis: IndexingDecisionBasis! - requireSupported: Boolean! - safety: Boolean! - protocolNetwork: String! - } - - input IndexingRuleInput { - identifier: String! - identifierType: IdentifierType! - allocationAmount: BigInt - allocationLifetime: Int - autoRenewal: Boolean - parallelAllocations: Int - maxAllocationPercentage: Float - minSignal: BigInt - maxSignal: BigInt - minStake: BigInt - minAverageQueryFees: BigInt - custom: String - decisionBasis: IndexingDecisionBasis - requireSupported: Boolean - safety: Boolean - protocolNetwork: String! - } - - input IndexingRuleIdentifier { - identifier: String! - protocolNetwork: String! - } - - type GeoLocation { - latitude: String! - longitude: String! - } - - type IndexerRegistration { - url: String - protocolNetwork: String! - address: String - registered: Boolean! - location: GeoLocation - } - - type IndexingError { - handler: String - message: String! - } - - type BlockPointer { - number: Int! - hash: String! - } - - type ChainIndexingStatus { - network: String! - latestBlock: BlockPointer - chainHeadBlock: BlockPointer - earliestBlock: BlockPointer - } - - type IndexerDeployment { - subgraphDeployment: String! - synced: Boolean! - health: String! - fatalError: IndexingError - node: String - chains: [ChainIndexingStatus] - } - - type IndexerAllocation { - id: String! - allocatedTokens: BigInt! - createdAtEpoch: Int! - closedAtEpoch: Int - subgraphDeployment: String! - signalledTokens: BigInt! - stakedTokens: BigInt! - } - - type IndexerEndpointTest { - test: String! - error: String - possibleActions: [String]! - } - - type IndexerEndpoint { - url: String - healthy: Boolean! - protocolNetwork: String! - tests: [IndexerEndpointTest!]! - } - - type IndexerEndpoints { - service: IndexerEndpoint! - status: IndexerEndpoint! - } - - type CostModel { - deployment: String! - model: String - variables: String - } - - input CostModelInput { - deployment: String! - model: String - variables: String - } - - type Query { - indexingRule( - identifier: IndexingRuleIdentifier! - merged: Boolean! = false - ): IndexingRule - indexingRules(merged: Boolean! = false, protocolNetwork: String): [IndexingRule!]! - indexerRegistration(protocolNetwork: String!): IndexerRegistration! - indexerDeployments: [IndexerDeployment]! - indexerAllocations(protocolNetwork: String!): [IndexerAllocation]! - indexerEndpoints(protocolNetwork: String): [IndexerEndpoints!]! - - costModels(deployments: [String!]): [CostModel!]! - costModel(deployment: String!): CostModel - - dispute(identifier: POIDisputeIdentifier!): POIDispute - disputes( - status: String! - minClosedEpoch: Int! - protocolNetwork: String - ): [POIDispute]! - - allocations(filter: AllocationFilter!): [Allocation!]! - - action(actionID: String!): Action - actions( - filter: ActionFilter - orderBy: ActionParams - orderDirection: OrderDirection - first: Int - ): [Action]! - } - - type Mutation { - setIndexingRule(rule: IndexingRuleInput!): IndexingRule! - deleteIndexingRule(identifier: IndexingRuleIdentifier!): Boolean! - deleteIndexingRules(identifiers: [IndexingRuleIdentifier!]!): Boolean! - - setCostModel(costModel: CostModelInput!): CostModel! - deleteCostModels(deployments: [String!]!): Int! - - storeDisputes(disputes: [POIDisputeInput!]!): [POIDispute!] - deleteDisputes(identifiers: [POIDisputeIdentifier!]!): Int! - - createAllocation( - deployment: String! - amount: String! - indexNode: String - protocolNetwork: String! - ): CreateAllocationResult! - closeAllocation( - allocation: String! - poi: String - force: Boolean - protocolNetwork: String! - ): CloseAllocationResult! - reallocateAllocation( - allocation: String! - poi: String - amount: String! - force: Boolean - protocolNetwork: String! - ): ReallocateAllocationResult! - - updateAction(action: ActionInput!): Action! - updateActions(filter: ActionFilter!, action: ActionUpdateInput!): [Action]! - queueActions(actions: [ActionInput!]!): [Action]! - cancelActions(actionIDs: [String!]!): [Action]! - deleteActions(actionIDs: [String!]!): Int! - approveActions(actionIDs: [String!]!): [Action]! - executeApprovedActions: [ActionResult!]! - } -` - -export interface IndexerManagementDefaults { - globalIndexingRule: Omit< - IndexingRuleCreationAttributes, - 'identifier' | 'allocationAmount' - > & { allocationAmount: BigNumber } -} - -export interface IndexerManagementClientOptions { - logger: Logger - models: IndexerManagementModels - graphNode: GraphNode - // TODO:L2: Do we need this information? The GraphNode class auto-selects nodes based - // on availability. - // Ford: there were some edge cases where the GraphNode was not able to auto handle it on its own - indexNodeIDs: string[] - multiNetworks: MultiNetworks | undefined - defaults: IndexerManagementDefaults -} - -export class IndexerManagementClient extends Client { - private logger?: Logger - private models: IndexerManagementModels - private dai: WritableEventual - - constructor( - clientOptions: ClientOptions, - options: IndexerManagementClientOptions, - featureOptions: { dai: WritableEventual }, - ) { - super(clientOptions) - - this.logger = options.logger - this.models = options.models - this.dai = featureOptions.dai - } - - public async setDai(value: string): Promise { - // Get current value - const oldValue = this.dai.valueReady ? await this.dai.value() : undefined - - // Don't do anything if there is no change - if (equal(oldValue, value)) { - return - } - - // Notify others of the new value - this.dai.push(value) - - // Update DAI in all cost models - const update = `'${JSON.stringify({ DAI: value })}'::jsonb` - await this.models.CostModel.update( - { - // This merges DAI into the variables, overwriting existing values - variables: Sequelize.literal(`coalesce(variables, '{}'::jsonb) || ${update}`), - }, - { - // TODO: update to match all rows?? - where: { model: { [Op.not]: null } }, - }, - ) - } -} - -// TODO:L2: Put the IndexerManagementClient creation inside the Agent, and receive -// MultiNetworks from it -export const createIndexerManagementClient = async ( - options: IndexerManagementClientOptions, -): Promise => { - const { models, graphNode, logger, defaults, multiNetworks } = options - const schema = buildSchema(print(SCHEMA_SDL)) - const resolvers = { - ...indexingRuleResolvers, - ...statusResolvers, - ...costModelResolvers, - ...poiDisputeResolvers, - ...allocationResolvers, - ...actionResolvers, - } - - const dai: WritableEventual = mutable() - - const actionManager = multiNetworks - ? await ActionManager.create(multiNetworks, logger, models, graphNode) - : undefined - - const context: IndexerManagementResolverContext = { - models, - graphNode, - defaults, - logger: logger.child({ component: 'IndexerManagementClient' }), - dai, - multiNetworks, - actionManager, - } - - const exchange = executeExchange({ - schema, - rootValue: resolvers, - context, - }) - - return new IndexerManagementClient({ url: 'no-op', exchanges: [exchange] }, options, { - dai, - }) -} diff --git a/packages/indexer-common/src/indexer-management/context.ts b/packages/indexer-common/src/indexer-management/context.ts index 61cafd507..e674abc21 100644 --- a/packages/indexer-common/src/indexer-management/context.ts +++ b/packages/indexer-common/src/indexer-management/context.ts @@ -1,8 +1,17 @@ import { Logger, WritableEventual } from '@graphprotocol/common-ts' -import { IndexerManagementModels } from './models' +import { IndexerManagementModels, IndexingRuleCreationAttributes } from './models' import { GraphNode } from '../graph-node' -import { ActionManager, MultiNetworks, Network } from '@graphprotocol/indexer-common' -import { IndexerManagementDefaults } from './client' +import { BigNumber } from 'ethers' +import { ActionManager } from './actions' +import { MultiNetworks } from '../multi-networks' +import { Network } from '../network' + +export interface IndexerManagementDefaults { + globalIndexingRule: Omit< + IndexingRuleCreationAttributes, + 'identifier' | 'allocationAmount' + > & { allocationAmount: BigNumber } +} export interface IndexerManagementResolverContext { models: IndexerManagementModels diff --git a/packages/indexer-common/src/indexer-management/index.ts b/packages/indexer-common/src/indexer-management/index.ts index 1aeddfe92..83bbc9d2b 100644 --- a/packages/indexer-common/src/indexer-management/index.ts +++ b/packages/indexer-common/src/indexer-management/index.ts @@ -1,9 +1,10 @@ export * from './actions' export * from './allocations' -export * from './client' export * from './models' export * from './monitor' export * from './server' export * from './rules' export * from './types' export * from './context' + +export { isAsyncIterable } from 'graphql-yoga' diff --git a/packages/indexer-common/src/indexer-management/resolvers/actions.ts b/packages/indexer-common/src/indexer-management/resolvers/actions.ts deleted file mode 100644 index 2ad32b5fd..000000000 --- a/packages/indexer-common/src/indexer-management/resolvers/actions.ts +++ /dev/null @@ -1,429 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-types */ -import { IndexerManagementResolverContext } from '../context' -import { Logger } from '@graphprotocol/common-ts' -import { - Action, - ActionParams, - ActionResult, - ActionUpdateInput, - IndexerManagementModels, - Network, - NetworkMapped, - OrderDirection, - validateActionInputs, - validateNetworkIdentifier, -} from '@graphprotocol/indexer-common' -import { literal, Op, Transaction } from 'sequelize' -import { ActionManager } from '../actions' -import groupBy from 'lodash.groupby' -import { - ActionFilter, - ActionInput, - ActionStatus, - ActionType, -} from '../../schema/types.generated' - -// Perform insert, update, or no-op depending on existing queue data -// INSERT - No item in the queue yet targeting this deploymentID -// UPDATE - Already an item in the queue targeting the same deploymentID AND that item was added by the same 'source' -// NO-OP - Already an item in the queue targeting the same deploymentID BUT was added by a different source -// TODO: Use pending status for actions in process of execution, detect here and if duplicate pending found, NOOP -async function executeQueueOperation( - logger: Logger, - action: ActionInput, - actionsAwaitingExecution: Action[], - recentlyAttemptedActions: Action[], - models: IndexerManagementModels, - transaction: Transaction, -): Promise { - // Check for previously failed conflicting actions - const conflictingActions = recentlyAttemptedActions.filter(function (recentAction) { - const areEqual = compareActions(recentAction, action) - const fromAgent = action.source === 'indexerAgent' - return areEqual && fromAgent - }) - if (conflictingActions.length > 0) { - const message = `Recently executed '${action.type}' action found in queue targeting '${action.deploymentID}', ignoring.` - logger.warn(message, { - recentlyAttemptedAction: conflictingActions, - proposedAction: action, - }) - throw Error(message) - } - - // Check for duplicated actions - const duplicateActions = actionsAwaitingExecution.filter( - (a) => - a.deploymentID === action.deploymentID && - a.protocolNetwork === action.protocolNetwork, - ) - if (duplicateActions.length === 0) { - logger.trace('Inserting Action in database', { action }) - return [ - await models.Action.create( - { - ...action, - // @ts-expect-error once we upgrade to latest TS types will get asserted with the filter - deploymentID: action.deploymentID, - }, - { - validate: true, - returning: true, - transaction, - }, - ), - ] - } else if (duplicateActions.length === 1) { - if ( - duplicateActions[0].source === action.source && - duplicateActions[0].status === action.status - ) { - // TODO: Log this only when update will actually change existing item - logger.trace( - `Action found in queue that effects the same deployment as proposed queue action, updating existing action`, - { - actionInQueue: duplicateActions, - proposedAction: action, - proposedSource: action.source, - actionSources: duplicateActions[0].source, - }, - ) - const [, updatedAction] = await models.Action.update( - { - ...action, - // @ts-expect-error once we upgrade to latest TS types will get asserted with the filter - deploymentID: action.deploymentID, - }, - { - where: { id: duplicateActions[0].id }, - returning: true, - validate: true, - transaction, - }, - ) - return updatedAction - } else { - const message = - `Duplicate action found in queue that effects '${action.deploymentID}' but NOT overwritten because it has a different source and/or status. If you ` + - `would like to replace the item currently in the queue please cancel it and then queue the proposed action` - logger.warn(message, { - actionInQueue: duplicateActions, - proposedAction: action, - }) - throw Error(message) - } - } else { - throw Error( - `Uniqueness constraint broken: Multiple actions items targeting the same deployment found in queue (ActionStatus = queued). Something has gone wrong, please cleanup your 'Actions' table to continue`, - ) - } -} - -export default { - action: async ( - { actionID }: { actionID: string }, - { logger, models }: IndexerManagementResolverContext, - ): Promise => { - logger.debug(`Execute 'action' query`, { - actionID, - }) - return await models.Action.findOne({ - where: { id: actionID }, - }) - }, - - actions: async ( - { - filter, - orderBy, - orderDirection, - first, - }: { - filter: ActionFilter - orderBy: ActionParams - orderDirection: OrderDirection - first: number - }, - { logger, models }: IndexerManagementResolverContext, - ): Promise => { - logger.debug(`Execute 'actions' query`, { - filter, - orderBy, - orderDirection, - first, - }) - return await ActionManager.fetchActions( - models, - filter, - orderBy, - orderDirection, - first, - ) - }, - - queueActions: async ( - { actions }: { actions: ActionInput[] }, - { actionManager, logger, multiNetworks, models }: IndexerManagementResolverContext, - ): Promise => { - logger.debug(`Execute 'queueActions' mutation`, { - actions, - }) - - if (!actionManager || !multiNetworks) { - throw Error('IndexerManagementClient must be in `network` mode to modify actions') - } - - // Sanitize protocol network identifier - actions.forEach((action) => { - try { - action.protocolNetwork = validateNetworkIdentifier(action.protocolNetwork) - } catch (e) { - throw Error(`Invalid value for the field 'protocolNetwork'. ${e}`) - } - }) - - // Let Network Monitors validate actions based on their protocol networks - await multiNetworks.mapNetworkMapped( - groupBy(actions, (action) => action.protocolNetwork), - (network: Network, actions: ActionInput[]) => - validateActionInputs(actions, network.networkMonitor, logger), - ) - - const alreadyQueuedActions = await ActionManager.fetchActions( - models, - { - status: ActionStatus.queued, - }, - undefined, - ) - const alreadyApprovedActions = await ActionManager.fetchActions( - models, - { - status: ActionStatus.approved, - }, - undefined, - ) - const actionsAwaitingExecution = alreadyQueuedActions.concat(alreadyApprovedActions) - - // Fetch recently attempted actions - const last15Minutes = { - [Op.gte]: literal("NOW() - INTERVAL '15m'"), - } - - const recentlyFailedActions = await ActionManager.fetchActions( - models, - { - status: ActionStatus.failed, - updatedAt: last15Minutes, - }, - undefined, - ) - - const recentlySuccessfulActions = await ActionManager.fetchActions( - models, - { - status: ActionStatus.success, - updatedAt: last15Minutes, - }, - undefined, - ) - - logger.trace('Recently attempted actions', { - recentlySuccessfulActions, - recentlyFailedActions, - }) - - const recentlyAttemptedActions = recentlyFailedActions.concat( - recentlySuccessfulActions, - ) - - let results: ActionResult[] = [] - - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - await models.Action.sequelize!.transaction(async (transaction) => { - for (const action of actions) { - const result = await executeQueueOperation( - logger, - action, - actionsAwaitingExecution, - recentlyAttemptedActions, - models, - transaction, - ) - results = results.concat(result) - } - }) - - return results - }, - - cancelActions: async ( - { actionIDs }: { actionIDs: number[] }, - { logger, models }: IndexerManagementResolverContext, - ): Promise => { - logger.debug(`Execute 'cancelActions' mutation`, { - actionIDs, - }) - const [, canceledActions] = await models.Action.update( - { status: ActionStatus.canceled }, - { where: { id: actionIDs }, returning: true }, - ) - - if (canceledActions.length === 0) { - throw Error(`Cancel action failed: No action items found with id in [${actionIDs}]`) - } - - return canceledActions - }, - - deleteActions: async ( - { actionIDs }: { actionIDs: number[] }, - { logger, models }: IndexerManagementResolverContext, - ): Promise => { - logger.debug(`Execute 'deleteActions' mutation`, { - actionIDs, - }) - const numDeleted = await models.Action.destroy({ where: { id: actionIDs } }) - - if (numDeleted === 0) { - throw Error(`Delete action failed: No action items found with id in [${actionIDs}]`) - } - - return numDeleted - }, - - updateAction: async ( - { action }: { action: Action }, - { logger, models }: IndexerManagementResolverContext, - ): Promise => { - logger.debug(`Execute 'updateAction' mutation`, { - action, - }) - const [, updatedActions] = await models.Action.update(action, { - where: { id: action.id }, - returning: true, - }) - - if (updatedActions.length === 0) { - throw Error( - `Update action failed, are you sure there is an item in the queue with id = ${action.id}`, - ) - } - if (updatedActions.length > 1) { - throw Error( - `${updatedActions.length} action items updated in the queue. Should be '1'`, - ) - } - return updatedActions[0] - }, - - updateActions: async ( - { - filter, - action, - }: { - filter: ActionFilter - action: ActionUpdateInput - }, - { logger, models }: IndexerManagementResolverContext, - ): Promise => { - logger.debug(`Execute 'updateActions' mutation`, { - filter, - action, - }) - - const results = await ActionManager.updateActions(models, action, filter) - - if (results[0] === 0) { - const msg = `Actions update failed: No action was matched by the filter, '${JSON.stringify( - filter, - )}'` - logger.debug(msg) - throw Error(msg) - } - logger.info(`'${results[0]}' actions updated`) - - return results[1] - }, - - approveActions: async ( - { actionIDs }: { actionIDs: number[] }, - { logger, models }: IndexerManagementResolverContext, - ): Promise => { - logger.debug(`Execute 'approveActions' mutation`, { - actionIDs, - }) - const [, updatedActions] = await models.Action.update( - { status: ActionStatus.approved }, - { where: { id: actionIDs }, returning: true }, - ) - - if (updatedActions.length === 0) { - throw Error( - `Approve action failed: No action items found with id in [${actionIDs}]`, - ) - } - - return updatedActions - }, - - executeApprovedActions: async ( - _: unknown, - { logger: parentLogger, actionManager }: IndexerManagementResolverContext, - ): Promise => { - const logger = parentLogger.child({ function: 'executeApprovedActions' }) - logger.trace(`Begin executing 'executeApprovedActions' mutation`) - if (!actionManager) { - throw Error('IndexerManagementClient must be in `network` mode to modify actions') - } - const result: NetworkMapped = await actionManager.multiNetworks.map( - async (network: Network) => { - logger.debug(`Execute 'executeApprovedActions' mutation`, { - protocolNetwork: network.specification.networkIdentifier, - }) - try { - return await actionManager.executeApprovedActions(network) - } catch (error) { - logger.error('Failed to execute approved actions for network', { - protocolNetwork: network.specification.networkIdentifier, - error, - }) - return [] - } - }, - ) - return Object.values(result).flat() - }, -} - -// Helper function to assess equality among a enqueued and a proposed actions -function compareActions(enqueued: Action, proposed: ActionInput): boolean { - // actions are not the same if they target different protocol networks - if (enqueued.protocolNetwork !== proposed.protocolNetwork) { - return false - } - - // actions are not the same if they target different deployments - if (enqueued.deploymentID !== proposed.deploymentID) { - return false - } - // actions are not the same if they have different types - if (enqueued.type !== proposed.type) { - return false - } - - // Different fields are used to assess equality depending on the action type - const amount = enqueued.amount === proposed.amount - const poi = enqueued.poi == proposed.poi - const force = enqueued.force == proposed.force - switch (proposed.type) { - case ActionType.allocate: - return amount - case ActionType.unallocate: - return poi && force - case ActionType.reallocate: - return amount && poi && force - default: - return false - } -} diff --git a/packages/indexer-common/src/indexer-management/resolvers/allocations.ts b/packages/indexer-common/src/indexer-management/resolvers/allocations.ts deleted file mode 100644 index 214bf617a..000000000 --- a/packages/indexer-common/src/indexer-management/resolvers/allocations.ts +++ /dev/null @@ -1,1115 +0,0 @@ -import { - NetworkMonitor, - epochElapsedBlocks, - Network, -} from '@graphprotocol/indexer-common' -/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ -/* eslint-disable @typescript-eslint/ban-types */ -import { - Allocation as AllocationInfo, - IdentifierType, - IndexingDecisionBasis, -} from '../../schema/types.generated' -import pMap from 'p-map' -import gql from 'graphql-tag' -import { BigNumber, utils } from 'ethers' - -import { - Address, - formatGRT, - Logger, - parseGRT, - SubgraphDeploymentID, - toAddress, -} from '@graphprotocol/common-ts' -import { - Allocation, - allocationIdProof, - AllocationStatus, - CloseAllocationResult, - CreateAllocationResult, - indexerError, - IndexerErrorCode, - IndexerManagementResolverContext, - IndexingRuleAttributes, - GraphNode, - NetworkSubgraph, - ReallocateAllocationResult, - uniqueAllocationID, -} from '@graphprotocol/indexer-common' -import { extractNetwork } from './utils' - -interface AllocationFilter { - status: 'active' | 'closed' - allocation: string | null - subgraphDeployment: string | null - protocolNetwork: string | null -} - -enum AllocationQuery { - all = 'all', - active = 'active', - closed = 'closed', - allocation = 'allocation', -} - -const ALLOCATION_QUERIES = { - [AllocationQuery.all]: gql` - query allocations($indexer: String!) { - allocations(where: { indexer: $indexer }, first: 1000) { - id - subgraphDeployment { - id - stakedTokens - signalledTokens - } - indexer { - id - } - allocatedTokens - createdAtEpoch - closedAtEpoch - indexingRewards - queryFeesCollected - status - } - } - `, - [AllocationQuery.active]: gql` - query allocations($indexer: String!) { - allocations(where: { indexer: $indexer, status: Active }, first: 1000) { - id - subgraphDeployment { - id - stakedTokens - signalledTokens - } - indexer { - id - } - allocatedTokens - createdAtEpoch - closedAtEpoch - indexingRewards - queryFeesCollected - status - } - } - `, - [AllocationQuery.closed]: gql` - query allocations($indexer: String!) { - allocations(where: { indexer: $indexer, status: Closed }, first: 1000) { - id - subgraphDeployment { - id - stakedTokens - signalledTokens - } - indexer { - id - } - allocatedTokens - createdAtEpoch - closedAtEpoch - indexingRewards - queryFeesCollected - status - } - } - `, - [AllocationQuery.allocation]: gql` - query allocations($allocation: String!) { - allocations(where: { id: $allocation }, first: 1000) { - id - subgraphDeployment { - id - stakedTokens - signalledTokens - } - indexer { - id - } - allocatedTokens - createdAtEpoch - closedAtEpoch - indexingRewards - queryFeesCollected - status - } - } - `, -} - -export async function queryAllocations( - logger: Logger, - networkSubgraph: NetworkSubgraph, - variables: { - indexer: Address - allocation: Address | null - status: 'active' | 'closed' | null - }, - context: { - currentEpoch: number - currentEpochStartBlock: number - currentEpochElapsedBlocks: number - maxAllocationEpochs: number - blocksPerEpoch: number - avgBlockTime: number - protocolNetwork: string - }, -): Promise { - logger.trace('Query Allocations', { - variables, - context, - }) - - let filterType: AllocationQuery - let filterVars: object - if (variables.allocation) { - filterType = AllocationQuery.allocation - filterVars = { - allocation: variables.allocation.toLowerCase(), - } - } else if (variables.status == null && variables.allocation == null) { - filterType = AllocationQuery.all - filterVars = { - indexer: variables.indexer.toLowerCase(), - } - } else if (variables.status == 'active') { - filterType = AllocationQuery.active - filterVars = { - indexer: variables.indexer.toLowerCase(), - } - } else if (variables.status == 'closed') { - filterType = AllocationQuery.closed - filterVars = { - indexer: variables.indexer.toLowerCase(), - } - } else { - // Shouldn't ever get here - throw new Error( - `Unsupported combination of variables provided, variables: ${variables}`, - ) - } - - const result = await networkSubgraph.checkedQuery( - ALLOCATION_QUERIES[filterType], - filterVars, - ) - - if (result.data.allocations.length == 0) { - // TODO: Is 'Claimable' still the correct term here, after Exponential Rebates? - logger.info(`No 'Claimable' allocations found`) - return [] - } - - if (result.error) { - logger.warning('Query failed', { - error: result.error, - }) - throw result.error - } - - // eslint-disable-next-line @typescript-eslint/no-explicit-any - return pMap( - result.data.allocations, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - async (allocation: any): Promise => { - const deadlineEpoch = allocation.createdAtEpoch + context.maxAllocationEpochs - const remainingBlocks = - // blocks remaining in current epoch - context.blocksPerEpoch - - context.currentEpochElapsedBlocks + - // blocks in the remaining epochs after this one - context.blocksPerEpoch * (deadlineEpoch - context.currentEpoch - 1) - return { - id: allocation.id, - indexer: allocation.indexer.id, - subgraphDeployment: new SubgraphDeploymentID(allocation.subgraphDeployment.id) - .ipfsHash, - signalledTokens: allocation.subgraphDeployment.signalledTokens, - stakedTokens: allocation.subgraphDeployment.stakedTokens, - allocatedTokens: BigNumber.from(allocation.allocatedTokens).toString(), - createdAtEpoch: allocation.createdAtEpoch, - closedAtEpoch: allocation.closedAtEpoch, - ageInEpochs: allocation.closedAtEpoch - ? allocation.closedAtEpoch - allocation.createdAtEpoch - : context.currentEpoch - allocation.createdAtEpoch, - closeDeadlineEpoch: allocation.createdAtEpoch + context.maxAllocationEpochs, - closeDeadlineBlocksRemaining: remainingBlocks, - closeDeadlineTimeRemaining: remainingBlocks * context.avgBlockTime, - indexingRewards: allocation.indexingRewards, - queryFeesCollected: allocation.queryFeesCollected, - status: allocation.status, - protocolNetwork: context.protocolNetwork, - } - }, - ) -} - -async function resolvePOI( - networkMonitor: NetworkMonitor, - graphNode: GraphNode, - allocation: Allocation, - poi: string | undefined, - force: boolean, -): Promise { - // poi = undefined, force=true -- submit even if poi is 0x0 - // poi = defined, force=true -- no generatedPOI needed, just submit the POI supplied (with some sanitation?) - // poi = undefined, force=false -- submit with generated POI if one available - // poi = defined, force=false -- submit user defined POI only if generated POI matches - switch (force) { - case true: - switch (!!poi) { - case true: - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - return poi! - case false: - return ( - (await graphNode.proofOfIndexing( - allocation.subgraphDeployment.id, - await networkMonitor.fetchPOIBlockPointer(allocation), - allocation.indexer, - )) || utils.hexlify(Array(32).fill(0)) - ) - } - break - case false: { - const currentEpochStartBlock = await networkMonitor.fetchPOIBlockPointer(allocation) - const generatedPOI = await graphNode.proofOfIndexing( - allocation.subgraphDeployment.id, - currentEpochStartBlock, - allocation.indexer, - ) - switch (poi == generatedPOI) { - case true: - if (poi == undefined) { - const deploymentStatus = await graphNode.indexingStatus([ - allocation.subgraphDeployment.id, - ]) - throw indexerError( - IndexerErrorCode.IE067, - `POI not available for deployment at current epoch start block. - currentEpochStartBlock: ${currentEpochStartBlock.number} - deploymentStatus: ${ - deploymentStatus.length > 0 - ? JSON.stringify(deploymentStatus) - : 'not deployed' - }`, - ) - } else { - return poi - } - case false: - if (poi == undefined && generatedPOI !== undefined) { - return generatedPOI - } else if (poi !== undefined && generatedPOI == undefined) { - return poi - } - throw indexerError( - IndexerErrorCode.IE068, - `User provided POI does not match reference fetched from the graph-node. Use '--force' to bypass this POI accuracy check. - POI: ${poi}, - referencePOI: ${generatedPOI}`, - ) - } - } - } -} - -export default { - allocations: async ( - { filter }: { filter: AllocationFilter }, - { multiNetworks, logger }: IndexerManagementResolverContext, - ): Promise => { - logger.debug('Execute allocations() query', { - filter, - }) - if (!multiNetworks) { - throw Error( - 'IndexerManagementClient must be in `network` mode to fetch allocations', - ) - } - - const allocationsByNetwork = await multiNetworks.map( - async (network: Network): Promise => { - // Return early if a different protocol network is specifically requested - if ( - filter.protocolNetwork && - filter.protocolNetwork !== network.specification.networkIdentifier - ) { - return [] - } - - const { - networkMonitor, - networkSubgraph, - contracts, - specification: { - indexerOptions: { address }, - }, - } = network - - const [currentEpoch, maxAllocationEpochs, epochLength] = await Promise.all([ - networkMonitor.networkCurrentEpoch(), - contracts.staking.maxAllocationEpochs(), - contracts.epochManager.epochLength(), - ]) - - const allocation = filter.allocation - ? filter.allocation === 'all' - ? null - : toAddress(filter.allocation) - : null - - const variables = { - indexer: toAddress(address), - allocation, - status: filter.status, - } - - const context = { - currentEpoch: currentEpoch.epochNumber, - currentEpochStartBlock: currentEpoch.startBlockNumber, - currentEpochElapsedBlocks: epochElapsedBlocks(currentEpoch), - latestBlock: currentEpoch.latestBlock, - maxAllocationEpochs, - blocksPerEpoch: epochLength.toNumber(), - avgBlockTime: 13000, - protocolNetwork: network.specification.networkIdentifier, - } - - return queryAllocations(logger, networkSubgraph, variables, context) - }, - ) - - return Object.values(allocationsByNetwork).flat() - }, - - createAllocation: async ( - { - deployment, - amount, - protocolNetwork, - }: { - deployment: string - amount: string - protocolNetwork: string - }, - { multiNetworks, graphNode, logger, models }: IndexerManagementResolverContext, - ): Promise => { - logger.debug('Execute createAllocation() mutation', { - deployment, - amount, - protocolNetwork, - }) - if (!multiNetworks) { - throw Error( - 'IndexerManagementClient must be in `network` mode to fetch allocations', - ) - } - const network = extractNetwork(protocolNetwork, multiNetworks) - const networkMonitor = network.networkMonitor - const contracts = network.contracts - const transactionManager = network.transactionManager - const address = network.specification.indexerOptions.address - - const allocationAmount = parseGRT(amount) - const subgraphDeployment = new SubgraphDeploymentID(deployment) - - const activeAllocations = await networkMonitor.allocations(AllocationStatus.ACTIVE) - - const allocation = activeAllocations.find( - (allocation) => - allocation.subgraphDeployment.id.toString() === subgraphDeployment.toString(), - ) - if (allocation) { - logger.warn('Already allocated to deployment', { - deployment: allocation.subgraphDeployment.id.ipfsHash, - activeAllocation: allocation.id, - }) - throw indexerError( - IndexerErrorCode.IE060, - `Allocation failed. An active allocation already exists for deployment '${allocation.subgraphDeployment.id.ipfsHash}'`, - ) - } - - if (allocationAmount.lt('0')) { - logger.warn('Cannot allocate a negative amount of GRT', { - amount: formatGRT(allocationAmount), - }) - throw indexerError( - IndexerErrorCode.IE061, - `Invalid allocation amount provided (${amount.toString()}). Must use positive allocation amount`, - ) - } - - try { - const currentEpoch = await contracts.epochManager.currentEpoch() - - // Identify how many GRT the indexer has staked - const freeStake = await contracts.staking.getIndexerCapacity(address) - - // If there isn't enough left for allocating, abort - if (freeStake.lt(allocationAmount)) { - logger.error( - `Allocation of ${formatGRT( - allocationAmount, - )} GRT cancelled: indexer only has a free stake amount of ${formatGRT( - freeStake, - )} GRT`, - ) - throw indexerError( - IndexerErrorCode.IE013, - `Allocation of ${formatGRT( - allocationAmount, - )} GRT cancelled: indexer only has a free stake amount of ${formatGRT( - freeStake, - )} GRT`, - ) - } - - // Ensure subgraph is deployed before allocating - await graphNode.ensure( - `indexer-agent/${subgraphDeployment.ipfsHash.slice(-10)}`, - subgraphDeployment, - ) - - logger.debug('Obtain a unique Allocation ID') - - // Obtain a unique allocation ID - const { allocationSigner, allocationId } = uniqueAllocationID( - transactionManager.wallet.mnemonic.phrase, - currentEpoch.toNumber(), - subgraphDeployment, - activeAllocations.map((allocation) => allocation.id), - ) - - // Double-check whether the allocationID already exists on chain, to - // avoid unnecessary transactions. - // Note: We're checking the allocation state here, which is defined as - // - // enum AllocationState { Null, Active, Closed, Finalized } - // - // in the contracts. - const state = await contracts.staking.getAllocationState(allocationId) - if (state !== 0) { - logger.debug(`Skipping allocation as it already exists onchain`, { - indexer: address, - allocation: allocationId, - state, - }) - throw indexerError( - IndexerErrorCode.IE066, - `Allocation '${allocationId}' already exists onchain`, - ) - } - - logger.debug('Generating new allocation ID proof', { - newAllocationSigner: allocationSigner, - newAllocationID: allocationId, - indexerAddress: address, - }) - - const proof = await allocationIdProof(allocationSigner, address, allocationId) - - logger.debug('Successfully generated allocation ID proof', { - allocationIDProof: proof, - }) - - logger.debug(`Sending allocateFrom transaction`, { - indexer: address, - subgraphDeployment: subgraphDeployment.ipfsHash, - amount: formatGRT(allocationAmount), - allocation: allocationId, - proof, - protocolNetwork, - }) - - const receipt = await transactionManager.executeTransaction( - async () => - contracts.staking.estimateGas.allocateFrom( - address, - subgraphDeployment.bytes32, - allocationAmount, - allocationId, - utils.hexlify(Array(32).fill(0)), - proof, - ), - async (gasLimit) => - contracts.staking.allocateFrom( - address, - subgraphDeployment.bytes32, - allocationAmount, - allocationId, - utils.hexlify(Array(32).fill(0)), - proof, - { gasLimit }, - ), - logger.child({ action: 'allocate' }), - ) - - if (receipt === 'paused' || receipt === 'unauthorized') { - throw indexerError( - IndexerErrorCode.IE062, - `Allocation not created. ${ - receipt === 'paused' ? 'Network paused' : 'Operator not authorized' - }`, - ) - } - - const createAllocationEventLogs = network.transactionManager.findEvent( - 'AllocationCreated', - network.contracts.staking.interface, - 'subgraphDeploymentID', - subgraphDeployment.toString(), - receipt, - logger, - ) - - if (!createAllocationEventLogs) { - throw indexerError( - IndexerErrorCode.IE014, - `Allocation create transaction was never mined`, - ) - } - - logger.info(`Successfully allocated to subgraph deployment`, { - amountGRT: formatGRT(createAllocationEventLogs.tokens), - allocation: createAllocationEventLogs.allocationID, - epoch: createAllocationEventLogs.epoch.toString(), - transaction: receipt.transactionHash, - }) - - logger.debug( - `Updating indexing rules, so indexer-agent will now manage the active allocation`, - ) - const indexingRule = { - identifier: subgraphDeployment.ipfsHash, - allocationAmount: allocationAmount.toString(), - identifierType: IdentifierType.deployment, - decisionBasis: IndexingDecisionBasis.always, - protocolNetwork, - } as Partial - - await models.IndexingRule.upsert(indexingRule) - - // Since upsert succeeded, we _must_ have a rule - const updatedRule = await models.IndexingRule.findOne({ - where: { identifier: indexingRule.identifier }, - }) - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - logger.debug(`DecisionBasis.ALWAYS rule merged into indexing rules`, { - rule: updatedRule, - }) - - return { - actionID: 0, - type: 'allocate', - transactionID: receipt.transactionHash, - deployment, - allocation: createAllocationEventLogs.allocationID, - allocatedTokens: formatGRT(allocationAmount.toString()), - protocolNetwork, - } - } catch (error) { - logger.error(`Failed to allocate`, { - amount: formatGRT(allocationAmount), - error, - }) - throw error - } - }, - - closeAllocation: async ( - { - allocation, - poi, - force, - protocolNetwork, - }: { - allocation: string - poi: string | undefined - force: boolean - protocolNetwork: string - }, - { graphNode, logger, models, multiNetworks }: IndexerManagementResolverContext, - ): Promise => { - logger.debug('Execute closeAllocation() mutation', { - allocationID: allocation, - poi: poi || 'none provided', - }) - if (!multiNetworks) { - throw Error( - 'IndexerManagementClient must be in `network` mode to fetch allocations', - ) - } - const network = extractNetwork(protocolNetwork, multiNetworks) - const networkMonitor = network.networkMonitor - const contracts = network.contracts - const transactionManager = network.transactionManager - const receiptCollector = network.receiptCollector - - const allocationData = await networkMonitor.allocation(allocation) - - try { - // Ensure allocation is old enough to close - const currentEpoch = await contracts.epochManager.currentEpoch() - if (BigNumber.from(allocationData.createdAtEpoch).eq(currentEpoch)) { - throw indexerError( - IndexerErrorCode.IE064, - `Allocation '${ - allocationData.id - }' cannot be closed until epoch ${currentEpoch.add( - 1, - )}. (Allocations cannot be closed in the same epoch they were created)`, - ) - } - - poi = await resolvePOI(networkMonitor, graphNode, allocationData, poi, force) - - // Double-check whether the allocation is still active on chain, to - // avoid unnecessary transactions. - // Note: We're checking the allocation state here, which is defined as - // - // enum AllocationState { Null, Active, Closed, Finalized } - // - // in the contracts. - const state = await contracts.staking.getAllocationState(allocationData.id) - if (state !== 1) { - throw indexerError(IndexerErrorCode.IE065, 'Allocation has already been closed') - } - - logger.debug('Sending closeAllocation transaction') - const receipt = await transactionManager.executeTransaction( - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - () => contracts.staking.estimateGas.closeAllocation(allocationData.id, poi!), - (gasLimit) => - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - contracts.staking.closeAllocation(allocationData.id, poi!, { - gasLimit, - }), - logger, - ) - - if (receipt === 'paused' || receipt === 'unauthorized') { - throw indexerError( - IndexerErrorCode.IE062, - `Allocation '${allocationData.id}' could not be closed: ${receipt}`, - ) - } - - const closeAllocationEventLogs = transactionManager.findEvent( - 'AllocationClosed', - contracts.staking.interface, - 'allocationID', - allocation, - receipt, - logger, - ) - - if (!closeAllocationEventLogs) { - throw indexerError( - IndexerErrorCode.IE015, - `Allocation close transaction was never successfully mined`, - ) - } - - const rewardsEventLogs = transactionManager.findEvent( - 'RewardsAssigned', - contracts.rewardsManager.interface, - 'allocationID', - allocation, - receipt, - logger, - ) - - const rewardsAssigned = rewardsEventLogs ? rewardsEventLogs.amount : 0 - - if (rewardsAssigned == 0) { - logger.warn('No rewards were distributed upon closing the allocation') - } - - logger.info(`Successfully closed allocation`, { - deployment: closeAllocationEventLogs.subgraphDeploymentID, - allocation: closeAllocationEventLogs.allocationID, - indexer: closeAllocationEventLogs.indexer, - amountGRT: formatGRT(closeAllocationEventLogs.tokens), - effectiveAllocation: closeAllocationEventLogs.effectiveAllocation.toString(), - poi: closeAllocationEventLogs.poi, - epoch: closeAllocationEventLogs.epoch.toString(), - transaction: receipt.transactionHash, - indexingRewards: rewardsAssigned, - }) - - logger.info('Identifying receipts worth collecting', { - allocation: closeAllocationEventLogs.allocationID, - }) - - // Collect query fees for this allocation - const isCollectingQueryFees = await receiptCollector.collectReceipts( - 0, - allocationData, - ) - - logger.debug( - `Updating indexing rules, so indexer-agent keeps the deployment synced but doesn't reallocate to it`, - ) - const offchainIndexingRule = { - protocolNetwork: network.specification.networkIdentifier, - identifier: allocationData.subgraphDeployment.id.ipfsHash, - identifierType: IdentifierType.deployment, - decisionBasis: IndexingDecisionBasis.offchain, - } as Partial - - await models.IndexingRule.upsert(offchainIndexingRule) - - // Since upsert succeeded, we _must_ have a rule - const updatedRule = await models.IndexingRule.findOne({ - where: { identifier: offchainIndexingRule.identifier }, - }) - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - logger.info(`DecisionBasis.OFFCHAIN rule merged into indexing rules`, { - rule: updatedRule, - }) - - return { - actionID: 0, - type: 'unallocate', - transactionID: receipt.transactionHash, - allocation: closeAllocationEventLogs.allocationID, - allocatedTokens: formatGRT(closeAllocationEventLogs.tokens), - indexingRewards: formatGRT(rewardsAssigned), - receiptsWorthCollecting: isCollectingQueryFees, - protocolNetwork: network.specification.networkIdentifier, - } - } catch (error) { - logger.error(error.toString()) - throw error - } - }, - - reallocateAllocation: async ( - { - allocation, - poi, - amount, - force, - protocolNetwork, - }: { - allocation: string - poi: string | undefined - amount: string - force: boolean - protocolNetwork: string - }, - { graphNode, logger, models, multiNetworks }: IndexerManagementResolverContext, - ): Promise => { - logger = logger.child({ - component: 'reallocateAllocationResolver', - }) - - logger.info('Reallocating allocation', { - allocation: allocation, - poi: poi || 'none provided', - amount, - force, - }) - - if (!multiNetworks) { - throw Error( - 'IndexerManagementClient must be in `network` mode to fetch allocations', - ) - } - - // Obtain the Network object and its associated components and data - const network = extractNetwork(protocolNetwork, multiNetworks) - const networkMonitor = network.networkMonitor - const contracts = network.contracts - const transactionManager = network.transactionManager - const receiptCollector = network.receiptCollector - const address = network.specification.indexerOptions.address - - const allocationAmount = parseGRT(amount) - - const activeAllocations = await networkMonitor.allocations(AllocationStatus.ACTIVE) - - const allocationAddress = toAddress(allocation) - const allocationData = activeAllocations.find((allocation) => { - return allocation.id === allocationAddress - }) - - if (!allocationData) { - throw indexerError( - IndexerErrorCode.IE063, - `Reallocation failed: No active allocation with id '${allocation}' found`, - ) - } - - try { - // Ensure allocation is old enough to close - const currentEpoch = await contracts.epochManager.currentEpoch() - if (BigNumber.from(allocationData.createdAtEpoch).eq(currentEpoch)) { - throw indexerError( - IndexerErrorCode.IE064, - `Allocation '${ - allocationData.id - }' cannot be closed until epoch ${currentEpoch.add( - 1, - )}. (Allocations cannot be closed in the same epoch they were created)`, - ) - } - - logger.debug('Resolving POI') - const allocationPOI = await resolvePOI( - networkMonitor, - graphNode, - allocationData, - poi, - force, - ) - logger.debug('POI resolved', { - userProvidedPOI: poi, - poi: allocationPOI, - }) - - // Double-check whether the allocation is still active on chain, to - // avoid unnecessary transactions. - // Note: We're checking the allocation state here, which is defined as - // - // enum AllocationState { Null, Active, Closed, Finalized } - // - // in the contracts. - const state = await contracts.staking.getAllocationState(allocationData.id) - if (state !== 1) { - logger.warn(`Allocation has already been closed`) - throw indexerError(IndexerErrorCode.IE065, `Allocation has already been closed`) - } - - if (allocationAmount.lt('0')) { - logger.warn('Cannot reallocate a negative amount of GRT', { - amount: allocationAmount.toString(), - }) - throw indexerError( - IndexerErrorCode.IE061, - 'Cannot reallocate a negative amount of GRT', - ) - } - - logger.info(`Reallocate to subgraph deployment`, { - existingAllocationAmount: formatGRT(allocationData.allocatedTokens), - newAllocationAmount: formatGRT(allocationAmount), - epoch: currentEpoch.toString(), - }) - - // Identify how many GRT the indexer has staked - const freeStake = await contracts.staking.getIndexerCapacity(address) - - // When reallocating, we will first close the old allocation and free up the GRT in that allocation - // This GRT will be available in addition to freeStake for the new allocation - const postCloseFreeStake = freeStake.add(allocationData.allocatedTokens) - - // If there isn't enough left for allocating, abort - if (postCloseFreeStake.lt(allocationAmount)) { - throw indexerError( - IndexerErrorCode.IE013, - `Unable to allocate ${formatGRT( - allocationAmount, - )} GRT: indexer only has a free stake amount of ${formatGRT( - freeStake, - )} GRT, plus ${formatGRT( - allocationData.allocatedTokens, - )} GRT from the existing allocation`, - ) - } - - logger.debug('Generating a new unique Allocation ID') - const { allocationSigner, allocationId: newAllocationId } = uniqueAllocationID( - transactionManager.wallet.mnemonic.phrase, - currentEpoch.toNumber(), - allocationData.subgraphDeployment.id, - activeAllocations.map((allocation) => allocation.id), - ) - - logger.debug('New unique Allocation ID generated', { - newAllocationID: newAllocationId, - newAllocationSigner: allocationSigner, - }) - - // Double-check whether the allocationID already exists on chain, to - // avoid unnecessary transactions. - // Note: We're checking the allocation state here, which is defined as - // - // enum AllocationState { Null, Active, Closed, Finalized } - // - // in the contracts. - const newAllocationState = - await contracts.staking.getAllocationState(newAllocationId) - if (newAllocationState !== 0) { - logger.warn(`Skipping Allocation as it already exists onchain`, { - indexer: address, - allocation: newAllocationId, - newAllocationState, - }) - throw indexerError(IndexerErrorCode.IE066, 'AllocationID already exists') - } - - logger.debug('Generating new allocation ID proof', { - newAllocationSigner: allocationSigner, - newAllocationID: newAllocationId, - indexerAddress: address, - }) - const proof = await allocationIdProof(allocationSigner, address, newAllocationId) - logger.debug('Successfully generated allocation ID proof', { - allocationIDProof: proof, - }) - - logger.info(`Sending close and allocate multicall transaction`, { - indexer: address, - amount: formatGRT(allocationAmount), - oldAllocation: allocationData.id, - newAllocation: newAllocationId, - newAllocationAmount: formatGRT(allocationAmount), - deployment: allocationData.subgraphDeployment.id.toString(), - poi: allocationPOI, - proof, - epoch: currentEpoch.toString(), - }) - - const callData = [ - await contracts.staking.populateTransaction.closeAllocation( - allocationData.id, - allocationPOI, - ), - await contracts.staking.populateTransaction.allocateFrom( - address, - allocationData.subgraphDeployment.id.bytes32, - allocationAmount, - newAllocationId, - utils.hexlify(Array(32).fill(0)), // metadata - proof, - ), - ].map((tx) => tx.data as string) - - const receipt = await transactionManager.executeTransaction( - async () => contracts.staking.estimateGas.multicall(callData), - async (gasLimit) => contracts.staking.multicall(callData, { gasLimit }), - logger.child({ - function: 'closeAndAllocate', - }), - ) - - if (receipt === 'paused' || receipt === 'unauthorized') { - throw indexerError( - IndexerErrorCode.IE062, - `Allocation '${newAllocationId}' could not be closed: ${receipt}`, - ) - } - - const createAllocationEventLogs = transactionManager.findEvent( - 'AllocationCreated', - contracts.staking.interface, - 'subgraphDeploymentID', - allocationData.subgraphDeployment.id.toString(), - receipt, - logger, - ) - - if (!createAllocationEventLogs) { - throw indexerError(IndexerErrorCode.IE014, `Allocation was never mined`) - } - - const closeAllocationEventLogs = transactionManager.findEvent( - 'AllocationClosed', - contracts.staking.interface, - 'allocationID', - allocation, - receipt, - logger, - ) - - if (!closeAllocationEventLogs) { - throw indexerError( - IndexerErrorCode.IE015, - `Allocation close transaction was never successfully mined`, - ) - } - - const rewardsEventLogs = transactionManager.findEvent( - 'RewardsAssigned', - contracts.rewardsManager.interface, - 'allocationID', - allocation, - receipt, - logger, - ) - - const rewardsAssigned = rewardsEventLogs ? rewardsEventLogs.amount : 0 - - if (rewardsAssigned == 0) { - logger.warn('No rewards were distributed upon closing the allocation') - } - - logger.info(`Successfully reallocated allocation`, { - deployment: createAllocationEventLogs.subgraphDeploymentID, - closedAllocation: closeAllocationEventLogs.allocationID, - closedAllocationStakeGRT: formatGRT(closeAllocationEventLogs.tokens), - closedAllocationPOI: closeAllocationEventLogs.poi, - closedAllocationEpoch: closeAllocationEventLogs.epoch.toString(), - indexingRewardsCollected: rewardsAssigned, - createdAllocation: createAllocationEventLogs.allocationID, - createdAllocationStakeGRT: formatGRT(createAllocationEventLogs.tokens), - indexer: createAllocationEventLogs.indexer, - epoch: createAllocationEventLogs.epoch.toString(), - transaction: receipt.transactionHash, - }) - - logger.info('Identifying receipts worth collecting', { - allocation: closeAllocationEventLogs.allocationID, - }) - - // Collect query fees for this allocation - const isCollectingQueryFees = await receiptCollector.collectReceipts( - 0, - allocationData, - ) - - logger.debug( - `Updating indexing rules, so indexer-agent will now manage the active allocation`, - ) - const indexingRule = { - identifier: allocationData.subgraphDeployment.id.ipfsHash, - allocationAmount: allocationAmount.toString(), - identifierType: IdentifierType.deployment, - decisionBasis: IndexingDecisionBasis.always, - protocolNetwork, - } as Partial - - await models.IndexingRule.upsert(indexingRule) - - // Since upsert succeeded, we _must_ have a rule - const updatedRule = await models.IndexingRule.findOne({ - where: { identifier: indexingRule.identifier }, - }) - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - logger.debug(`DecisionBasis.ALWAYS rule merged into indexing rules`, { - rule: updatedRule, - }) - - return { - actionID: 0, - type: 'reallocate', - transactionID: receipt.transactionHash, - closedAllocation: closeAllocationEventLogs.allocationID, - indexingRewardsCollected: formatGRT(rewardsAssigned), - receiptsWorthCollecting: isCollectingQueryFees, - createdAllocation: createAllocationEventLogs.allocationID, - createdAllocationStake: formatGRT(createAllocationEventLogs.tokens), - protocolNetwork, - } - } catch (error) { - logger.error(error.toString()) - throw error - } - }, -} diff --git a/packages/indexer-common/src/indexer-management/resolvers/cost-models.ts b/packages/indexer-common/src/indexer-management/resolvers/cost-models.ts deleted file mode 100644 index c05581532..000000000 --- a/packages/indexer-common/src/indexer-management/resolvers/cost-models.ts +++ /dev/null @@ -1,165 +0,0 @@ -/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ -/* eslint-disable @typescript-eslint/ban-types */ - -import { CostModelVariables, COST_MODEL_GLOBAL, parseGraphQLCostModel } from '../models' -import { IndexerManagementResolverContext } from '../context' -import { compileAsync } from '@graphprotocol/cost-model' -import { CostModel as GraphQLCostModelType } from '../../schema/types.generated' - -// eslint-disable-next-line @typescript-eslint/no-explicit-any -const getVariable = (vars: CostModelVariables | null, name: string): any | undefined => { - if (vars === null) { - return undefined - } else { - try { - if (Object.prototype.hasOwnProperty.call(vars, name)) { - return vars[name] - } else { - return undefined - } - } catch (e) { - return undefined - } - } -} - -const setVariable = ( - vars: CostModelVariables | null, - name: string, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - value: any, -): CostModelVariables => { - if (vars === null) { - return { [name]: value } - } else { - try { - vars[name] = value - return vars - } catch (e) { - return vars - } - } -} - -export default { - costModel: async ( - { deployment }: { deployment: string }, - { models }: IndexerManagementResolverContext, - ): Promise => { - const model = await models.CostModel.findOne({ - where: { deployment }, - }) - if (model) { - return model.toGraphQL() - } - - const globalModel = await models.CostModel.findOne({ - where: { deployment: COST_MODEL_GLOBAL }, - }) - if (globalModel) { - globalModel.setDataValue('deployment', deployment) - return globalModel.toGraphQL() - } - - return null - }, - - costModels: async ( - // eslint-disable-next-line @typescript-eslint/no-explicit-any - { deployments }: { deployments: string[] | null | undefined }, - { models }: IndexerManagementResolverContext, - ): Promise => { - const costModels = await models.CostModel.findAll({ - where: deployments ? { deployment: deployments } : undefined, - order: [['deployment', 'ASC']], - }) - const definedDeployments = new Set(costModels.map((model) => model.deployment)) - const undefinedDeployments = deployments?.filter((d) => !definedDeployments.has(d)) - const globalModel = await models.CostModel.findOne({ - where: { deployment: COST_MODEL_GLOBAL }, - }) - if (globalModel && undefinedDeployments) { - const mergedCostModels = undefinedDeployments.map((d) => { - globalModel.setDataValue('deployment', d) - return globalModel.toGraphQL() - }) - return costModels.map((model) => model.toGraphQL()).concat(mergedCostModels) - } - - return costModels.map((model) => model.toGraphQL()) - }, - - setCostModel: async ( - { costModel }: { deployment: string; costModel: GraphQLCostModelType }, - { models, multiNetworks, dai }: IndexerManagementResolverContext, - ): Promise => { - if (!multiNetworks) { - throw Error('IndexerManagementClient must be in `network` mode to set cost models') - } - - const update = parseGraphQLCostModel(costModel) - - // Validate cost model - try { - const modelForValidation = update.model || 'default => 1;' - const variablesForValidation = JSON.stringify(update.variables || {}) - await compileAsync(modelForValidation, variablesForValidation) - } catch (err) { - throw new Error(`Invalid cost model or variables: ${err.message}`) - } - const network = multiNetworks.inner['eip155:1'] - if (!network) { - throw new Error( - `Can't set cost model: Indexer Agent does not have Ethereum Mainnet network configured.`, - ) - } - const injectDai = !!network.specification.dai.inject - const [model] = await models.CostModel.findOrBuild({ - where: { deployment: update.deployment }, - }) - // logger.info('Fetched current model', { current: model, update }) - // model.set('deployment', update.deployment || model.deployment) - // // model.set('model', update.model || model.model) - // model.model = update.model || model.model - // logger.info('Merged models', { now: model }) - model.deployment = update.deployment || model.deployment - model.model = update.model || model.model - - // Update the model variables (fall back to current value if unchanged) - let variables = update.variables || model.variables - - if (injectDai) { - const oldDai = getVariable(model.variables, 'DAI') - const newDai = getVariable(update.variables, 'DAI') - - // Inject the latest DAI value if available - if (dai.valueReady) { - variables = setVariable(variables, 'DAI', await dai.value()) - } else if (newDai === undefined && oldDai !== undefined) { - // Otherwise preserve the old DAI value if there is one; - // this ensures it's never dropped - variables = setVariable(variables, 'DAI', oldDai) - } - } - - // Apply new variables - model.variables = variables - - return (await model.save()).toGraphQL() - }, - - deleteCostModels: async ( - { deployments }: { deployments: string[] }, - { models }: IndexerManagementResolverContext, - ): Promise => { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - return await models.CostModel.sequelize!.transaction(async (transaction) => { - return await models.CostModel.destroy({ - where: { - deployment: deployments, - }, - transaction, - }) - }) - }, -} diff --git a/packages/indexer-common/src/indexer-management/resolvers/indexer-status.ts b/packages/indexer-common/src/indexer-management/resolvers/indexer-status.ts deleted file mode 100644 index 76be9f894..000000000 --- a/packages/indexer-common/src/indexer-management/resolvers/indexer-status.ts +++ /dev/null @@ -1,317 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-types */ - -import geohash from 'ngeohash' -import gql from 'graphql-tag' -import { IndexerManagementResolverContext } from '../context' -import { SubgraphDeploymentID } from '@graphprotocol/common-ts' -import { - indexerError, - IndexerErrorCode, - Network, - validateNetworkIdentifier, -} from '@graphprotocol/indexer-common' -import { extractNetwork } from './utils' -interface Test { - test: (url: string) => string - run: (url: string) => Promise - possibleActions: (url: string) => string[] -} - -interface TestResult { - test: string - error: string | null - possibleActions: string[] -} - -const testURL = async ( - url: string, - tests: Test[], -): Promise<{ url: string; ok: boolean; tests: TestResult[] }> => { - const results: TestResult[] = [] - - for (const test of tests) { - const cmd = test.test(url) - - try { - await test.run(url) - - results.push({ - test: cmd, - error: null, - possibleActions: [], - }) - } catch (e) { - results.push({ - test: cmd, - error: e.message, - possibleActions: test.possibleActions(url), - }) - } - } - - return { url, tests: results, ok: !results.find((result) => result.error !== null) } -} - -const URL_VALIDATION_TEST: Test = { - test: () => `URL validation`, - run: async (url) => { - new URL(url) - }, - possibleActions: (url) => [`Make sure ${url} is a valid URL`], -} - -export default { - indexerRegistration: async ( - { protocolNetwork: unvalidatedProtocolNetwork }: { protocolNetwork: string }, - { multiNetworks }: IndexerManagementResolverContext, - ): Promise => { - if (!multiNetworks) { - throw Error( - 'IndexerManagementClient must be in `network` mode to fetch indexer registration information', - ) - } - - const network = extractNetwork(unvalidatedProtocolNetwork, multiNetworks) - const protocolNetwork = network.specification.networkIdentifier - const address = network.specification.indexerOptions.address - const contracts = network.contracts - const registered = await contracts.serviceRegistry.isRegistered(address) - - if (registered) { - const service = await contracts.serviceRegistry.services(address) - return { - address, - protocolNetwork, - url: service.url, - location: geohash.decode(service.geohash), - registered, - __typename: 'IndexerRegistration', - } - } else { - return { - address, - url: null, - registered, - protocolNetwork, - location: null, - __typename: 'IndexerRegistration', - } - } - }, - - indexerDeployments: async ( - _: {}, - { graphNode }: IndexerManagementResolverContext, - ): Promise => { - const result = await graphNode.indexingStatus([]) - return result.map((status) => ({ - ...status, - subgraphDeployment: status.subgraphDeployment.ipfsHash, - })) - }, - - indexerAllocations: async ( - { protocolNetwork }: { protocolNetwork: string }, - { multiNetworks, logger }: IndexerManagementResolverContext, - ): Promise => { - if (!multiNetworks) { - throw Error( - 'IndexerManagementClient must be in `network` mode to fetch indexer allocations', - ) - } - - const network = extractNetwork(protocolNetwork, multiNetworks) - const address = network.specification.indexerOptions.address - - try { - const result = await network.networkSubgraph.checkedQuery( - gql` - query allocations($indexer: String!) { - allocations( - where: { indexer: $indexer, status: Active } - first: 1000 - orderDirection: desc - ) { - id - allocatedTokens - createdAtEpoch - closedAtEpoch - subgraphDeployment { - id - stakedTokens - signalledTokens - } - } - } - `, - { indexer: address.toLocaleLowerCase() }, - ) - if (result.error) { - throw result.error - } - // eslint-disable-next-line @typescript-eslint/no-explicit-any - return result.data.allocations.map((allocation: any) => ({ - ...allocation, - subgraphDeployment: new SubgraphDeploymentID(allocation.subgraphDeployment.id) - .ipfsHash, - signalledTokens: allocation.subgraphDeployment.signalledTokens, - stakedTokens: allocation.subgraphDeployment.stakedTokens, - protocolNetwork: network.specification.networkIdentifier, - })) - } catch (error) { - const err = indexerError(IndexerErrorCode.IE010, error) - logger?.error(`Failed to query indexer allocations`, { - err, - }) - throw err - } - }, - - indexerEndpoints: async ( - { protocolNetwork: unvalidatedProtocolNetwork }: { protocolNetwork: string | null }, - { multiNetworks, logger }: IndexerManagementResolverContext, - ): Promise => { - if (!multiNetworks) { - throw Error( - 'IndexerManagementClient must be in `network` mode to fetch indexer endpoints', - ) - } - const endpoints: Endpoints[] = [] - let networkIdentifier: string | null = null - - // Validate protocol network - try { - if (unvalidatedProtocolNetwork) { - networkIdentifier = validateNetworkIdentifier(unvalidatedProtocolNetwork) - } - } catch (parseError) { - throw new Error( - `Invalid protocol network identifier: '${unvalidatedProtocolNetwork}'. Error: ${parseError}`, - ) - } - - await multiNetworks.map(async (network: Network) => { - // Skip if this query asks for another protocol network - if ( - networkIdentifier && - networkIdentifier !== network.specification.networkIdentifier - ) { - return - } - try { - const networkEndpoints = await endpointForNetwork(network) - endpoints.push(networkEndpoints) - } catch (err) { - // Ignore endpoints for this network - logger?.warn(`Failed to detect service endpoints for network`, { - err, - protocolNetwork: network.specification.networkIdentifier, - }) - } - }) - return endpoints - }, -} - -interface Endpoint { - url: string | null - healthy: boolean - protocolNetwork: string - // eslint-disable-next-line @typescript-eslint/no-explicit-any - tests: any[] -} - -interface Endpoints { - service: Endpoint - status: Endpoint -} - -function defaultEndpoint(protocolNetwork: string): Endpoint { - return { - url: null as string | null, - healthy: false, - protocolNetwork, - tests: [] as TestResult[], - } -} -function defaultEndpoints(protocolNetwork: string): Endpoints { - return { - service: defaultEndpoint(protocolNetwork), - status: defaultEndpoint(protocolNetwork), - } -} - -async function endpointForNetwork(network: Network): Promise { - const contracts = network.contracts - const address = network.specification.indexerOptions.address - const endpoints = defaultEndpoints(network.specification.networkIdentifier) - const service = await contracts.serviceRegistry.services(address) - if (service) { - { - const { url, tests, ok } = await testURL(service.url, [ - URL_VALIDATION_TEST, - { - test: (url) => `http get ${url}`, - run: async (url) => { - const response = await fetch(url) - if (!response.ok) { - throw new Error( - `Returned status ${response.status}: ${ - response.body ? response.body.toString() : 'No data returned' - }`, - ) - } - }, - possibleActions: (url) => [ - `Make sure ${url} can be resolved and reached from this machine`, - `Make sure the port of ${url} is set up correctly`, - `Make sure the test command returns an HTTP status code < 400`, - ], - }, - ]) - - endpoints.service.url = url - endpoints.service.healthy = ok - endpoints.service.tests = tests - } - - { - const statusURL = endpoints.service.url.endsWith('/') - ? endpoints.service.url.substring(0, endpoints.service.url.length - 1) + '/status' - : endpoints.service.url + '/status' - - const { url, tests, ok } = await testURL(statusURL, [ - URL_VALIDATION_TEST, - { - test: (url) => `http post ${url} query="{ indexingStatuses { subgraph } }"`, - run: async (url) => { - const response = await fetch(url, { - method: 'POST', - headers: { 'content-type': 'application/json' }, - body: JSON.stringify({ query: '{ indexingStatuses { subgraph } }' }), - }) - if (!response.ok) { - throw new Error( - `Returned status ${response.status}: ${ - response.body ? response.body.toString() : 'No data returned' - }`, - ) - } - }, - possibleActions: (url) => [ - `Make sure ${url} can be reached from this machine`, - `Make sure the port of ${url} is set up correctly`, - `Make sure ${url} is the /status endpoint of indexer-service`, - `Make sure the test command returns an HTTP status code < 400`, - `Make sure the test command returns a valid GraphQL response`, - ], - }, - ]) - - endpoints.status.url = url - endpoints.status.healthy = ok - endpoints.status.tests = tests - } - } - return endpoints -} diff --git a/packages/indexer-common/src/indexer-management/resolvers/indexing-rules.ts b/packages/indexer-common/src/indexer-management/resolvers/indexing-rules.ts deleted file mode 100644 index 490a7fd9d..000000000 --- a/packages/indexer-common/src/indexer-management/resolvers/indexing-rules.ts +++ /dev/null @@ -1,198 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-types */ - -import { - IndexerManagementModels, - INDEXING_RULE_GLOBAL, - IndexingRuleIdentifier, - IndexingRuleCreationAttributes, -} from '../models' -import { IndexerManagementDefaults } from '../client' -import { IndexerManagementResolverContext } from '../context' -import { Transaction } from 'sequelize/types' -import { fetchIndexingRules } from '../rules' -import { processIdentifier } from '../../' -import { validateNetworkIdentifier } from '../../parsers' -import groupBy from 'lodash.groupby' - -export const resetGlobalRule = async ( - ruleIdentifier: IndexingRuleIdentifier, - defaults: IndexerManagementDefaults['globalIndexingRule'], - models: IndexerManagementModels, - transaction: Transaction, -) => { - await models.IndexingRule.upsert( - { - ...defaults, - ...ruleIdentifier, - allocationAmount: defaults.allocationAmount.toString(), - }, - { transaction }, - ) -} - -export default { - indexingRule: async ( - { - identifier: indexingRuleIdentifier, - merged, - }: { identifier: IndexingRuleIdentifier; merged: boolean }, - { models }: IndexerManagementResolverContext, - ): Promise => { - const [identifier] = await processIdentifier(indexingRuleIdentifier.identifier, { - all: false, - global: true, - }) - - // Sanitize protocol network identifier - const protocolNetwork = validateNetworkIdentifier( - indexingRuleIdentifier.protocolNetwork, - ) - - const rule = await models.IndexingRule.findOne({ - where: { identifier, protocolNetwork }, - }) - if (rule && merged) { - return rule.mergeToGraphQL( - await models.IndexingRule.findOne({ - where: { identifier: INDEXING_RULE_GLOBAL }, - }), - ) - } else { - return rule?.toGraphQL() || null - } - }, - - indexingRules: async ( - { - merged, - protocolNetwork: uncheckedProtocolNetwork, - }: { merged: boolean; protocolNetwork: string | undefined }, - { models }: IndexerManagementResolverContext, - ): Promise => { - // Convert the input `protocolNetwork` value to a CAIP2-ID - const protocolNetwork = uncheckedProtocolNetwork - ? validateNetworkIdentifier(uncheckedProtocolNetwork) - : undefined - return await fetchIndexingRules(models, merged, protocolNetwork) - }, - - setIndexingRule: async ( - { rule }: { rule: IndexingRuleCreationAttributes }, - { models }: IndexerManagementResolverContext, - ): Promise => { - if (!rule.identifier) { - throw Error('Cannot set indexingRule without identifier') - } - - if (!rule.protocolNetwork) { - throw Error("Cannot set an indexing rule without the field 'protocolNetwork'") - } else { - try { - rule.protocolNetwork = validateNetworkIdentifier(rule.protocolNetwork) - } catch (e) { - throw Error(`Invalid value for the field 'protocolNetwork'. ${e}`) - } - } - - const [identifier] = await processIdentifier(rule.identifier, { - all: false, - global: true, - }) - rule.identifier = identifier - - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const [updatedRule, _created] = await models.IndexingRule.upsert(rule) - return updatedRule.toGraphQL() - }, - - deleteIndexingRule: async ( - { identifier: indexingRuleIdentifier }: { identifier: IndexingRuleIdentifier }, - { models, defaults }: IndexerManagementResolverContext, - ): Promise => { - const [identifier] = await processIdentifier(indexingRuleIdentifier.identifier, { - all: false, - global: true, - }) - - // Sanitize protocol network identifier - const protocolNetwork = validateNetworkIdentifier( - indexingRuleIdentifier.protocolNetwork, - ) - - const validatedRuleIdentifier = { - protocolNetwork, - identifier, - } - - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - return await models.IndexingRule.sequelize!.transaction(async (transaction) => { - const numDeleted = await models.IndexingRule.destroy({ - where: validatedRuleIdentifier, - transaction, - }) - - // Reset the global rule - if (validatedRuleIdentifier.identifier === 'global') { - await resetGlobalRule( - validatedRuleIdentifier, - defaults.globalIndexingRule, - models, - transaction, - ) - } - - return numDeleted > 0 - }) - }, - - deleteIndexingRules: async ( - { identifiers: indexingRuleIdentifiers }: { identifiers: IndexingRuleIdentifier[] }, - { models, defaults }: IndexerManagementResolverContext, - ): Promise => { - let totalNumDeleted = 0 - - // Sanitize protocol network identifiers - for (const identifier of indexingRuleIdentifiers) { - identifier.protocolNetwork = validateNetworkIdentifier(identifier.protocolNetwork) - } - - // Batch deletions by the `IndexingRuleIdentifier.protocolNetwork` attribute . - const batches = groupBy( - indexingRuleIdentifiers, - (x: IndexingRuleIdentifier) => x.protocolNetwork, - ) - - for (const protocolNetwork in batches) { - const batch = batches[protocolNetwork] - const identifiers = await Promise.all( - batch.map( - async ({ identifier }: IndexingRuleIdentifier) => - (await processIdentifier(identifier, { all: false, global: true }))[0], - ), - ) - // Execute deletion batch - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - await models.IndexingRule.sequelize!.transaction(async (transaction) => { - const numDeleted = await models.IndexingRule.destroy({ - where: { - identifier: identifiers, - protocolNetwork: protocolNetwork, - }, - transaction, - }) - - if (identifiers.includes('global')) { - const globalIdentifier = { identifier: 'global', protocolNetwork } - await resetGlobalRule( - globalIdentifier, - defaults.globalIndexingRule, - models, - transaction, - ) - } - totalNumDeleted += numDeleted - }) - } - return totalNumDeleted > 0 - }, -} diff --git a/packages/indexer-common/src/indexer-management/resolvers/poi-disputes.ts b/packages/indexer-common/src/indexer-management/resolvers/poi-disputes.ts deleted file mode 100644 index 0ec6eaabb..000000000 --- a/packages/indexer-common/src/indexer-management/resolvers/poi-disputes.ts +++ /dev/null @@ -1,104 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-types */ - -import { POIDispute, POIDisputeIdentifier, POIDisputeCreationAttributes } from '../models' -import { IndexerManagementResolverContext } from '../context' -import { validateNetworkIdentifier } from '../../parsers' -import { Op, WhereOptions } from 'sequelize' -import groupBy from 'lodash.groupby' - -export default { - dispute: async ( - { identifier }: { identifier: POIDisputeIdentifier }, - { models }: IndexerManagementResolverContext, - ): Promise => { - const dispute = await models.POIDispute.findOne({ - where: { ...identifier }, - }) - return dispute?.toGraphQL() || dispute - }, - - disputes: async ( - { - status, - minClosedEpoch, - protocolNetwork: uncheckedProtocolNetwork, - }: { status: string; minClosedEpoch: number; protocolNetwork: string | undefined }, - { models }: IndexerManagementResolverContext, - ): Promise => { - // Sanitize protocol network identifier - const protocolNetwork = uncheckedProtocolNetwork - ? validateNetworkIdentifier(uncheckedProtocolNetwork) - : undefined - - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const sqlAndExpression: WhereOptions = [ - { status }, - { closedEpoch: { [Op.gte]: minClosedEpoch } }, - ] - - if (protocolNetwork) { - sqlAndExpression.push({ protocolNetwork }) - } - - const disputes = await models.POIDispute.findAll({ - where: { [Op.and]: sqlAndExpression }, - order: [['allocationAmount', 'DESC']], - }) - return disputes.map((dispute) => dispute.toGraphQL()) - }, - - storeDisputes: async ( - { disputes }: { disputes: POIDisputeCreationAttributes[] }, - { models }: IndexerManagementResolverContext, - ): Promise => { - // Sanitize protocol network identifiers - for (const dispute of disputes) { - if (!dispute.protocolNetwork) { - throw new Error(`Dispute is missing the attribute 'protocolNetwork'`) - } - dispute.protocolNetwork = validateNetworkIdentifier(dispute.protocolNetwork) - } - - const createdDisputes = await models.POIDispute.bulkCreate(disputes, { - returning: true, - validate: true, - updateOnDuplicate: [ - 'closedEpochReferenceProof', - 'previousEpochReferenceProof', - 'status', - ], - conflictAttributes: ['allocationID', 'protocolNetwork'], - }) - return createdDisputes.map((dispute: POIDispute) => dispute.toGraphQL()) - }, - - deleteDisputes: async ( - { identifiers }: { identifiers: POIDisputeIdentifier[] }, - { models }: IndexerManagementResolverContext, - ): Promise => { - let totalNumDeleted = 0 - - // Sanitize protocol network identifiers - for (const identifier of identifiers) { - if (!identifier.protocolNetwork) { - throw new Error(`Dispute is missing the attribute 'protocolNetwork'`) - } - identifier.protocolNetwork = validateNetworkIdentifier(identifier.protocolNetwork) - } - - // Batch by protocolNetwork - const batches = groupBy(identifiers, (x: POIDisputeIdentifier) => x.protocolNetwork) - - for (const protocolNetwork in batches) { - const batch = batches[protocolNetwork] - const numDeleted = await models.POIDispute.destroy({ - where: { - allocationID: batch.map((x) => x.allocationID), - }, - force: true, - }) - totalNumDeleted += numDeleted - } - return totalNumDeleted - }, -} diff --git a/packages/indexer-common/src/indexer-management/yoga.ts b/packages/indexer-common/src/indexer-management/yoga.ts index a7a604b64..2c282f111 100644 --- a/packages/indexer-common/src/indexer-management/yoga.ts +++ b/packages/indexer-common/src/indexer-management/yoga.ts @@ -1,11 +1,26 @@ import { createYoga, createSchema } from 'graphql-yoga' import { typeDefs } from '../schema/typeDefs.generated' import { resolvers } from '../schema/resolvers.generated' -import { IndexerManagementResolverContext } from './context' -import { WritableEventual, equal, mutable } from '@graphprotocol/common-ts' +import { IndexerManagementDefaults, IndexerManagementResolverContext } from './context' +import { Logger, WritableEventual, equal, mutable } from '@graphprotocol/common-ts' import { ActionManager } from './actions' -import { IndexerManagementClientOptions } from './client' import { Op, Sequelize } from 'sequelize' +import { IndexerManagementModels } from './models' +import { GraphNode } from '../graph-node' +import { MultiNetworks } from '../multi-networks' +import { Network } from '../network' + +interface IndexerManagementClientOptions { + logger: Logger + models: IndexerManagementModels + graphNode: GraphNode + // TODO:L2: Do we need this information? The GraphNode class auto-selects nodes based + // on availability. + // Ford: there were some edge cases where the GraphNode was not able to auto handle it on its own + indexNodeIDs: string[] + multiNetworks: MultiNetworks | undefined + defaults: IndexerManagementDefaults +} export async function createIndexerManagementYogaClient( options: IndexerManagementClientOptions, diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/closeAllocation.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/closeAllocation.ts index 046447f75..d60aedc2e 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/closeAllocation.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/closeAllocation.ts @@ -1,4 +1,4 @@ -import { extractNetwork } from '../../../../indexer-management/resolvers/utils' +import { extractNetwork } from '../utils' import { IdentifierType, IndexingDecisionBasis, diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/createAllocation.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/createAllocation.ts index 747a310d4..cde0f8603 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/createAllocation.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/createAllocation.ts @@ -1,4 +1,4 @@ -import { extractNetwork } from '../../../../indexer-management/resolvers/utils' +import { extractNetwork } from '../utils' import { IdentifierType, IndexingDecisionBasis, diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRule.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRule.ts index 4df93307e..d45459aaa 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRule.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRule.ts @@ -1,7 +1,7 @@ import { processIdentifier } from '../../../../subgraphs' import type { MutationResolvers } from './../../../types.generated' import { validateNetworkIdentifier } from '../../../../parsers/validators' -import { resetGlobalRule } from '../../../../indexer-management/resolvers/indexing-rules' +import { resetGlobalRule } from '../utils' export const deleteIndexingRule: NonNullable< MutationResolvers['deleteIndexingRule'] diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRules.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRules.ts index d12a9a04b..beeae8b86 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRules.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/deleteIndexingRules.ts @@ -2,7 +2,7 @@ import { validateNetworkIdentifier } from '../../../../parsers/validators' import type { MutationResolvers } from './../../../types.generated' import groupBy from 'lodash.groupby' import { processIdentifier } from '../../../../subgraphs' -import { resetGlobalRule } from '../../../../indexer-management/resolvers/indexing-rules' +import { resetGlobalRule } from '../utils' export const deleteIndexingRules: NonNullable< MutationResolvers['deleteIndexingRules'] diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/reallocateAllocation.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/reallocateAllocation.ts index 64301f49e..72d66fa74 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/reallocateAllocation.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/reallocateAllocation.ts @@ -1,4 +1,4 @@ -import { extractNetwork } from '../../../../indexer-management/resolvers/utils' +import { extractNetwork } from '../utils' import { IdentifierType, IndexingDecisionBasis, diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/allocations.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/allocations.ts index 591a68ac0..0b533a884 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/allocations.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/allocations.ts @@ -1,7 +1,216 @@ -import { queryAllocations } from '../../../../indexer-management/resolvers/allocations' -import type { QueryResolvers } from './../../../types.generated' -import { toAddress } from '@graphprotocol/common-ts' +import type { Allocation, QueryResolvers } from './../../../types.generated' +import { + Address, + Logger, + SubgraphDeploymentID, + toAddress, +} from '@graphprotocol/common-ts' import { epochElapsedBlocks } from '../../../../indexer-management' +import { NetworkSubgraph } from '@graphprotocol/indexer-common' +import { BigNumber } from 'ethers' +import gql from 'graphql-tag' +import pMap from 'p-map' + +enum AllocationQuery { + all = 'all', + active = 'active', + closed = 'closed', + allocation = 'allocation', +} + +const ALLOCATION_QUERIES = { + [AllocationQuery.all]: gql` + query allocations($indexer: String!) { + allocations(where: { indexer: $indexer }, first: 1000) { + id + subgraphDeployment { + id + stakedTokens + signalledTokens + } + indexer { + id + } + allocatedTokens + createdAtEpoch + closedAtEpoch + indexingRewards + queryFeesCollected + status + } + } + `, + [AllocationQuery.active]: gql` + query allocations($indexer: String!) { + allocations(where: { indexer: $indexer, status: Active }, first: 1000) { + id + subgraphDeployment { + id + stakedTokens + signalledTokens + } + indexer { + id + } + allocatedTokens + createdAtEpoch + closedAtEpoch + indexingRewards + queryFeesCollected + status + } + } + `, + [AllocationQuery.closed]: gql` + query allocations($indexer: String!) { + allocations(where: { indexer: $indexer, status: Closed }, first: 1000) { + id + subgraphDeployment { + id + stakedTokens + signalledTokens + } + indexer { + id + } + allocatedTokens + createdAtEpoch + closedAtEpoch + indexingRewards + queryFeesCollected + status + } + } + `, + [AllocationQuery.allocation]: gql` + query allocations($allocation: String!) { + allocations(where: { id: $allocation }, first: 1000) { + id + subgraphDeployment { + id + stakedTokens + signalledTokens + } + indexer { + id + } + allocatedTokens + createdAtEpoch + closedAtEpoch + indexingRewards + queryFeesCollected + status + } + } + `, +} + +async function queryAllocations( + logger: Logger, + networkSubgraph: NetworkSubgraph, + variables: { + indexer: Address + allocation: Address | null + status: 'active' | 'closed' | null + }, + context: { + currentEpoch: number + currentEpochStartBlock: number + currentEpochElapsedBlocks: number + maxAllocationEpochs: number + blocksPerEpoch: number + avgBlockTime: number + protocolNetwork: string + }, +): Promise { + logger.trace('Query Allocations', { + variables, + context, + }) + + let filterType: AllocationQuery + let filterVars: object + if (variables.allocation) { + filterType = AllocationQuery.allocation + filterVars = { + allocation: variables.allocation.toLowerCase(), + } + } else if (variables.status == null && variables.allocation == null) { + filterType = AllocationQuery.all + filterVars = { + indexer: variables.indexer.toLowerCase(), + } + } else if (variables.status == 'active') { + filterType = AllocationQuery.active + filterVars = { + indexer: variables.indexer.toLowerCase(), + } + } else if (variables.status == 'closed') { + filterType = AllocationQuery.closed + filterVars = { + indexer: variables.indexer.toLowerCase(), + } + } else { + // Shouldn't ever get here + throw new Error( + `Unsupported combination of variables provided, variables: ${variables}`, + ) + } + + const result = await networkSubgraph.checkedQuery( + ALLOCATION_QUERIES[filterType], + filterVars, + ) + + if (result.data.allocations.length == 0) { + // TODO: Is 'Claimable' still the correct term here, after Exponential Rebates? + logger.info(`No 'Claimable' allocations found`) + return [] + } + + if (result.error) { + logger.warning('Query failed', { + error: result.error, + }) + throw result.error + } + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return pMap( + result.data.allocations, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + async (allocation: any): Promise => { + const deadlineEpoch = allocation.createdAtEpoch + context.maxAllocationEpochs + const remainingBlocks = + // blocks remaining in current epoch + context.blocksPerEpoch - + context.currentEpochElapsedBlocks + + // blocks in the remaining epochs after this one + context.blocksPerEpoch * (deadlineEpoch - context.currentEpoch - 1) + return { + id: allocation.id, + indexer: allocation.indexer.id, + subgraphDeployment: new SubgraphDeploymentID(allocation.subgraphDeployment.id) + .ipfsHash, + signalledTokens: allocation.subgraphDeployment.signalledTokens, + stakedTokens: allocation.subgraphDeployment.stakedTokens, + allocatedTokens: BigNumber.from(allocation.allocatedTokens).toString(), + createdAtEpoch: allocation.createdAtEpoch, + closedAtEpoch: allocation.closedAtEpoch, + ageInEpochs: allocation.closedAtEpoch + ? allocation.closedAtEpoch - allocation.createdAtEpoch + : context.currentEpoch - allocation.createdAtEpoch, + closeDeadlineEpoch: allocation.createdAtEpoch + context.maxAllocationEpochs, + closeDeadlineBlocksRemaining: remainingBlocks, + closeDeadlineTimeRemaining: remainingBlocks * context.avgBlockTime, + indexingRewards: allocation.indexingRewards, + queryFeesCollected: allocation.queryFeesCollected, + status: allocation.status, + protocolNetwork: context.protocolNetwork, + } + }, + ) +} export const allocations: NonNullable = async ( _parent, diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerAllocations.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerAllocations.ts index d2d9a6dd9..3de4b4635 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerAllocations.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerAllocations.ts @@ -1,4 +1,4 @@ -import { extractNetwork } from '../../../../indexer-management/resolvers/utils' +import { extractNetwork } from '../utils' import type { QueryResolvers } from './../../../types.generated' import gql from 'graphql-tag' import { SubgraphDeploymentID } from '@graphprotocol/common-ts' diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerRegistration.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerRegistration.ts index 1db3c0d7e..0fc3ea46d 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerRegistration.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Query/indexerRegistration.ts @@ -1,4 +1,4 @@ -import { extractNetwork } from '../../../../indexer-management/resolvers/utils' +import { extractNetwork } from '../utils' import geohash from 'ngeohash' import type { QueryResolvers } from './../../../types.generated' diff --git a/packages/indexer-common/src/indexer-management/resolvers/utils.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/utils.ts similarity index 56% rename from packages/indexer-common/src/indexer-management/resolvers/utils.ts rename to packages/indexer-common/src/schema/indexer-management/resolvers/utils.ts index baa061fdf..f4c404b0e 100644 --- a/packages/indexer-common/src/indexer-management/resolvers/utils.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/utils.ts @@ -1,8 +1,12 @@ import { + IndexerManagementDefaults, + IndexerManagementModels, MultiNetworks, Network, validateNetworkIdentifier, } from '@graphprotocol/indexer-common' +import { IndexingRuleIdentifier } from '../../types.generated' +import { Transaction } from 'sequelize' export function extractNetwork( unvalidatedNetworkIdentifier: string, @@ -24,3 +28,19 @@ export function extractNetwork( } return network } + +export const resetGlobalRule = async ( + ruleIdentifier: IndexingRuleIdentifier, + defaults: IndexerManagementDefaults['globalIndexingRule'], + models: IndexerManagementModels, + transaction: Transaction, +) => { + await models.IndexingRule.upsert( + { + ...defaults, + ...ruleIdentifier, + allocationAmount: defaults.allocationAmount.toString(), + }, + { transaction }, + ) +} diff --git a/packages/indexer-service/package.json b/packages/indexer-service/package.json index da3368f60..13f1f5c56 100644 --- a/packages/indexer-service/package.json +++ b/packages/indexer-service/package.json @@ -35,6 +35,7 @@ "@graphprotocol/common-ts": "2.0.9", "@graphprotocol/indexer-common": "^0.21.2", "@graphprotocol/indexer-native": "0.20.11", + "@graphql-tools/executor-http": "^1.0.9", "@graphql-tools/load": "8.0.0", "@graphql-tools/url-loader": "8.0.0", "@graphql-tools/wrap": "10.0.1", diff --git a/packages/indexer-service/src/commands/start.ts b/packages/indexer-service/src/commands/start.ts index f24fe827d..1ffc9c4d8 100644 --- a/packages/indexer-service/src/commands/start.ts +++ b/packages/indexer-service/src/commands/start.ts @@ -17,7 +17,7 @@ import { toAddress, } from '@graphprotocol/common-ts' import { - createIndexerManagementClient, + createIndexerManagementYogaClient, defineIndexerManagementModels, defineQueryFeeModels, indexerError, @@ -456,7 +456,7 @@ export default { queryTimingLogs: argv.queryTimingLogs, }) - const indexerManagementClient = await createIndexerManagementClient({ + const indexerManagementClient = await createIndexerManagementYogaClient({ models, graphNode, indexNodeIDs: ['node_1'], // This is just a dummy since the indexer-service doesn't manage deployments, diff --git a/packages/indexer-service/src/server/cost.ts b/packages/indexer-service/src/server/cost.ts index 1b288733c..ef1e1a5d3 100644 --- a/packages/indexer-service/src/server/cost.ts +++ b/packages/indexer-service/src/server/cost.ts @@ -1,17 +1,21 @@ import { graphqlHTTP } from 'express-graphql' import { Request, Response } from 'express' import { makeExecutableSchema } from '@graphql-tools/schema' -import { IndexerManagementClient } from '@graphprotocol/indexer-common' import gql from 'graphql-tag' import { Metrics, SubgraphDeploymentID } from '@graphprotocol/common-ts' +import { + IndexerManagementYogaClient, + isAsyncIterable, +} from '@graphprotocol/indexer-common' +import { buildHTTPExecutor } from '@graphql-tools/executor-http' export interface GraphQLServerOptions { - indexerManagementClient: IndexerManagementClient + indexerManagementClient: IndexerManagementYogaClient metrics: Metrics } interface Context { - client: IndexerManagementClient + client: IndexerManagementYogaClient } interface CostModelsArgs { @@ -105,6 +109,10 @@ export const createCostServer = async ({ resolvers: { Query: { costModels: async (parent, args: CostModelsArgs, context: Context) => { + const executor = buildHTTPExecutor({ + fetch: context.client.yoga.fetch, + }) + resolverMetrics.costModelBatchQueries.inc() if (!args.deployments) { @@ -118,27 +126,29 @@ export const createCostServer = async ({ const stopTimer = resolverMetrics.costModelBatchQueryDuration.startTimer() try { - const result = await context.client - .query( - gql` - query costModels($deployments: [String!]) { - costModels(deployments: $deployments) { - deployment - model - variables - } + const result = await executor({ + document: gql` + query costModels($deployments: [String!]) { + costModels(deployments: $deployments) { + deployment + model + variables } - `, - { - deployments: args.deployments - ? args.deployments.map(s => new SubgraphDeploymentID(s).bytes32) - : null, - }, - ) - .toPromise() - - if (result.error) { - throw result.error + } + `, + variables: { + deployments: args.deployments + ? args.deployments.map(s => new SubgraphDeploymentID(s).bytes32) + : null, + }, + }) + + if (isAsyncIterable(result)) { + throw new Error('Expected a single result, but got an async iterable') + } + + if (result.errors) { + throw result.errors } return result.data.costModels @@ -152,6 +162,9 @@ export const createCostServer = async ({ costModel: async (parent, args: CostModelArgs, context: Context) => { const deployment = new SubgraphDeploymentID(args.deployment).bytes32 + const executor = buildHTTPExecutor({ + fetch: context.client.yoga.fetch, + }) if (!deployment) { resolverMetrics.invalidCostModelQueries.inc() @@ -164,23 +177,25 @@ export const createCostServer = async ({ deployment, }) try { - const result = await context.client - .query( - gql` - query costModel($deployment: String!) { - costModel(deployment: $deployment) { - deployment - model - variables - } + const result = await executor({ + document: gql` + query costModel($deployment: String!) { + costModel(deployment: $deployment) { + deployment + model + variables } - `, - { deployment }, - ) - .toPromise() + } + `, + variables: { deployment }, + }) + + if (isAsyncIterable(result)) { + throw new Error('Expected a single result, but got an async iterable') + } - if (result.error) { - throw result.error + if (result.errors) { + throw result.errors } return result.data.costModel diff --git a/packages/indexer-service/src/server/index.ts b/packages/indexer-service/src/server/index.ts index 5ab3fb3d4..dd893e2e5 100644 --- a/packages/indexer-service/src/server/index.ts +++ b/packages/indexer-service/src/server/index.ts @@ -15,7 +15,7 @@ import { import { indexerError, IndexerErrorCode, - IndexerManagementClient, + IndexerManagementYogaClient, NetworkSubgraph, } from '@graphprotocol/indexer-common' import { createCostServer } from './cost' @@ -30,7 +30,7 @@ export interface ServerOptions { queryProcessor: QueryProcessor freeQueryAuthToken: string | undefined graphNodeStatusEndpoint: string - indexerManagementClient: IndexerManagementClient + indexerManagementClient: IndexerManagementYogaClient release: { version: string dependencies: { [key: string]: string } From 16c3ca3e971e69af9f9a2c7afcd10d588ea33184 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Wed, 3 Apr 2024 10:16:58 -0400 Subject: [PATCH 42/48] bring back some deps because of typings --- packages/indexer-common/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/indexer-common/package.json b/packages/indexer-common/package.json index 724ab2bba..dc89ef9da 100644 --- a/packages/indexer-common/package.json +++ b/packages/indexer-common/package.json @@ -30,6 +30,7 @@ "@types/lodash.clonedeep": "^4.5.7", "@types/lodash.intersection": "^4.4.7", "@types/lodash.xor": "^4.5.7", + "@urql/core": "2.4.4", "axios": "1.6.2", "body-parser": "1.20.2", "cors": "2.8.5", From 02ca2ab886e67e5a3a27adf2e820108b1143a25b Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Mon, 8 Jul 2024 16:20:20 -0400 Subject: [PATCH 43/48] Fix test --- .../__tests__/resolvers/indexing-rules.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/indexer-common/src/indexer-management/__tests__/resolvers/indexing-rules.test.ts b/packages/indexer-common/src/indexer-management/__tests__/resolvers/indexing-rules.test.ts index c3efb806b..e4701d318 100644 --- a/packages/indexer-common/src/indexer-management/__tests__/resolvers/indexing-rules.test.ts +++ b/packages/indexer-common/src/indexer-management/__tests__/resolvers/indexing-rules.test.ts @@ -425,8 +425,8 @@ describe('Indexing rules', () => { const globalInput = { identifier: INDEXING_RULE_GLOBAL, identifierType: IdentifierType.group, - allocationAmount: '1', - minSignal: '1', + allocationAmount: 1, + minSignal: 1, decisionBasis: IndexingDecisionBasis.never, protocolNetwork: 'arbitrum-sepolia', } From 572d48bbad65c1771783612d88571b74bf9368b2 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Tue, 9 Jul 2024 11:47:10 -0400 Subject: [PATCH 44/48] fix indexer agent --- packages/indexer-agent/src/__tests__/indexer.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/indexer-agent/src/__tests__/indexer.ts b/packages/indexer-agent/src/__tests__/indexer.ts index 150db6ffc..fc565d7c1 100644 --- a/packages/indexer-agent/src/__tests__/indexer.ts +++ b/packages/indexer-agent/src/__tests__/indexer.ts @@ -17,6 +17,7 @@ import { QueryFeeModels, defineQueryFeeModels, MultiNetworks, + createIndexerManagementYogaClient, loadTestYamlConfig, } from '@graphprotocol/indexer-common' import { Sequelize } from 'sequelize' From dd1832c9a838de8d2ed1558f7cafb7ee3820ad1c Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Tue, 9 Jul 2024 11:57:06 -0400 Subject: [PATCH 45/48] fix cli test --- packages/indexer-cli/src/__tests__/util.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/indexer-cli/src/__tests__/util.ts b/packages/indexer-cli/src/__tests__/util.ts index fb3024a6a..d62ecbe29 100644 --- a/packages/indexer-cli/src/__tests__/util.ts +++ b/packages/indexer-cli/src/__tests__/util.ts @@ -20,6 +20,7 @@ import { QueryFeeModels, specification, IndexerManagementYogaClient, + createIndexerManagementYogaClient, } from '@graphprotocol/indexer-common' import { connectDatabase, From eeb644bf8f6586365730db74b7baaa4b666b3ad1 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Tue, 9 Jul 2024 13:41:01 -0400 Subject: [PATCH 46/48] fix cli test --- .../resolvers/Mutation/setCostModel.ts | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setCostModel.ts b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setCostModel.ts index dead39605..1a6d2fa8f 100644 --- a/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setCostModel.ts +++ b/packages/indexer-common/src/schema/indexer-management/resolvers/Mutation/setCostModel.ts @@ -29,7 +29,20 @@ export const setCostModel: NonNullable = asyn { multiNetworks, models, dai }, ) => { if (!multiNetworks) { - throw Error('IndexerManagementClient must be in `network` mode to set cost models') + throw new Error('No network configuration available') + } + + if (Object.keys(multiNetworks.inner).length !== 1) { + throw Error('Must be in single network mode to set cost models') + } + + const network = Object.values(multiNetworks.inner)[0] + const injectDai = network.specification.dai.inject + + if (network.specification.networkIdentifier !== 'eip155:1' && injectDai) { + throw new Error( + `Can't set cost model: DAI injection enabled but not on Ethereum Mainnet`, + ) } const update = parseGraphQLCostModel(costModel) @@ -42,14 +55,7 @@ export const setCostModel: NonNullable = asyn } catch (err) { throw new Error(`Invalid cost model or variables: ${err.message}`) } - const network = multiNetworks.inner['eip155:1'] - if (!network) { - throw new Error( - `Can't set cost model: Indexer Agent does not have Ethereum Mainnet network configured.`, - ) - } - const injectDai = !!network.specification.dai.inject const [model] = await models.CostModel.findOrBuild({ where: { deployment: update.deployment }, }) From 0ca52d4ff819c681c0f8dc0c0bf2d8bc86e1008d Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Tue, 6 Aug 2024 09:25:45 -0500 Subject: [PATCH 47/48] fix some type issues and format --- packages/indexer-agent/src/agent.ts | 57 +++++++++++++------------ packages/indexer-agent/src/types.ts | 4 +- packages/indexer-cli/src/allocations.ts | 2 +- 3 files changed, 33 insertions(+), 30 deletions(-) diff --git a/packages/indexer-agent/src/agent.ts b/packages/indexer-agent/src/agent.ts index 49729b84a..9bd8f1a44 100644 --- a/packages/indexer-agent/src/agent.ts +++ b/packages/indexer-agent/src/agent.ts @@ -281,33 +281,36 @@ export class Agent { }, ) - const indexingRules: Eventual< NetworkMapped> = - timer(requestIntervalSmall).tryMap( - async () => { - return this.multiNetworks.map(async ({ network, operator }) => { - logger.trace('Fetching indexing rules', { - protocolNetwork: network.specification.networkIdentifier, - }) - let rules = await operator.indexingRules(true) - const subgraphRuleIds = rules - .filter( - rule => rule.identifierType == GeneratedGraphQLTypes.IdentifierType.subgraph, - ) - .map(rule => rule.identifier!) - const subgraphsMatchingRules = - await network.networkMonitor.subgraphs(subgraphRuleIds) - if (subgraphsMatchingRules.length >= 1) { - const epochLength = - await network.contracts.epochManager.epochLength() - const blockPeriod = 15 - const bufferPeriod = epochLength.toNumber() * blockPeriod * 100 // 100 epochs - rules = convertSubgraphBasedRulesToDeploymentBased( - rules, - subgraphsMatchingRules, - bufferPeriod, - ) - } - return rules + const indexingRules: Eventual< + NetworkMapped + > = timer(requestIntervalSmall).tryMap( + async () => { + return this.multiNetworks.map(async ({ network, operator }) => { + logger.trace('Fetching indexing rules', { + protocolNetwork: network.specification.networkIdentifier, + }) + let rules = await operator.indexingRules(true) + const subgraphRuleIds = rules + .filter( + rule => + rule.identifierType == + GeneratedGraphQLTypes.IdentifierType.subgraph, + ) + .map(rule => rule.identifier!) + const subgraphsMatchingRules = + await network.networkMonitor.subgraphs(subgraphRuleIds) + if (subgraphsMatchingRules.length >= 1) { + const epochLength = + await network.contracts.epochManager.epochLength() + const blockPeriod = 15 + const bufferPeriod = epochLength.toNumber() * blockPeriod * 100 // 100 epochs + rules = convertSubgraphBasedRulesToDeploymentBased( + rules, + subgraphsMatchingRules, + bufferPeriod, + ) + } + return rules }) }, { diff --git a/packages/indexer-agent/src/types.ts b/packages/indexer-agent/src/types.ts index f71f9d295..5a8b38ae5 100644 --- a/packages/indexer-agent/src/types.ts +++ b/packages/indexer-agent/src/types.ts @@ -3,7 +3,7 @@ import { Network, GraphNode, DeploymentManagementMode, - IndexerManagementClient, + IndexerManagementYogaClient, Operator, } from '@graphprotocol/indexer-common' @@ -19,7 +19,7 @@ export interface AgentConfigs { metrics: Metrics graphNode: GraphNode operators: Operator[] - indexerManagement: IndexerManagementClient + indexerManagement: IndexerManagementYogaClient networks: Network[] deploymentManagement: DeploymentManagementMode autoMigrationSupport: boolean diff --git a/packages/indexer-cli/src/allocations.ts b/packages/indexer-cli/src/allocations.ts index 63dfc66bb..083c60195 100644 --- a/packages/indexer-cli/src/allocations.ts +++ b/packages/indexer-cli/src/allocations.ts @@ -313,7 +313,7 @@ export const reallocateAllocation = async ( } export const submitCollectReceiptsJob = async ( - client: IndexerManagementClient, + client: Client, allocationID: string, protocolNetwork: string, ): Promise => { From 38a0eab8a0f4edace8f7eb5a6f6fa3d69e417bd1 Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Tue, 6 Aug 2024 09:54:06 -0500 Subject: [PATCH 48/48] add contributor guide --- CONTRIBUTING.md | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..a93857328 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,53 @@ + +# Contributing to Indexer Components + +Welcome to the Graph Protocol! Thanks a ton for your interest in contributing. + +If you run into any problems feel free to create an issue. PRs are much appreciated for simple things. Here's [a list of good first issues](https://github.com/graphprotocol/indexer/labels/good%20first%20issue). If it's something more complex we'd appreciate having a quick chat in GitHub Issues or Discord. + +Join the conversation on our [Discord](https://discord.gg/graphprotocol). + +Please follow the [Code of Conduct](https://github.com/graphprotocol/graph-node/blob/master/CODE_OF_CONDUCT.md) for all the communications and at events. Thank you! + +## Development flow + +#### Clone the repository and install the dependencies: + +```sh +git clone git@github.com:graphprotocol/indexer.git +cd indexer +yarn +``` + +#### To run the tests: + +```sh +yarn test +``` + +#### Creating new resolvers + +The [`indexer-common`](./packages/indexer-common/) package is shared between the different indexer packages in this repository. If you are creating a new resolver, you should add it to the `indexer-common` package. This way, the resolver can be shared between the different indexer packages. To introduce a new resolver, you should: +1. Add the GraphQL schema in [`packages/indexer-common/src/indexer-management/schema.graphql`](./packages/indexer-common/src/indexer-management/schema.graphql). +2. Run `yarn codegen` this uses the [GraphQL Codegen Server preset](https://the-guild.dev/graphql/codegen/docs/guides/graphql-server-apollo-yoga-with-server-preset) to generate TypeScript types for the schema and resolvers. +3. Now you should see resolver in [`packages/indexer-common/src/schema/indexer-management/resolvers`](./packages/indexer-common/src/schema/indexer-management/resolvers/) directory and write the logic for the resolver in the file. + +#### GraphQL Unit Testing + +We use [Jest](https://jestjs.io/) for unit testing. You can write tests for your resolvers in the `__tests__` directory in the same directory as the resolver. For example, if you have a resolver in `packages/indexer-common/src/schema/indexer-management/resolvers/MyResolver.ts`, you should write tests for it in `packages/indexer-common/src/schema/indexer-management/resolvers/__tests__/MyResolver.test.ts`. The test setup utilizes [HTTP Injection from GraphQL Yoga](https://the-guild.dev/graphql/yoga-server/docs/features/testing). + +## Commit messages and pull requests + +We use the following format for commit messages: +`{package-name}: {Brief description of changes}`, for example: `indexer-cli: Remove l1 support`. + +If multiple packages are being changed list them all like this: `all: ` + +If a shared package is touched and impacts multiple packages, you can use short-had like this: `*: `. + +The body of the message can be terse, with just enough information to explain what the commit does overall. In a lot of cases, more extensive explanations of _how_ the commit achieves its goal are better as comments +in the code. + +Commits in a pull request should be structured in such a way that each commit consists of a small logical step towards the overall goal of the pull request. Your pull request should make it as easy as possible for the +reviewer to follow each change you are making. For example, it is a good idea to separate simple mechanical changes like renaming a method that touches many files from logic changes. Your pull request should not be +structured into commits according to how you implemented your feature, often indicated by commit messages like 'Fix problem' or 'Cleanup'. Flex a bit, and make the world think that you implemented your feature perfectly, in small logical steps, in one sitting without ever having to touch up something you did earlier in the pull request. (In reality, that means you'll use `git rebase -i` a lot)