@graphql-hive/laboratory
Version:
30 lines (29 loc) • 1.51 kB
TypeScript
import { GraphQLSchema, IntrospectionQuery } from 'graphql';
import { LaboratoryEnvActions, LaboratoryEnvState } from './env';
import { LaboratoryOperationsActions, LaboratoryOperationsState } from './operations';
import { LaboratoryPluginsActions, LaboratoryPluginsState } from './plugins';
import { LaboratoryPreflightActions, LaboratoryPreflightState } from './preflight';
import { LaboratorySettingsActions, LaboratorySettingsState } from './settings';
export interface LaboratoryEndpointState {
endpoint: string | null;
schema: GraphQLSchema | null;
introspection: IntrospectionQuery | null;
defaultEndpoint: string | null;
shouldPollSchema: boolean;
}
export interface LaboratoryEndpointActions {
setEndpoint: (endpoint: string) => void;
fetchSchema: () => void;
restoreDefaultEndpoint: () => void;
}
export declare const EXPECTED_ERROR_REASON = "Expected error reason";
export declare const useEndpoint: (props: {
defaultEndpoint?: string | null;
onEndpointChange?: (endpoint: string | null) => void;
defaultSchemaIntrospection?: IntrospectionQuery | null;
settingsApi?: LaboratorySettingsState & LaboratorySettingsActions;
operationsApi?: LaboratoryOperationsState & LaboratoryOperationsActions;
envApi?: LaboratoryEnvState & LaboratoryEnvActions;
pluginsApi?: LaboratoryPluginsState & LaboratoryPluginsActions;
preflightApi?: LaboratoryPreflightState & LaboratoryPreflightActions;
}) => LaboratoryEndpointState & LaboratoryEndpointActions;