@apollo/client 3.11.8 → 3.12.0-alpha.0

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 (183) hide show
  1. package/.changeset/nasty-camels-pay.md +36 -0
  2. package/.changeset/pre.json +10 -0
  3. package/CHANGELOG.md +37 -0
  4. package/apollo-client.cjs +435 -108
  5. package/apollo-client.cjs.map +1 -1
  6. package/apollo-client.min.cjs +1 -1
  7. package/cache/cache.cjs +218 -22
  8. package/cache/cache.cjs.map +1 -1
  9. package/cache/cache.cjs.native.js +218 -22
  10. package/cache/core/cache.d.ts +13 -10
  11. package/cache/core/cache.js +32 -14
  12. package/cache/core/cache.js.map +1 -1
  13. package/cache/core/types/Cache.d.ts +2 -1
  14. package/cache/core/types/Cache.js.map +1 -1
  15. package/cache/core/types/DataProxy.d.ts +4 -3
  16. package/cache/core/types/DataProxy.js.map +1 -1
  17. package/cache/inmemory/entityStore.js +3 -3
  18. package/cache/inmemory/inMemoryCache.d.ts +3 -1
  19. package/cache/inmemory/inMemoryCache.js +7 -0
  20. package/cache/inmemory/inMemoryCache.js.map +1 -1
  21. package/cache/inmemory/key-extractor.js +1 -1
  22. package/cache/inmemory/policies.js +4 -4
  23. package/cache/inmemory/readFromStore.js +2 -2
  24. package/cache/inmemory/writeToStore.js +4 -4
  25. package/core/ApolloClient.d.ts +14 -6
  26. package/core/ApolloClient.js +14 -6
  27. package/core/ApolloClient.js.map +1 -1
  28. package/core/LocalState.js +2 -2
  29. package/core/ObservableQuery.d.ts +17 -14
  30. package/core/ObservableQuery.js +29 -16
  31. package/core/ObservableQuery.js.map +1 -1
  32. package/core/QueryInfo.js.map +1 -1
  33. package/core/QueryManager.d.ts +18 -3
  34. package/core/QueryManager.js +39 -14
  35. package/core/QueryManager.js.map +1 -1
  36. package/core/core.cjs +285 -37
  37. package/core/core.cjs.map +1 -1
  38. package/core/core.cjs.native.js +285 -37
  39. package/core/index.d.ts +1 -0
  40. package/core/index.js.map +1 -1
  41. package/core/masking.d.ts +4 -0
  42. package/core/masking.js +212 -0
  43. package/core/masking.js.map +1 -0
  44. package/core/types.d.ts +3 -2
  45. package/core/types.js.map +1 -1
  46. package/core/watchQueryOptions.d.ts +8 -6
  47. package/core/watchQueryOptions.js.map +1 -1
  48. package/dev/dev.cjs +131 -87
  49. package/dev/dev.cjs.map +1 -1
  50. package/dev/dev.cjs.native.js +131 -87
  51. package/invariantErrorCodes.js +140 -86
  52. package/link/core/ApolloLink.js +2 -2
  53. package/link/core/core.cjs +2 -2
  54. package/link/core/core.cjs.map +1 -1
  55. package/link/core/core.cjs.native.js +2 -2
  56. package/link/http/checkFetcher.js +1 -1
  57. package/link/http/createHttpLink.js +1 -1
  58. package/link/http/http.cjs +3 -3
  59. package/link/http/http.cjs.map +1 -1
  60. package/link/http/http.cjs.native.js +3 -3
  61. package/link/http/serializeFetchParameter.js +1 -1
  62. package/link/persisted-queries/index.js +2 -2
  63. package/link/persisted-queries/persisted-queries.cjs +2 -2
  64. package/link/persisted-queries/persisted-queries.cjs.map +1 -1
  65. package/link/persisted-queries/persisted-queries.cjs.native.js +2 -2
  66. package/link/utils/toPromise.js +1 -1
  67. package/link/utils/utils.cjs +2 -2
  68. package/link/utils/utils.cjs.map +1 -1
  69. package/link/utils/utils.cjs.native.js +2 -2
  70. package/link/utils/validateOperation.js +1 -1
  71. package/masking/index.d.ts +2 -0
  72. package/masking/index.js +2 -0
  73. package/masking/index.js.map +1 -0
  74. package/masking/internal/types.d.ts +15 -0
  75. package/masking/internal/types.js +2 -0
  76. package/masking/internal/types.js.map +1 -0
  77. package/masking/masking.cjs +3 -0
  78. package/masking/masking.cjs.map +1 -0
  79. package/masking/masking.cjs.native.js +3 -0
  80. package/masking/masking.d.cts +1 -0
  81. package/masking/package.json +8 -0
  82. package/masking/types.d.ts +44 -0
  83. package/masking/types.js +2 -0
  84. package/masking/types.js.map +1 -0
  85. package/package.json +2 -1
  86. package/react/context/ApolloConsumer.js +1 -1
  87. package/react/context/ApolloContext.js +1 -1
  88. package/react/context/ApolloProvider.js +1 -1
  89. package/react/context/context.cjs +3 -3
  90. package/react/context/context.cjs.map +1 -1
  91. package/react/context/context.cjs.native.js +3 -3
  92. package/react/hoc/hoc-utils.js +1 -1
  93. package/react/hoc/hoc.cjs +2 -2
  94. package/react/hoc/hoc.cjs.map +1 -1
  95. package/react/hoc/hoc.cjs.native.js +2 -2
  96. package/react/hoc/withApollo.js +1 -1
  97. package/react/hooks/hooks.cjs +24 -16
  98. package/react/hooks/hooks.cjs.map +1 -1
  99. package/react/hooks/hooks.cjs.native.js +24 -16
  100. package/react/hooks/useApolloClient.js +1 -1
  101. package/react/hooks/useFragment.d.ts +4 -3
  102. package/react/hooks/useFragment.js +12 -5
  103. package/react/hooks/useFragment.js.map +1 -1
  104. package/react/hooks/useLazyQuery.js +1 -1
  105. package/react/hooks/useLazyQuery.js.map +1 -1
  106. package/react/hooks/useLoadableQuery.js +2 -2
  107. package/react/hooks/useQuery.d.ts +4 -3
  108. package/react/hooks/useQuery.js +2 -1
  109. package/react/hooks/useQuery.js.map +1 -1
  110. package/react/hooks/useReadQuery.d.ts +2 -1
  111. package/react/hooks/useReadQuery.js.map +1 -1
  112. package/react/hooks/useSubscription.d.ts +2 -1
  113. package/react/hooks/useSubscription.js +3 -3
  114. package/react/hooks/useSubscription.js.map +1 -1
  115. package/react/hooks/useSuspenseQuery.d.ts +6 -5
  116. package/react/hooks/useSuspenseQuery.js +2 -2
  117. package/react/hooks/useSuspenseQuery.js.map +1 -1
  118. package/react/hooks/useSyncExternalStore.js +1 -1
  119. package/react/internal/cache/QueryReference.d.ts +5 -4
  120. package/react/internal/cache/QueryReference.js +1 -1
  121. package/react/internal/cache/QueryReference.js.map +1 -1
  122. package/react/internal/internal.cjs +2 -2
  123. package/react/internal/internal.cjs.map +1 -1
  124. package/react/internal/internal.cjs.native.js +2 -2
  125. package/react/parser/index.js +5 -5
  126. package/react/parser/parser.cjs +5 -5
  127. package/react/parser/parser.cjs.map +1 -1
  128. package/react/parser/parser.cjs.native.js +5 -5
  129. package/react/types/types.d.ts +18 -42
  130. package/react/types/types.js.map +1 -1
  131. package/testing/core/core.cjs +3 -3
  132. package/testing/core/core.cjs.map +1 -1
  133. package/testing/core/core.cjs.native.js +3 -3
  134. package/testing/core/mocking/mockLink.d.ts +3 -2
  135. package/testing/core/mocking/mockLink.js +3 -3
  136. package/testing/core/mocking/mockLink.js.map +1 -1
  137. package/testing/core/mocking/mockQueryManager.d.ts +1 -0
  138. package/testing/core/mocking/mockQueryManager.js +1 -1
  139. package/testing/core/mocking/mockQueryManager.js.map +1 -1
  140. package/testing/internal/disposables/index.d.ts +1 -0
  141. package/testing/internal/disposables/index.js +1 -0
  142. package/testing/internal/disposables/index.js.map +1 -1
  143. package/testing/internal/disposables/withProdMode.d.ts +4 -0
  144. package/testing/internal/disposables/withProdMode.js +10 -0
  145. package/testing/internal/disposables/withProdMode.js.map +1 -0
  146. package/testing/internal/scenarios/index.d.ts +28 -0
  147. package/testing/internal/scenarios/index.js +18 -2
  148. package/testing/internal/scenarios/index.js.map +1 -1
  149. package/utilities/common/maybeDeepFreeze.d.ts +1 -0
  150. package/utilities/common/maybeDeepFreeze.js +1 -1
  151. package/utilities/common/maybeDeepFreeze.js.map +1 -1
  152. package/utilities/globals/globals.cjs +1 -1
  153. package/utilities/globals/globals.cjs.map +1 -1
  154. package/utilities/globals/globals.cjs.native.js +1 -1
  155. package/utilities/graphql/DocumentTransform.js +1 -1
  156. package/utilities/graphql/directives.d.ts +3 -1
  157. package/utilities/graphql/directives.js +39 -5
  158. package/utilities/graphql/directives.js.map +1 -1
  159. package/utilities/graphql/fragments.js +3 -3
  160. package/utilities/graphql/getFromAST.js +8 -8
  161. package/utilities/graphql/storeUtils.js +1 -1
  162. package/utilities/graphql/transform.d.ts +1 -0
  163. package/utilities/graphql/transform.js +15 -2
  164. package/utilities/graphql/transform.js.map +1 -1
  165. package/utilities/index.d.ts +7 -3
  166. package/utilities/index.js +4 -3
  167. package/utilities/index.js.map +1 -1
  168. package/utilities/promises/preventUnhandledRejection.d.ts +2 -0
  169. package/utilities/promises/preventUnhandledRejection.js +5 -0
  170. package/utilities/promises/preventUnhandledRejection.js.map +1 -0
  171. package/utilities/types/NoInfer.d.ts +27 -0
  172. package/utilities/types/NoInfer.js +2 -0
  173. package/utilities/types/NoInfer.js.map +1 -0
  174. package/utilities/types/Prettify.d.ts +4 -0
  175. package/utilities/types/Prettify.js +2 -0
  176. package/utilities/types/Prettify.js.map +1 -0
  177. package/utilities/types/UnionToIntersection.d.ts +2 -0
  178. package/utilities/types/UnionToIntersection.js +2 -0
  179. package/utilities/types/UnionToIntersection.js.map +1 -0
  180. package/utilities/utilities.cjs +73 -19
  181. package/utilities/utilities.cjs.map +1 -1
  182. package/utilities/utilities.cjs.native.js +73 -19
  183. package/version.js +1 -1
@@ -0,0 +1,36 @@
1
+ ---
2
+ "@apollo/client": minor
3
+ ---
4
+
5
+ Introduces data masking into Apollo Client. Data masking allows components to access only the data they asked for through GraphQL fragments. This prevents coupling between components that might otherwise implicitly rely on fields not requested by the component. Data masking also provides the benefit that masked fields only rerender components that ask for the field.
6
+
7
+ To enable data masking in Apollo Client, set the `dataMasking` option to `true`.
8
+
9
+ ```ts
10
+ new ApolloClient({
11
+ dataMasking: true,
12
+ // ... other options
13
+ })
14
+ ```
15
+
16
+ You can selectively disable data masking using the `@unmask` directive. Apply this to any named fragment to receive all fields requested by the fragment.
17
+
18
+ ```graphql
19
+ query {
20
+ user {
21
+ id
22
+ ...UserFields @unmask
23
+ }
24
+ }
25
+ ```
26
+
27
+ To help with migration, use the `@unmask` migrate mode which will add warnings when accessing fields that would otherwise be masked.
28
+
29
+ ```graphql
30
+ query {
31
+ user {
32
+ id
33
+ ...UserFields @unmask(mode: "migrate")
34
+ }
35
+ }
36
+ ```
@@ -0,0 +1,10 @@
1
+ {
2
+ "mode": "pre",
3
+ "tag": "alpha",
4
+ "initialVersions": {
5
+ "@apollo/client": "3.11.5"
6
+ },
7
+ "changesets": [
8
+ "nasty-camels-pay"
9
+ ]
10
+ }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # @apollo/client
2
2
 
3
+ ## 3.12.0-alpha.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#12042](https://github.com/apollographql/apollo-client/pull/12042) [`1c0ecbf`](https://github.com/apollographql/apollo-client/commit/1c0ecbf3c0454056853dd3dcb493dfd5fa1a96b1) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Introduces data masking into Apollo Client. Data masking allows components to access only the data they asked for through GraphQL fragments. This prevents coupling between components that might otherwise implicitly rely on fields not requested by the component. Data masking also provides the benefit that masked fields only rerender components that ask for the field.
8
+
9
+ To enable data masking in Apollo Client, set the `dataMasking` option to `true`.
10
+
11
+ ```ts
12
+ new ApolloClient({
13
+ dataMasking: true,
14
+ // ... other options
15
+ });
16
+ ```
17
+
18
+ You can selectively disable data masking using the `@unmask` directive. Apply this to any named fragment to receive all fields requested by the fragment.
19
+
20
+ ```graphql
21
+ query {
22
+ user {
23
+ id
24
+ ...UserFields @unmask
25
+ }
26
+ }
27
+ ```
28
+
29
+ To help with migration, use the `@unmask` migrate mode which will add warnings when accessing fields that would otherwise be masked.
30
+
31
+ ```graphql
32
+ query {
33
+ user {
34
+ id
35
+ ...UserFields @unmask(mode: "migrate")
36
+ }
37
+ }
38
+ ```
39
+
3
40
  ## 3.11.8
4
41
 
5
42
  ### Patch Changes