@khanacademy/wonder-blocks-data 11.0.3 → 11.0.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 (42) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/components/data.d.ts +1 -1
  3. package/dist/components/data.js.flow +1 -2
  4. package/dist/components/gql-router.js.flow +1 -2
  5. package/dist/components/intercept-context.js.flow +1 -2
  6. package/dist/components/intercept-requests.js.flow +1 -2
  7. package/dist/components/track-data.js.flow +1 -2
  8. package/dist/hooks/use-cached-effect.js.flow +1 -2
  9. package/dist/hooks/use-gql-router-context.js.flow +1 -2
  10. package/dist/hooks/use-gql.js.flow +1 -2
  11. package/dist/hooks/use-hydratable-effect.js.flow +1 -2
  12. package/dist/hooks/use-request-interception.js.flow +1 -2
  13. package/dist/hooks/use-server-effect.js.flow +1 -2
  14. package/dist/hooks/use-shared-cache.js.flow +1 -2
  15. package/dist/index.js.flow +1 -2
  16. package/dist/util/data-error.js.flow +1 -2
  17. package/dist/util/get-gql-data-from-response.js.flow +1 -2
  18. package/dist/util/get-gql-request-id.js.flow +1 -2
  19. package/dist/util/gql-error.js.flow +1 -2
  20. package/dist/util/gql-router-context.js.flow +1 -2
  21. package/dist/util/gql-types.js.flow +1 -2
  22. package/dist/util/graphql-document-node-parser.js.flow +1 -2
  23. package/dist/util/graphql-types.js.flow +28 -24
  24. package/dist/util/hydration-cache-api.js.flow +1 -2
  25. package/dist/util/merge-gql-context.js.flow +1 -2
  26. package/dist/util/purge-caches.js.flow +1 -2
  27. package/dist/util/request-api.js.flow +1 -2
  28. package/dist/util/request-fulfillment.js.flow +1 -2
  29. package/dist/util/request-tracking.js.flow +1 -2
  30. package/dist/util/result-from-cache-response.js.flow +1 -2
  31. package/dist/util/scoped-in-memory-cache.js.flow +1 -2
  32. package/dist/util/serializable-in-memory-cache.js.flow +1 -2
  33. package/dist/util/ssr-cache.js.flow +1 -2
  34. package/dist/util/status.js.flow +1 -2
  35. package/dist/util/to-gql-operation.js.flow +1 -2
  36. package/dist/util/types.js.flow +1 -2
  37. package/package.json +2 -2
  38. package/src/components/__tests__/data.test.tsx +0 -34
  39. package/src/components/data.ts +4 -4
  40. package/src/util/graphql-types.js.flow +30 -0
  41. package/src/util/graphql-types.ts +1 -0
  42. package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @khanacademy/wonder-blocks-data
2
2
 
3
+ ## 11.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - 43155769: Fix DocumentNode type definition
8
+
9
+ ## 11.0.4
10
+
11
+ ### Patch Changes
12
+
13
+ - bedcbcf8: Update <Data>'s 'children' prop to allow a ReactNode to be returned
14
+
3
15
  ## 11.0.3
4
16
 
5
17
  ### Patch Changes
@@ -41,7 +41,7 @@ TData extends ValidCacheData> = {
41
41
  * loading state and data or error that gets retrieved from cache or loaded
42
42
  * via the request if no cached value is available.
43
43
  */
44
- children: (result: Result<TData>) => React.ReactElement;
44
+ children: (result: Result<TData>) => React.ReactNode;
45
45
  };
46
46
  /**
47
47
  * This component is the main component of Wonder Blocks Data. With this, data
@@ -4,7 +4,6 @@
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
-
8
7
  import * as React from "react";
9
8
  import { WhenClientSide } from "../hooks/use-hydratable-effect";
10
9
  import type { Result, ValidCacheData } from "../util/types";
@@ -51,7 +50,7 @@ declare type Props<TData: ValidCacheData> = {|
51
50
  * loading state and data or error that gets retrieved from cache or loaded
52
51
  * via the request if no cached value is available.
53
52
  */
54
- children: (result: Result<TData>) => React.Element<any>,
53
+ children: (result: Result<TData>) => React.Node,
55
54
  |};
56
55
  /**
57
56
  * This component is the main component of Wonder Blocks Data. With this, data
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Flowtype definitions for gql-router
2
+ * Flowtype definitions for data
3
3
  * Generated by Flowgen from a Typescript Definition
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
-
8
7
  import * as React from "react";
9
8
  import type { GqlContext, GqlFetchFn } from "../util/gql-types";
10
9
  declare type Props<TContext: GqlContext> = {|
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Flowtype definitions for intercept-context
2
+ * Flowtype definitions for data
3
3
  * Generated by Flowgen from a Typescript Definition
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
-
8
7
  import * as React from "react";
9
8
  import type { ValidCacheData } from "../util/types";
10
9
  declare type InterceptContextData = $ReadOnlyArray<
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Flowtype definitions for intercept-requests
2
+ * Flowtype definitions for data
3
3
  * Generated by Flowgen from a Typescript Definition
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
-
8
7
  import * as React from "react";
9
8
  import type { ValidCacheData } from "../util/types";
10
9
  declare type Props<TData: ValidCacheData> = {|
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Flowtype definitions for track-data
2
+ * Flowtype definitions for data
3
3
  * Generated by Flowgen from a Typescript Definition
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
-
8
7
  import * as React from "react";
9
8
  declare type TrackDataProps = {|
10
9
  children: React.Node,
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Flowtype definitions for use-cached-effect
2
+ * Flowtype definitions for data
3
3
  * Generated by Flowgen from a Typescript Definition
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
-
8
7
  import type { Result, ValidCacheData } from "../util/types";
9
8
  import { FetchPolicy } from "../util/types";
10
9
  declare type CachedEffectOptions<TData: ValidCacheData> = {|
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Flowtype definitions for use-gql-router-context
2
+ * Flowtype definitions for data
3
3
  * Generated by Flowgen from a Typescript Definition
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
-
8
7
  import type { GqlRouterConfiguration, GqlContext } from "../util/gql-types";
9
8
 
10
9
  /**
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Flowtype definitions for use-gql
2
+ * Flowtype definitions for data
3
3
  * Generated by Flowgen from a Typescript Definition
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
-
8
7
  import type {
9
8
  GqlContext,
10
9
  GqlOperation,
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Flowtype definitions for use-hydratable-effect
2
+ * Flowtype definitions for data
3
3
  * Generated by Flowgen from a Typescript Definition
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
-
8
7
  import type { Result, ValidCacheData } from "../util/types";
9
8
 
10
9
  /**
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Flowtype definitions for use-request-interception
2
+ * Flowtype definitions for data
3
3
  * Generated by Flowgen from a Typescript Definition
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
-
8
7
  import type { ValidCacheData } from "../util/types";
9
8
 
10
9
  /**
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Flowtype definitions for use-server-effect
2
+ * Flowtype definitions for data
3
3
  * Generated by Flowgen from a Typescript Definition
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
-
8
7
  import type { Result, ValidCacheData } from "../util/types";
9
8
  declare type ServerEffectOptions = {|
10
9
  /**
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Flowtype definitions for use-shared-cache
2
+ * Flowtype definitions for data
3
3
  * Generated by Flowgen from a Typescript Definition
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
-
8
7
  import type { ValidCacheData, ScopedCache } from "../util/types";
9
8
 
10
9
  /**
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Flowtype definitions for index
2
+ * Flowtype definitions for data
3
3
  * Generated by Flowgen from a Typescript Definition
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
-
8
7
  declare export { FetchPolicy } from "./util/types";
9
8
  export type {
10
9
  ErrorOptions,
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Flowtype definitions for data-error
2
+ * Flowtype definitions for data
3
3
  * Generated by Flowgen from a Typescript Definition
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
-
8
7
  import { KindError } from "@khanacademy/wonder-stuff-core";
9
8
  import type { ErrorOptions } from "./types";
10
9
 
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Flowtype definitions for get-gql-data-from-response
2
+ * Flowtype definitions for data
3
3
  * Generated by Flowgen from a Typescript Definition
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
-
8
7
  /**
9
8
  * Validate a GQL operation response and extract the data.
10
9
  */
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Flowtype definitions for get-gql-request-id
2
+ * Flowtype definitions for data
3
3
  * Generated by Flowgen from a Typescript Definition
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
-
8
7
  import type { GqlOperation, GqlContext } from "./gql-types";
9
8
 
10
9
  /**
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Flowtype definitions for gql-error
2
+ * Flowtype definitions for data
3
3
  * Generated by Flowgen from a Typescript Definition
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
-
8
7
  import { KindError } from "@khanacademy/wonder-stuff-core";
9
8
  import type { ErrorOptions } from "./types";
10
9
 
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Flowtype definitions for gql-router-context
2
+ * Flowtype definitions for data
3
3
  * Generated by Flowgen from a Typescript Definition
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
-
8
7
  import * as React from "react";
9
8
  import type { GqlRouterConfiguration } from "./gql-types";
10
9
  declare export var GqlRouterContext: React.Context<GqlRouterConfiguration<any> | null | void>;
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Flowtype definitions for gql-types
2
+ * Flowtype definitions for data
3
3
  * Generated by Flowgen from a Typescript Definition
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
-
8
7
  /**
9
8
  * Operation types.
10
9
  */
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Flowtype definitions for graphql-document-node-parser
2
+ * Flowtype definitions for data
3
3
  * Generated by Flowgen from a Typescript Definition
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
-
8
7
  import type { DocumentNode, VariableDefinitionNode } from "./graphql-types";
9
8
  declare export var DocumentTypes: $ReadOnly<{|
10
9
  query: "query",
@@ -1,26 +1,30 @@
1
- /**
2
- * Flowtype definitions for graphql-types
3
- * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.21.0
5
- * @flow
6
- */
7
-
1
+ // @flow
2
+ // NOTE(somewhatabstract):
3
+ // These types are bare minimum to support document parsing. They're derived
4
+ // from graphql@14.5.8, the last version that provided flow types.
5
+ // Doing this avoids us having to take a dependency on that library just for
6
+ // these types.
8
7
  export interface DefinitionNode {
9
- +kind: string;
8
+ +kind: string;
10
9
  }
11
- export type VariableDefinitionNode = {|
12
- +kind: "VariableDefinition",
13
- |};
14
- export type OperationDefinitionNode = {
15
- +kind: "OperationDefinition",
16
- +operation: string,
17
- +variableDefinitions: $ReadOnlyArray<VariableDefinitionNode>,
18
- +name?: {|
19
- +kind: mixed,
20
- +value: string,
21
- |},
22
- } & DefinitionNode;
23
- export type DocumentNode = {|
24
- +kind: "Document",
25
- +definitions: $ReadOnlyArray<DefinitionNode>,
26
- |};
10
+
11
+ export type VariableDefinitionNode = {
12
+ +kind: "VariableDefinition",
13
+ ...
14
+ };
15
+
16
+ export interface OperationDefinitionNode extends DefinitionNode {
17
+ +kind: "OperationDefinition";
18
+ +operation: string;
19
+ +variableDefinitions: $ReadOnlyArray<VariableDefinitionNode>;
20
+ +name?: {|
21
+ +kind: mixed,
22
+ +value: string,
23
+ |};
24
+ }
25
+
26
+ export type DocumentNode = {
27
+ +kind: "Document",
28
+ +definitions: $ReadOnlyArray<DefinitionNode>,
29
+ ...
30
+ };
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Flowtype definitions for hydration-cache-api
2
+ * Flowtype definitions for data
3
3
  * Generated by Flowgen from a Typescript Definition
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
-
8
7
  import type { ValidCacheData, CachedResponse, ResponseCache } from "./types";
9
8
 
10
9
  /**
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Flowtype definitions for merge-gql-context
2
+ * Flowtype definitions for data
3
3
  * Generated by Flowgen from a Typescript Definition
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
-
8
7
  import type { GqlContext } from "./gql-types";
9
8
 
10
9
  /**
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Flowtype definitions for purge-caches
2
+ * Flowtype definitions for data
3
3
  * Generated by Flowgen from a Typescript Definition
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
-
8
7
  /**
9
8
  * Purge all caches managed by Wonder Blocks Data.
10
9
  *
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Flowtype definitions for request-api
2
+ * Flowtype definitions for data
3
3
  * Generated by Flowgen from a Typescript Definition
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
-
8
7
  import type { ResponseCache } from "./types";
9
8
 
10
9
  /**
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Flowtype definitions for request-fulfillment
2
+ * Flowtype definitions for data
3
3
  * Generated by Flowgen from a Typescript Definition
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
-
8
7
  import type { Result, ValidCacheData } from "./types";
9
8
  declare type RequestCache = {
10
9
  [id: string]: Promise<Result<any>>,
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Flowtype definitions for request-tracking
2
+ * Flowtype definitions for data
3
3
  * Generated by Flowgen from a Typescript Definition
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
-
8
7
  import * as React from "react";
9
8
  import { SsrCache } from "./ssr-cache";
10
9
  import { RequestFulfillment } from "./request-fulfillment";
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Flowtype definitions for result-from-cache-response
2
+ * Flowtype definitions for data
3
3
  * Generated by Flowgen from a Typescript Definition
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
-
8
7
  import type { ValidCacheData, CachedResponse, Result } from "./types";
9
8
 
10
9
  /**
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Flowtype definitions for scoped-in-memory-cache
2
+ * Flowtype definitions for data
3
3
  * Generated by Flowgen from a Typescript Definition
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
-
8
7
  import type { ScopedCache, RawScopedCache, ValidCacheData } from "./types";
9
8
 
10
9
  /**
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Flowtype definitions for serializable-in-memory-cache
2
+ * Flowtype definitions for data
3
3
  * Generated by Flowgen from a Typescript Definition
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
-
8
7
  import { ScopedInMemoryCache } from "./scoped-in-memory-cache";
9
8
  import type { ValidCacheData, RawScopedCache } from "./types";
10
9
 
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Flowtype definitions for ssr-cache
2
+ * Flowtype definitions for data
3
3
  * Generated by Flowgen from a Typescript Definition
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
-
8
7
  import { SerializableInMemoryCache } from "./serializable-in-memory-cache";
9
8
  import type { ValidCacheData, CachedResponse, ResponseCache } from "./types";
10
9
 
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Flowtype definitions for status
2
+ * Flowtype definitions for data
3
3
  * Generated by Flowgen from a Typescript Definition
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
-
8
7
  import type { Result, ValidCacheData } from "./types";
9
8
 
10
9
  /**
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Flowtype definitions for to-gql-operation
2
+ * Flowtype definitions for data
3
3
  * Generated by Flowgen from a Typescript Definition
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
-
8
7
  import type { GqlOperation } from "./gql-types";
9
8
  import type { DocumentNode } from "./graphql-types";
10
9
 
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Flowtype definitions for types
2
+ * Flowtype definitions for data
3
3
  * Generated by Flowgen from a Typescript Definition
4
4
  * Flowgen v1.21.0
5
5
  * @flow
6
6
  */
7
-
8
7
  import type { Metadata } from "@khanacademy/wonder-stuff-core";
9
8
 
10
9
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@khanacademy/wonder-blocks-data",
3
- "version": "11.0.3",
3
+ "version": "11.0.5",
4
4
  "design": "v1",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -21,7 +21,7 @@
21
21
  "react": "16.14.0"
22
22
  },
23
23
  "devDependencies": {
24
- "wb-dev-build-settings": "^0.9.2"
24
+ "wb-dev-build-settings": "^0.9.4"
25
25
  },
26
26
  "author": "",
27
27
  "license": "MIT"