@apollo/client 4.0.0-alpha.10 → 4.0.0-alpha.12
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/.changeset/afraid-grapes-call.md +5 -0
- package/.changeset/brave-moons-juggle.md +5 -0
- package/.changeset/gentle-waves-cough.md +5 -0
- package/.changeset/lucky-sheep-explain.md +34 -0
- package/.changeset/orange-suits-laugh.md +5 -0
- package/.changeset/perfect-ducks-reflect.md +12 -0
- package/.changeset/pre.json +12 -0
- package/.changeset/seven-schools-carry.md +5 -0
- package/.changeset/short-tomatoes-attend.md +5 -0
- package/.changeset/silly-seas-confess.md +5 -0
- package/.changeset/small-poems-rest.md +5 -0
- package/.changeset/sour-kids-deliver.md +5 -0
- package/.changeset/witty-paws-marry.md +26 -0
- package/CHANGELOG.md +96 -0
- package/__cjs/cache/core/cache.cjs +1 -1
- package/__cjs/cache/inmemory/entityStore.cjs +3 -3
- 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 +17 -25
- package/__cjs/core/ApolloClient.cjs.map +1 -1
- package/__cjs/core/ApolloClient.d.cts +4 -21
- package/__cjs/core/LocalState.cjs +2 -3
- package/__cjs/core/LocalState.cjs.map +1 -1
- package/__cjs/core/LocalState.d.cts +1 -2
- package/__cjs/core/ObservableQuery.cjs +11 -11
- package/__cjs/core/ObservableQuery.cjs.map +1 -1
- package/__cjs/core/QueryInfo.cjs.map +1 -1
- package/__cjs/core/QueryInfo.d.cts +1 -1
- package/__cjs/core/QueryManager.cjs +34 -33
- package/__cjs/core/QueryManager.cjs.map +1 -1
- package/__cjs/core/QueryManager.d.cts +16 -18
- package/__cjs/core/index.cjs +7 -7
- package/__cjs/core/index.cjs.map +1 -1
- package/__cjs/core/index.d.cts +4 -4
- package/__cjs/core/types.d.cts +8 -3
- package/__cjs/core/watchQueryOptions.d.cts +4 -4
- package/__cjs/errors/index.cjs.map +1 -1
- package/__cjs/errors/index.d.cts +1 -1
- package/__cjs/invariantErrorCodes.cjs +47 -37
- package/__cjs/link/batch/batchLink.cjs +2 -2
- package/__cjs/link/batch/batchLink.cjs.map +1 -1
- package/__cjs/link/batch/batchLink.d.cts +2 -2
- package/__cjs/link/batch/batching.cjs.map +1 -1
- package/__cjs/link/batch/batching.d.cts +1 -1
- package/__cjs/link/batch-http/batchHttpLink.cjs +2 -2
- package/__cjs/link/batch-http/batchHttpLink.cjs.map +1 -1
- package/__cjs/link/batch-http/batchHttpLink.d.cts +5 -4
- package/__cjs/link/context/index.cjs +2 -2
- package/__cjs/link/context/index.cjs.map +1 -1
- package/__cjs/link/context/index.d.cts +3 -4
- package/__cjs/link/core/ApolloLink.cjs +2 -2
- package/__cjs/link/core/ApolloLink.cjs.map +1 -1
- package/__cjs/link/core/ApolloLink.d.cts +2 -2
- package/__cjs/link/core/types.d.cts +19 -8
- package/__cjs/link/error/index.cjs +3 -3
- package/__cjs/link/error/index.cjs.map +1 -1
- package/__cjs/link/error/index.d.cts +2 -2
- package/__cjs/link/http/HttpLink.cjs +2 -2
- package/__cjs/link/http/HttpLink.cjs.map +1 -1
- package/__cjs/link/http/HttpLink.d.cts +129 -4
- package/__cjs/link/http/createHttpLink.cjs +2 -2
- package/__cjs/link/http/createHttpLink.cjs.map +1 -1
- package/__cjs/link/http/createHttpLink.d.cts +3 -3
- package/__cjs/link/http/index.cjs.map +1 -1
- package/__cjs/link/http/index.d.cts +0 -1
- package/__cjs/link/http/parseAndCheckHttpResponse.cjs.map +1 -1
- package/__cjs/link/http/parseAndCheckHttpResponse.d.cts +1 -1
- package/__cjs/link/http/rewriteURIForGET.cjs.map +1 -1
- package/__cjs/link/http/rewriteURIForGET.d.cts +2 -2
- package/__cjs/link/http/selectHttpOptionsAndBody.cjs.map +1 -1
- package/__cjs/link/http/selectHttpOptionsAndBody.d.cts +8 -83
- package/__cjs/link/http/selectURI.cjs.map +1 -1
- package/__cjs/link/http/selectURI.d.cts +1 -1
- package/__cjs/link/{core/index.cjs → index.cjs} +6 -6
- package/__cjs/link/index.cjs.map +1 -0
- package/__cjs/link/index.d.cts +8 -0
- package/__cjs/link/persisted-queries/index.cjs +2 -2
- package/__cjs/link/persisted-queries/index.cjs.map +1 -1
- package/__cjs/link/persisted-queries/index.d.cts +2 -2
- package/__cjs/link/remove-typename/removeTypenameFromVariables.cjs +2 -2
- package/__cjs/link/remove-typename/removeTypenameFromVariables.cjs.map +1 -1
- package/__cjs/link/remove-typename/removeTypenameFromVariables.d.cts +1 -1
- package/__cjs/link/retry/delayFunction.cjs.map +1 -1
- package/__cjs/link/retry/delayFunction.d.cts +1 -1
- package/__cjs/link/retry/retryFunction.cjs.map +1 -1
- package/__cjs/link/retry/retryFunction.d.cts +1 -1
- package/__cjs/link/retry/retryLink.cjs +2 -2
- package/__cjs/link/retry/retryLink.cjs.map +1 -1
- package/__cjs/link/retry/retryLink.d.cts +2 -2
- package/__cjs/link/schema/index.cjs +2 -2
- package/__cjs/link/schema/index.cjs.map +1 -1
- package/__cjs/link/schema/index.d.cts +2 -2
- package/__cjs/link/subscriptions/index.cjs +2 -2
- package/__cjs/link/subscriptions/index.cjs.map +1 -1
- package/__cjs/link/subscriptions/index.d.cts +2 -2
- package/__cjs/link/utils/createOperation.cjs +5 -1
- package/__cjs/link/utils/createOperation.cjs.map +1 -1
- package/__cjs/link/utils/createOperation.d.cts +2 -2
- package/__cjs/link/utils/transformOperation.cjs.map +1 -1
- package/__cjs/link/utils/transformOperation.d.cts +1 -1
- package/__cjs/link/utils/validateOperation.cjs.map +1 -1
- package/__cjs/link/utils/validateOperation.d.cts +1 -1
- package/__cjs/link/ws/index.cjs +2 -2
- package/__cjs/link/ws/index.cjs.map +1 -1
- package/__cjs/link/ws/index.d.cts +2 -2
- package/__cjs/react/hooks/useMutation.cjs.map +1 -1
- package/__cjs/react/hooks/useMutation.d.cts +45 -12
- package/__cjs/react/index.cjs +3 -1
- package/__cjs/react/index.cjs.map +1 -1
- package/__cjs/react/index.d.cts +1 -0
- package/__cjs/react/types/deprecated.d.cts +3 -3
- package/__cjs/testing/core/mocking/mockLink.cjs +2 -2
- package/__cjs/testing/core/mocking/mockLink.cjs.map +1 -1
- package/__cjs/testing/core/mocking/mockLink.d.cts +2 -2
- package/__cjs/testing/core/mocking/mockSubscriptionLink.cjs +2 -2
- package/__cjs/testing/core/mocking/mockSubscriptionLink.cjs.map +1 -1
- package/__cjs/testing/core/mocking/mockSubscriptionLink.d.cts +2 -2
- package/__cjs/testing/internal/index.cjs +4 -1
- package/__cjs/testing/internal/index.cjs.map +1 -1
- package/__cjs/testing/internal/index.d.cts +1 -0
- package/__cjs/testing/internal/link.cjs +22 -0
- package/__cjs/testing/internal/link.cjs.map +1 -0
- package/__cjs/testing/internal/link.d.cts +6 -0
- package/__cjs/testing/matchers/isSameClient.cjs +19 -0
- package/__cjs/testing/matchers/isSameClient.cjs.map +1 -0
- package/__cjs/testing/matchers/isSameClient.d.cts +3 -0
- package/__cjs/testing/matchers/isSameObservableQuery.cjs +19 -0
- package/__cjs/testing/matchers/isSameObservableQuery.cjs.map +1 -0
- package/__cjs/testing/matchers/isSameObservableQuery.d.cts +3 -0
- package/__cjs/testing/matchers/toStrictEqualTyped.cjs +9 -3
- package/__cjs/testing/matchers/toStrictEqualTyped.cjs.map +1 -1
- package/__cjs/testing/matchers/toStrictEqualTyped.d.cts +6 -1
- package/__cjs/testing/matchers/utils/getSerializableProperties.cjs +3 -2
- package/__cjs/testing/matchers/utils/getSerializableProperties.cjs.map +1 -1
- package/__cjs/testing/matchers/utils/getSerializableProperties.d.cts +3 -1
- package/__cjs/testing/react/MockedProvider.cjs.map +1 -1
- package/__cjs/testing/react/MockedProvider.d.cts +1 -1
- package/__cjs/utilities/common/errorHandling.cjs.map +1 -1
- package/__cjs/utilities/common/errorHandling.d.cts +1 -1
- package/__cjs/utilities/common/incrementalResult.cjs.map +1 -1
- package/__cjs/utilities/common/incrementalResult.d.cts +1 -1
- package/__cjs/utilities/common/mergeOptions.cjs.map +1 -1
- package/__cjs/utilities/common/mergeOptions.d.cts +2 -2
- package/__cjs/utilities/subscriptions/relay/index.cjs.map +1 -1
- package/__cjs/version.cjs +1 -1
- package/cache/core/cache.js +1 -1
- package/cache/inmemory/entityStore.js +3 -3
- 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 +4 -21
- package/core/ApolloClient.js +18 -26
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.d.ts +1 -2
- package/core/LocalState.js +2 -3
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.js +11 -11
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +1 -1
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +16 -18
- package/core/QueryManager.js +34 -33
- package/core/QueryManager.js.map +1 -1
- package/core/index.d.ts +4 -4
- package/core/index.js +1 -1
- package/core/index.js.map +1 -1
- package/core/types.d.ts +8 -3
- package/core/watchQueryOptions.d.ts +4 -4
- package/errors/index.d.ts +1 -1
- package/errors/index.js.map +1 -1
- package/invariantErrorCodes.js +47 -37
- package/legacyEntryPoints/link/index.d.ts +1 -0
- package/legacyEntryPoints/link/index.js +1 -0
- package/legacyEntryPoints/link/link.cjs +1 -0
- package/legacyEntryPoints/link/link.d.cts +1 -0
- package/link/batch/batchLink.d.ts +2 -2
- package/link/batch/batchLink.js +1 -1
- package/link/batch/batchLink.js.map +1 -1
- package/link/batch/batching.d.ts +1 -1
- package/link/batch/batching.js.map +1 -1
- package/link/batch-http/batchHttpLink.d.ts +5 -4
- package/link/batch-http/batchHttpLink.js +1 -1
- package/link/batch-http/batchHttpLink.js.map +1 -1
- package/link/context/index.d.ts +3 -4
- package/link/context/index.js +1 -1
- package/link/context/index.js.map +1 -1
- package/link/core/ApolloLink.d.ts +2 -2
- package/link/core/ApolloLink.js +2 -2
- package/link/core/ApolloLink.js.map +1 -1
- package/link/core/types.d.ts +19 -8
- package/link/error/index.d.ts +2 -2
- package/link/error/index.js +1 -1
- package/link/error/index.js.map +1 -1
- package/link/http/HttpLink.d.ts +129 -4
- package/link/http/HttpLink.js +1 -1
- package/link/http/HttpLink.js.map +1 -1
- package/link/http/createHttpLink.d.ts +3 -3
- package/link/http/createHttpLink.js +1 -1
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/index.d.ts +0 -1
- package/link/http/index.js.map +1 -1
- package/link/http/parseAndCheckHttpResponse.d.ts +1 -1
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/link/http/rewriteURIForGET.d.ts +2 -2
- package/link/http/rewriteURIForGET.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.d.ts +8 -83
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/link/http/selectURI.d.ts +1 -1
- package/link/http/selectURI.js.map +1 -1
- package/link/index.d.ts +8 -0
- package/link/index.js +7 -0
- package/link/index.js.map +1 -0
- package/link/persisted-queries/index.d.ts +2 -2
- package/link/persisted-queries/index.js +1 -1
- package/link/persisted-queries/index.js.map +1 -1
- package/link/remove-typename/removeTypenameFromVariables.d.ts +1 -1
- package/link/remove-typename/removeTypenameFromVariables.js +1 -1
- package/link/remove-typename/removeTypenameFromVariables.js.map +1 -1
- package/link/retry/delayFunction.d.ts +1 -1
- package/link/retry/delayFunction.js.map +1 -1
- package/link/retry/retryFunction.d.ts +1 -1
- package/link/retry/retryFunction.js.map +1 -1
- package/link/retry/retryLink.d.ts +2 -2
- package/link/retry/retryLink.js +1 -1
- package/link/retry/retryLink.js.map +1 -1
- package/link/schema/index.d.ts +2 -2
- package/link/schema/index.js +1 -1
- package/link/schema/index.js.map +1 -1
- package/link/subscriptions/index.d.ts +2 -2
- package/link/subscriptions/index.js +1 -1
- package/link/subscriptions/index.js.map +1 -1
- package/link/utils/createOperation.d.ts +2 -2
- package/link/utils/createOperation.js +5 -1
- package/link/utils/createOperation.js.map +1 -1
- package/link/utils/transformOperation.d.ts +1 -1
- package/link/utils/transformOperation.js.map +1 -1
- package/link/utils/validateOperation.d.ts +1 -1
- package/link/utils/validateOperation.js.map +1 -1
- package/link/ws/index.d.ts +2 -2
- package/link/ws/index.js +1 -1
- package/link/ws/index.js.map +1 -1
- package/package.json +12 -12
- package/react/hooks/useMutation.d.ts +45 -12
- package/react/hooks/useMutation.js.map +1 -1
- package/react/index.d.ts +1 -0
- package/react/index.js +1 -0
- package/react/index.js.map +1 -1
- package/react/types/deprecated.d.ts +3 -3
- package/testing/core/mocking/mockLink.d.ts +2 -2
- package/testing/core/mocking/mockLink.js +1 -1
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/testing/core/mocking/mockSubscriptionLink.d.ts +2 -2
- package/testing/core/mocking/mockSubscriptionLink.js +1 -1
- package/testing/core/mocking/mockSubscriptionLink.js.map +1 -1
- package/testing/internal/index.d.ts +1 -0
- package/testing/internal/index.js +1 -0
- package/testing/internal/index.js.map +1 -1
- package/testing/internal/link.d.ts +6 -0
- package/testing/internal/link.js +18 -0
- package/testing/internal/link.js.map +1 -0
- package/testing/matchers/isSameClient.d.ts +3 -0
- package/testing/matchers/isSameClient.js +15 -0
- package/testing/matchers/isSameClient.js.map +1 -0
- package/testing/matchers/isSameObservableQuery.d.ts +3 -0
- package/testing/matchers/isSameObservableQuery.js +15 -0
- package/testing/matchers/isSameObservableQuery.js.map +1 -0
- package/testing/matchers/toStrictEqualTyped.d.ts +6 -1
- package/testing/matchers/toStrictEqualTyped.js +9 -3
- package/testing/matchers/toStrictEqualTyped.js.map +1 -1
- package/testing/matchers/utils/getSerializableProperties.d.ts +3 -1
- package/testing/matchers/utils/getSerializableProperties.js +3 -2
- package/testing/matchers/utils/getSerializableProperties.js.map +1 -1
- package/testing/react/MockedProvider.d.ts +1 -1
- package/testing/react/MockedProvider.js.map +1 -1
- package/utilities/common/errorHandling.d.ts +1 -1
- package/utilities/common/errorHandling.js.map +1 -1
- package/utilities/common/incrementalResult.d.ts +1 -1
- package/utilities/common/incrementalResult.js.map +1 -1
- package/utilities/common/mergeOptions.d.ts +2 -2
- package/utilities/common/mergeOptions.js.map +1 -1
- package/utilities/subscriptions/relay/index.js.map +1 -1
- package/version.js +1 -1
- package/__cjs/link/core/index.cjs.map +0 -1
- package/__cjs/link/core/index.d.cts +0 -8
- package/legacyEntryPoints/link/core/core.cjs +0 -1
- package/legacyEntryPoints/link/core/core.d.cts +0 -1
- package/legacyEntryPoints/link/core/index.d.ts +0 -1
- package/legacyEntryPoints/link/core/index.js +0 -1
- package/link/core/index.d.ts +0 -8
- package/link/core/index.js +0 -7
- package/link/core/index.js.map +0 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@apollo/client": major
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
The `cache` and `forceFetch` properties are no longer available on context when calling `operation.getContext()`. `cache` can be accessed through the `operation` with `operation.client.cache` instead. `forceFetch` has been replaced with `queryDeduplication` which specifies whether `queryDeduplication` was enabled for the request or not.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@apollo/client": minor
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Provide an extension to define types for `context` passed to the link chain. To define your own types, use [declaration merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html) to add properties to the `DefaultContext` type.
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
// @apollo-client.d.ts
|
|
9
|
+
// This import is necessary to ensure all Apollo Client imports
|
|
10
|
+
// are still available to the rest of the application.
|
|
11
|
+
import '@apollo/client';
|
|
12
|
+
|
|
13
|
+
declare module "@apollo/client" {
|
|
14
|
+
interface DefaultContext extends Record<string, any> {
|
|
15
|
+
myProperty: string;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Links that provide context options can be used with this type to add those context types to `DefaultContext`. For example, to add context options from `HttpLink`, add the following code:
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { HttpLink } from "@apollo/client";
|
|
24
|
+
|
|
25
|
+
declare module "@apollo/client" {
|
|
26
|
+
interface DefaultContext extends HttpLink.ContextOptions {
|
|
27
|
+
myProperty: string;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
At this time, the following built-in links support context options:
|
|
33
|
+
- `HttpLink.ContextOptions`
|
|
34
|
+
- `BatchHttpLink.ContextOptions`
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@apollo/client": patch
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Adjust `useMutation` types to better handle required variables. When required variables are missing, TypeScript will now complain if they are not provided either to the hook or the returned `mutate` function. Providing required variables to `useMutation` will make them optional in the returned `mutate` function.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@apollo/client": major
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
`ApolloLink.execute` now requires a third argument which provides the `client` that initiated the request to the link chain. If you use `execute` directly, add a third argument with a `client` property:
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
ApolloLink.execute(link, operation, { client });
|
|
9
|
+
|
|
10
|
+
// or if you import the `execute` function directly:
|
|
11
|
+
execute(link, operation, { client });
|
|
12
|
+
```
|
package/.changeset/pre.json
CHANGED
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
"@apollo/client": "3.12.2"
|
|
6
6
|
},
|
|
7
7
|
"changesets": [
|
|
8
|
+
"afraid-grapes-call",
|
|
8
9
|
"afraid-moons-arrive",
|
|
9
10
|
"beige-mirrors-talk",
|
|
11
|
+
"brave-moons-juggle",
|
|
10
12
|
"brave-radios-wait",
|
|
11
13
|
"bright-ads-share",
|
|
12
14
|
"calm-frogs-remain",
|
|
@@ -35,6 +37,7 @@
|
|
|
35
37
|
"funny-terms-deny",
|
|
36
38
|
"fuzzy-tips-sit",
|
|
37
39
|
"gentle-badgers-train",
|
|
40
|
+
"gentle-waves-cough",
|
|
38
41
|
"giant-apes-thank",
|
|
39
42
|
"giant-bags-share",
|
|
40
43
|
"good-dolphins-peel",
|
|
@@ -59,6 +62,7 @@
|
|
|
59
62
|
"little-spoons-kick",
|
|
60
63
|
"loud-cows-raise",
|
|
61
64
|
"lucky-hats-push",
|
|
65
|
+
"lucky-sheep-explain",
|
|
62
66
|
"many-buses-allow",
|
|
63
67
|
"many-papayas-hide",
|
|
64
68
|
"mean-lizards-think",
|
|
@@ -74,6 +78,8 @@
|
|
|
74
78
|
"ninety-bags-bake",
|
|
75
79
|
"odd-chicken-hide",
|
|
76
80
|
"odd-lemons-relax",
|
|
81
|
+
"orange-suits-laugh",
|
|
82
|
+
"perfect-ducks-reflect",
|
|
77
83
|
"perfect-vans-give",
|
|
78
84
|
"polite-bees-care",
|
|
79
85
|
"poor-eels-punch",
|
|
@@ -89,21 +95,26 @@
|
|
|
89
95
|
"serious-moons-juggle",
|
|
90
96
|
"seven-dragons-repair",
|
|
91
97
|
"seven-foxes-melt",
|
|
98
|
+
"seven-schools-carry",
|
|
92
99
|
"shaggy-pugs-add",
|
|
93
100
|
"shiny-carrots-invent",
|
|
94
101
|
"short-jokes-jam",
|
|
95
102
|
"short-months-complain",
|
|
103
|
+
"short-tomatoes-attend",
|
|
96
104
|
"silly-knives-exist",
|
|
105
|
+
"silly-seas-confess",
|
|
97
106
|
"slimy-chicken-melt",
|
|
98
107
|
"slimy-maps-press",
|
|
99
108
|
"slow-ravens-explain",
|
|
100
109
|
"small-buttons-rhyme",
|
|
101
110
|
"small-cycles-rescue",
|
|
102
111
|
"small-kids-film",
|
|
112
|
+
"small-poems-rest",
|
|
103
113
|
"smart-rats-explode",
|
|
104
114
|
"smooth-coins-collect",
|
|
105
115
|
"smooth-pens-reply",
|
|
106
116
|
"soft-mails-clean",
|
|
117
|
+
"sour-kids-deliver",
|
|
107
118
|
"sour-pillows-guess",
|
|
108
119
|
"strange-seahorses-impress",
|
|
109
120
|
"swift-rivers-share",
|
|
@@ -125,6 +136,7 @@
|
|
|
125
136
|
"unlucky-sheep-change",
|
|
126
137
|
"warm-ties-sit",
|
|
127
138
|
"wicked-forks-double",
|
|
139
|
+
"witty-paws-marry",
|
|
128
140
|
"yellow-cats-judge",
|
|
129
141
|
"young-phones-fold",
|
|
130
142
|
"young-snails-grin",
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@apollo/client": major
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Require the `link` option when instantiating `ApolloClient`. This removes the `uri`, `credentials` and `headers` options from `ApolloClient` in favor of passing an instantiated `HttpLink` directly. To migrate:
|
|
6
|
+
|
|
7
|
+
**If using `uri`, `credentials`, or `headers` options**
|
|
8
|
+
```diff
|
|
9
|
+
new ApolloClient({
|
|
10
|
+
// ...
|
|
11
|
+
- uri,
|
|
12
|
+
- credentials,
|
|
13
|
+
- headers,
|
|
14
|
+
+ link: new HttpLink({ uri, credentials, headers }),
|
|
15
|
+
// or if you prefer the function call approach:
|
|
16
|
+
+ link: createHttpLink({ uri, credentials, headers }),
|
|
17
|
+
});
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**If creating a client without the `link` option**
|
|
21
|
+
```diff
|
|
22
|
+
new ApolloClient({
|
|
23
|
+
// ...
|
|
24
|
+
+ link: ApolloLink.empty()
|
|
25
|
+
});
|
|
26
|
+
```
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,101 @@
|
|
|
1
1
|
# @apollo/client
|
|
2
2
|
|
|
3
|
+
## 4.0.0-alpha.12
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#12586](https://github.com/apollographql/apollo-client/pull/12586) [`605db8e`](https://github.com/apollographql/apollo-client/commit/605db8e94fe2ce74c0a395f38f6873d40f431365) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Remove the `typeDefs` option from `ApolloClient`.
|
|
8
|
+
|
|
9
|
+
- [#12588](https://github.com/apollographql/apollo-client/pull/12588) [`eed825a`](https://github.com/apollographql/apollo-client/commit/eed825a2549f1d21fff2ec179815206b3baf0fcb) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Remove `TContext` generic argument from all types that use it. `TContext` is replaced with `DefaultContext` which can be modified using declaration merging.
|
|
10
|
+
|
|
11
|
+
- [#12590](https://github.com/apollographql/apollo-client/pull/12590) [`a005e82`](https://github.com/apollographql/apollo-client/commit/a005e822de7b24783f85be45df142ffbb9bc561b) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Drop `graphql` v15 as a valid peer dependency.
|
|
12
|
+
|
|
13
|
+
- [#12591](https://github.com/apollographql/apollo-client/pull/12591) [`a7e7383`](https://github.com/apollographql/apollo-client/commit/a7e738328951f5dac25a5fe48d28b3640a3e0eb9) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Rename the `@apollo/client/link/core` entrypoint to `@apollo/client/link`.
|
|
14
|
+
|
|
15
|
+
- [#12589](https://github.com/apollographql/apollo-client/pull/12589) [`15f5a1c`](https://github.com/apollographql/apollo-client/commit/15f5a1c29ac05015387a7bbc2dbe9a91d09fedfa) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Require the `link` option when instantiating `ApolloClient`. This removes the `uri`, `credentials` and `headers` options from `ApolloClient` in favor of passing an instantiated `HttpLink` directly. To migrate:
|
|
16
|
+
|
|
17
|
+
**If using `uri`, `credentials`, or `headers` options**
|
|
18
|
+
|
|
19
|
+
```diff
|
|
20
|
+
new ApolloClient({
|
|
21
|
+
// ...
|
|
22
|
+
- uri,
|
|
23
|
+
- credentials,
|
|
24
|
+
- headers,
|
|
25
|
+
+ link: new HttpLink({ uri, credentials, headers }),
|
|
26
|
+
// or if you prefer the function call approach:
|
|
27
|
+
+ link: createHttpLink({ uri, credentials, headers }),
|
|
28
|
+
});
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**If creating a client without the `link` option**
|
|
32
|
+
|
|
33
|
+
```diff
|
|
34
|
+
new ApolloClient({
|
|
35
|
+
// ...
|
|
36
|
+
+ link: ApolloLink.empty()
|
|
37
|
+
});
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## 4.0.0-alpha.11
|
|
41
|
+
|
|
42
|
+
### Major Changes
|
|
43
|
+
|
|
44
|
+
- [#12576](https://github.com/apollographql/apollo-client/pull/12576) [`a92ff78`](https://github.com/apollographql/apollo-client/commit/a92ff780abee60896bb9632867e90c82d0829255) Thanks [@jerelmiller](https://github.com/jerelmiller)! - The `cache` and `forceFetch` properties are no longer available on context when calling `operation.getContext()`. `cache` can be accessed through the `operation` with `operation.client.cache` instead. `forceFetch` has been replaced with `queryDeduplication` which specifies whether `queryDeduplication` was enabled for the request or not.
|
|
45
|
+
|
|
46
|
+
- [#12576](https://github.com/apollographql/apollo-client/pull/12576) [`a92ff78`](https://github.com/apollographql/apollo-client/commit/a92ff780abee60896bb9632867e90c82d0829255) Thanks [@jerelmiller](https://github.com/jerelmiller)! - `ApolloLink.execute` now requires a third argument which provides the `client` that initiated the request to the link chain. If you use `execute` directly, add a third argument with a `client` property:
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
ApolloLink.execute(link, operation, { client });
|
|
50
|
+
|
|
51
|
+
// or if you import the `execute` function directly:
|
|
52
|
+
execute(link, operation, { client });
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
- [#12566](https://github.com/apollographql/apollo-client/pull/12566) [`ce4b488`](https://github.com/apollographql/apollo-client/commit/ce4b488bef13f2f5ce1b348d8c3196e198165dd6) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Don't `broadcastQueries` when a query is torn down.
|
|
56
|
+
|
|
57
|
+
### Minor Changes
|
|
58
|
+
|
|
59
|
+
- [#12576](https://github.com/apollographql/apollo-client/pull/12576) [`a92ff78`](https://github.com/apollographql/apollo-client/commit/a92ff780abee60896bb9632867e90c82d0829255) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Provide an extension to define types for `context` passed to the link chain. To define your own types, use [declaration merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html) to add properties to the `DefaultContext` type.
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
// @apollo-client.d.ts
|
|
63
|
+
// This import is necessary to ensure all Apollo Client imports
|
|
64
|
+
// are still available to the rest of the application.
|
|
65
|
+
import "@apollo/client";
|
|
66
|
+
|
|
67
|
+
declare module "@apollo/client" {
|
|
68
|
+
interface DefaultContext extends Record<string, any> {
|
|
69
|
+
myProperty: string;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Links that provide context options can be used with this type to add those context types to `DefaultContext`. For example, to add context options from `HttpLink`, add the following code:
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
import { HttpLink } from "@apollo/client";
|
|
78
|
+
|
|
79
|
+
declare module "@apollo/client" {
|
|
80
|
+
interface DefaultContext extends HttpLink.ContextOptions {
|
|
81
|
+
myProperty: string;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
At this time, the following built-in links support context options:
|
|
87
|
+
|
|
88
|
+
- `HttpLink.ContextOptions`
|
|
89
|
+
- `BatchHttpLink.ContextOptions`
|
|
90
|
+
|
|
91
|
+
- [#12576](https://github.com/apollographql/apollo-client/pull/12576) [`a92ff78`](https://github.com/apollographql/apollo-client/commit/a92ff780abee60896bb9632867e90c82d0829255) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Add a `client` property to the `operation` passed to the link chain. This `client` is set as the `client` making the request to the link chain.
|
|
92
|
+
|
|
93
|
+
### Patch Changes
|
|
94
|
+
|
|
95
|
+
- [#12574](https://github.com/apollographql/apollo-client/pull/12574) [`0098ec9`](https://github.com/apollographql/apollo-client/commit/0098ec9f860e4e08a2070823f723dce401ae588a) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Export `gql` from the `@apollo/client/react` entrypoint.
|
|
96
|
+
|
|
97
|
+
- [#12572](https://github.com/apollographql/apollo-client/pull/12572) [`3dc50e6`](https://github.com/apollographql/apollo-client/commit/3dc50e6476dcedf82ed3856bf9f4571a32a760a6) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Adjust `useMutation` types to better handle required variables. When required variables are missing, TypeScript will now complain if they are not provided either to the hook or the returned `mutate` function. Providing required variables to `useMutation` will make them optional in the returned `mutate` function.
|
|
98
|
+
|
|
3
99
|
## 4.0.0-alpha.10
|
|
4
100
|
|
|
5
101
|
### Major Changes
|
|
@@ -94,7 +94,7 @@ class ApolloCache {
|
|
|
94
94
|
if (environment_1.__DEV__) {
|
|
95
95
|
const actualFragmentName = fragmentName || (0, utilities_1.getFragmentDefinition)(fragment).name.value;
|
|
96
96
|
if (!id) {
|
|
97
|
-
__DEV__ && invariant_1.invariant.warn(
|
|
97
|
+
__DEV__ && invariant_1.invariant.warn(97, actualFragmentName);
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
const diffOptions = {
|
|
@@ -81,7 +81,7 @@ class EntityStore {
|
|
|
81
81
|
// then there are no fields to be merged, so we're done.
|
|
82
82
|
if (!incoming)
|
|
83
83
|
return;
|
|
84
|
-
(0, invariant_1.invariant)(typeof dataId === "string",
|
|
84
|
+
(0, invariant_1.invariant)(typeof dataId === "string", 83);
|
|
85
85
|
const merged = new utilities_1.DeepMerger(storeObjectReconciler).merge(existing, incoming);
|
|
86
86
|
// Even if merged === existing, existing may have come from a lower
|
|
87
87
|
// layer, so we always need to set this.data[dataId] on this level.
|
|
@@ -181,7 +181,7 @@ class EntityStore {
|
|
|
181
181
|
if (environment_1.__DEV__) {
|
|
182
182
|
const checkReference = (ref) => {
|
|
183
183
|
if (this.lookup(ref.__ref) === undefined) {
|
|
184
|
-
__DEV__ && invariant_1.invariant.warn(
|
|
184
|
+
__DEV__ && invariant_1.invariant.warn(84, ref);
|
|
185
185
|
return true;
|
|
186
186
|
}
|
|
187
187
|
};
|
|
@@ -210,7 +210,7 @@ class EntityStore {
|
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
212
|
if (seenReference && someNonReference !== undefined) {
|
|
213
|
-
__DEV__ && invariant_1.invariant.warn(
|
|
213
|
+
__DEV__ && invariant_1.invariant.warn(85, someNonReference);
|
|
214
214
|
break;
|
|
215
215
|
}
|
|
216
216
|
}
|
|
@@ -41,7 +41,7 @@ function keyFieldsFnFromSpecifier(specifier) {
|
|
|
41
41
|
// context.readField for this extraction.
|
|
42
42
|
extracted = extractKeyPath(object, schemaKeyPath, extractKey);
|
|
43
43
|
}
|
|
44
|
-
(0, invariant_1.invariant)(extracted !== void 0,
|
|
44
|
+
(0, invariant_1.invariant)(extracted !== void 0, 86, schemaKeyPath.join("."), object);
|
|
45
45
|
return extracted;
|
|
46
46
|
}));
|
|
47
47
|
return `${context.typename}:${JSON.stringify(keyObject)}`;
|
|
@@ -203,7 +203,7 @@ class Policies {
|
|
|
203
203
|
const rootId = "ROOT_" + which.toUpperCase();
|
|
204
204
|
const old = this.rootTypenamesById[rootId];
|
|
205
205
|
if (typename !== old) {
|
|
206
|
-
(0, invariant_1.invariant)(!old || old === which,
|
|
206
|
+
(0, invariant_1.invariant)(!old || old === which, 87, which);
|
|
207
207
|
// First, delete any old __typename associated with this rootId from
|
|
208
208
|
// rootIdsByTypename.
|
|
209
209
|
if (old)
|
|
@@ -348,7 +348,7 @@ class Policies {
|
|
|
348
348
|
if (supertypeSet.has(supertype)) {
|
|
349
349
|
if (!typenameSupertypeSet.has(supertype)) {
|
|
350
350
|
if (checkingFuzzySubtypes) {
|
|
351
|
-
__DEV__ && invariant_1.invariant.warn(
|
|
351
|
+
__DEV__ && invariant_1.invariant.warn(88, typename, supertype);
|
|
352
352
|
}
|
|
353
353
|
// Record positive results for faster future lookup.
|
|
354
354
|
// Unfortunately, we cannot safely cache negative results,
|
|
@@ -559,7 +559,7 @@ function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables)
|
|
|
559
559
|
}
|
|
560
560
|
}
|
|
561
561
|
if (environment_1.__DEV__ && options.from === void 0) {
|
|
562
|
-
__DEV__ && invariant_1.invariant.warn(
|
|
562
|
+
__DEV__ && invariant_1.invariant.warn(89, (0, utilities_1.stringifyForDisplay)(Array.from(readFieldArgs)));
|
|
563
563
|
}
|
|
564
564
|
if (void 0 === options.variables) {
|
|
565
565
|
options.variables = variables;
|
|
@@ -569,7 +569,7 @@ function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables)
|
|
|
569
569
|
function makeMergeObjectsFunction(store) {
|
|
570
570
|
return function mergeObjects(existing, incoming) {
|
|
571
571
|
if ((0, helpers_js_1.isArray)(existing) || (0, helpers_js_1.isArray)(incoming)) {
|
|
572
|
-
throw (0, invariant_1.newInvariantError)(
|
|
572
|
+
throw (0, invariant_1.newInvariantError)(90);
|
|
573
573
|
}
|
|
574
574
|
// These dynamic checks are necessary because the parameters of a
|
|
575
575
|
// custom merge function can easily have the any type, so the type
|
|
@@ -197,7 +197,7 @@ class StoreReader {
|
|
|
197
197
|
else {
|
|
198
198
|
const fragment = (0, utilities_1.getFragmentFromSelection)(selection, context.lookupFragment);
|
|
199
199
|
if (!fragment && selection.kind === graphql_1.Kind.FRAGMENT_SPREAD) {
|
|
200
|
-
throw (0, invariant_1.newInvariantError)(
|
|
200
|
+
throw (0, invariant_1.newInvariantError)(91, selection.name.value);
|
|
201
201
|
}
|
|
202
202
|
if (fragment && policies.fragmentMatches(fragment, typename)) {
|
|
203
203
|
fragment.selectionSet.selections.forEach(workSet.add, workSet);
|
|
@@ -281,7 +281,7 @@ function assertSelectionSetForIdValue(store, field, fieldValue) {
|
|
|
281
281
|
if ((0, utilities_1.isNonNullObject)(value)) {
|
|
282
282
|
(0, invariant_1.invariant)(
|
|
283
283
|
!(0, utilities_1.isReference)(value),
|
|
284
|
-
|
|
284
|
+
92,
|
|
285
285
|
(0, helpers_js_1.getTypenameFromStoreObject)(store, value),
|
|
286
286
|
field.name.value
|
|
287
287
|
);
|
|
@@ -72,7 +72,7 @@ class StoreWriter {
|
|
|
72
72
|
context,
|
|
73
73
|
});
|
|
74
74
|
if (!(0, utilities_1.isReference)(ref)) {
|
|
75
|
-
throw (0, invariant_1.newInvariantError)(
|
|
75
|
+
throw (0, invariant_1.newInvariantError)(93, result);
|
|
76
76
|
}
|
|
77
77
|
// So far, the store has not been modified, so now it's time to process
|
|
78
78
|
// context.incomingById and merge those incoming fields into context.store.
|
|
@@ -222,7 +222,7 @@ class StoreWriter {
|
|
|
222
222
|
// provide a default value, so its absence from the written data should
|
|
223
223
|
// not be cause for alarm.
|
|
224
224
|
!policies.getReadFunction(typename, field.name.value)) {
|
|
225
|
-
__DEV__ && invariant_1.invariant.error(
|
|
225
|
+
__DEV__ && invariant_1.invariant.error(94, (0, utilities_1.resultKeyNameFromField)(field), result);
|
|
226
226
|
}
|
|
227
227
|
});
|
|
228
228
|
// Identify the result object, even if dataId was already provided,
|
|
@@ -369,7 +369,7 @@ class StoreWriter {
|
|
|
369
369
|
else {
|
|
370
370
|
const fragment = (0, utilities_1.getFragmentFromSelection)(selection, context.lookupFragment);
|
|
371
371
|
if (!fragment && selection.kind === graphql_1.Kind.FRAGMENT_SPREAD) {
|
|
372
|
-
throw (0, invariant_1.newInvariantError)(
|
|
372
|
+
throw (0, invariant_1.newInvariantError)(95, selection.name.value);
|
|
373
373
|
}
|
|
374
374
|
if (fragment &&
|
|
375
375
|
policies.fragmentMatches(fragment, typename, result, context.variables)) {
|
|
@@ -542,7 +542,7 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
|
|
|
542
542
|
}
|
|
543
543
|
});
|
|
544
544
|
}
|
|
545
|
-
__DEV__ && invariant_1.invariant.warn(
|
|
545
|
+
__DEV__ && invariant_1.invariant.warn(96, fieldName, parentType, childTypenames.length ?
|
|
546
546
|
"either ensure all objects of type " +
|
|
547
547
|
childTypenames.join(" and ") +
|
|
548
548
|
" have an ID or a custom merge function, or "
|
|
@@ -7,8 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.ApolloClient = exports.mergeOptions = void 0;
|
|
8
8
|
const graphql_1 = require("graphql");
|
|
9
9
|
const rxjs_1 = require("rxjs");
|
|
10
|
-
const
|
|
11
|
-
const http_1 = require("@apollo/client/link/http");
|
|
10
|
+
const link_1 = require("@apollo/client/link");
|
|
12
11
|
const utilities_1 = require("@apollo/client/utilities");
|
|
13
12
|
Object.defineProperty(exports, "mergeOptions", { enumerable: true, get: function () { return utilities_1.mergeOptions; } });
|
|
14
13
|
const environment_1 = require("@apollo/client/utilities/environment");
|
|
@@ -47,7 +46,6 @@ class ApolloClient {
|
|
|
47
46
|
version;
|
|
48
47
|
queryDeduplication;
|
|
49
48
|
defaultOptions;
|
|
50
|
-
typeDefs;
|
|
51
49
|
devtoolsConfig;
|
|
52
50
|
queryManager;
|
|
53
51
|
devToolsHookCb;
|
|
@@ -81,24 +79,19 @@ class ApolloClient {
|
|
|
81
79
|
* ```
|
|
82
80
|
*/
|
|
83
81
|
constructor(options) {
|
|
84
|
-
if (
|
|
85
|
-
|
|
82
|
+
if (environment_1.__DEV__) {
|
|
83
|
+
(0, invariant_1.invariant)(options.cache, 58);
|
|
84
|
+
(0, invariant_1.invariant)(options.link, 59);
|
|
86
85
|
}
|
|
87
|
-
const {
|
|
86
|
+
const { cache, documentTransform, ssrMode = false, ssrForceFetchDelay = 0,
|
|
88
87
|
// Expose the client instance as window.__APOLLO_CLIENT__ and call
|
|
89
88
|
// onBroadcast in queryManager.broadcastQueries to enable browser
|
|
90
89
|
// devtools, but disable them by default in production.
|
|
91
|
-
connectToDevTools, queryDeduplication = true, defaultOptions, defaultContext, assumeImmutableResults = cache.assumeImmutableResults, resolvers,
|
|
92
|
-
let { link } = options;
|
|
93
|
-
if (!link) {
|
|
94
|
-
link =
|
|
95
|
-
uri ? new http_1.HttpLink({ uri, credentials, headers }) : core_1.ApolloLink.empty();
|
|
96
|
-
}
|
|
90
|
+
connectToDevTools, queryDeduplication = true, defaultOptions, defaultContext, assumeImmutableResults = cache.assumeImmutableResults, resolvers, fragmentMatcher, name: clientAwarenessName, version: clientAwarenessVersion, devtools, dataMasking, link, } = options;
|
|
97
91
|
this.link = link;
|
|
98
92
|
this.cache = cache;
|
|
99
93
|
this.queryDeduplication = queryDeduplication;
|
|
100
94
|
this.defaultOptions = defaultOptions || {};
|
|
101
|
-
this.typeDefs = typeDefs;
|
|
102
95
|
this.devtoolsConfig = {
|
|
103
96
|
...devtools,
|
|
104
97
|
enabled: devtools?.enabled ?? connectToDevTools,
|
|
@@ -120,8 +113,7 @@ class ApolloClient {
|
|
|
120
113
|
fragmentMatcher,
|
|
121
114
|
});
|
|
122
115
|
this.queryManager = new QueryManager_js_1.QueryManager({
|
|
123
|
-
|
|
124
|
-
link: this.link,
|
|
116
|
+
client: this,
|
|
125
117
|
defaultOptions: this.defaultOptions,
|
|
126
118
|
defaultContext,
|
|
127
119
|
documentTransform,
|
|
@@ -247,13 +239,13 @@ class ApolloClient {
|
|
|
247
239
|
options = (0, utilities_1.mergeOptions)(this.defaultOptions.query, options);
|
|
248
240
|
}
|
|
249
241
|
if (environment_1.__DEV__) {
|
|
250
|
-
(0, invariant_1.invariant)(options.fetchPolicy !== "cache-and-network",
|
|
251
|
-
(0, invariant_1.invariant)(options.fetchPolicy !== "standby",
|
|
252
|
-
(0, invariant_1.invariant)(options.query,
|
|
253
|
-
(0, invariant_1.invariant)(options.query.kind === "Document",
|
|
254
|
-
(0, invariant_1.invariant)(!options.returnPartialData,
|
|
255
|
-
(0, invariant_1.invariant)(!options.pollInterval,
|
|
256
|
-
(0, invariant_1.invariant)(!options.notifyOnNetworkStatusChange,
|
|
242
|
+
(0, invariant_1.invariant)(options.fetchPolicy !== "cache-and-network", 60);
|
|
243
|
+
(0, invariant_1.invariant)(options.fetchPolicy !== "standby", 61);
|
|
244
|
+
(0, invariant_1.invariant)(options.query, 62);
|
|
245
|
+
(0, invariant_1.invariant)(options.query.kind === "Document", 63);
|
|
246
|
+
(0, invariant_1.invariant)(!options.returnPartialData, 64);
|
|
247
|
+
(0, invariant_1.invariant)(!options.pollInterval, 65);
|
|
248
|
+
(0, invariant_1.invariant)(!options.notifyOnNetworkStatusChange, 66);
|
|
257
249
|
(0, utilities_1.checkDocument)(options.query, graphql_1.OperationTypeNode.QUERY);
|
|
258
250
|
}
|
|
259
251
|
return this.queryManager.query(options);
|
|
@@ -373,7 +365,7 @@ class ApolloClient {
|
|
|
373
365
|
this.devToolsHookCb = cb;
|
|
374
366
|
}
|
|
375
367
|
__requestRaw(payload) {
|
|
376
|
-
return (0,
|
|
368
|
+
return (0, link_1.execute)(this.link, payload, { client: this });
|
|
377
369
|
}
|
|
378
370
|
/**
|
|
379
371
|
* Resets your entire store by clearing out your cache and then re-executing
|
|
@@ -475,7 +467,7 @@ class ApolloClient {
|
|
|
475
467
|
// result.queries and result.results instead, you shouldn't have to worry
|
|
476
468
|
// about preventing uncaught rejections for the Promise.all result.
|
|
477
469
|
result.catch((error) => {
|
|
478
|
-
__DEV__ && invariant_1.invariant.debug(
|
|
470
|
+
__DEV__ && invariant_1.invariant.debug(67, error);
|
|
479
471
|
});
|
|
480
472
|
return result;
|
|
481
473
|
}
|
|
@@ -537,7 +529,7 @@ class ApolloClient {
|
|
|
537
529
|
* Define a new ApolloLink (or link chain) that Apollo Client will use.
|
|
538
530
|
*/
|
|
539
531
|
setLink(newLink) {
|
|
540
|
-
this.link =
|
|
532
|
+
this.link = newLink;
|
|
541
533
|
}
|
|
542
534
|
get defaultContext() {
|
|
543
535
|
return this.queryManager.defaultContext;
|