@apollo/client 4.2.0-alpha.2 → 4.2.0-alpha.4
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 +240 -0
- package/__cjs/cache/core/cache.cjs +1 -1
- package/__cjs/cache/inmemory/entityStore.cjs +3 -3
- package/__cjs/cache/inmemory/entityStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
- package/__cjs/cache/inmemory/policies.cjs +4 -4
- package/__cjs/cache/inmemory/readFromStore.cjs +2 -2
- package/__cjs/cache/inmemory/writeToStore.cjs +4 -4
- package/__cjs/core/ApolloClient.cjs +52 -20
- package/__cjs/core/ApolloClient.cjs.map +1 -1
- package/__cjs/core/ApolloClient.d.cts +159 -22
- package/__cjs/core/ObservableQuery.cjs +7 -7
- package/__cjs/core/ObservableQuery.cjs.map +1 -1
- package/__cjs/core/ObservableQuery.d.cts +20 -1
- package/__cjs/core/QueryManager.cjs +12 -12
- package/__cjs/core/QueryManager.cjs.map +1 -1
- package/__cjs/core/RefetchEventManager.cjs +134 -0
- package/__cjs/core/RefetchEventManager.cjs.map +1 -0
- package/__cjs/core/RefetchEventManager.d.cts +130 -0
- package/__cjs/core/index.cjs +7 -1
- package/__cjs/core/index.cjs.map +1 -1
- package/__cjs/core/index.d.cts +4 -1
- package/__cjs/core/refetchSources/onlineSource.cjs +10 -0
- package/__cjs/core/refetchSources/onlineSource.cjs.map +1 -0
- package/__cjs/core/refetchSources/onlineSource.d.cts +3 -0
- package/__cjs/core/refetchSources/windowFocusSource.cjs +13 -0
- package/__cjs/core/refetchSources/windowFocusSource.cjs.map +1 -0
- package/__cjs/core/refetchSources/windowFocusSource.d.cts +3 -0
- package/__cjs/core/types.d.cts +20 -0
- package/__cjs/invariantErrorCodes.cjs +69 -44
- package/__cjs/link/ws/index.cjs +9 -1
- package/__cjs/link/ws/index.cjs.map +1 -1
- package/__cjs/link/ws/index.d.cts +1 -1
- package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useBackgroundQuery.d.cts +1486 -66
- package/__cjs/react/hooks/useLazyQuery.cjs +1 -0
- package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useLazyQuery.d.cts +366 -40
- package/__cjs/react/hooks/useLoadableQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useLoadableQuery.d.cts +512 -50
- package/__cjs/react/hooks/useMutation.cjs +5 -48
- package/__cjs/react/hooks/useMutation.cjs.map +1 -1
- package/__cjs/react/hooks/useMutation.d.cts +239 -130
- package/__cjs/react/hooks/useQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useQuery.d.cts +590 -41
- package/__cjs/react/hooks/useSubscription.cjs +1 -1
- package/__cjs/react/hooks/useSubscription.cjs.map +1 -1
- package/__cjs/react/hooks/useSubscription.d.cts +2 -2
- package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useSuspenseQuery.d.cts +754 -46
- package/__cjs/react/internal/cache/QueryReference.cjs +1 -0
- package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
- package/__cjs/react/internal/cache/QueryReference.d.cts +1 -1
- package/__cjs/react/query-preloader/createQueryPreloader.cjs.map +1 -1
- package/__cjs/react/query-preloader/createQueryPreloader.d.cts +20 -1
- package/__cjs/react/types/types.documentation.d.cts +19 -0
- package/__cjs/version.cjs +1 -1
- package/cache/core/cache.js +1 -1
- package/cache/inmemory/entityStore.js +3 -3
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/key-extractor.js +1 -1
- package/cache/inmemory/policies.js +4 -4
- package/cache/inmemory/readFromStore.js +2 -2
- package/cache/inmemory/writeToStore.js +4 -4
- package/core/ApolloClient.d.ts +159 -22
- package/core/ApolloClient.js +53 -21
- package/core/ApolloClient.js.map +1 -1
- package/core/ObservableQuery.d.ts +20 -1
- package/core/ObservableQuery.js +7 -7
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryManager.js +12 -12
- package/core/QueryManager.js.map +1 -1
- package/core/RefetchEventManager.d.ts +130 -0
- package/core/RefetchEventManager.js +126 -0
- package/core/RefetchEventManager.js.map +1 -0
- package/core/index.d.ts +4 -1
- package/core/index.js +3 -0
- package/core/index.js.map +1 -1
- package/core/refetchSources/onlineSource.d.ts +3 -0
- package/core/refetchSources/onlineSource.js +6 -0
- package/core/refetchSources/onlineSource.js.map +1 -0
- package/core/refetchSources/windowFocusSource.d.ts +3 -0
- package/core/refetchSources/windowFocusSource.js +9 -0
- package/core/refetchSources/windowFocusSource.js.map +1 -0
- package/core/types.d.ts +20 -0
- package/core/types.js.map +1 -1
- package/invariantErrorCodes.js +69 -44
- package/link/ws/index.d.ts +1 -1
- package/link/ws/index.js +9 -1
- package/link/ws/index.js.map +1 -1
- package/package.json +3 -7
- package/react/hooks/useBackgroundQuery.d.ts +1486 -66
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useLazyQuery.d.ts +366 -40
- package/react/hooks/useLazyQuery.js +1 -0
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useLoadableQuery.d.ts +512 -50
- package/react/hooks/useLoadableQuery.js.map +1 -1
- package/react/hooks/useMutation.d.ts +239 -130
- package/react/hooks/useMutation.js +5 -48
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.d.ts +590 -41
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useSubscription.d.ts +2 -2
- package/react/hooks/useSubscription.js +1 -1
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseQuery.d.ts +754 -46
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/hooks-compiled/useBackgroundQuery.d.ts +1486 -66
- package/react/hooks-compiled/useBackgroundQuery.js.map +1 -1
- package/react/hooks-compiled/useLazyQuery.d.ts +366 -40
- package/react/hooks-compiled/useLazyQuery.js +1 -0
- package/react/hooks-compiled/useLazyQuery.js.map +1 -1
- package/react/hooks-compiled/useLoadableQuery.d.ts +512 -50
- package/react/hooks-compiled/useLoadableQuery.js.map +1 -1
- package/react/hooks-compiled/useMutation.d.ts +239 -130
- package/react/hooks-compiled/useMutation.js +4 -47
- package/react/hooks-compiled/useMutation.js.map +1 -1
- package/react/hooks-compiled/useQuery.d.ts +590 -41
- package/react/hooks-compiled/useQuery.js.map +1 -1
- package/react/hooks-compiled/useSubscription.d.ts +2 -2
- package/react/hooks-compiled/useSubscription.js +1 -1
- package/react/hooks-compiled/useSubscription.js.map +1 -1
- package/react/hooks-compiled/useSuspenseQuery.d.ts +754 -46
- package/react/hooks-compiled/useSuspenseQuery.js.map +1 -1
- package/react/internal/cache/QueryReference.d.ts +1 -1
- package/react/internal/cache/QueryReference.js +1 -0
- package/react/internal/cache/QueryReference.js.map +1 -1
- package/react/query-preloader/createQueryPreloader.d.ts +20 -1
- package/react/query-preloader/createQueryPreloader.js.map +1 -1
- package/react/types/types.documentation.d.ts +19 -0
- package/react/types/types.documentation.js.map +1 -1
- package/skills/apollo-client/SKILL.md +168 -0
- package/skills/apollo-client/references/caching.md +560 -0
- package/skills/apollo-client/references/error-handling.md +350 -0
- package/skills/apollo-client/references/fragments.md +804 -0
- package/skills/apollo-client/references/integration-client.md +336 -0
- package/skills/apollo-client/references/integration-nextjs.md +325 -0
- package/skills/apollo-client/references/integration-react-router.md +256 -0
- package/skills/apollo-client/references/integration-tanstack-start.md +378 -0
- package/skills/apollo-client/references/mutations.md +549 -0
- package/skills/apollo-client/references/queries.md +416 -0
- package/skills/apollo-client/references/state-management.md +428 -0
- package/skills/apollo-client/references/suspense-hooks.md +773 -0
- package/skills/apollo-client/references/troubleshooting.md +487 -0
- package/skills/apollo-client/references/typescript-codegen.md +133 -0
- package/version.js +1 -1
|
@@ -12,7 +12,8 @@ import type { LazyType, OptionWithFallback, SignatureStyle, VariablesOption, var
|
|
|
12
12
|
import { getApolloClientMemoryInternals } from "@apollo/client/utilities/internal";
|
|
13
13
|
import type { DeclareDefaultOptions, DefaultOptions } from "./defaultOptions.cjs";
|
|
14
14
|
import type { ObservableQuery } from "./ObservableQuery.cjs";
|
|
15
|
-
import type {
|
|
15
|
+
import type { RefetchEventManager } from "./RefetchEventManager.cjs";
|
|
16
|
+
import type { DefaultContext, ErrorLike, InternalRefetchQueriesInclude, InternalRefetchQueriesResult, MutationQueryReducersMap, MutationUpdaterFunction, NormalizedExecutionResult, OnQueryUpdated, OperationVariables, RefetchOn, RefetchQueriesInclude, RefetchQueriesPromiseResults, SubscriptionObservable, TypedDocumentNode } from "./types.cjs";
|
|
16
17
|
import type { ErrorPolicy, FetchPolicy, MutationFetchPolicy, NextFetchPolicyContext, RefetchWritePolicy, WatchQueryFetchPolicy } from "./watchQueryOptions.cjs";
|
|
17
18
|
/**
|
|
18
19
|
* @knipignore
|
|
@@ -28,6 +29,13 @@ export interface ReferenceToAvoidDroppingImportOnBuild {
|
|
|
28
29
|
}
|
|
29
30
|
export declare namespace ApolloClient {
|
|
30
31
|
export type { DeclareDefaultOptions, DefaultOptions };
|
|
32
|
+
export namespace DocumentationTypes {
|
|
33
|
+
interface DefaultOptions {
|
|
34
|
+
watchQuery?: Partial<ApolloClient.WatchQueryOptions<any, any>>;
|
|
35
|
+
query?: Partial<ApolloClient.QueryOptions<any, any>>;
|
|
36
|
+
mutate?: Partial<ApolloClient.MutateOptions<any, any, any>>;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
31
39
|
export interface Options extends InternalTypes.DefaultOptionsParentObject {
|
|
32
40
|
/**
|
|
33
41
|
* 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/).
|
|
@@ -99,6 +107,11 @@ export declare namespace ApolloClient {
|
|
|
99
107
|
* Do not pass in experiments that are not provided by Apollo.
|
|
100
108
|
*/
|
|
101
109
|
experiments?: ApolloClient.Experiment[];
|
|
110
|
+
/**
|
|
111
|
+
* The `RefetchEventManager` instance that manages automatic refetches for
|
|
112
|
+
* the client.
|
|
113
|
+
*/
|
|
114
|
+
refetchEventManager?: RefetchEventManager;
|
|
102
115
|
}
|
|
103
116
|
export interface DevtoolsOptions {
|
|
104
117
|
/**
|
|
@@ -216,24 +229,118 @@ export declare namespace ApolloClient {
|
|
|
216
229
|
*/
|
|
217
230
|
mutation: DocumentNode | TypedDocumentNode<TData, TVariables>;
|
|
218
231
|
} & VariablesOption<NoInfer<TVariables>>;
|
|
219
|
-
export
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
232
|
+
export namespace mutate {
|
|
233
|
+
interface DefaultOptions extends ApolloClient.DefaultOptions.Mutate.Calculated {
|
|
234
|
+
}
|
|
235
|
+
type ResultForOptions<TData, TVariables extends OperationVariables, TCache extends ApolloCache, TOptions extends Record<string, unknown> | MutateOptions<any, TVariables, TCache>> = LazyType<MutateResult<MaybeMasked<TData>, OptionWithFallback<TOptions, DefaultOptions, "errorPolicy"> & ErrorPolicy>>;
|
|
236
|
+
namespace Signatures {
|
|
237
|
+
interface Classic {
|
|
238
|
+
/**
|
|
239
|
+
* @deprecated Avoid manually specifying generics on `client.mutate`.
|
|
240
|
+
* Instead, rely on TypeScript's type inference along with a correctly typed `TypedDocumentNode` to get accurate types for your mutation results.
|
|
241
|
+
*
|
|
242
|
+
*
|
|
243
|
+
* This resolves a single mutation according to the options specified and returns a
|
|
244
|
+
* Promise which is either resolved with the resulting data or rejected with an
|
|
245
|
+
* error. In some cases both `data` and `errors` might be undefined, for example
|
|
246
|
+
* when `errorPolicy` is set to `'ignore'`.
|
|
247
|
+
*
|
|
248
|
+
* It takes options as an object with the following keys and values:
|
|
249
|
+
*/
|
|
250
|
+
<TData = unknown, TVariables extends OperationVariables = OperationVariables, TCache extends ApolloCache = ApolloCache>(options: ApolloClient.MutateOptions<TData, TVariables, TCache>): Promise<ApolloClient.MutateResult<MaybeMasked<TData>>>;
|
|
251
|
+
}
|
|
252
|
+
interface Modern {
|
|
253
|
+
/**
|
|
254
|
+
* This resolves a single mutation according to the options specified and returns a
|
|
255
|
+
* Promise which is either resolved with the resulting data or rejected with an
|
|
256
|
+
* error. In some cases both `data` and `errors` might be undefined, for example
|
|
257
|
+
* when `errorPolicy` is set to `'ignore'`.
|
|
258
|
+
*
|
|
259
|
+
* It takes options as an object with the following keys and values:
|
|
260
|
+
*/
|
|
261
|
+
<TData, TVariables extends OperationVariables, TCache extends ApolloCache, TOptions extends ApolloClient.MutateOptions<NoInfer<TData>, NoInfer<TVariables>, TCache> & VariablesOption<TVariables & {
|
|
262
|
+
[K in Exclude<keyof TOptions["variables"], keyof TVariables>]?: never;
|
|
263
|
+
}>>(options: TOptions & {
|
|
264
|
+
mutation: TypedDocumentNode<TData, TVariables>;
|
|
265
|
+
}): Promise<ApolloClient.mutate.ResultForOptions<TData, TVariables, TCache, TOptions>>;
|
|
266
|
+
}
|
|
267
|
+
type Evaluated = SignatureStyle extends "classic" ? Classic : Modern;
|
|
268
|
+
}
|
|
226
269
|
/**
|
|
227
|
-
*
|
|
270
|
+
* This resolves a single mutation according to the options specified and returns a
|
|
271
|
+
* Promise which is either resolved with the resulting data or rejected with an
|
|
272
|
+
* error. In some cases both `data` and `errors` might be undefined, for example
|
|
273
|
+
* when `errorPolicy` is set to `'ignore'`.
|
|
228
274
|
*
|
|
229
|
-
*
|
|
275
|
+
* It takes options as an object with the following keys and values:
|
|
230
276
|
*/
|
|
231
|
-
|
|
277
|
+
interface Signature extends Signatures.Evaluated {
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
export type MutateResultMap<TData = unknown> = {
|
|
281
|
+
none: {
|
|
282
|
+
/**
|
|
283
|
+
* The data returned from your mutation. Can be `undefined` if the `errorPolicy`
|
|
284
|
+
* is `all` or `ignore` and the server returns a GraphQL response with `errors`
|
|
285
|
+
* but not `data` or a network error is returned.
|
|
286
|
+
*/
|
|
287
|
+
data: TData;
|
|
288
|
+
/**
|
|
289
|
+
* If the mutation produces one or more errors, this object contains either an array of `graphQLErrors` or a single `networkError`. Otherwise, this value is `undefined`.
|
|
290
|
+
*
|
|
291
|
+
* For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).
|
|
292
|
+
*/
|
|
293
|
+
error?: never;
|
|
294
|
+
};
|
|
295
|
+
all: {
|
|
296
|
+
/**
|
|
297
|
+
* The data returned from your mutation. Can be `undefined` if the `errorPolicy`
|
|
298
|
+
* is `all` or `ignore` and the server returns a GraphQL response with `errors`
|
|
299
|
+
* but not `data` or a network error is returned.
|
|
300
|
+
*/
|
|
301
|
+
data: TData | undefined;
|
|
302
|
+
/**
|
|
303
|
+
* If the mutation produces one or more errors, this object contains either an array of `graphQLErrors` or a single `networkError`. Otherwise, this value is `undefined`.
|
|
304
|
+
*
|
|
305
|
+
* For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).
|
|
306
|
+
*/
|
|
307
|
+
error?: ErrorLike;
|
|
308
|
+
};
|
|
309
|
+
ignore: {
|
|
310
|
+
/**
|
|
311
|
+
* The data returned from your mutation. Can be `undefined` if the `errorPolicy`
|
|
312
|
+
* is `all` or `ignore` and the server returns a GraphQL response with `errors`
|
|
313
|
+
* but not `data` or a network error is returned.
|
|
314
|
+
*/
|
|
315
|
+
data: TData | undefined;
|
|
316
|
+
/**
|
|
317
|
+
* If the mutation produces one or more errors, this object contains either an array of `graphQLErrors` or a single `networkError`. Otherwise, this value is `undefined`.
|
|
318
|
+
*
|
|
319
|
+
* For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).
|
|
320
|
+
*/
|
|
321
|
+
error?: never;
|
|
322
|
+
};
|
|
323
|
+
undefined: {
|
|
324
|
+
/**
|
|
325
|
+
* The data returned from your mutation. Can be `undefined` if the `errorPolicy`
|
|
326
|
+
* is `all` or `ignore` and the server returns a GraphQL response with `errors`
|
|
327
|
+
* but not `data` or a network error is returned.
|
|
328
|
+
*/
|
|
329
|
+
data: TData | undefined;
|
|
330
|
+
/**
|
|
331
|
+
* If the mutation produces one or more errors, this object contains either an array of `graphQLErrors` or a single `networkError`. Otherwise, this value is `undefined`.
|
|
332
|
+
*
|
|
333
|
+
* For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).
|
|
334
|
+
*/
|
|
335
|
+
error?: ErrorLike;
|
|
336
|
+
};
|
|
337
|
+
};
|
|
338
|
+
export type MutateResult<TData = unknown, TErrorPolicy extends ErrorPolicy | undefined = undefined> = MutateResultMap<TData>[`${TErrorPolicy}`] & {
|
|
232
339
|
/**
|
|
233
340
|
* Custom extensions returned from the GraphQL server
|
|
234
341
|
*/
|
|
235
342
|
extensions?: Record<string, unknown>;
|
|
236
|
-
}
|
|
343
|
+
};
|
|
237
344
|
/**
|
|
238
345
|
* Query options.
|
|
239
346
|
*/
|
|
@@ -271,7 +378,7 @@ export declare namespace ApolloClient {
|
|
|
271
378
|
*/
|
|
272
379
|
fetchPolicy?: FetchPolicy;
|
|
273
380
|
} & VariablesOption<NoInfer<TVariables>>;
|
|
274
|
-
export type QueryResultMap<TData = unknown
|
|
381
|
+
export type QueryResultMap<TData = unknown> = {
|
|
275
382
|
none: {
|
|
276
383
|
/**
|
|
277
384
|
* An object containing the result of your GraphQL query after it completes.
|
|
@@ -349,7 +456,7 @@ export declare namespace ApolloClient {
|
|
|
349
456
|
error?: ErrorLike;
|
|
350
457
|
};
|
|
351
458
|
};
|
|
352
|
-
export type QueryResult<TData = unknown, TErrorPolicy extends ErrorPolicy | undefined = undefined> = QueryResultMap<TData
|
|
459
|
+
export type QueryResult<TData = unknown, TErrorPolicy extends ErrorPolicy | undefined = undefined> = QueryResultMap<TData>[`${TErrorPolicy}`];
|
|
353
460
|
export namespace query {
|
|
354
461
|
interface DefaultOptions extends ApolloClient.DefaultOptions.Query.Calculated {
|
|
355
462
|
}
|
|
@@ -598,6 +705,25 @@ export declare namespace ApolloClient {
|
|
|
598
705
|
*/
|
|
599
706
|
query: DocumentNode | TypedDocumentNode<TData, TVariables>;
|
|
600
707
|
/**
|
|
708
|
+
* Determines whether events trigger refetches for the query. Provide an
|
|
709
|
+
* object mapping each refetch event to `true` (enable), `false` (disable)
|
|
710
|
+
* or a callback function that returns `true`/`false` to control individual
|
|
711
|
+
* events. Provide `false` to disable all automatic refetch events for this
|
|
712
|
+
* query. Provide `true` to enable all automatic refetch events for this query.
|
|
713
|
+
* Provide a callback function to perform additional logic to determine
|
|
714
|
+
* whether to enable or disable a refetch for a query.
|
|
715
|
+
*
|
|
716
|
+
* `@remarks`
|
|
717
|
+
* `refetchOn` inherits from `defaultOptions.watchQuery.refetchOn`. If
|
|
718
|
+
* `defaultOptions.watchQuery.refetchOn` is not set, all refetch events are
|
|
719
|
+
* enabled by default.
|
|
720
|
+
*
|
|
721
|
+
* This option only has an effect when the client is configured with a
|
|
722
|
+
* `refetchEventManager`.
|
|
723
|
+
* @docGroup 1. Operation options
|
|
724
|
+
*/
|
|
725
|
+
refetchOn?: RefetchOn.Option;
|
|
726
|
+
/**
|
|
601
727
|
* @internal This API is meant for framework integrations only.
|
|
602
728
|
* Do not use for everyday use.
|
|
603
729
|
*
|
|
@@ -827,6 +953,15 @@ export declare namespace ApolloClient {
|
|
|
827
953
|
* server at all or just resolve from the cache, etc.
|
|
828
954
|
*/
|
|
829
955
|
function query<TData = unknown, TVariables extends OperationVariables = OperationVariables>(options: ApolloClient.QueryOptions<TData, TVariables>): Promise<ApolloClient.QueryResult<MaybeMasked<TData>>>;
|
|
956
|
+
/**
|
|
957
|
+
* This resolves a single mutation according to the options specified and returns a
|
|
958
|
+
* Promise which is either resolved with the resulting data or rejected with an
|
|
959
|
+
* error. In some cases both `data` and `errors` might be undefined, for example
|
|
960
|
+
* when `errorPolicy` is set to `'ignore'`.
|
|
961
|
+
*
|
|
962
|
+
* It takes options as an object with the following keys and values:
|
|
963
|
+
*/
|
|
964
|
+
function mutate<TData = unknown, TVariables extends OperationVariables = OperationVariables, TCache extends ApolloCache = ApolloCache>(options: ApolloClient.MutateOptions<TData, TVariables, TCache>): Promise<ApolloClient.MutateResult<MaybeMasked<TData>>>;
|
|
830
965
|
}
|
|
831
966
|
}
|
|
832
967
|
/**
|
|
@@ -855,6 +990,7 @@ export declare class ApolloClient {
|
|
|
855
990
|
queryDeduplication: boolean;
|
|
856
991
|
defaultOptions: ApolloClient.DefaultOptions;
|
|
857
992
|
readonly devtoolsConfig: ApolloClient.DevtoolsOptions;
|
|
993
|
+
readonly refetchEventManager: RefetchEventManager | undefined;
|
|
858
994
|
private queryManager;
|
|
859
995
|
private devToolsHookCb?;
|
|
860
996
|
private resetStoreCallbacks;
|
|
@@ -907,6 +1043,7 @@ export declare class ApolloClient {
|
|
|
907
1043
|
* - Unsubscribes all active `ObservableQuery` instances by emitting a `completed` event
|
|
908
1044
|
* - Rejects all currently running queries with "QueryManager stopped while query was in flight"
|
|
909
1045
|
* - Removes all queryRefs from the suspense cache
|
|
1046
|
+
* - Disconnects the `RefetchEventManager` if configured.
|
|
910
1047
|
*/
|
|
911
1048
|
stop(): void;
|
|
912
1049
|
/**
|
|
@@ -940,14 +1077,14 @@ export declare class ApolloClient {
|
|
|
940
1077
|
*/
|
|
941
1078
|
query: ApolloClient.query.Signature;
|
|
942
1079
|
/**
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
mutate
|
|
1080
|
+
* This resolves a single mutation according to the options specified and returns a
|
|
1081
|
+
* Promise which is either resolved with the resulting data or rejected with an
|
|
1082
|
+
* error. In some cases both `data` and `errors` might be undefined, for example
|
|
1083
|
+
* when `errorPolicy` is set to `'ignore'`.
|
|
1084
|
+
*
|
|
1085
|
+
* It takes options as an object with the following keys and values:
|
|
1086
|
+
*/
|
|
1087
|
+
mutate: ApolloClient.mutate.Signature;
|
|
951
1088
|
/**
|
|
952
1089
|
* This subscribes to a graphql subscription according to the options specified and returns an
|
|
953
1090
|
* `Observable` which either emits received data or an error.
|
|
@@ -84,7 +84,7 @@ class ObservableQuery {
|
|
|
84
84
|
// Make sure we don't store "standby" as the initialFetchPolicy.
|
|
85
85
|
initialFetchPolicy = fetchPolicy === "standby" ? defaultFetchPolicy : (fetchPolicy), } = options;
|
|
86
86
|
if (options[internal_1.variablesUnknownSymbol]) {
|
|
87
|
-
(0, invariant_1.invariant)(fetchPolicy === "standby",
|
|
87
|
+
(0, invariant_1.invariant)(fetchPolicy === "standby", 82);
|
|
88
88
|
this.variablesUnknown = true;
|
|
89
89
|
}
|
|
90
90
|
this.lastQuery = transformedQuery;
|
|
@@ -390,7 +390,7 @@ class ObservableQuery {
|
|
|
390
390
|
const queryDef = (0, internal_1.getQueryDefinition)(this.query);
|
|
391
391
|
const vars = queryDef.variableDefinitions;
|
|
392
392
|
if (!vars || !vars.some((v) => v.variable.name.value === "variables")) {
|
|
393
|
-
__DEV__ && invariant_1.invariant.warn(
|
|
393
|
+
__DEV__ && invariant_1.invariant.warn(83, variables, queryDef.name?.value || queryDef);
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
396
|
if (variables && !(0, equality_1.equal)(this.variables, variables)) {
|
|
@@ -406,7 +406,7 @@ class ObservableQuery {
|
|
|
406
406
|
fetchMore({ query, variables, context, errorPolicy, updateQuery, }) {
|
|
407
407
|
(0, invariant_1.invariant)(
|
|
408
408
|
this.options.fetchPolicy !== "cache-only",
|
|
409
|
-
|
|
409
|
+
84,
|
|
410
410
|
(0, internal_1.getOperationName)(this.query, "(anonymous)")
|
|
411
411
|
);
|
|
412
412
|
const combinedOptions = {
|
|
@@ -440,7 +440,7 @@ class ObservableQuery {
|
|
|
440
440
|
let wasUpdated = false;
|
|
441
441
|
const isCached = this.options.fetchPolicy !== "no-cache";
|
|
442
442
|
if (!isCached) {
|
|
443
|
-
(0, invariant_1.invariant)(updateQuery,
|
|
443
|
+
(0, invariant_1.invariant)(updateQuery, 85);
|
|
444
444
|
}
|
|
445
445
|
const { finalize, pushNotification } = this.pushOperation(networkStatus_js_1.NetworkStatus.fetchMore);
|
|
446
446
|
pushNotification({
|
|
@@ -616,7 +616,7 @@ class ObservableQuery {
|
|
|
616
616
|
onError(error);
|
|
617
617
|
}
|
|
618
618
|
else {
|
|
619
|
-
invariant_1.invariant.error(
|
|
619
|
+
invariant_1.invariant.error(86, error);
|
|
620
620
|
}
|
|
621
621
|
return;
|
|
622
622
|
}
|
|
@@ -867,7 +867,7 @@ class ObservableQuery {
|
|
|
867
867
|
if (!this.didWarnCacheOnlyPolling &&
|
|
868
868
|
pollInterval &&
|
|
869
869
|
fetchPolicy === "cache-only") {
|
|
870
|
-
__DEV__ && invariant_1.invariant.warn(
|
|
870
|
+
__DEV__ && invariant_1.invariant.warn(87, (0, internal_1.getOperationName)(this.query, "(anonymous)"));
|
|
871
871
|
this.didWarnCacheOnlyPolling = true;
|
|
872
872
|
}
|
|
873
873
|
}
|
|
@@ -1367,7 +1367,7 @@ class ObservableQuery {
|
|
|
1367
1367
|
exports.ObservableQuery = ObservableQuery;
|
|
1368
1368
|
function logMissingFieldErrors(missing) {
|
|
1369
1369
|
if (environment_1.__DEV__ && missing) {
|
|
1370
|
-
__DEV__ && invariant_1.invariant.debug(
|
|
1370
|
+
__DEV__ && invariant_1.invariant.debug(88, missing);
|
|
1371
1371
|
}
|
|
1372
1372
|
}
|
|
1373
1373
|
function isEqualQuery(a, b) {
|