Options
All
  • Public
  • Public/Protected
  • All
Menu

Class GraphNodeObserver

handles connections with the Graph

param

Hierarchy

  • GraphNodeObserver

Index

Constructors

constructor

  • Parameters

    • options: object
      • Optional errHandler?: any
      • Optional graphqlHttpProvider?: undefined | string
      • Optional graphqlSubscribeToQueries?: undefined | false | true
      • Optional graphqlWsProvider?: undefined | string
      • Optional prefetchHook?: any
      • Optional retryLink?: any

    Returns GraphNodeObserver

Properties

Logger

Logger: GlobalLogger = Logger

Optional apolloClient

apolloClient: ApolloClient<object>

Optional graphqlHttpProvider

graphqlHttpProvider: undefined | string

Optional graphqlSubscribeToQueries

graphqlSubscribeToQueries: undefined | false | true

Optional graphqlWsProvider

graphqlWsProvider: undefined | string

Methods

getObservable

  • Given a gql query, will return an observable of query results

    Parameters

    • query: any

      a gql query object to execute

    • Default value apolloQueryOptions: IApolloQueryOptions = {}

      options to pass on to Apollo, cf ..

    Returns any

    an Observable that will first yield the current result, and yields updates every time the data changes

getObservableList

  • getObservableList(query: any, itemMap?: function, apolloQueryOptions?: IApolloQueryOptions): any
  • Returns an observable that:

    • sends a query over http and returns the current list of results
    • subscribes over a websocket to changes, and returns the updated list.
    example:
       const query = gql`
       {
         daos {
           id
           address
         }
       }`
       getObservableList(query, (r:any) => new DAO(r.address))

    Parameters

    • query: any

      The query to be run

    • Default value itemMap: function = (o) => o

      (optional) a function that takes elements of the list and creates new objects

        • (o: object): object | null
        • Parameters

          • o: object

          Returns object | null

    • Default value apolloQueryOptions: IApolloQueryOptions = {}

    Returns any

    an Observable

getObservableObject

  • getObservableObject(query: any, itemMap?: function, apolloQueryOptions?: IApolloQueryOptions): any
  • Returns an observable that:

    • sends a query over http and returns the current list of results
    • subscribes over a websocket to changes, and returns the updated list example: const query = gql` { daos {
       id
       address
      } }` getObservableList(query, (r:any) => new DAO(r.address), filter((r:any) => r.address === "0x1234..."))

    Parameters

    • query: any

      The query to be run

    • Default value itemMap: function = (o) => o

      (optional) a function that takes elements of the list and creates new objects

        • (o: object): object | null
        • Parameters

          • o: object

          Returns object | null

    • Default value apolloQueryOptions: IApolloQueryOptions = {}

    Returns any

sendQuery

Generated using TypeDoc