@apollo/client 4.2.0-alpha.1 → 4.2.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +148 -0
- package/__cjs/core/ApolloClient.cjs +16 -3
- package/__cjs/core/ApolloClient.cjs.map +1 -1
- package/__cjs/core/ApolloClient.d.cts +180 -131
- package/__cjs/core/QueryManager.cjs.map +1 -1
- package/__cjs/core/defaultOptions.cjs +3 -0
- package/__cjs/core/defaultOptions.cjs.map +1 -0
- package/__cjs/core/defaultOptions.d.cts +90 -0
- package/__cjs/core/index.cjs.map +1 -1
- package/__cjs/core/index.d.cts +2 -1
- package/__cjs/react/hooks/useBackgroundQuery.cjs +3 -3
- package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useBackgroundQuery.d.cts +254 -822
- package/__cjs/react/hooks/useLazyQuery.cjs +3 -5
- package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useLazyQuery.d.cts +93 -146
- package/__cjs/react/hooks/useLoadableQuery.cjs +8 -4
- package/__cjs/react/hooks/useLoadableQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useLoadableQuery.d.cts +105 -233
- package/__cjs/react/hooks/useQuery.cjs +5 -5
- package/__cjs/react/hooks/useQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useQuery.d.cts +138 -308
- package/__cjs/react/hooks/useSuspenseQuery.cjs +3 -3
- package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useSuspenseQuery.d.cts +147 -436
- package/__cjs/react/internal/cache/getSuspenseCache.cjs.map +1 -1
- package/__cjs/react/internal/cache/getSuspenseCache.d.cts +7 -0
- package/__cjs/utilities/internal/LazyType.cjs +3 -0
- package/__cjs/utilities/internal/LazyType.cjs.map +1 -0
- package/__cjs/utilities/internal/LazyType.d.cts +10 -0
- package/__cjs/utilities/internal/index.cjs.map +1 -1
- package/__cjs/utilities/internal/index.d.cts +3 -0
- package/__cjs/utilities/internal/types/OptionWithFallback.cjs +3 -0
- package/__cjs/utilities/internal/types/OptionWithFallback.cjs.map +1 -0
- package/__cjs/utilities/internal/types/OptionWithFallback.d.cts +5 -0
- package/__cjs/utilities/internal/types/SignatureStyle.cjs +3 -0
- package/__cjs/utilities/internal/types/SignatureStyle.cjs.map +1 -0
- package/__cjs/utilities/internal/types/SignatureStyle.d.cts +24 -0
- package/__cjs/version.cjs +1 -1
- package/core/ApolloClient.d.ts +180 -131
- package/core/ApolloClient.js +16 -3
- package/core/ApolloClient.js.map +1 -1
- package/core/QueryManager.js.map +1 -1
- package/core/defaultOptions.d.ts +90 -0
- package/core/defaultOptions.js +2 -0
- package/core/defaultOptions.js.map +1 -0
- package/core/index.d.ts +2 -1
- package/core/index.js.map +1 -1
- package/package.json +1 -1
- package/react/hooks/useBackgroundQuery.d.ts +254 -822
- package/react/hooks/useBackgroundQuery.js +2 -2
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useLazyQuery.d.ts +93 -146
- package/react/hooks/useLazyQuery.js +2 -4
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useLoadableQuery.d.ts +105 -233
- package/react/hooks/useLoadableQuery.js +7 -3
- package/react/hooks/useLoadableQuery.js.map +1 -1
- package/react/hooks/useQuery.d.ts +138 -308
- package/react/hooks/useQuery.js +2 -2
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useSuspenseQuery.d.ts +147 -436
- package/react/hooks/useSuspenseQuery.js +2 -2
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/hooks-compiled/useBackgroundQuery.d.ts +254 -822
- package/react/hooks-compiled/useBackgroundQuery.js +2 -2
- package/react/hooks-compiled/useBackgroundQuery.js.map +1 -1
- package/react/hooks-compiled/useLazyQuery.d.ts +93 -146
- package/react/hooks-compiled/useLazyQuery.js +2 -4
- package/react/hooks-compiled/useLazyQuery.js.map +1 -1
- package/react/hooks-compiled/useLoadableQuery.d.ts +105 -233
- package/react/hooks-compiled/useLoadableQuery.js +2 -2
- package/react/hooks-compiled/useLoadableQuery.js.map +1 -1
- package/react/hooks-compiled/useQuery.d.ts +138 -308
- package/react/hooks-compiled/useQuery.js +2 -2
- package/react/hooks-compiled/useQuery.js.map +1 -1
- package/react/hooks-compiled/useSuspenseQuery.d.ts +147 -436
- package/react/hooks-compiled/useSuspenseQuery.js +2 -2
- package/react/hooks-compiled/useSuspenseQuery.js.map +1 -1
- package/react/internal/cache/getSuspenseCache.d.ts +7 -0
- package/react/internal/cache/getSuspenseCache.js.map +1 -1
- package/utilities/internal/LazyType.d.ts +10 -0
- package/utilities/internal/LazyType.js +2 -0
- package/utilities/internal/LazyType.js.map +1 -0
- package/utilities/internal/index.d.ts +3 -0
- package/utilities/internal/index.js.map +1 -1
- package/utilities/internal/types/OptionWithFallback.d.ts +5 -0
- package/utilities/internal/types/OptionWithFallback.js +2 -0
- package/utilities/internal/types/OptionWithFallback.js.map +1 -0
- package/utilities/internal/types/SignatureStyle.d.ts +24 -0
- package/utilities/internal/types/SignatureStyle.js +2 -0
- package/utilities/internal/types/SignatureStyle.js.map +1 -0
- package/version.js +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { DocumentNode } from "graphql";
|
|
2
2
|
import type { Observable } from "rxjs";
|
|
3
|
+
import type { InternalTypes } from "@apollo/client";
|
|
3
4
|
import type { ApolloCache, Cache, IgnoreModifier, Reference } from "@apollo/client/cache";
|
|
4
5
|
import type { Incremental } from "@apollo/client/incremental";
|
|
5
6
|
import type { ApolloLink } from "@apollo/client/link";
|
|
@@ -7,18 +8,27 @@ import type { ClientAwarenessLink } from "@apollo/client/link/client-awareness";
|
|
|
7
8
|
import type { LocalState } from "@apollo/client/local-state";
|
|
8
9
|
import type { MaybeMasked, Unmasked } from "@apollo/client/masking";
|
|
9
10
|
import { DocumentTransform } from "@apollo/client/utilities";
|
|
10
|
-
import type { VariablesOption, variablesUnknownSymbol } from "@apollo/client/utilities/internal";
|
|
11
|
+
import type { LazyType, OptionWithFallback, SignatureStyle, VariablesOption, variablesUnknownSymbol } from "@apollo/client/utilities/internal";
|
|
11
12
|
import { getApolloClientMemoryInternals } from "@apollo/client/utilities/internal";
|
|
13
|
+
import type { DeclareDefaultOptions, DefaultOptions } from "./defaultOptions.cjs";
|
|
12
14
|
import type { ObservableQuery } from "./ObservableQuery.cjs";
|
|
13
15
|
import type { DefaultContext, ErrorLike, InternalRefetchQueriesInclude, InternalRefetchQueriesResult, MutationQueryReducersMap, MutationUpdaterFunction, NormalizedExecutionResult, OnQueryUpdated, OperationVariables, RefetchQueriesInclude, RefetchQueriesPromiseResults, SubscriptionObservable, TypedDocumentNode } from "./types.cjs";
|
|
14
16
|
import type { ErrorPolicy, FetchPolicy, MutationFetchPolicy, NextFetchPolicyContext, RefetchWritePolicy, WatchQueryFetchPolicy } from "./watchQueryOptions.cjs";
|
|
17
|
+
/**
|
|
18
|
+
* @knipignore
|
|
19
|
+
* @internal
|
|
20
|
+
* For some reason, without this export the build stop drops references to `DefaultOptions` and `DeclareDefaultOptions`, resulting in a broken build.
|
|
21
|
+
* Adding this fixes that, although it's not particularly elegant.
|
|
22
|
+
*
|
|
23
|
+
* @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time.
|
|
24
|
+
*/
|
|
25
|
+
export interface ReferenceToAvoidDroppingImportOnBuild {
|
|
26
|
+
_1: DeclareDefaultOptions.Mutate;
|
|
27
|
+
_2: DefaultOptions;
|
|
28
|
+
}
|
|
15
29
|
export declare namespace ApolloClient {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
query?: Partial<ApolloClient.QueryOptions<any, any>>;
|
|
19
|
-
mutate?: Partial<ApolloClient.MutateOptions<any, any, any>>;
|
|
20
|
-
}
|
|
21
|
-
interface Options {
|
|
30
|
+
export type { DeclareDefaultOptions, DefaultOptions };
|
|
31
|
+
export interface Options extends InternalTypes.DefaultOptionsParentObject {
|
|
22
32
|
/**
|
|
23
33
|
* An `ApolloLink` instance to serve as Apollo Client's network layer. For more information, see [Advanced HTTP networking](https://www.apollographql.com/docs/react/networking/advanced-http-networking/).
|
|
24
34
|
*/
|
|
@@ -47,12 +57,6 @@ export declare namespace ApolloClient {
|
|
|
47
57
|
* @defaultValue `true`
|
|
48
58
|
*/
|
|
49
59
|
queryDeduplication?: boolean;
|
|
50
|
-
/**
|
|
51
|
-
* Provide this object to set application-wide default values for options you can provide to the `watchQuery`, `query`, and `mutate` functions. See below for an example object.
|
|
52
|
-
*
|
|
53
|
-
* See this [example object](https://www.apollographql.com/docs/react/api/core/ApolloClient#example-defaultoptions-object).
|
|
54
|
-
*/
|
|
55
|
-
defaultOptions?: ApolloClient.DefaultOptions;
|
|
56
60
|
defaultContext?: Partial<DefaultContext>;
|
|
57
61
|
/**
|
|
58
62
|
* If `true`, Apollo Client will assume results read from the cache are never mutated by application code, which enables substantial performance optimizations.
|
|
@@ -96,7 +100,7 @@ export declare namespace ApolloClient {
|
|
|
96
100
|
*/
|
|
97
101
|
experiments?: ApolloClient.Experiment[];
|
|
98
102
|
}
|
|
99
|
-
interface DevtoolsOptions {
|
|
103
|
+
export interface DevtoolsOptions {
|
|
100
104
|
/**
|
|
101
105
|
* If `true`, the [Apollo Client Devtools](https://www.apollographql.com/docs/react/development-testing/developer-tooling/#apollo-client-devtools) browser extension can connect to this `ApolloClient` instance.
|
|
102
106
|
*
|
|
@@ -110,7 +114,7 @@ export declare namespace ApolloClient {
|
|
|
110
114
|
*/
|
|
111
115
|
name?: string;
|
|
112
116
|
}
|
|
113
|
-
type MutateOptions<TData = unknown, TVariables extends OperationVariables = OperationVariables, TCache extends ApolloCache = ApolloCache> = {
|
|
117
|
+
export type MutateOptions<TData = unknown, TVariables extends OperationVariables = OperationVariables, TCache extends ApolloCache = ApolloCache> = {
|
|
114
118
|
/**
|
|
115
119
|
* By providing either an object or a callback function that, when invoked after
|
|
116
120
|
* a mutation, allows you to return optimistic data and optionally skip updates
|
|
@@ -212,7 +216,7 @@ export declare namespace ApolloClient {
|
|
|
212
216
|
*/
|
|
213
217
|
mutation: DocumentNode | TypedDocumentNode<TData, TVariables>;
|
|
214
218
|
} & VariablesOption<NoInfer<TVariables>>;
|
|
215
|
-
interface MutateResult<TData = unknown> {
|
|
219
|
+
export interface MutateResult<TData = unknown> {
|
|
216
220
|
/**
|
|
217
221
|
* The data returned from your mutation. Can be `undefined` if the `errorPolicy`
|
|
218
222
|
* is `all` or `ignore` and the server returns a GraphQL response with `errors`
|
|
@@ -233,7 +237,7 @@ export declare namespace ApolloClient {
|
|
|
233
237
|
/**
|
|
234
238
|
* Query options.
|
|
235
239
|
*/
|
|
236
|
-
type QueryOptions<TData = unknown, TVariables extends OperationVariables = OperationVariables> = {
|
|
240
|
+
export type QueryOptions<TData = unknown, TVariables extends OperationVariables = OperationVariables> = {
|
|
237
241
|
/**
|
|
238
242
|
* A GraphQL query string parsed into an AST with the gql template literal.
|
|
239
243
|
*
|
|
@@ -267,83 +271,140 @@ export declare namespace ApolloClient {
|
|
|
267
271
|
*/
|
|
268
272
|
fetchPolicy?: FetchPolicy;
|
|
269
273
|
} & VariablesOption<NoInfer<TVariables>>;
|
|
270
|
-
type
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
274
|
+
export type QueryResultMap<TData = unknown, TErrorPolicy extends ErrorPolicy | undefined = undefined> = {
|
|
275
|
+
none: {
|
|
276
|
+
/**
|
|
277
|
+
* An object containing the result of your GraphQL query after it completes.
|
|
278
|
+
*
|
|
279
|
+
* This value might be `undefined` if a query results in one or more errors (depending on the query's `errorPolicy`).
|
|
280
|
+
*
|
|
281
|
+
* @docGroup 1. Operation data
|
|
282
|
+
*/
|
|
283
|
+
data: TData;
|
|
284
|
+
/**
|
|
285
|
+
* A single ErrorLike object describing the error that occurred during the latest
|
|
286
|
+
* query execution.
|
|
287
|
+
*
|
|
288
|
+
* For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).
|
|
289
|
+
*
|
|
290
|
+
* @docGroup 1. Operation data
|
|
291
|
+
*/
|
|
292
|
+
error?: never;
|
|
293
|
+
};
|
|
294
|
+
all: {
|
|
295
|
+
/**
|
|
296
|
+
* An object containing the result of your GraphQL query after it completes.
|
|
297
|
+
*
|
|
298
|
+
* This value might be `undefined` if a query results in one or more errors (depending on the query's `errorPolicy`).
|
|
299
|
+
*
|
|
300
|
+
* @docGroup 1. Operation data
|
|
301
|
+
*/
|
|
302
|
+
data: TData | undefined;
|
|
303
|
+
/**
|
|
304
|
+
* A single ErrorLike object describing the error that occurred during the latest
|
|
305
|
+
* query execution.
|
|
306
|
+
*
|
|
307
|
+
* For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).
|
|
308
|
+
*
|
|
309
|
+
* @docGroup 1. Operation data
|
|
310
|
+
*/
|
|
311
|
+
error?: ErrorLike;
|
|
312
|
+
};
|
|
313
|
+
ignore: {
|
|
314
|
+
/**
|
|
315
|
+
* An object containing the result of your GraphQL query after it completes.
|
|
316
|
+
*
|
|
317
|
+
* This value might be `undefined` if a query results in one or more errors (depending on the query's `errorPolicy`).
|
|
318
|
+
*
|
|
319
|
+
* @docGroup 1. Operation data
|
|
320
|
+
*/
|
|
321
|
+
data: TData | undefined;
|
|
322
|
+
/**
|
|
323
|
+
* A single ErrorLike object describing the error that occurred during the latest
|
|
324
|
+
* query execution.
|
|
325
|
+
*
|
|
326
|
+
* For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).
|
|
327
|
+
*
|
|
328
|
+
* @docGroup 1. Operation data
|
|
329
|
+
*/
|
|
330
|
+
error?: never;
|
|
331
|
+
};
|
|
332
|
+
undefined: {
|
|
333
|
+
/**
|
|
334
|
+
* An object containing the result of your GraphQL query after it completes.
|
|
335
|
+
*
|
|
336
|
+
* This value might be `undefined` if a query results in one or more errors (depending on the query's `errorPolicy`).
|
|
337
|
+
*
|
|
338
|
+
* @docGroup 1. Operation data
|
|
339
|
+
*/
|
|
340
|
+
data: TData | undefined;
|
|
341
|
+
/**
|
|
342
|
+
* A single ErrorLike object describing the error that occurred during the latest
|
|
343
|
+
* query execution.
|
|
344
|
+
*
|
|
345
|
+
* For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).
|
|
346
|
+
*
|
|
347
|
+
* @docGroup 1. Operation data
|
|
348
|
+
*/
|
|
349
|
+
error?: ErrorLike;
|
|
350
|
+
};
|
|
351
|
+
};
|
|
352
|
+
export type QueryResult<TData = unknown, TErrorPolicy extends ErrorPolicy | undefined = undefined> = QueryResultMap<TData, TErrorPolicy>[`${TErrorPolicy}`];
|
|
353
|
+
export namespace query {
|
|
354
|
+
interface DefaultOptions extends ApolloClient.DefaultOptions.Query.Calculated {
|
|
355
|
+
}
|
|
356
|
+
type ResultForOptions<TData, TVariables extends OperationVariables, TOptions extends Record<string, unknown> | QueryOptions<any, TVariables>> = LazyType<QueryResult<MaybeMasked<TData>, OptionWithFallback<TOptions, DefaultOptions, "errorPolicy"> & ErrorPolicy>>;
|
|
357
|
+
namespace Signatures {
|
|
358
|
+
interface Classic {
|
|
359
|
+
/**
|
|
360
|
+
* @deprecated Avoid manually specifying generics on `client.query`.
|
|
361
|
+
* Instead, rely on TypeScript's type inference along with a correctly typed `TypedDocumentNode` to get accurate types for your query results.
|
|
362
|
+
*
|
|
363
|
+
*
|
|
364
|
+
* This resolves a single query according to the options specified and
|
|
365
|
+
* returns a `Promise` which is either resolved with the resulting data
|
|
366
|
+
* or rejected with an error.
|
|
367
|
+
*
|
|
368
|
+
* @param options - An object of type `QueryOptions` that allows us to
|
|
369
|
+
* describe how this query should be treated e.g. whether it should hit the
|
|
370
|
+
* server at all or just resolve from the cache, etc.
|
|
371
|
+
*/
|
|
372
|
+
<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.QueryOptions<TData, TVariables>): Promise<ApolloClient.QueryResult<MaybeMasked<TData>>>;
|
|
373
|
+
}
|
|
374
|
+
interface Modern {
|
|
375
|
+
/**
|
|
376
|
+
* This resolves a single query according to the options specified and
|
|
377
|
+
* returns a `Promise` which is either resolved with the resulting data
|
|
378
|
+
* or rejected with an error.
|
|
379
|
+
*
|
|
380
|
+
* @param options - An object of type `QueryOptions` that allows us to
|
|
381
|
+
* describe how this query should be treated e.g. whether it should hit the
|
|
382
|
+
* server at all or just resolve from the cache, etc.
|
|
383
|
+
*/
|
|
384
|
+
<TData, TVariables extends OperationVariables, TOptions extends ApolloClient.QueryOptions<NoInfer<TData>, NoInfer<TVariables>> & VariablesOption<TVariables & {
|
|
385
|
+
[K in Exclude<keyof TOptions["variables"], keyof TVariables>]?: never;
|
|
386
|
+
}>>(options: TOptions & {
|
|
387
|
+
query: TypedDocumentNode<TData, TVariables>;
|
|
388
|
+
}): Promise<ApolloClient.query.ResultForOptions<TData, TVariables, TOptions>>;
|
|
389
|
+
}
|
|
390
|
+
type Evaluated = SignatureStyle extends "classic" ? Classic : Modern;
|
|
391
|
+
}
|
|
333
392
|
/**
|
|
334
|
-
*
|
|
335
|
-
*
|
|
393
|
+
* This resolves a single query according to the options specified and
|
|
394
|
+
* returns a `Promise` which is either resolved with the resulting data
|
|
395
|
+
* or rejected with an error.
|
|
336
396
|
*
|
|
337
|
-
*
|
|
338
|
-
*
|
|
339
|
-
*
|
|
397
|
+
* @param options - An object of type `QueryOptions` that allows us to
|
|
398
|
+
* describe how this query should be treated e.g. whether it should hit the
|
|
399
|
+
* server at all or just resolve from the cache, etc.
|
|
340
400
|
*/
|
|
341
|
-
|
|
342
|
-
|
|
401
|
+
interface Signature extends Signatures.Evaluated {
|
|
402
|
+
}
|
|
403
|
+
}
|
|
343
404
|
/**
|
|
344
405
|
* Options object for the `client.refetchQueries` method.
|
|
345
406
|
*/
|
|
346
|
-
interface RefetchQueriesOptions<TCache extends ApolloCache, TResult> {
|
|
407
|
+
export interface RefetchQueriesOptions<TCache extends ApolloCache, TResult> {
|
|
347
408
|
/**
|
|
348
409
|
* Optional function that updates cached fields to trigger refetches of queries that include those fields.
|
|
349
410
|
*/
|
|
@@ -377,9 +438,9 @@ export declare namespace ApolloClient {
|
|
|
377
438
|
* immediately by examining the additional `queries` and `results` properties of
|
|
378
439
|
* the `RefetchQueriesResult<TResult> object`.
|
|
379
440
|
*/
|
|
380
|
-
interface RefetchQueriesResult<TResult> extends Promise<RefetchQueriesPromiseResults<TResult>>, RefetchQueriesResult.AdditionalProperties<TResult> {
|
|
441
|
+
export interface RefetchQueriesResult<TResult> extends Promise<RefetchQueriesPromiseResults<TResult>>, RefetchQueriesResult.AdditionalProperties<TResult> {
|
|
381
442
|
}
|
|
382
|
-
namespace RefetchQueriesResult {
|
|
443
|
+
export namespace RefetchQueriesResult {
|
|
383
444
|
interface AdditionalProperties<TResult> {
|
|
384
445
|
/**
|
|
385
446
|
* An array of ObservableQuery objects corresponding 1:1 to TResult values
|
|
@@ -396,7 +457,7 @@ export declare namespace ApolloClient {
|
|
|
396
457
|
results: InternalRefetchQueriesResult<TResult>[];
|
|
397
458
|
}
|
|
398
459
|
}
|
|
399
|
-
type SubscribeOptions<TData = unknown, TVariables extends OperationVariables = OperationVariables> = {
|
|
460
|
+
export type SubscribeOptions<TData = unknown, TVariables extends OperationVariables = OperationVariables> = {
|
|
400
461
|
/**
|
|
401
462
|
* A GraphQL document, often created with `gql` from the `graphql-tag`
|
|
402
463
|
* package, that contains a single subscription inside of it.
|
|
@@ -419,7 +480,7 @@ export declare namespace ApolloClient {
|
|
|
419
480
|
*/
|
|
420
481
|
extensions?: Record<string, any>;
|
|
421
482
|
} & VariablesOption<NoInfer<TVariables>>;
|
|
422
|
-
interface SubscribeResult<TData = unknown> {
|
|
483
|
+
export interface SubscribeResult<TData = unknown> {
|
|
423
484
|
/**
|
|
424
485
|
* The data returned from your mutation. Can be `undefined` if the `errorPolicy`
|
|
425
486
|
* is `all` or `ignore` and the server returns a GraphQL response with `errors`
|
|
@@ -437,9 +498,9 @@ export declare namespace ApolloClient {
|
|
|
437
498
|
*/
|
|
438
499
|
extensions?: Record<string, unknown>;
|
|
439
500
|
}
|
|
440
|
-
type WatchFragmentOptions<TData = unknown, TVariables extends OperationVariables = OperationVariables> = ApolloCache.WatchFragmentOptions<TData, TVariables>;
|
|
441
|
-
type WatchFragmentResult<TData = unknown> = ApolloCache.WatchFragmentResult<MaybeMasked<TData>>;
|
|
442
|
-
interface ObservableFragment<TData = unknown> extends Observable<ApolloClient.WatchFragmentResult<TData>> {
|
|
501
|
+
export type WatchFragmentOptions<TData = unknown, TVariables extends OperationVariables = OperationVariables> = ApolloCache.WatchFragmentOptions<TData, TVariables>;
|
|
502
|
+
export type WatchFragmentResult<TData = unknown> = ApolloCache.WatchFragmentResult<MaybeMasked<TData>>;
|
|
503
|
+
export interface ObservableFragment<TData = unknown> extends Observable<ApolloClient.WatchFragmentResult<TData>> {
|
|
443
504
|
/**
|
|
444
505
|
* Return the current result for the fragment.
|
|
445
506
|
*/
|
|
@@ -448,7 +509,7 @@ export declare namespace ApolloClient {
|
|
|
448
509
|
/**
|
|
449
510
|
* Watched query options.
|
|
450
511
|
*/
|
|
451
|
-
type WatchQueryOptions<TData = unknown, TVariables extends OperationVariables = OperationVariables> = {
|
|
512
|
+
export type WatchQueryOptions<TData = unknown, TVariables extends OperationVariables = OperationVariables> = {
|
|
452
513
|
/**
|
|
453
514
|
* Specifies how the query interacts with the Apollo Client cache during execution (for example, whether it checks the cache for results before sending a request to the server).
|
|
454
515
|
*
|
|
@@ -580,8 +641,8 @@ export declare namespace ApolloClient {
|
|
|
580
641
|
optimistic?: boolean;
|
|
581
642
|
}
|
|
582
643
|
}
|
|
583
|
-
type ReadQueryOptions<TData, TVariables extends OperationVariables> = Base.ReadQueryOptions<TData, TVariables> & VariablesOption<TVariables>;
|
|
584
|
-
namespace DocumentationTypes {
|
|
644
|
+
export type ReadQueryOptions<TData, TVariables extends OperationVariables> = Base.ReadQueryOptions<TData, TVariables> & VariablesOption<TVariables>;
|
|
645
|
+
export namespace DocumentationTypes {
|
|
585
646
|
interface ReadQueryOptions<TData, TVariables extends OperationVariables> extends Base.ReadQueryOptions<TData, TVariables> {
|
|
586
647
|
/**
|
|
587
648
|
* Any variables that the GraphQL query may depend on.
|
|
@@ -619,7 +680,7 @@ export declare namespace ApolloClient {
|
|
|
619
680
|
optimistic?: boolean;
|
|
620
681
|
}
|
|
621
682
|
}
|
|
622
|
-
namespace DocumentationTypes {
|
|
683
|
+
export namespace DocumentationTypes {
|
|
623
684
|
interface ReadFragmentOptions<TData, TVariables extends OperationVariables> extends Base.ReadFragmentOptions<TData, TVariables> {
|
|
624
685
|
/**
|
|
625
686
|
* The root id to be used. This id should take the same form as the
|
|
@@ -639,8 +700,8 @@ export declare namespace ApolloClient {
|
|
|
639
700
|
from?: ApolloCache.FromOptionValue<TData>;
|
|
640
701
|
}
|
|
641
702
|
}
|
|
642
|
-
type ReadFragmentOptions<TData, TVariables extends OperationVariables> = Base.ReadFragmentOptions<TData, TVariables> & VariablesOption<TVariables> & Cache.CacheIdentifierOption<TData>;
|
|
643
|
-
namespace DocumentationTypes {
|
|
703
|
+
export type ReadFragmentOptions<TData, TVariables extends OperationVariables> = Base.ReadFragmentOptions<TData, TVariables> & VariablesOption<TVariables> & Cache.CacheIdentifierOption<TData>;
|
|
704
|
+
export namespace DocumentationTypes {
|
|
644
705
|
interface WriteQueryOptions<TData, TVariables extends OperationVariables> extends Base.WriteQueryOptions<TData, TVariables> {
|
|
645
706
|
/**
|
|
646
707
|
* Any variables that your GraphQL fragments depend on.
|
|
@@ -684,8 +745,8 @@ export declare namespace ApolloClient {
|
|
|
684
745
|
extensions?: Record<string, unknown>;
|
|
685
746
|
}
|
|
686
747
|
}
|
|
687
|
-
type WriteQueryOptions<TData, TVariables extends OperationVariables> = Base.WriteQueryOptions<TData, TVariables> & VariablesOption<TVariables>;
|
|
688
|
-
namespace DocumentationTypes {
|
|
748
|
+
export type WriteQueryOptions<TData, TVariables extends OperationVariables> = Base.WriteQueryOptions<TData, TVariables> & VariablesOption<TVariables>;
|
|
749
|
+
export namespace DocumentationTypes {
|
|
689
750
|
interface WriteQueryOptions<TData, TVariables extends OperationVariables> extends Base.WriteQueryOptions<TData, TVariables> {
|
|
690
751
|
/**
|
|
691
752
|
* Any variables that the GraphQL query may depend on.
|
|
@@ -726,8 +787,8 @@ export declare namespace ApolloClient {
|
|
|
726
787
|
overwrite?: boolean;
|
|
727
788
|
}
|
|
728
789
|
}
|
|
729
|
-
type WriteFragmentOptions<TData, TVariables extends OperationVariables> = Base.WriteFragmentOptions<TData, TVariables> & VariablesOption<TVariables> & Cache.CacheIdentifierOption<TData>;
|
|
730
|
-
namespace DocumentationTypes {
|
|
790
|
+
export type WriteFragmentOptions<TData, TVariables extends OperationVariables> = Base.WriteFragmentOptions<TData, TVariables> & VariablesOption<TVariables> & Cache.CacheIdentifierOption<TData>;
|
|
791
|
+
export namespace DocumentationTypes {
|
|
731
792
|
interface WriteFragmentOptions<TData, TVariables extends OperationVariables> extends Base.WriteFragmentOptions<TData, TVariables> {
|
|
732
793
|
/**
|
|
733
794
|
* The root id to be used. This id should take the same form as the
|
|
@@ -751,10 +812,22 @@ export declare namespace ApolloClient {
|
|
|
751
812
|
variables?: TVariables;
|
|
752
813
|
}
|
|
753
814
|
}
|
|
754
|
-
interface Experiment {
|
|
815
|
+
export interface Experiment {
|
|
755
816
|
(this: ApolloClient, options: ApolloClient.Options): void;
|
|
756
817
|
v: 1;
|
|
757
818
|
}
|
|
819
|
+
export namespace DocumentationTypes {
|
|
820
|
+
/**
|
|
821
|
+
* This resolves a single query according to the options specified and
|
|
822
|
+
* returns a `Promise` which is either resolved with the resulting data
|
|
823
|
+
* or rejected with an error.
|
|
824
|
+
*
|
|
825
|
+
* @param options - An object of type `QueryOptions` that allows us to
|
|
826
|
+
* describe how this query should be treated e.g. whether it should hit the
|
|
827
|
+
* server at all or just resolve from the cache, etc.
|
|
828
|
+
*/
|
|
829
|
+
function query<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.QueryOptions<TData, TVariables>): Promise<ApolloClient.QueryResult<MaybeMasked<TData>>>;
|
|
830
|
+
}
|
|
758
831
|
}
|
|
759
832
|
/**
|
|
760
833
|
* This is the primary Apollo Client class. It is used to send GraphQL documents (i.e. queries
|
|
@@ -856,30 +929,6 @@ export declare class ApolloClient {
|
|
|
856
929
|
* a description of store reactivity.
|
|
857
930
|
*/
|
|
858
931
|
watchQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.WatchQueryOptions<TData, TVariables>): ObservableQuery<TData, TVariables>;
|
|
859
|
-
/**
|
|
860
|
-
* This resolves a single query according to the options specified and
|
|
861
|
-
* returns a `Promise` which is either resolved with the resulting data
|
|
862
|
-
* or rejected with an error.
|
|
863
|
-
*
|
|
864
|
-
* @param options - An object of type `QueryOptions` that allows us to
|
|
865
|
-
* describe how this query should be treated e.g. whether it should hit the
|
|
866
|
-
* server at all or just resolve from the cache, etc.
|
|
867
|
-
*/
|
|
868
|
-
query<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.QueryOptions<TData, TVariables> & {
|
|
869
|
-
errorPolicy: "all";
|
|
870
|
-
}): Promise<ApolloClient.QueryResult<MaybeMasked<TData>, "all">>;
|
|
871
|
-
/**
|
|
872
|
-
* This resolves a single query according to the options specified and
|
|
873
|
-
* returns a `Promise` which is either resolved with the resulting data
|
|
874
|
-
* or rejected with an error.
|
|
875
|
-
*
|
|
876
|
-
* @param options - An object of type `QueryOptions` that allows us to
|
|
877
|
-
* describe how this query should be treated e.g. whether it should hit the
|
|
878
|
-
* server at all or just resolve from the cache, etc.
|
|
879
|
-
*/
|
|
880
|
-
query<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.QueryOptions<TData, TVariables> & {
|
|
881
|
-
errorPolicy: "ignore";
|
|
882
|
-
}): Promise<ApolloClient.QueryResult<MaybeMasked<TData>, "ignore">>;
|
|
883
932
|
/**
|
|
884
933
|
* This resolves a single query according to the options specified and
|
|
885
934
|
* returns a `Promise` which is either resolved with the resulting data
|
|
@@ -889,7 +938,7 @@ export declare class ApolloClient {
|
|
|
889
938
|
* describe how this query should be treated e.g. whether it should hit the
|
|
890
939
|
* server at all or just resolve from the cache, etc.
|
|
891
940
|
*/
|
|
892
|
-
query
|
|
941
|
+
query: ApolloClient.query.Signature;
|
|
893
942
|
/**
|
|
894
943
|
* This resolves a single mutation according to the options specified and returns a
|
|
895
944
|
* Promise which is either resolved with the resulting data or rejected with an
|