@apollo/client 4.0.0-alpha.17 → 4.0.0-alpha.18
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/CHANGELOG.md +45 -0
- package/__cjs/core/ObservableQuery.cjs.map +1 -1
- package/__cjs/core/QueryInfo.cjs.map +1 -1
- package/__cjs/masking/GraphQLCodegenDataMasking.cjs +3 -0
- package/__cjs/masking/GraphQLCodegenDataMasking.cjs.map +1 -0
- package/__cjs/masking/GraphQLCodegenDataMasking.d.cts +79 -0
- package/__cjs/masking/index.cjs.map +1 -1
- package/__cjs/masking/index.d.cts +1 -0
- package/__cjs/masking/types.d.cts +11 -26
- package/__cjs/utilities/HKT.cjs +3 -0
- package/__cjs/utilities/HKT.cjs.map +1 -0
- package/__cjs/utilities/HKT.d.cts +35 -0
- package/__cjs/utilities/index.cjs.map +1 -1
- package/__cjs/utilities/index.d.cts +1 -0
- package/__cjs/utilities/internal/index.cjs.map +1 -1
- package/__cjs/utilities/internal/index.d.cts +2 -0
- package/__cjs/utilities/internal/types/ApplyHKT.cjs +3 -0
- package/__cjs/utilities/internal/types/ApplyHKT.cjs.map +1 -0
- package/__cjs/utilities/internal/types/ApplyHKT.d.cts +13 -0
- package/__cjs/utilities/internal/types/ApplyHKTImplementationWithDefault.cjs +3 -0
- package/__cjs/utilities/internal/types/ApplyHKTImplementationWithDefault.cjs.map +1 -0
- package/__cjs/utilities/internal/types/ApplyHKTImplementationWithDefault.d.cts +11 -0
- package/__cjs/version.cjs +1 -1
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.js.map +1 -1
- package/masking/GraphQLCodegenDataMasking.d.ts +79 -0
- package/masking/GraphQLCodegenDataMasking.js +2 -0
- package/masking/GraphQLCodegenDataMasking.js.map +1 -0
- package/masking/index.d.ts +1 -0
- package/masking/index.js.map +1 -1
- package/masking/types.d.ts +11 -26
- package/package.json +1 -1
- package/utilities/HKT.d.ts +35 -0
- package/utilities/HKT.js +2 -0
- package/utilities/HKT.js.map +1 -0
- package/utilities/index.d.ts +1 -0
- package/utilities/index.js.map +1 -1
- package/utilities/internal/index.d.ts +2 -0
- package/utilities/internal/index.js.map +1 -1
- package/utilities/internal/types/ApplyHKT.d.ts +13 -0
- package/utilities/internal/types/ApplyHKT.js +2 -0
- package/utilities/internal/types/ApplyHKT.js.map +1 -0
- package/utilities/internal/types/ApplyHKTImplementationWithDefault.d.ts +11 -0
- package/utilities/internal/types/ApplyHKTImplementationWithDefault.js +2 -0
- package/utilities/internal/types/ApplyHKTImplementationWithDefault.js.map +1 -0
- package/version.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,50 @@
|
|
|
1
1
|
# @apollo/client
|
|
2
2
|
|
|
3
|
+
## 4.0.0-alpha.18
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#12670](https://github.com/apollographql/apollo-client/pull/12670) [`0a880ea`](https://github.com/apollographql/apollo-client/commit/0a880ea4c2360a985fdd2edadb94fcc4b82bad73) Thanks [@phryneas](https://github.com/phryneas)! - Provide a mechanism to override the DataMasking types.
|
|
8
|
+
|
|
9
|
+
Up until now, our types `Masked`, `MaskedDocumentNode`, `FragmentType`, `MaybeMasked` and `Unmasked` would assume that you are stictly using the type output format of GraphQL Codegen.
|
|
10
|
+
|
|
11
|
+
With this change, you can now modify the behaviour of those types if you use a different form of codegen that produces different types for your queries.
|
|
12
|
+
|
|
13
|
+
A simple implementation that would override the `Masked` type to remove all fields starting with `_` from a type would look like this:
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
// your actual implementation of `Masked`
|
|
17
|
+
type CustomMaskedImplementation<TData> = {
|
|
18
|
+
[K in keyof TData as K extends `_${string}` ? never : K]: TData[K];
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
import { HKT } from "@apollo/client/utilities";
|
|
22
|
+
// transform this type into a higher kinded type that can be evaulated at a later time
|
|
23
|
+
interface CustomMaskedType extends HKT {
|
|
24
|
+
arg1: unknown; // TData
|
|
25
|
+
return: CustomMaskedImplementation<this["arg1"]>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// create an "implementation interface" for the types you want to override
|
|
29
|
+
export interface CustomDataMaskingImplementation {
|
|
30
|
+
Masked: CustomMaskedType;
|
|
31
|
+
// other possible keys: `MaskedDocumentNode`, `FragmentType`, `MaybeMasked` and `Unmasked`
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
then you would use that `CustomDataMaskingImplementation` interface in your project to extend the `DataMasking` interface exported by `@apollo/client` with it's functionality:
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
declare module "@apollo/client" {
|
|
39
|
+
export interface DataMasking extends CustomDataMaskingImplementation {}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
After that, all internal usage of `Masked` in Apollo Client as well as all usage in your code base will use the new `CustomMaskedType` implementation.
|
|
44
|
+
|
|
45
|
+
If you don't specify overrides, Apollo Client will still default to the GraphQL Codegen data masking implementation.
|
|
46
|
+
The types for that are also explicitly exported as the `GraphQLCodegenDataMasking` namespace in `@apollo/client/masking`.
|
|
47
|
+
|
|
3
48
|
## 4.0.0-alpha.17
|
|
4
49
|
|
|
5
50
|
### Major Changes
|