@apollo/client 4.0.0-alpha.4 → 4.0.0-alpha.5
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/eleven-kangaroos-jump.md +5 -0
- package/.changeset/forty-shrimps-fry.md +5 -0
- package/.changeset/grumpy-vans-type.md +5 -0
- package/.changeset/little-spoons-kick.md +7 -0
- package/.changeset/loud-cows-raise.md +7 -0
- package/.changeset/many-buses-allow.md +5 -0
- package/.changeset/poor-eels-punch.md +5 -0
- package/.changeset/pre.json +13 -0
- package/.changeset/real-teachers-peel.md +5 -0
- package/.changeset/slimy-chicken-melt.md +5 -0
- package/.changeset/thick-books-grin.md +5 -0
- package/.changeset/tough-rockets-allow.md +5 -0
- package/.changeset/tricky-tables-shave.md +5 -0
- package/.changeset/warm-ties-sit.md +7 -0
- package/CHANGELOG.md +40 -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 +3 -3
- package/__cjs/core/ApolloClient.cjs.map +1 -1
- package/__cjs/core/ApolloClient.d.cts +4 -4
- package/__cjs/core/LocalState.cjs +2 -2
- package/__cjs/core/ObservableQuery.cjs +15 -12
- package/__cjs/core/ObservableQuery.cjs.map +1 -1
- package/__cjs/core/QueryManager.cjs +57 -35
- package/__cjs/core/QueryManager.cjs.map +1 -1
- package/__cjs/core/QueryManager.d.cts +3 -3
- package/__cjs/core/types.d.cts +32 -0
- package/__cjs/invariantErrorCodes.cjs +57 -77
- package/__cjs/link/core/ApolloLink.cjs +2 -2
- package/__cjs/link/http/checkFetcher.cjs +1 -1
- package/__cjs/link/http/createHttpLink.cjs +1 -1
- package/__cjs/link/http/parseAndCheckHttpResponse.cjs +1 -1
- package/__cjs/link/http/serializeFetchParameter.cjs +1 -1
- package/__cjs/link/persisted-queries/index.cjs +2 -2
- package/__cjs/link/utils/validateOperation.cjs +1 -1
- package/__cjs/masking/maskDefinition.cjs +2 -2
- package/__cjs/masking/maskFragment.cjs +2 -2
- package/__cjs/masking/maskOperation.cjs +1 -1
- package/__cjs/masking/utils.cjs +1 -1
- package/__cjs/react/context/ApolloConsumer.cjs +1 -1
- package/__cjs/react/context/ApolloContext.cjs +1 -1
- package/__cjs/react/context/ApolloContext.cjs.map +1 -1
- package/__cjs/react/context/ApolloContext.d.cts +2 -2
- package/__cjs/react/context/ApolloProvider.cjs +1 -1
- package/__cjs/react/hooks/internal/wrapHook.cjs +26 -5
- package/__cjs/react/hooks/internal/wrapHook.cjs.map +1 -1
- package/__cjs/react/hooks/internal/wrapHook.d.cts +3 -1
- package/__cjs/react/hooks/useMutation.cjs +14 -19
- package/__cjs/react/hooks/useMutation.cjs.map +1 -1
- package/__cjs/react/hooks/useMutation.d.cts +4 -4
- package/__cjs/react/hooks/useQuery.cjs +82 -187
- package/__cjs/react/hooks/useQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useQuery.d.cts +4 -0
- package/__cjs/react/hooks/useSubscription.cjs +8 -57
- package/__cjs/react/hooks/useSubscription.cjs.map +1 -1
- package/__cjs/react/hooks/useSubscription.d.cts +6 -42
- package/__cjs/react/hooks/useSuspenseQuery.cjs +2 -2
- package/__cjs/react/hooks/useSyncExternalStore.cjs +1 -1
- package/__cjs/react/internal/index.cjs +3 -1
- package/__cjs/react/internal/index.cjs.map +1 -1
- package/__cjs/react/internal/index.d.cts +1 -0
- package/__cjs/react/ssr/getDataFromTree.cjs +43 -12
- package/__cjs/react/ssr/getDataFromTree.cjs.map +1 -1
- package/__cjs/react/ssr/getDataFromTree.d.cts +5 -0
- package/__cjs/react/ssr/index.cjs +1 -3
- package/__cjs/react/ssr/index.cjs.map +1 -1
- package/__cjs/react/ssr/index.d.cts +0 -1
- package/__cjs/react/ssr/useSSRQuery.cjs +60 -0
- package/__cjs/react/ssr/useSSRQuery.cjs.map +1 -0
- package/__cjs/react/ssr/useSSRQuery.d.cts +5 -0
- package/__cjs/react/types/deprecated.d.cts +1 -1
- package/__cjs/react/types/types.documentation.d.cts +4 -12
- package/__cjs/testing/matchers/index.cjs +2 -0
- package/__cjs/testing/matchers/index.cjs.map +1 -1
- package/__cjs/testing/matchers/toEmitStrictTyped.cjs +42 -0
- package/__cjs/testing/matchers/toEmitStrictTyped.cjs.map +1 -0
- package/__cjs/testing/matchers/toEmitStrictTyped.d.cts +7 -0
- package/__cjs/testing/matchers/toEqualStrictTyped.cjs +2 -20
- package/__cjs/testing/matchers/toEqualStrictTyped.cjs.map +1 -1
- package/__cjs/testing/matchers/utils/getSerializableProperties.cjs +23 -0
- package/__cjs/testing/matchers/utils/getSerializableProperties.cjs.map +1 -0
- package/__cjs/testing/matchers/utils/getSerializableProperties.d.cts +2 -0
- package/__cjs/version.cjs +1 -1
- package/__cjs/version.d.cts +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 -4
- package/core/ApolloClient.js +3 -3
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.js +2 -2
- package/core/ObservableQuery.js +15 -12
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryManager.d.ts +3 -3
- package/core/QueryManager.js +58 -36
- package/core/QueryManager.js.map +1 -1
- package/core/types.d.ts +32 -0
- package/invariantErrorCodes.js +57 -77
- package/link/core/ApolloLink.js +2 -2
- package/link/http/checkFetcher.js +1 -1
- package/link/http/createHttpLink.js +1 -1
- package/link/http/parseAndCheckHttpResponse.js +1 -1
- package/link/http/serializeFetchParameter.js +1 -1
- package/link/persisted-queries/index.js +2 -2
- package/link/utils/validateOperation.js +1 -1
- package/masking/maskDefinition.js +2 -2
- package/masking/maskFragment.js +2 -2
- package/masking/maskOperation.js +1 -1
- package/masking/utils.js +1 -1
- package/package.json +1 -1
- package/react/context/ApolloConsumer.js +1 -1
- package/react/context/ApolloContext.d.ts +2 -2
- package/react/context/ApolloContext.js +1 -1
- package/react/context/ApolloContext.js.map +1 -1
- package/react/context/ApolloProvider.js +1 -1
- package/react/hooks/internal/wrapHook.d.ts +3 -1
- package/react/hooks/internal/wrapHook.js +24 -5
- package/react/hooks/internal/wrapHook.js.map +1 -1
- package/react/hooks/useMutation.d.ts +4 -4
- package/react/hooks/useMutation.js +14 -19
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.d.ts +4 -0
- package/react/hooks/useQuery.js +83 -188
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useSubscription.d.ts +6 -42
- package/react/hooks/useSubscription.js +7 -53
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseQuery.js +2 -2
- package/react/hooks/useSyncExternalStore.js +1 -1
- package/react/internal/index.d.ts +1 -0
- package/react/internal/index.js +2 -1
- package/react/internal/index.js.map +1 -1
- package/react/ssr/getDataFromTree.d.ts +5 -0
- package/react/ssr/getDataFromTree.js +43 -12
- package/react/ssr/getDataFromTree.js.map +1 -1
- package/react/ssr/index.d.ts +0 -1
- package/react/ssr/index.js +0 -1
- package/react/ssr/index.js.map +1 -1
- package/react/ssr/useSSRQuery.d.ts +5 -0
- package/react/ssr/useSSRQuery.js +56 -0
- package/react/ssr/useSSRQuery.js.map +1 -0
- package/react/types/deprecated.d.ts +1 -1
- package/react/types/types.documentation.d.ts +4 -12
- package/testing/matchers/index.js +2 -0
- package/testing/matchers/index.js.map +1 -1
- package/testing/matchers/toEmitStrictTyped.d.ts +7 -0
- package/testing/matchers/toEmitStrictTyped.js +38 -0
- package/testing/matchers/toEmitStrictTyped.js.map +1 -0
- package/testing/matchers/toEqualStrictTyped.js +1 -19
- package/testing/matchers/toEqualStrictTyped.js.map +1 -1
- package/testing/matchers/utils/getSerializableProperties.d.ts +2 -0
- package/testing/matchers/utils/getSerializableProperties.js +20 -0
- package/testing/matchers/utils/getSerializableProperties.js.map +1 -0
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/__cjs/react/ssr/RenderPromises.cjs +0 -104
- package/__cjs/react/ssr/RenderPromises.cjs.map +0 -1
- package/__cjs/react/ssr/RenderPromises.d.cts +0 -25
- package/react/ssr/RenderPromises.d.ts +0 -25
- package/react/ssr/RenderPromises.js +0 -100
- package/react/ssr/RenderPromises.js.map +0 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@apollo/client": major
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Unify error behavior on mutations for GraphQL errors and network errors by ensuring network errors are subject to the `errorPolicy`. Network errors created when using an `errorPolicy` of `all` will now resolve the promise and be returned on the `error` property of the result, or stripped away when the `errorPolicy` is `none`.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@apollo/client": major
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
`client.mutate` now returns a `MutateResult` instead of `FetchResult`. As a result, the `errors` property has been removed in favor of `error` which is set if either a network error occured or GraphQL errors are returned from the server.
|
|
6
|
+
|
|
7
|
+
`useMutation` now also returns a `MutateResult` instead of a `FetchResult`.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@apollo/client": patch
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
`useQuery` with `ssr: false` - previously, `skip` had a higher priortity than `ssr: false` while `ssr: false` had a higher priority than `fetchPolicy: "standby"` (which is roughly equivalent to `skip`).
|
|
6
|
+
|
|
7
|
+
This priority has been adjusted so now both `skip` and `fetchPolicy: "standby"` have a higher priority than `ssr: false` and will return `loading: false`, while `ssr: false` will only come after those and will return `loading: true` if those are not set.
|
package/.changeset/pre.json
CHANGED
|
@@ -17,14 +17,17 @@
|
|
|
17
17
|
"curvy-pianos-count",
|
|
18
18
|
"dirty-trees-pump",
|
|
19
19
|
"eighty-squids-fix",
|
|
20
|
+
"eleven-kangaroos-jump",
|
|
20
21
|
"empty-rabbits-move",
|
|
21
22
|
"fluffy-shoes-applaud",
|
|
22
23
|
"forty-hairs-occur",
|
|
24
|
+
"forty-shrimps-fry",
|
|
23
25
|
"four-ghosts-watch",
|
|
24
26
|
"fresh-moose-hope",
|
|
25
27
|
"funny-jeans-invent",
|
|
26
28
|
"good-dolphins-peel",
|
|
27
29
|
"gorgeous-chefs-tap",
|
|
30
|
+
"grumpy-vans-type",
|
|
28
31
|
"healthy-apes-sneeze",
|
|
29
32
|
"hip-vans-act",
|
|
30
33
|
"hot-cycles-notice",
|
|
@@ -36,7 +39,10 @@
|
|
|
36
39
|
"light-apes-rescue",
|
|
37
40
|
"light-dolphins-taste",
|
|
38
41
|
"light-sloths-end",
|
|
42
|
+
"little-spoons-kick",
|
|
43
|
+
"loud-cows-raise",
|
|
39
44
|
"lucky-hats-push",
|
|
45
|
+
"many-buses-allow",
|
|
40
46
|
"many-papayas-hide",
|
|
41
47
|
"metal-needles-search",
|
|
42
48
|
"mighty-penguins-wink",
|
|
@@ -47,10 +53,12 @@
|
|
|
47
53
|
"nice-waves-work",
|
|
48
54
|
"odd-lemons-relax",
|
|
49
55
|
"polite-bees-care",
|
|
56
|
+
"poor-eels-punch",
|
|
50
57
|
"popular-games-sleep",
|
|
51
58
|
"purple-lions-cough",
|
|
52
59
|
"rare-houses-prove",
|
|
53
60
|
"real-gorillas-move",
|
|
61
|
+
"real-teachers-peel",
|
|
54
62
|
"rich-eagles-cross",
|
|
55
63
|
"rich-kids-carry",
|
|
56
64
|
"rude-fans-study",
|
|
@@ -58,6 +66,7 @@
|
|
|
58
66
|
"shiny-carrots-invent",
|
|
59
67
|
"short-jokes-jam",
|
|
60
68
|
"silly-knives-exist",
|
|
69
|
+
"slimy-chicken-melt",
|
|
61
70
|
"slimy-maps-press",
|
|
62
71
|
"slow-ravens-explain",
|
|
63
72
|
"small-buttons-rhyme",
|
|
@@ -72,12 +81,16 @@
|
|
|
72
81
|
"tall-bikes-develop",
|
|
73
82
|
"tall-cups-suffer",
|
|
74
83
|
"tame-doors-shop",
|
|
84
|
+
"thick-books-grin",
|
|
75
85
|
"tidy-squids-poke",
|
|
86
|
+
"tough-rockets-allow",
|
|
76
87
|
"tough-taxis-smoke",
|
|
77
88
|
"tough-tips-drop",
|
|
89
|
+
"tricky-tables-shave",
|
|
78
90
|
"twenty-snakes-sort",
|
|
79
91
|
"unlucky-kiwis-sell",
|
|
80
92
|
"unlucky-sheep-change",
|
|
93
|
+
"warm-ties-sit",
|
|
81
94
|
"yellow-cats-judge",
|
|
82
95
|
"young-phones-fold",
|
|
83
96
|
"young-turtles-explode"
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@apollo/client": major
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Unify error behavior on subscriptions for GraphQL errors and network errors by ensuring network errors are subject to the `errorPolicy`. Network errors that terminate the connection will now be emitted on the `error` property passed to the `next` callback followed by a call to the `complete` callback.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@apollo/client": major
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Subscriptions no longer emit errors in the `error` callback and instead provide errors on the `error` property on the result passed to the `next` callback. As a result, errors will no longer automatically terminate the connection allowing additional results to be emitted when the connection stays open.
|
|
6
|
+
|
|
7
|
+
When an error terminates the downstream connection, a `next` event will be emitted with an `error` property followed by a `complete` event instead.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# @apollo/client
|
|
2
2
|
|
|
3
|
+
## 4.0.0-alpha.5
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#12478](https://github.com/apollographql/apollo-client/pull/12478) [`5ea6a45`](https://github.com/apollographql/apollo-client/commit/5ea6a45b3ec2f0d526abe78ae03c42bb519f87c7) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Remove `variables` from the result returned from `useSubscription`.
|
|
8
|
+
|
|
9
|
+
- [#12476](https://github.com/apollographql/apollo-client/pull/12476) [`6afff60`](https://github.com/apollographql/apollo-client/commit/6afff60beece953406af2cbe07f7ccbf973cadaa) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Subscriptions now emit a `SubscribeResult` instead of a `FetchResult`. As a result, the `errors` field has been removed in favor of `error`.
|
|
10
|
+
|
|
11
|
+
- [#12475](https://github.com/apollographql/apollo-client/pull/12475) [`3de63eb`](https://github.com/apollographql/apollo-client/commit/3de63ebcdf95a87adc31e6b4a39cae5391ed945a) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Unify error behavior on mutations for GraphQL errors and network errors by ensuring network errors are subject to the `errorPolicy`. Network errors created when using an `errorPolicy` of `all` will now resolve the promise and be returned on the `error` property of the result, or stripped away when the `errorPolicy` is `none`.
|
|
12
|
+
|
|
13
|
+
- [#12475](https://github.com/apollographql/apollo-client/pull/12475) [`3de63eb`](https://github.com/apollographql/apollo-client/commit/3de63ebcdf95a87adc31e6b4a39cae5391ed945a) Thanks [@jerelmiller](https://github.com/jerelmiller)! - `client.mutate` now returns a `MutateResult` instead of `FetchResult`. As a result, the `errors` property has been removed in favor of `error` which is set if either a network error occured or GraphQL errors are returned from the server.
|
|
14
|
+
|
|
15
|
+
`useMutation` now also returns a `MutateResult` instead of a `FetchResult`.
|
|
16
|
+
|
|
17
|
+
- [#12475](https://github.com/apollographql/apollo-client/pull/12475) [`3de63eb`](https://github.com/apollographql/apollo-client/commit/3de63ebcdf95a87adc31e6b4a39cae5391ed945a) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Mutations no longer report errors if the GraphQL result from the server contains an empty array of errors.
|
|
18
|
+
|
|
19
|
+
- [#12476](https://github.com/apollographql/apollo-client/pull/12476) [`6afff60`](https://github.com/apollographql/apollo-client/commit/6afff60beece953406af2cbe07f7ccbf973cadaa) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Unify error behavior on subscriptions for GraphQL errors and network errors by ensuring network errors are subject to the `errorPolicy`. Network errors that terminate the connection will now be emitted on the `error` property passed to the `next` callback followed by a call to the `complete` callback.
|
|
20
|
+
|
|
21
|
+
- [#12478](https://github.com/apollographql/apollo-client/pull/12478) [`5ea6a45`](https://github.com/apollographql/apollo-client/commit/5ea6a45b3ec2f0d526abe78ae03c42bb519f87c7) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Remove deprecated `onSubscriptionData` and `onSubscriptionComplete` callbacks from `useSubscription`. Use `onData` and `onComplete` instead.
|
|
22
|
+
|
|
23
|
+
- [#12476](https://github.com/apollographql/apollo-client/pull/12476) [`6afff60`](https://github.com/apollographql/apollo-client/commit/6afff60beece953406af2cbe07f7ccbf973cadaa) Thanks [@jerelmiller](https://github.com/jerelmiller)! - GraphQL errors or network errors emitted while using an `errorPolicy` of `ignore` in subscriptions will no longer emit a result if there is no `data` emitted along with the error.
|
|
24
|
+
|
|
25
|
+
- [#12476](https://github.com/apollographql/apollo-client/pull/12476) [`6afff60`](https://github.com/apollographql/apollo-client/commit/6afff60beece953406af2cbe07f7ccbf973cadaa) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Subscriptions no longer emit errors in the `error` callback and instead provide errors on the `error` property on the result passed to the `next` callback. As a result, errors will no longer automatically terminate the connection allowing additional results to be emitted when the connection stays open.
|
|
26
|
+
|
|
27
|
+
When an error terminates the downstream connection, a `next` event will be emitted with an `error` property followed by a `complete` event instead.
|
|
28
|
+
|
|
29
|
+
### Minor Changes
|
|
30
|
+
|
|
31
|
+
- [#12487](https://github.com/apollographql/apollo-client/pull/12487) [`b695e5e`](https://github.com/apollographql/apollo-client/commit/b695e5e10ab0eb47948e914b610f67c40267349e) Thanks [@phryneas](https://github.com/phryneas)! - Split out SSR-specific code from useQuery hook, remove RenderPromises
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- [#12487](https://github.com/apollographql/apollo-client/pull/12487) [`b695e5e`](https://github.com/apollographql/apollo-client/commit/b695e5e10ab0eb47948e914b610f67c40267349e) Thanks [@phryneas](https://github.com/phryneas)! - `useQuery` with `ssr: false` - previously, `skip` had a higher priortity than `ssr: false` while `ssr: false` had a higher priority than `fetchPolicy: "standby"` (which is roughly equivalent to `skip`).
|
|
36
|
+
|
|
37
|
+
This priority has been adjusted so now both `skip` and `fetchPolicy: "standby"` have a higher priority than `ssr: false` and will return `loading: false`, while `ssr: false` will only come after those and will return `loading: true` if those are not set.
|
|
38
|
+
|
|
39
|
+
- [#12475](https://github.com/apollographql/apollo-client/pull/12475) [`3de63eb`](https://github.com/apollographql/apollo-client/commit/3de63ebcdf95a87adc31e6b4a39cae5391ed945a) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue where passing `onError` to `useMutation` would resolve the promise returned by the `mutate` function instead of rejecting when using an `errorPolicy` of `none`.
|
|
40
|
+
|
|
41
|
+
- [#12475](https://github.com/apollographql/apollo-client/pull/12475) [`3de63eb`](https://github.com/apollographql/apollo-client/commit/3de63ebcdf95a87adc31e6b4a39cae5391ed945a) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix an issue where additional response properties were returned on the result returned from `client.mutate`, such as `@defer` payload fields. These properties are now stripped out to correspond to the TypeScript type.
|
|
42
|
+
|
|
3
43
|
## 4.0.0-alpha.4
|
|
4
44
|
|
|
5
45
|
### 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(93, 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", 79);
|
|
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(80, 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(81, 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, 82, 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, 83, 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(84, 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(85, (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)(86);
|
|
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)(87, 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
|
+
88,
|
|
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)(89, 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(90, (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)(91, 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(92, 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 "
|
|
@@ -81,7 +81,7 @@ class ApolloClient {
|
|
|
81
81
|
*/
|
|
82
82
|
constructor(options) {
|
|
83
83
|
if (!options.cache) {
|
|
84
|
-
throw (0, invariant_1.newInvariantError)(
|
|
84
|
+
throw (0, invariant_1.newInvariantError)(58);
|
|
85
85
|
}
|
|
86
86
|
const { uri, credentials, headers, cache, documentTransform, ssrMode = false, ssrForceFetchDelay = 0,
|
|
87
87
|
// Expose the client instance as window.__APOLLO_CLIENT__ and call
|
|
@@ -245,7 +245,7 @@ class ApolloClient {
|
|
|
245
245
|
if (this.defaultOptions.query) {
|
|
246
246
|
options = (0, utilities_1.mergeOptions)(this.defaultOptions.query, options);
|
|
247
247
|
}
|
|
248
|
-
(0, invariant_1.invariant)(options.fetchPolicy !== "cache-and-network",
|
|
248
|
+
(0, invariant_1.invariant)(options.fetchPolicy !== "cache-and-network", 59);
|
|
249
249
|
return this.queryManager.query(options);
|
|
250
250
|
}
|
|
251
251
|
/**
|
|
@@ -465,7 +465,7 @@ class ApolloClient {
|
|
|
465
465
|
// result.queries and result.results instead, you shouldn't have to worry
|
|
466
466
|
// about preventing uncaught rejections for the Promise.all result.
|
|
467
467
|
result.catch((error) => {
|
|
468
|
-
__DEV__ && invariant_1.invariant.debug(
|
|
468
|
+
__DEV__ && invariant_1.invariant.debug(60, error);
|
|
469
469
|
});
|
|
470
470
|
return result;
|
|
471
471
|
}
|