import { Logger, SubgraphDeploymentID } from '@graphprotocol/common-ts'; import { SubgraphDeployment } from './types'; import { IndexingRuleAttributes } from './indexer-management'; import { DocumentNode } from 'graphql'; import { QueryResult } from './subgraph-client'; export declare enum SubgraphIdentifierType { DEPLOYMENT = "deployment", SUBGRAPH = "subgraph", GROUP = "group" } export declare function validateSubgraphID(s: string | undefined): Promise; export declare function validateDeploymentID(s: string | undefined): Promise; export declare function validateSubgraphGroupID(s: string | undefined, { all, global }: { all?: boolean; global?: boolean; }): Promise; export declare function processIdentifier(identifier: string, { all, global }: { all?: boolean; global?: boolean; }): Promise<[string, SubgraphIdentifierType]>; export declare enum ActivationCriteria { NA = "na", NONE = "none", ALWAYS = "always", SIGNAL_THRESHOLD = "signal_threshold", MIN_STAKE = "min_stake", MIN_AVG_QUERY_FEES = "min_avg_query_fees", UNSUPPORTED = "unsupported", NEVER = "never", OFFCHAIN = "offchain", INVALID_ALLOCATION_AMOUNT = "invalid_allocation_amount" } interface RuleMatch { rule: IndexingRuleAttributes | undefined; activationCriteria: ActivationCriteria; } export interface PreprocessedRules { deploymentRulesMap: { [key: string]: IndexingRuleAttributes; }; globalRule: IndexingRuleAttributes | undefined; } export declare function preprocessRules(rules: IndexingRuleAttributes[]): PreprocessedRules; export declare class AllocationDecision { deployment: SubgraphDeploymentID; toAllocate: boolean; ruleMatch: RuleMatch; protocolNetwork: string; constructor(deployment: SubgraphDeploymentID, matchingRule: IndexingRuleAttributes | undefined, toAllocate: boolean, ruleActivator: ActivationCriteria, protocolNetwork: string); reasonString(): string; } export declare function evaluateDeployments(logger: Logger, networkDeployments: SubgraphDeployment[], rules: IndexingRuleAttributes[]): AllocationDecision[]; export declare function isDeploymentWorthAllocatingTowards(logger: Logger, deployment: SubgraphDeployment, deploymentRulesMap: { [key: string]: IndexingRuleAttributes; }, globalRule: IndexingRuleAttributes | undefined): AllocationDecision; export interface ProviderInterface { getBlockNumber(): Promise; } export interface LoggerInterface { trace(msg: string, o?: object, ...args: any[]): void; error(msg: string, o?: object, ...args: any[]): void; warn(msg: string, o?: object, ...args: any[]): void; } export interface SubgraphQueryInterface { query(query: DocumentNode, variables?: Record): Promise>; endpoint?: string; } type Variables = Record; export declare class SubgraphFreshnessChecker { subgraphName: string; provider: ProviderInterface; threshold: number; logger: LoggerInterface; sleepDurationMillis: number; retries: number; constructor(subgraphName: string, provider: ProviderInterface, freshnessThreshold: number, sleepDurationMillis: number, logger: LoggerInterface, retries: number); checkedQuery(subgraph: SubgraphQueryInterface, query: DocumentNode, variables?: Variables): Promise>; private checkedQueryRecursive; checkMalformedQueryResult(subgraphQueryResult: any): string | undefined; } export {};