@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.
Files changed (168) hide show
  1. package/.changeset/eleven-kangaroos-jump.md +5 -0
  2. package/.changeset/forty-shrimps-fry.md +5 -0
  3. package/.changeset/grumpy-vans-type.md +5 -0
  4. package/.changeset/little-spoons-kick.md +7 -0
  5. package/.changeset/loud-cows-raise.md +7 -0
  6. package/.changeset/many-buses-allow.md +5 -0
  7. package/.changeset/poor-eels-punch.md +5 -0
  8. package/.changeset/pre.json +13 -0
  9. package/.changeset/real-teachers-peel.md +5 -0
  10. package/.changeset/slimy-chicken-melt.md +5 -0
  11. package/.changeset/thick-books-grin.md +5 -0
  12. package/.changeset/tough-rockets-allow.md +5 -0
  13. package/.changeset/tricky-tables-shave.md +5 -0
  14. package/.changeset/warm-ties-sit.md +7 -0
  15. package/CHANGELOG.md +40 -0
  16. package/__cjs/cache/core/cache.cjs +1 -1
  17. package/__cjs/cache/inmemory/entityStore.cjs +3 -3
  18. package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
  19. package/__cjs/cache/inmemory/policies.cjs +4 -4
  20. package/__cjs/cache/inmemory/readFromStore.cjs +2 -2
  21. package/__cjs/cache/inmemory/writeToStore.cjs +4 -4
  22. package/__cjs/core/ApolloClient.cjs +3 -3
  23. package/__cjs/core/ApolloClient.cjs.map +1 -1
  24. package/__cjs/core/ApolloClient.d.cts +4 -4
  25. package/__cjs/core/LocalState.cjs +2 -2
  26. package/__cjs/core/ObservableQuery.cjs +15 -12
  27. package/__cjs/core/ObservableQuery.cjs.map +1 -1
  28. package/__cjs/core/QueryManager.cjs +57 -35
  29. package/__cjs/core/QueryManager.cjs.map +1 -1
  30. package/__cjs/core/QueryManager.d.cts +3 -3
  31. package/__cjs/core/types.d.cts +32 -0
  32. package/__cjs/invariantErrorCodes.cjs +57 -77
  33. package/__cjs/link/core/ApolloLink.cjs +2 -2
  34. package/__cjs/link/http/checkFetcher.cjs +1 -1
  35. package/__cjs/link/http/createHttpLink.cjs +1 -1
  36. package/__cjs/link/http/parseAndCheckHttpResponse.cjs +1 -1
  37. package/__cjs/link/http/serializeFetchParameter.cjs +1 -1
  38. package/__cjs/link/persisted-queries/index.cjs +2 -2
  39. package/__cjs/link/utils/validateOperation.cjs +1 -1
  40. package/__cjs/masking/maskDefinition.cjs +2 -2
  41. package/__cjs/masking/maskFragment.cjs +2 -2
  42. package/__cjs/masking/maskOperation.cjs +1 -1
  43. package/__cjs/masking/utils.cjs +1 -1
  44. package/__cjs/react/context/ApolloConsumer.cjs +1 -1
  45. package/__cjs/react/context/ApolloContext.cjs +1 -1
  46. package/__cjs/react/context/ApolloContext.cjs.map +1 -1
  47. package/__cjs/react/context/ApolloContext.d.cts +2 -2
  48. package/__cjs/react/context/ApolloProvider.cjs +1 -1
  49. package/__cjs/react/hooks/internal/wrapHook.cjs +26 -5
  50. package/__cjs/react/hooks/internal/wrapHook.cjs.map +1 -1
  51. package/__cjs/react/hooks/internal/wrapHook.d.cts +3 -1
  52. package/__cjs/react/hooks/useMutation.cjs +14 -19
  53. package/__cjs/react/hooks/useMutation.cjs.map +1 -1
  54. package/__cjs/react/hooks/useMutation.d.cts +4 -4
  55. package/__cjs/react/hooks/useQuery.cjs +82 -187
  56. package/__cjs/react/hooks/useQuery.cjs.map +1 -1
  57. package/__cjs/react/hooks/useQuery.d.cts +4 -0
  58. package/__cjs/react/hooks/useSubscription.cjs +8 -57
  59. package/__cjs/react/hooks/useSubscription.cjs.map +1 -1
  60. package/__cjs/react/hooks/useSubscription.d.cts +6 -42
  61. package/__cjs/react/hooks/useSuspenseQuery.cjs +2 -2
  62. package/__cjs/react/hooks/useSyncExternalStore.cjs +1 -1
  63. package/__cjs/react/internal/index.cjs +3 -1
  64. package/__cjs/react/internal/index.cjs.map +1 -1
  65. package/__cjs/react/internal/index.d.cts +1 -0
  66. package/__cjs/react/ssr/getDataFromTree.cjs +43 -12
  67. package/__cjs/react/ssr/getDataFromTree.cjs.map +1 -1
  68. package/__cjs/react/ssr/getDataFromTree.d.cts +5 -0
  69. package/__cjs/react/ssr/index.cjs +1 -3
  70. package/__cjs/react/ssr/index.cjs.map +1 -1
  71. package/__cjs/react/ssr/index.d.cts +0 -1
  72. package/__cjs/react/ssr/useSSRQuery.cjs +60 -0
  73. package/__cjs/react/ssr/useSSRQuery.cjs.map +1 -0
  74. package/__cjs/react/ssr/useSSRQuery.d.cts +5 -0
  75. package/__cjs/react/types/deprecated.d.cts +1 -1
  76. package/__cjs/react/types/types.documentation.d.cts +4 -12
  77. package/__cjs/testing/matchers/index.cjs +2 -0
  78. package/__cjs/testing/matchers/index.cjs.map +1 -1
  79. package/__cjs/testing/matchers/toEmitStrictTyped.cjs +42 -0
  80. package/__cjs/testing/matchers/toEmitStrictTyped.cjs.map +1 -0
  81. package/__cjs/testing/matchers/toEmitStrictTyped.d.cts +7 -0
  82. package/__cjs/testing/matchers/toEqualStrictTyped.cjs +2 -20
  83. package/__cjs/testing/matchers/toEqualStrictTyped.cjs.map +1 -1
  84. package/__cjs/testing/matchers/utils/getSerializableProperties.cjs +23 -0
  85. package/__cjs/testing/matchers/utils/getSerializableProperties.cjs.map +1 -0
  86. package/__cjs/testing/matchers/utils/getSerializableProperties.d.cts +2 -0
  87. package/__cjs/version.cjs +1 -1
  88. package/__cjs/version.d.cts +1 -1
  89. package/cache/core/cache.js +1 -1
  90. package/cache/inmemory/entityStore.js +3 -3
  91. package/cache/inmemory/key-extractor.js +1 -1
  92. package/cache/inmemory/policies.js +4 -4
  93. package/cache/inmemory/readFromStore.js +2 -2
  94. package/cache/inmemory/writeToStore.js +4 -4
  95. package/core/ApolloClient.d.ts +4 -4
  96. package/core/ApolloClient.js +3 -3
  97. package/core/ApolloClient.js.map +1 -1
  98. package/core/LocalState.js +2 -2
  99. package/core/ObservableQuery.js +15 -12
  100. package/core/ObservableQuery.js.map +1 -1
  101. package/core/QueryManager.d.ts +3 -3
  102. package/core/QueryManager.js +58 -36
  103. package/core/QueryManager.js.map +1 -1
  104. package/core/types.d.ts +32 -0
  105. package/invariantErrorCodes.js +57 -77
  106. package/link/core/ApolloLink.js +2 -2
  107. package/link/http/checkFetcher.js +1 -1
  108. package/link/http/createHttpLink.js +1 -1
  109. package/link/http/parseAndCheckHttpResponse.js +1 -1
  110. package/link/http/serializeFetchParameter.js +1 -1
  111. package/link/persisted-queries/index.js +2 -2
  112. package/link/utils/validateOperation.js +1 -1
  113. package/masking/maskDefinition.js +2 -2
  114. package/masking/maskFragment.js +2 -2
  115. package/masking/maskOperation.js +1 -1
  116. package/masking/utils.js +1 -1
  117. package/package.json +1 -1
  118. package/react/context/ApolloConsumer.js +1 -1
  119. package/react/context/ApolloContext.d.ts +2 -2
  120. package/react/context/ApolloContext.js +1 -1
  121. package/react/context/ApolloContext.js.map +1 -1
  122. package/react/context/ApolloProvider.js +1 -1
  123. package/react/hooks/internal/wrapHook.d.ts +3 -1
  124. package/react/hooks/internal/wrapHook.js +24 -5
  125. package/react/hooks/internal/wrapHook.js.map +1 -1
  126. package/react/hooks/useMutation.d.ts +4 -4
  127. package/react/hooks/useMutation.js +14 -19
  128. package/react/hooks/useMutation.js.map +1 -1
  129. package/react/hooks/useQuery.d.ts +4 -0
  130. package/react/hooks/useQuery.js +83 -188
  131. package/react/hooks/useQuery.js.map +1 -1
  132. package/react/hooks/useSubscription.d.ts +6 -42
  133. package/react/hooks/useSubscription.js +7 -53
  134. package/react/hooks/useSubscription.js.map +1 -1
  135. package/react/hooks/useSuspenseQuery.js +2 -2
  136. package/react/hooks/useSyncExternalStore.js +1 -1
  137. package/react/internal/index.d.ts +1 -0
  138. package/react/internal/index.js +2 -1
  139. package/react/internal/index.js.map +1 -1
  140. package/react/ssr/getDataFromTree.d.ts +5 -0
  141. package/react/ssr/getDataFromTree.js +43 -12
  142. package/react/ssr/getDataFromTree.js.map +1 -1
  143. package/react/ssr/index.d.ts +0 -1
  144. package/react/ssr/index.js +0 -1
  145. package/react/ssr/index.js.map +1 -1
  146. package/react/ssr/useSSRQuery.d.ts +5 -0
  147. package/react/ssr/useSSRQuery.js +56 -0
  148. package/react/ssr/useSSRQuery.js.map +1 -0
  149. package/react/types/deprecated.d.ts +1 -1
  150. package/react/types/types.documentation.d.ts +4 -12
  151. package/testing/matchers/index.js +2 -0
  152. package/testing/matchers/index.js.map +1 -1
  153. package/testing/matchers/toEmitStrictTyped.d.ts +7 -0
  154. package/testing/matchers/toEmitStrictTyped.js +38 -0
  155. package/testing/matchers/toEmitStrictTyped.js.map +1 -0
  156. package/testing/matchers/toEqualStrictTyped.js +1 -19
  157. package/testing/matchers/toEqualStrictTyped.js.map +1 -1
  158. package/testing/matchers/utils/getSerializableProperties.d.ts +2 -0
  159. package/testing/matchers/utils/getSerializableProperties.js +20 -0
  160. package/testing/matchers/utils/getSerializableProperties.js.map +1 -0
  161. package/version.d.ts +1 -1
  162. package/version.js +1 -1
  163. package/__cjs/react/ssr/RenderPromises.cjs +0 -104
  164. package/__cjs/react/ssr/RenderPromises.cjs.map +0 -1
  165. package/__cjs/react/ssr/RenderPromises.d.cts +0 -25
  166. package/react/ssr/RenderPromises.d.ts +0 -25
  167. package/react/ssr/RenderPromises.js +0 -100
  168. package/react/ssr/RenderPromises.js.map +0 -1
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@apollo/client": major
3
+ ---
4
+
5
+ Remove `variables` from the result returned from `useSubscription`.
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@apollo/client": major
3
+ ---
4
+
5
+ Subscriptions now emit a `SubscribeResult` instead of a `FetchResult`. As a result, the `errors` field has been removed in favor of `error`.
@@ -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.
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@apollo/client": patch
3
+ ---
4
+
5
+ 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`.
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@apollo/client": major
3
+ ---
4
+
5
+ Mutations no longer report errors if the GraphQL result from the server contains an empty array of errors.
@@ -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,5 @@
1
+ ---
2
+ "@apollo/client": major
3
+ ---
4
+
5
+ Remove deprecated `onSubscriptionData` and `onSubscriptionComplete` callbacks from `useSubscription`. Use `onData` and `onComplete` instead.
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@apollo/client": minor
3
+ ---
4
+
5
+ Split out SSR-specific code from useQuery hook, remove RenderPromises
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@apollo/client": patch
3
+ ---
4
+
5
+ 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.
@@ -0,0 +1,5 @@
1
+ ---
2
+ "@apollo/client": major
3
+ ---
4
+
5
+ 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.
@@ -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, actualFragmentName);
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", 83);
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(84, ref);
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(85, someNonReference);
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, 86, schemaKeyPath.join("."), object);
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, 87, 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(88, typename, supertype);
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(89, (0, utilities_1.stringifyForDisplay)(Array.from(readFieldArgs)));
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)(90);
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)(91, selection.name.value);
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
- 92,
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)(93, result);
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(94, (0, utilities_1.resultKeyNameFromField)(field), result);
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)(95, selection.name.value);
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(96, fieldName, parentType, childTypenames.length ?
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)(62);
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", 63);
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(64, error);
468
+ __DEV__ && invariant_1.invariant.debug(60, error);
469
469
  });
470
470
  return result;
471
471
  }