UNPKG

@adpt/core

Version:
66 lines 2.35 kB
import { DocumentNode as Query, ExecutionResult, GraphQLSchema } from "graphql"; import { ObserverResponse } from "./plugin"; import { ObserverNameHolder } from "./registry"; export interface Variables { [n: string]: any; } interface PodExecutedQuery { query: string; variables?: Variables; } export interface ObserversThatNeedData { [name: string]: PodExecutedQuery[]; } export interface ExecutedQuery { query: Query; variables?: Variables; } export interface Observations { [observerName: string]: { observations: ObserverResponse; queries: ExecutedQuery[]; }; } export interface ObserverManagerDeployment { registerSchema(name: ObserverNameHolder, schema: GraphQLSchema, observations: ObserverResponse): void; findObserverSchema(observer: ObserverNameHolder): GraphQLSchema | undefined; executedQueries(): { [name: string]: ExecutedQuery[]; }; executedQueriesThatNeededData(): { [name: string]: ExecutedQuery[]; }; executeQuery<R = any>(observer: ObserverNameHolder, q: Query, vars?: Variables): Promise<ExecutionResult<R>>; } export declare function createObserverManagerDeployment(): ObserverManagerDeploymentImpl; declare type ExecutedQueryStorage = Map<string, { doc: Query; vars: Set<Variables | undefined>; }>; interface Observable { schema: GraphQLSchema; observations: ObserverResponse; executedQueries: ExecutedQueryStorage; } declare class ObserverManagerDeploymentImpl implements ObserverManagerDeployment { observable: { [name: string]: Observable; }; needsData: { [name: string]: ExecutedQueryStorage; }; registerSchema: (observer: ObserverNameHolder, schema: GraphQLSchema, observations: ObserverResponse<object, any>) => void; findObserverSchema: (observer: ObserverNameHolder) => GraphQLSchema | undefined; executedQueries: () => { [name: string]: ExecutedQuery[]; }; executedQueriesThatNeededData: () => { [name: string]: ExecutedQuery[]; }; executeQuery: <R = any>(observer: ObserverNameHolder, q: Query, vars?: Variables | undefined) => Promise<ExecutionResult<R>>; } export declare function simplifyNeedsData(nd: { [name: string]: ExecutedQuery[]; }): ObserversThatNeedData; export {}; //# sourceMappingURL=obs_manager_deployment.d.ts.map