apollo-angular

  • Version 2.6.0
  • Published
  • 682 kB
  • 4 dependencies
  • MIT license

Install

npm i apollo-angular
yarn add apollo-angular
pnpm add apollo-angular

Overview

Use your GraphQL data in your Angular app, with the Apollo Client

Index

Variables

variable APOLLO_FLAGS

const APOLLO_FLAGS: any;

    variable APOLLO_NAMED_OPTIONS

    const APOLLO_NAMED_OPTIONS: any;

      variable APOLLO_OPTIONS

      const APOLLO_OPTIONS: any;

        Classes

        class Apollo

        class Apollo extends ApolloBase<any> {}

          constructor

          constructor(
          _ngZone: any,
          apolloOptions?: any,
          apolloNamedOptions?: NamedOptions,
          flags?: Flags
          );

            method create

            create: <TCacheShape>(options: any, name?: string) => void;
            • Create an instance of ApolloClient

              Parameter options

              Options required to create ApolloClient

              Parameter name

              client's name

            method createDefault

            createDefault: <TCacheShape>(options: any) => void;
            • Create a default ApolloClient, same as apollo.create(options)

              Parameter options

              ApolloClient's options

            method createNamed

            createNamed: <TCacheShape>(name: string, options: any) => void;
            • Create a named ApolloClient, same as apollo.create(options, name)

              Parameter name

              client's name

              Parameter options

              ApolloClient's options

            method default

            default: () => ApolloBase<any>;
            • Use a default ApolloClient

            method removeClient

            removeClient: (name?: string) => void;
            • Remember to clean up the store before removing a client

              Parameter name

              client's name

            method use

            use: (name: string) => ApolloBase<any>;
            • Use a named ApolloClient

              Parameter name

              client's name

            class ApolloBase

            class ApolloBase<TCacheShape = any> {}

              constructor

              constructor(ngZone: any, flags?: Flags, _client?: any);

                property client

                client: any;
                • Get an access to an instance of ApolloClient

                property flags

                protected flags?: Flags;

                  property ngZone

                  protected ngZone: any;

                    method getClient

                    getClient: () => any;
                    • Get an access to an instance of ApolloClient

                      Deprecated

                      use apollo.client instead

                    method mutate

                    mutate: <T, V = EmptyObject>(options: any) => any;

                      method query

                      query: <T, V = EmptyObject>(options: any) => any;

                        method setClient

                        setClient: (client: any) => void;
                        • Set a new instance of ApolloClient Remember to clean up the store before setting a new client.

                          Parameter client

                          ApolloClient instance

                          Deprecated

                          use apollo.client = client instead

                        method subscribe

                        subscribe: <T, V = EmptyObject>(
                        options: any,
                        extra?: ExtraSubscriptionOptions
                        ) => any;

                          method watchQuery

                          watchQuery: <TData, TVariables = EmptyObject>(
                          options: WatchQueryOptions<TVariables, TData>
                          ) => QueryRef<TData, TVariables>;

                            class Mutation

                            class Mutation<T = {}, V = EmptyObject> {}

                              constructor

                              constructor(apollo: Apollo);

                                property apollo

                                protected apollo: Apollo;

                                  property client

                                  client: string;

                                    property document

                                    readonly document: any;

                                      method mutate

                                      mutate: (variables?: V, options?: MutationOptionsAlone<T, V>) => any;

                                        class Query

                                        class Query<T = {}, V = EmptyObject> {}

                                          constructor

                                          constructor(apollo: Apollo);

                                            property apollo

                                            protected apollo: Apollo;

                                              property client

                                              client: string;

                                                property document

                                                readonly document: any;

                                                  method fetch

                                                  fetch: (variables?: V, options?: QueryOptionsAlone<V, T>) => any;

                                                    method watch

                                                    watch: (variables?: V, options?: WatchQueryOptionsAlone<V, T>) => QueryRef<T, V>;

                                                      class QueryRef

                                                      class QueryRef<T, V = EmptyObject> {}

                                                        constructor

                                                        constructor(obsQuery: any, ngZone: any, options: WatchQueryOptions<V, T>);

                                                          property options

                                                          options: any;

                                                            property queryId

                                                            queryId: any;

                                                              property valueChanges

                                                              valueChanges: any;

                                                                property variables

                                                                variables: {};

                                                                  method fetchMore

                                                                  fetchMore: <K extends keyof V>(
                                                                  fetchMoreOptions: FetchMoreQueryOptions<V, K> & FetchMoreOptions<T, V>
                                                                  ) => Promise<ApolloQueryResult<T>>;

                                                                    method getCurrentResult

                                                                    getCurrentResult: () => any;

                                                                      method getLastError

                                                                      getLastError: () => any;

                                                                        method getLastResult

                                                                        getLastResult: () => any;

                                                                          method refetch

                                                                          refetch: (variables?: V) => Promise<ApolloQueryResult<T>>;

                                                                            method resetLastResults

                                                                            resetLastResults: () => void;

                                                                              method result

                                                                              result: () => Promise<ApolloQueryResult<T>>;

                                                                                method setOptions

                                                                                setOptions: (opts: any) => Promise<ApolloQueryResult<T>>;

                                                                                  method setVariables

                                                                                  setVariables: (variables: V) => Promise<void | ApolloQueryResult<T>>;

                                                                                    method startPolling

                                                                                    startPolling: (pollInterval: number) => void;

                                                                                      method stopPolling

                                                                                      stopPolling: () => void;

                                                                                        method subscribeToMore

                                                                                        subscribeToMore: <MT = any, MV = EmptyObject>(options: any) => () => void;

                                                                                          method updateQuery

                                                                                          updateQuery: (mapFn: (previousQueryResult: T, options: any) => T) => void;

                                                                                            class Subscription

                                                                                            class Subscription<T = any, V = EmptyObject> {}

                                                                                              constructor

                                                                                              constructor(apollo: Apollo);

                                                                                                property apollo

                                                                                                protected apollo: Apollo;

                                                                                                  property client

                                                                                                  client: string;

                                                                                                    property document

                                                                                                    readonly document: any;

                                                                                                      method subscribe

                                                                                                      subscribe: (
                                                                                                      variables?: V,
                                                                                                      options?: SubscriptionOptionsAlone<V, T>,
                                                                                                      extra?: ExtraSubscriptionOptions
                                                                                                      ) => any;

                                                                                                        Interfaces

                                                                                                        interface ExtraSubscriptionOptions

                                                                                                        interface ExtraSubscriptionOptions {}

                                                                                                          property useZone

                                                                                                          useZone?: boolean;

                                                                                                            interface SubscriptionResult

                                                                                                            interface SubscriptionResult<TData> extends ExecutionResult {}

                                                                                                              property data

                                                                                                              data?: TData;

                                                                                                                interface WatchQueryOptions

                                                                                                                interface WatchQueryOptions<TVariables, TData>
                                                                                                                extends CoreWatchQueryOptions<TVariables, TData> {}

                                                                                                                  property useInitialLoading

                                                                                                                  useInitialLoading?: boolean;
                                                                                                                  • Observable starts with { loading: true }. There's a big chance the next major version will enable that by default.

                                                                                                                    Disabled by default

                                                                                                                  Type Aliases

                                                                                                                  type Flags

                                                                                                                  type Flags = {
                                                                                                                  /**
                                                                                                                  * Observable starts with `{ loading: true }`.
                                                                                                                  * There's a big chance the next major version will enable that by default.
                                                                                                                  *
                                                                                                                  * Disabled by default
                                                                                                                  */
                                                                                                                  useInitialLoading?: boolean;
                                                                                                                  };

                                                                                                                    type NamedOptions

                                                                                                                    type NamedOptions = Record<string, ApolloClientOptions<any>>;

                                                                                                                      type ResultOf

                                                                                                                      type ResultOf<T extends TypedDocumentNode> = T extends TypedDocumentNode<infer R>
                                                                                                                      ? R
                                                                                                                      : never;

                                                                                                                        type VariablesOf

                                                                                                                        type VariablesOf<T extends TypedDocumentNode> = T extends TypedDocumentNode<
                                                                                                                        any,
                                                                                                                        infer V
                                                                                                                        >
                                                                                                                        ? V
                                                                                                                        : never;

                                                                                                                          Package Files (8)

                                                                                                                          Dependencies (4)

                                                                                                                          Dev Dependencies (0)

                                                                                                                          No dev dependencies.

                                                                                                                          Peer Dependencies (5)

                                                                                                                          Badge

                                                                                                                          To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                          You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/apollo-angular.

                                                                                                                          • Markdown
                                                                                                                            [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/apollo-angular)
                                                                                                                          • HTML
                                                                                                                            <a href="https://www.jsdocs.io/package/apollo-angular"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>