UNPKG

@graphql-hive/laboratory

Version:

[Hive](https://the-guild.dev/graphql/hive) is a fully open-source schema registry, analytics, metrics and gateway for [GraphQL federation](https://the-guild.dev/graphql/hive/federation) and other GraphQL APIs.

35 lines (34 loc) 1.23 kB
import { LaboratoryOperation } from './operations'; export interface LaboratoryTestTaskBase { id: string; next: string | null; } export interface LaboratoryTestTaskOperation extends LaboratoryTestTaskBase { type: 'operation'; data: Pick<LaboratoryOperation, 'id'>; } export interface LaboratoryTestTaskUtlity extends LaboratoryTestTaskBase { type: 'utility'; data: unknown; } export type LaboratoryTestTask = LaboratoryTestTaskOperation | LaboratoryTestTaskUtlity; export interface LaboratoryTest { id: string; name: string; description?: string; createdAt: string; tasks: LaboratoryTestTask[]; } export interface LaboratoryTestState { tests: LaboratoryTest[]; } export interface LaboratoryTestActions { addTest: (test: Omit<LaboratoryTest, 'id' | 'createdAt' | 'tasks'>) => LaboratoryTest; addTaskToTest: (testId: string, task: Pick<LaboratoryTestTask, 'type' | 'data'>) => void; deleteTaskFromTest: (testId: string, taskId: string) => void; deleteTest: (testId: string) => void; } export declare const useTests: (props: { defaultTests?: LaboratoryTest[]; onTestsChange?: (test: LaboratoryTest[]) => void; }) => LaboratoryTestState & LaboratoryTestActions;