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.

42 lines (41 loc) 2.29 kB
import { LaboratoryOperation } from './operations'; import { LaboratoryTabsActions, LaboratoryTabsState } from './tabs'; export interface LaboratoryCollectionOperation extends LaboratoryOperation { id: string; name: string; description: string; createdAt: string; } export interface LaboratoryCollection { id: string; name: string; description?: string; createdAt: string; operations: LaboratoryCollectionOperation[]; } export interface LaboratoryCollectionsActions { addCollection: (collection: Omit<LaboratoryCollection, 'id' | 'createdAt' | 'operations'> & { operations?: Omit<LaboratoryCollectionOperation, 'createdAt'>[]; }) => LaboratoryCollection; addOperationToCollection: (collectionId: string, operation: Omit<LaboratoryCollectionOperation, 'createdAt'>) => void; deleteCollection: (collectionId: string) => void; deleteOperationFromCollection: (collectionId: string, operationId: string) => void; updateCollection: (collectionId: string, collection: Omit<LaboratoryCollection, 'id' | 'createdAt' | 'operations'>) => void; updateOperationInCollection: (collectionId: string, operationId: string, operation: Omit<LaboratoryCollectionOperation, 'id' | 'createdAt'>) => void; } export interface LaboratoryCollectionsState { collections: LaboratoryCollection[]; } export interface LaboratoryCollectionsCallbacks { onCollectionCreate?: (collection: LaboratoryCollection) => void; onCollectionUpdate?: (collection: LaboratoryCollection) => void; onCollectionDelete?: (collection: LaboratoryCollection) => void; onCollectionOperationCreate?: (collection: LaboratoryCollection, operation: LaboratoryCollectionOperation) => void; onCollectionOperationUpdate?: (collection: LaboratoryCollection, operation: LaboratoryCollectionOperation) => void; onCollectionOperationDelete?: (collection: LaboratoryCollection, operation: LaboratoryCollectionOperation) => void; } export declare const useCollections: (props: { defaultCollections?: LaboratoryCollection[]; onCollectionsChange?: (collections: LaboratoryCollection[]) => void; tabsApi?: LaboratoryTabsState & LaboratoryTabsActions; } & LaboratoryCollectionsCallbacks) => LaboratoryCollectionsState & LaboratoryCollectionsActions;