@apollo/client 3.11.9 → 3.11.11-rc.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.
- package/.changeset/early-bobcats-eat.md +5 -0
- package/.changeset/flat-beans-knock.md +15 -0
- package/.changeset/kind-toys-tie.md +5 -0
- package/.changeset/nasty-camels-pay.md +36 -0
- package/.changeset/nervous-owls-hear.md +5 -0
- package/.changeset/pre.json +14 -0
- package/CHANGELOG.md +65 -0
- package/apollo-client.cjs +503 -120
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +237 -31
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +237 -31
- package/cache/core/cache.d.ts +13 -10
- package/cache/core/cache.js +32 -14
- package/cache/core/cache.js.map +1 -1
- package/cache/core/types/Cache.d.ts +2 -1
- package/cache/core/types/Cache.js.map +1 -1
- package/cache/core/types/DataProxy.d.ts +4 -3
- package/cache/core/types/DataProxy.js.map +1 -1
- package/cache/inmemory/entityStore.js +3 -3
- package/cache/inmemory/inMemoryCache.d.ts +3 -1
- package/cache/inmemory/inMemoryCache.js +7 -0
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/key-extractor.js +1 -1
- package/cache/inmemory/policies.js +16 -13
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/readFromStore.js +2 -2
- package/cache/inmemory/writeToStore.js +4 -4
- package/core/ApolloClient.d.ts +14 -6
- package/core/ApolloClient.js +20 -8
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.js +2 -2
- package/core/ObservableQuery.d.ts +17 -14
- package/core/ObservableQuery.js +31 -16
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +22 -4
- package/core/QueryManager.js +63 -14
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +324 -39
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +324 -39
- package/core/index.d.ts +1 -0
- package/core/index.js.map +1 -1
- package/core/masking.d.ts +10 -0
- package/core/masking.js +230 -0
- package/core/masking.js.map +1 -0
- package/core/types.d.ts +3 -2
- package/core/types.js.map +1 -1
- package/core/watchQueryOptions.d.ts +8 -6
- package/core/watchQueryOptions.js.map +1 -1
- package/dev/dev.cjs +136 -88
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +136 -88
- package/invariantErrorCodes.js +146 -87
- package/link/core/ApolloLink.js +2 -2
- package/link/core/core.cjs +2 -2
- package/link/core/core.cjs.map +1 -1
- package/link/core/core.cjs.native.js +2 -2
- package/link/http/checkFetcher.js +1 -1
- package/link/http/createHttpLink.js +1 -1
- package/link/http/http.cjs +3 -3
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +3 -3
- package/link/http/serializeFetchParameter.js +1 -1
- package/link/persisted-queries/index.js +2 -2
- package/link/persisted-queries/index.js.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs +2 -2
- package/link/persisted-queries/persisted-queries.cjs.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.native.js +2 -2
- package/link/utils/toPromise.js +1 -1
- package/link/utils/utils.cjs +2 -2
- package/link/utils/utils.cjs.map +1 -1
- package/link/utils/utils.cjs.native.js +2 -2
- package/link/utils/validateOperation.js +1 -1
- package/masking/index.d.ts +2 -0
- package/masking/index.js +2 -0
- package/masking/index.js.map +1 -0
- package/masking/internal/types.d.ts +15 -0
- package/masking/internal/types.js +2 -0
- package/masking/internal/types.js.map +1 -0
- package/masking/masking.cjs +3 -0
- package/masking/masking.cjs.map +1 -0
- package/masking/masking.cjs.native.js +3 -0
- package/masking/masking.d.cts +1 -0
- package/masking/package.json +8 -0
- package/masking/types.d.ts +44 -0
- package/masking/types.js +2 -0
- package/masking/types.js.map +1 -0
- package/package.json +2 -2
- package/react/context/ApolloConsumer.js +1 -1
- package/react/context/ApolloContext.js +1 -1
- package/react/context/ApolloProvider.js +1 -1
- package/react/context/context.cjs +3 -3
- package/react/context/context.cjs.map +1 -1
- package/react/context/context.cjs.native.js +3 -3
- package/react/hoc/hoc-utils.js +1 -1
- package/react/hoc/hoc.cjs +2 -2
- package/react/hoc/hoc.cjs.map +1 -1
- package/react/hoc/hoc.cjs.native.js +2 -2
- package/react/hoc/withApollo.js +1 -1
- package/react/hooks/hooks.cjs +24 -16
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +24 -16
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useFragment.d.ts +4 -3
- package/react/hooks/useFragment.js +12 -5
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useLazyQuery.js +1 -1
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useLoadableQuery.js +2 -2
- package/react/hooks/useQuery.d.ts +4 -3
- package/react/hooks/useQuery.js +2 -1
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useReadQuery.d.ts +2 -1
- package/react/hooks/useReadQuery.js.map +1 -1
- package/react/hooks/useSubscription.d.ts +2 -1
- package/react/hooks/useSubscription.js +3 -3
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseQuery.d.ts +6 -5
- package/react/hooks/useSuspenseQuery.js +2 -2
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/hooks/useSyncExternalStore.js +1 -1
- package/react/internal/cache/QueryReference.d.ts +5 -4
- package/react/internal/cache/QueryReference.js +1 -1
- package/react/internal/cache/QueryReference.js.map +1 -1
- package/react/internal/internal.cjs +2 -2
- package/react/internal/internal.cjs.map +1 -1
- package/react/internal/internal.cjs.native.js +2 -2
- package/react/parser/index.js +5 -5
- package/react/parser/parser.cjs +5 -5
- package/react/parser/parser.cjs.map +1 -1
- package/react/parser/parser.cjs.native.js +5 -5
- package/react/types/types.d.ts +18 -42
- package/react/types/types.js.map +1 -1
- package/testing/core/core.cjs +3 -3
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +3 -3
- package/testing/core/mocking/mockLink.d.ts +3 -2
- package/testing/core/mocking/mockLink.js +3 -3
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/testing/core/mocking/mockQueryManager.d.ts +1 -0
- package/testing/core/mocking/mockQueryManager.js +1 -1
- package/testing/core/mocking/mockQueryManager.js.map +1 -1
- package/testing/internal/disposables/index.d.ts +1 -0
- package/testing/internal/disposables/index.js +1 -0
- package/testing/internal/disposables/index.js.map +1 -1
- package/testing/internal/disposables/withProdMode.d.ts +4 -0
- package/testing/internal/disposables/withProdMode.js +10 -0
- package/testing/internal/disposables/withProdMode.js.map +1 -0
- package/testing/internal/scenarios/index.d.ts +28 -0
- package/testing/internal/scenarios/index.js +18 -2
- package/testing/internal/scenarios/index.js.map +1 -1
- package/utilities/common/maybeDeepFreeze.d.ts +1 -0
- package/utilities/common/maybeDeepFreeze.js +1 -1
- package/utilities/common/maybeDeepFreeze.js.map +1 -1
- package/utilities/globals/globals.cjs +1 -1
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +1 -1
- package/utilities/graphql/DocumentTransform.js +1 -1
- package/utilities/graphql/directives.d.ts +3 -1
- package/utilities/graphql/directives.js +39 -5
- package/utilities/graphql/directives.js.map +1 -1
- package/utilities/graphql/fragments.d.ts +1 -0
- package/utilities/graphql/fragments.js +18 -3
- package/utilities/graphql/fragments.js.map +1 -1
- package/utilities/graphql/getFromAST.js +8 -8
- package/utilities/graphql/storeUtils.js +1 -1
- package/utilities/graphql/transform.d.ts +1 -0
- package/utilities/graphql/transform.js +21 -2
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/index.d.ts +8 -4
- package/utilities/index.js +5 -4
- package/utilities/index.js.map +1 -1
- package/utilities/promises/preventUnhandledRejection.d.ts +2 -0
- package/utilities/promises/preventUnhandledRejection.js +5 -0
- package/utilities/promises/preventUnhandledRejection.js.map +1 -0
- package/utilities/types/NoInfer.d.ts +27 -0
- package/utilities/types/NoInfer.js +2 -0
- package/utilities/types/NoInfer.js.map +1 -0
- package/utilities/types/Prettify.d.ts +4 -0
- package/utilities/types/Prettify.js +2 -0
- package/utilities/types/Prettify.js.map +1 -0
- package/utilities/types/UnionToIntersection.d.ts +2 -0
- package/utilities/types/UnionToIntersection.js +2 -0
- package/utilities/types/UnionToIntersection.js.map +1 -0
- package/utilities/utilities.cjs +92 -19
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +92 -19
- package/version.js +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@apollo/client": patch
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Provide a codemod that applies `@unmask` to all named fragments for all operations and fragments. To use the codemod, run the following command:
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
npx jscodeshift -t node_modules/@apollo/client/scripts/codemods/data-masking/unmask.ts --extensions tsx --parser tsx path/to/app/
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
To customize the tag used to search for GraphQL operations, use the `--tag` option. By default the codemod looks for `gql` and `graphql` tags.
|
|
12
|
+
|
|
13
|
+
To apply the directive in migrate mode in order to receive runtime warnings on potentially masked fields, use the `--mode migrate` option.
|
|
14
|
+
|
|
15
|
+
For more information on the options that can be used with `jscodeshift`, check out the [`jscodeshift` documentation](https://github.com/facebook/jscodeshift).
|
|
@@ -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
|
+
```
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,70 @@
|
|
|
1
1
|
# @apollo/client
|
|
2
2
|
|
|
3
|
+
## 3.11.11-rc.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#12116](https://github.com/apollographql/apollo-client/pull/12116) [`8ae6e4e`](https://github.com/apollographql/apollo-client/commit/8ae6e4e5cec296c3910fdffb0ce51a0f5f06c5d3) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Prevent field accessor warnings when using `@unmask(mode: "migrate")` on objects that are passed into `cache.identify`.
|
|
8
|
+
|
|
9
|
+
- [#12120](https://github.com/apollographql/apollo-client/pull/12120) [`6a98e76`](https://github.com/apollographql/apollo-client/commit/6a98e76af5c800a91a748c498611b55c33e02c68) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Provide a codemod that applies `@unmask` to all named fragments for all operations and fragments. To use the codemod, run the following command:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
npx jscodeshift -t node_modules/@apollo/client/scripts/codemods/data-masking/unmask.ts --extensions tsx --parser tsx path/to/app/
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
To customize the tag used to search for GraphQL operations, use the `--tag` option. By default the codemod looks for `gql` and `graphql` tags.
|
|
16
|
+
|
|
17
|
+
To apply the directive in migrate mode in order to receive runtime warnings on potentially masked fields, use the `--mode migrate` option.
|
|
18
|
+
|
|
19
|
+
For more information on the options that can be used with `jscodeshift`, check out the [`jscodeshift` documentation](https://github.com/facebook/jscodeshift).
|
|
20
|
+
|
|
21
|
+
- [#12121](https://github.com/apollographql/apollo-client/pull/12121) [`1085a95`](https://github.com/apollographql/apollo-client/commit/1085a95e4430da35d19033613e73f315a0aede9e) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Warn when using data masking with "no-cache" operations.
|
|
22
|
+
|
|
23
|
+
- [#12114](https://github.com/apollographql/apollo-client/pull/12114) [`1d4ce00`](https://github.com/apollographql/apollo-client/commit/1d4ce0034395147445165022f7d23f42ff638d8a) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Fix error when combining `@unmask` and `@defer` directives on a fragment spread when data masking is enabled.
|
|
24
|
+
|
|
25
|
+
## 3.12.0-alpha.0
|
|
26
|
+
|
|
27
|
+
### Minor Changes
|
|
28
|
+
|
|
29
|
+
- [#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.
|
|
30
|
+
|
|
31
|
+
To enable data masking in Apollo Client, set the `dataMasking` option to `true`.
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
new ApolloClient({
|
|
35
|
+
dataMasking: true,
|
|
36
|
+
// ... other options
|
|
37
|
+
});
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
You can selectively disable data masking using the `@unmask` directive. Apply this to any named fragment to receive all fields requested by the fragment.
|
|
41
|
+
|
|
42
|
+
```graphql
|
|
43
|
+
query {
|
|
44
|
+
user {
|
|
45
|
+
id
|
|
46
|
+
...UserFields @unmask
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
To help with migration, use the `@unmask` migrate mode which will add warnings when accessing fields that would otherwise be masked.
|
|
52
|
+
|
|
53
|
+
```graphql
|
|
54
|
+
query {
|
|
55
|
+
user {
|
|
56
|
+
id
|
|
57
|
+
...UserFields @unmask(mode: "migrate")
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## 3.11.10
|
|
63
|
+
|
|
64
|
+
### Patch Changes
|
|
65
|
+
|
|
66
|
+
- [#12093](https://github.com/apollographql/apollo-client/pull/12093) [`1765668`](https://github.com/apollographql/apollo-client/commit/1765668b7d495ef8a581f697bf9e4b7460455f13) Thanks [@mgmolisani](https://github.com/mgmolisani)! - Fixed a bug when evaluating the devtools flag with the new syntax `devtools.enabled` that could result to `true` when explicitly set to `false`.
|
|
67
|
+
|
|
3
68
|
## 3.11.9
|
|
4
69
|
|
|
5
70
|
### Patch Changes
|