1 | import { NgZone } from '@angular/core';
|
2 | import type { QueryOptions, ApolloQueryResult, SubscriptionOptions, ApolloClientOptions, FetchResult } from '@apollo/client/core';
|
3 | import { ApolloClient } from '@apollo/client/core';
|
4 | import { Observable } from 'rxjs';
|
5 | import { QueryRef } from './query-ref';
|
6 | import { WatchQueryOptions, ExtraSubscriptionOptions, EmptyObject, NamedOptions, Flags, MutationResult, MutationOptions } from './types';
|
7 | import * as i0 from "@angular/core";
|
8 | export declare class ApolloBase<TCacheShape = any> {
|
9 | protected ngZone: NgZone;
|
10 | protected flags?: Flags;
|
11 | protected _client?: ApolloClient<TCacheShape>;
|
12 | private useInitialLoading;
|
13 | private useMutationLoading;
|
14 | constructor(ngZone: NgZone, flags?: Flags, _client?: ApolloClient<TCacheShape>);
|
15 | watchQuery<TData, TVariables = EmptyObject>(options: WatchQueryOptions<TVariables, TData>): QueryRef<TData, TVariables>;
|
16 | query<T, V = EmptyObject>(options: QueryOptions<V, T>): Observable<ApolloQueryResult<T>>;
|
17 | mutate<T, V = EmptyObject>(options: MutationOptions<T, V>): Observable<MutationResult<T>>;
|
18 | subscribe<T, V = EmptyObject>(options: SubscriptionOptions<V, T>, extra?: ExtraSubscriptionOptions): Observable<FetchResult<T>>;
|
19 | /**
|
20 | * Get an access to an instance of ApolloClient
|
21 | * @deprecated use `apollo.client` instead
|
22 | */
|
23 | getClient(): ApolloClient<TCacheShape>;
|
24 | /**
|
25 | * Set a new instance of ApolloClient
|
26 | * Remember to clean up the store before setting a new client.
|
27 | * @deprecated use `apollo.client = client` instead
|
28 | *
|
29 | * @param client ApolloClient instance
|
30 | */
|
31 | setClient(client: ApolloClient<TCacheShape>): void;
|
32 | /**
|
33 | * Get an access to an instance of ApolloClient
|
34 | */
|
35 | get client(): ApolloClient<TCacheShape>;
|
36 | /**
|
37 | * Set a new instance of ApolloClient
|
38 | * Remember to clean up the store before setting a new client.
|
39 | *
|
40 | * @param client ApolloClient instance
|
41 | */
|
42 | set client(client: ApolloClient<TCacheShape>);
|
43 | private ensureClient;
|
44 | private checkInstance;
|
45 | }
|
46 | export declare class Apollo extends ApolloBase<any> {
|
47 | private _ngZone;
|
48 | private map;
|
49 | constructor(_ngZone: NgZone, apolloOptions?: ApolloClientOptions<any>, apolloNamedOptions?: NamedOptions, flags?: Flags);
|
50 | /**
|
51 | * Create an instance of ApolloClient
|
52 | * @param options Options required to create ApolloClient
|
53 | * @param name client's name
|
54 | */
|
55 | create<TCacheShape>(options: ApolloClientOptions<TCacheShape>, name?: string): void;
|
56 | /**
|
57 | * Use a default ApolloClient
|
58 | */
|
59 | default(): ApolloBase<any>;
|
60 | /**
|
61 | * Use a named ApolloClient
|
62 | * @param name client's name
|
63 | */
|
64 | use(name: string): ApolloBase<any>;
|
65 | /**
|
66 | * Create a default ApolloClient, same as `apollo.create(options)`
|
67 | * @param options ApolloClient's options
|
68 | */
|
69 | createDefault<TCacheShape>(options: ApolloClientOptions<TCacheShape>): void;
|
70 | /**
|
71 | * Create a named ApolloClient, same as `apollo.create(options, name)`
|
72 | * @param name client's name
|
73 | * @param options ApolloClient's options
|
74 | */
|
75 | createNamed<TCacheShape>(name: string, options: ApolloClientOptions<TCacheShape>): void;
|
76 | /**
|
77 | * Remember to clean up the store before removing a client
|
78 | * @param name client's name
|
79 | */
|
80 | removeClient(name?: string): void;
|
81 | static ɵfac: i0.ɵɵFactoryDeclaration<Apollo, [null, { optional: true; }, { optional: true; }, { optional: true; }]>;
|
82 | static ɵprov: i0.ɵɵInjectableDeclaration<Apollo>;
|
83 | }
|