Options
All
  • Public
  • Public/Protected
  • All
Menu

Package graphiql-plugin-history

@graphiql/plugin-history

API

  • useHistory: Persists executed requests in storage
  • useHistoryActions: Actions related to the history

Index

References

HistoryStore

Re-exports HistoryStore

useHistory

Re-exports useHistory

useHistoryActions

Re-exports useHistoryActions

useHistoryContext

Re-exports useHistoryContext

Variables

Const create

create: Create = (<T>(stateCreator: StateCreator<T>) => {console.log('zustand create mock');// to support a curried version of createreturn typeof stateCreator === 'function'? createUncurried(stateCreator): createUncurried;}) as typeof originalCreate

Const createStore

createStore: CreateStore = (<T>(stateCreator: StateCreator<T>) => {console.log('zustand createStore mock');// to support a curried version of createStorereturn typeof stateCreator === 'function'? createStoreUncurried(stateCreator): createStoreUncurried;}) as typeof originalCreateStore

Const storeResetFns

storeResetFns: Set<() => void> = new Set<() => void>()

Functions

Const History

  • History(): Element

Const HistoryItem

  • HistoryItem(props: QueryHistoryItemProps): Element

Const HistoryStore

  • HistoryStore(__namedParameters: { children: ReactNode; maxHistoryLength: number }): ReactElement<unknown, string | ((props: P) => ReactElement<any, any> | null) | {}>
  • The functions send the entire operation so users can customize their own application and get access to the operation plus any additional props they added for their needs (i.e., build their own functions that may save to a backend instead of localStorage and might need an id property added to the QueryStoreItem)

    Parameters

    • __namedParameters: { children: ReactNode; maxHistoryLength: number }
      • children: ReactNode
      • maxHistoryLength: number

    Returns ReactElement<unknown, string | ((props: P) => ReactElement<any, any> | null) | {}>

formatQuery

Const useHistory

Const useHistoryActions

  • useHistoryActions(): { addToHistory: any; deleteFromHistory: any; editLabel: any; setActive: any; toggleFavorite: any }
  • Actions are functions used to update values in your store. They are static and never change.

    see

    https://tkdodo.eu/blog/working-with-zustand#separate-actions-from-state

    Returns { addToHistory: any; deleteFromHistory: any; editLabel: any; setActive: any; toggleFavorite: any }

    • addToHistory: function
      • addToHistory(operation: { headers?: undefined | string; operationName?: undefined | string; query?: undefined | string; variables?: undefined | string }): void
      • Add an operation to the history.

        Parameters

        • operation: { headers?: undefined | string; operationName?: undefined | string; query?: undefined | string; variables?: undefined | string }

          The operation that was executed, consisting of the query, variables, headers, and operation name.

          • Optional headers?: undefined | string
          • Optional operationName?: undefined | string
          • Optional query?: undefined | string
          • Optional variables?: undefined | string

        Returns void

    • deleteFromHistory: function
      • deleteFromHistory(args: QueryStoreItem, clearFavorites?: undefined | false | true): void
      • Delete an operation from the history.

        Parameters

        • args: QueryStoreItem

          The operation that was executed, consisting of the query, variables, headers, and operation name.

        • Optional clearFavorites: undefined | false | true

          This is only if you press the 'clear' button

        Returns void

    • editLabel: function
      • editLabel(args: { favorite?: undefined | false | true; headers?: undefined | string; label?: undefined | string; operationName?: undefined | string; query?: undefined | string; variables?: undefined | string }, index?: undefined | number): void
      • Change the custom label of an item from the history.

        Parameters

        • args: { favorite?: undefined | false | true; headers?: undefined | string; label?: undefined | string; operationName?: undefined | string; query?: undefined | string; variables?: undefined | string }

          An object containing the label (undefined if it should be unset) and properties that identify the history item that the label should be applied to. (This can result in the label being applied to multiple history items.)

          • Optional favorite?: undefined | false | true
          • Optional headers?: undefined | string
          • Optional label?: undefined | string
          • Optional operationName?: undefined | string
          • Optional query?: undefined | string
          • Optional variables?: undefined | string
        • Optional index: undefined | number

          Index to edit. Without it, will look for the first index matching the operation, which may lead to misleading results if multiple items have the same label

        Returns void

    • setActive: function
    • toggleFavorite: function
      • toggleFavorite(args: { favorite?: undefined | false | true; headers?: undefined | string; label?: undefined | string; operationName?: undefined | string; query?: undefined | string; variables?: undefined | string }): void
      • Toggle the favorite state of an item from the history.

        Parameters

        • args: { favorite?: undefined | false | true; headers?: undefined | string; label?: undefined | string; operationName?: undefined | string; query?: undefined | string; variables?: undefined | string }

          An object containing the favorite state (undefined if it should be unset) and properties that identify the history item that the label should be applied to. (This can result in the label being applied to multiple history items.)

          • Optional favorite?: undefined | false | true
          • Optional headers?: undefined | string
          • Optional label?: undefined | string
          • Optional operationName?: undefined | string
          • Optional query?: undefined | string
          • Optional variables?: undefined | string

        Returns void

useHistoryContext

Object literals

Const HISTORY_PLUGIN

HISTORY_PLUGIN: object

content

content: FC<{}> = History

icon

icon: FC<SVGProps<SVGSVGElement>> = HistoryIcon

title

title: string = "History"

Const editor

editor: object

create

  • create(editorContainer: HTMLElement, options: undefined | IStandaloneEditorConstructionOptions): IStandaloneCodeEditor & { getValue: any; setValue: any }

createModel

  • createModel(value: string, language: undefined | string, uri: undefined | Uri): ITextModel

Generated using TypeDoc