@khanacademy/wonder-blocks-data 3.1.2 → 3.1.3

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @khanacademy/wonder-blocks-data
2
2
 
3
+ ## 3.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 9931ae6b: Simplify GQL types
8
+
3
9
  ## 3.1.2
4
10
 
5
11
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@khanacademy/wonder-blocks-data",
3
- "version": "3.1.2",
3
+ "version": "3.1.3",
4
4
  "design": "v1",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -18,7 +18,7 @@ type Props<TContext: GqlContext> = {|
18
18
  /**
19
19
  * The function to use when fetching requests.
20
20
  */
21
- fetch: GqlFetchFn<any, any, any, TContext>,
21
+ fetch: GqlFetchFn<any, any, TContext>,
22
22
 
23
23
  /**
24
24
  * The children to be rendered inside the router.
@@ -24,7 +24,7 @@ export const useGql = (): (<
24
24
  TVariables: {...},
25
25
  TContext: GqlContext,
26
26
  >(
27
- operation: GqlOperation<TType, TData, TVariables>,
27
+ operation: GqlOperation<TData, TVariables>,
28
28
  options?: GqlFetchOptions<TVariables, TContext>,
29
29
  ) => Promise<?TData>) => {
30
30
  // This hook only works if the `GqlRouter` has been used to setup context.
@@ -41,13 +41,8 @@ export const useGql = (): (<
41
41
  // in hooks deps without fear of it triggering extra renders.
42
42
  const gqlFetch = useMemo(
43
43
  () =>
44
- <
45
- TType: GqlOperationType,
46
- TData,
47
- TVariables: {...},
48
- TContext: GqlContext,
49
- >(
50
- operation: GqlOperation<TType, TData, TVariables>,
44
+ <TData, TVariables: {...}, TContext: GqlContext>(
45
+ operation: GqlOperation<TData, TVariables>,
51
46
  options: GqlFetchOptions<TVariables, TContext> = Object.freeze(
52
47
  {},
53
48
  ),
@@ -8,7 +8,6 @@ export type GqlOperationType = "mutation" | "query";
8
8
  * A GraphQL operation.
9
9
  */
10
10
  export type GqlOperation<
11
- TType: GqlOperationType,
12
11
  // TData is not used to define a field on this type, but it is used
13
12
  // to ensure that calls using this operation will properly return the
14
13
  // correct data type.
@@ -20,13 +19,14 @@ export type GqlOperation<
20
19
  // eslint-disable-next-line no-unused-vars
21
20
  TVariables: {...} = Empty,
22
21
  > = {
23
- type: TType,
22
+ type: GqlOperationType,
24
23
  id: string,
25
24
  // We allow other things here to be passed along to the fetch function.
26
25
  // For example, we might want to pass the full query/mutation definition
27
26
  // as a string here to allow that to be sent to an Apollo server that
28
27
  // expects it. This is a courtesy to calling code; these additional
29
28
  // values are ignored by WB Data, and passed through as-is.
29
+ [key: string]: mixed,
30
30
  ...
31
31
  };
32
32
 
@@ -37,13 +37,8 @@ export type GqlContext = {|
37
37
  /**
38
38
  * Functions that make fetches of GQL operations.
39
39
  */
40
- export type GqlFetchFn<
41
- TType,
42
- TData,
43
- TVariables: {...},
44
- TContext: GqlContext,
45
- > = (
46
- operation: GqlOperation<TType, TData, TVariables>,
40
+ export type GqlFetchFn<TData, TVariables: {...}, TContext: GqlContext> = (
41
+ operation: GqlOperation<TData, TVariables>,
47
42
  variables: ?TVariables,
48
43
  context: TContext,
49
44
  ) => Promise<Response>;
@@ -52,7 +47,7 @@ export type GqlFetchFn<
52
47
  * The configuration stored in the GqlRouterContext context.
53
48
  */
54
49
  export type GqlRouterConfiguration<TContext: GqlContext> = {|
55
- fetch: GqlFetchFn<any, any, any, any>,
50
+ fetch: GqlFetchFn<any, any, any>,
56
51
  defaultContext: TContext,
57
52
  |};
58
53