import { ApolloClient, TypedDocumentNode, OperationVariables, ObservableQuery, MaybeMasked } from '@apollo/client'; export { TypedDocumentNode } from '@apollo/client'; import * as i0 from '@angular/core'; import { Provider, NgZone, InjectionToken } from '@angular/core'; import { Observable, OperatorFunction } from 'rxjs'; import { DocumentNode } from 'graphql'; import { ObservableQuery as ObservableQuery$1, ApolloClient as ApolloClient$1, GetDataState } from '@apollo/client/core'; type EmptyObject = { [key: string]: any; }; type ResultOf = T extends TypedDocumentNode ? R : never; type VariablesOf = T extends TypedDocumentNode ? V : never; type NamedOptions = Record; type Flags = { /** * Observable starts with `{ loading: true }`. * * Disabled by default */ useMutationLoading?: boolean; }; declare function provideApollo(optionsFactory: () => ApolloClient.Options, flags?: Flags): Provider; declare function provideNamedApollo(optionsFactory: () => NamedOptions, flags?: Flags): Provider; type QueryRefFromDocument = T extends TypedDocumentNode ? QueryRef : never; declare class QueryRef { private readonly obsQuery; readonly valueChanges: Observable>; constructor(obsQuery: ObservableQuery, ngZone: NgZone); get options(): ObservableQuery['options']; get variables(): ObservableQuery['variables']; getCurrentResult(): ReturnType['getCurrentResult']>; refetch(variables?: Parameters['refetch']>[0]): ReturnType['refetch']>; fetchMore(fetchMoreOptions: ObservableQuery.FetchMoreOptions): Promise>>; subscribeToMore(options: ObservableQuery.SubscribeToMoreOptions): ReturnType['subscribeToMore']>; updateQuery(mapFn: Parameters['updateQuery']>[0]): ReturnType['updateQuery']>; stopPolling(): ReturnType['stopPolling']>; startPolling(pollInterval: Parameters['startPolling']>[0]): ReturnType['startPolling']>; setVariables(variables: Parameters['setVariables']>[0]): ReturnType['setVariables']>; reobserve(options: ObservableQuery.Options): ReturnType['reobserve']>; } declare class ApolloBase { protected readonly ngZone: NgZone; protected readonly flags?: Flags; protected _client?: ApolloClient; private useMutationLoading; constructor(ngZone: NgZone, flags?: Flags, _client?: ApolloClient); watchQuery(options: Apollo.WatchQueryOptions): QueryRef; query(options: Apollo.QueryOptions): Observable>; mutate(options: Apollo.MutateOptions): Observable>; watchFragment(options: Apollo.WatchFragmentOptions): Observable>; subscribe(options: Apollo.SubscribeOptions): Observable>; /** * Get an instance of ApolloClient */ get client(): ApolloClient; /** * Set a new instance of ApolloClient * Remember to clean up the store before setting a new client. * * @param client ApolloClient instance */ set client(client: ApolloClient); private ensureClient; private checkInstance; } declare namespace Apollo { type WatchQueryOptions = ApolloClient.WatchQueryOptions; type QueryOptions = ApolloClient.QueryOptions; type QueryResult = ApolloClient.QueryResult; type MutateOptions = ApolloClient.MutateOptions & { /** * Observable starts with `{ loading: true }`. * * Disabled by default */ useMutationLoading?: boolean; }; type MutateResult = ApolloClient.MutateResult & { loading?: boolean; }; type SubscribeOptions = ApolloClient.SubscribeOptions & { useZone?: boolean; }; type SubscribeResult = ApolloClient.SubscribeResult; interface WatchFragmentOptions extends ApolloClient.WatchFragmentOptions { useZone?: boolean; } type WatchFragmentResult = ApolloClient.WatchFragmentResult; } declare class Apollo extends ApolloBase { private map; constructor(ngZone: NgZone, apolloOptions?: ApolloClient.Options, apolloNamedOptions?: NamedOptions, flags?: Flags); /** * Create an instance of ApolloClient * @param options Options required to create ApolloClient * @param name client's name */ create(options: ApolloClient.Options, name?: string): void; /** * Use a default ApolloClient */ default(): ApolloBase; /** * Use a named ApolloClient * @param name client's name */ use(name: string): ApolloBase; /** * Create a default ApolloClient, same as `apollo.create(options)` * @param options ApolloClient's options */ createDefault(options: ApolloClient.Options): void; /** * Create a named ApolloClient, same as `apollo.create(options, name)` * @param name client's name * @param options ApolloClient's options */ createNamed(name: string, options: ApolloClient.Options): void; /** * Remember to clean up the store before removing a client * @param name client's name */ removeClient(name?: string): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare namespace Query { type WatchOptions = Omit, 'query'>; type FetchOptions = Omit, 'query'>; } declare abstract class Query { protected readonly apollo: Apollo; abstract readonly document: DocumentNode | TypedDocumentNode; client: string; constructor(apollo: Apollo); watch(...[options]: {} extends TVariables ? [options?: Query.WatchOptions] : [options: Query.WatchOptions]): QueryRef; fetch(...[options]: {} extends TVariables ? [options?: Query.FetchOptions] : [options: Query.FetchOptions]): Observable>; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵprov: i0.ɵɵInjectableDeclaration>; } declare namespace Mutation { type MutateOptions = Omit, 'mutation'>; } declare abstract class Mutation { protected readonly apollo: Apollo; abstract readonly document: DocumentNode | TypedDocumentNode; client: string; constructor(apollo: Apollo); mutate(...[options]: {} extends TVariables ? [options?: Mutation.MutateOptions] : [options: Mutation.MutateOptions]): Observable>; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵprov: i0.ɵɵInjectableDeclaration>; } declare namespace Subscription { type SubscribeOptions = Omit, 'query'>; } declare abstract class Subscription { protected readonly apollo: Apollo; abstract readonly document: DocumentNode | TypedDocumentNode; client: string; constructor(apollo: Apollo); subscribe(...[options]: {} extends TVariables ? [options?: Subscription.SubscribeOptions] : [options: Subscription.SubscribeOptions]): Observable>; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵprov: i0.ɵɵInjectableDeclaration>; } declare const APOLLO_FLAGS: InjectionToken; declare const APOLLO_OPTIONS: InjectionToken; declare const APOLLO_NAMED_OPTIONS: InjectionToken; declare const gql: (literals: ReadonlyArray | Readonly, ...placeholders: any[]) => TypedDocumentNode; type CompleteFragment = { complete: true; missing?: never; } & GetDataState; type ForWatchFragment = OperatorFunction, CompleteFragment>; /** * Filter emitted results to only receive results that are complete (`result.dataState === 'complete'`). * * This is a small wrapper around rxjs `filter()` for convenience only. * * If you use this, you should probably combine it with [`notifyOnNetworkStatusChange`](https://www.apollographql.com/docs/react/data/queries#queryhookoptions-interface-notifyonnetworkstatuschange). * This tells `@apollo/client` to not emit the first `partial` result, so `apollo-angular` does * not need to filter it out. The overall behavior is identical, but it saves some CPU cycles. * * So something like this: * * ```ts * apollo * .watchQuery({ * query: myQuery, * notifyOnNetworkStatusChange: false, // Adding this will save CPU cycles * }) * .valueChanges * .pipe(onlyCompleteData()) * .subscribe(result => { * // Do something with complete result * }); * ``` */ declare function onlyCompleteData(): OperatorFunction, ObservableQuery$1.Result>; /** * @deprecated Use `onlyCompleteData()` instead. */ declare const onlyComplete: typeof onlyCompleteData; /** * Same as `onlyCompleteData()` but for `Apollo.watchFragment()`. */ declare function onlyCompleteFragment(): ForWatchFragment; export { APOLLO_FLAGS, APOLLO_NAMED_OPTIONS, APOLLO_OPTIONS, Apollo, ApolloBase, Mutation, Query, QueryRef, Subscription, gql, onlyComplete, onlyCompleteData, onlyCompleteFragment, provideApollo, provideNamedApollo }; export type { Flags, NamedOptions, QueryRefFromDocument, ResultOf, VariablesOf };