@khanacademy/wonder-blocks-data 11.0.16 → 12.0.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 (44) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/es/index.js +14 -12
  3. package/dist/hooks/use-hydratable-effect.d.ts +6 -6
  4. package/dist/index.js +14 -12
  5. package/dist/util/types.d.ts +6 -6
  6. package/package.json +3 -3
  7. package/src/hooks/use-hydratable-effect.ts +6 -7
  8. package/src/util/types.ts +6 -7
  9. package/tsconfig-build.tsbuildinfo +1 -1
  10. package/dist/components/data.js.flow +0 -63
  11. package/dist/components/gql-router.js.flow +0 -33
  12. package/dist/components/intercept-context.js.flow +0 -18
  13. package/dist/components/intercept-requests.js.flow +0 -51
  14. package/dist/components/track-data.js.flow +0 -16
  15. package/dist/hooks/use-cached-effect.js.flow +0 -83
  16. package/dist/hooks/use-gql-router-context.js.flow +0 -14
  17. package/dist/hooks/use-gql.js.flow +0 -28
  18. package/dist/hooks/use-hydratable-effect.js.flow +0 -122
  19. package/dist/hooks/use-request-interception.js.flow +0 -24
  20. package/dist/hooks/use-server-effect.js.flow +0 -49
  21. package/dist/hooks/use-shared-cache.js.flow +0 -42
  22. package/dist/index.js.flow +0 -47
  23. package/dist/util/data-error.js.flow +0 -62
  24. package/dist/util/get-gql-data-from-response.js.flow +0 -12
  25. package/dist/util/get-gql-request-id.js.flow +0 -16
  26. package/dist/util/gql-error.js.flow +0 -41
  27. package/dist/util/gql-router-context.js.flow +0 -10
  28. package/dist/util/gql-types.js.flow +0 -50
  29. package/dist/util/graphql-document-node-parser.js.flow +0 -29
  30. package/dist/util/graphql-types.js.flow +0 -30
  31. package/dist/util/hydration-cache-api.js.flow +0 -29
  32. package/dist/util/merge-gql-context.js.flow +0 -18
  33. package/dist/util/purge-caches.js.flow +0 -14
  34. package/dist/util/request-api.js.flow +0 -33
  35. package/dist/util/request-fulfillment.js.flow +0 -48
  36. package/dist/util/request-tracking.js.flow +0 -81
  37. package/dist/util/result-from-cache-response.js.flow +0 -14
  38. package/dist/util/scoped-in-memory-cache.js.flow +0 -56
  39. package/dist/util/serializable-in-memory-cache.js.flow +0 -25
  40. package/dist/util/ssr-cache.js.flow +0 -86
  41. package/dist/util/status.js.flow +0 -17
  42. package/dist/util/to-gql-operation.js.flow +0 -41
  43. package/dist/util/types.js.flow +0 -142
  44. package/src/util/graphql-types.js.flow +0 -30
@@ -1,83 +0,0 @@
1
- /**
2
- * Flowtype definitions for data
3
- * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.21.0
5
- * @flow
6
- */
7
- import type { Result, ValidCacheData } from "../util/types";
8
- import { FetchPolicy } from "../util/types";
9
- declare type CachedEffectOptions<TData: ValidCacheData> = {|
10
- /**
11
- * The policy to use when determining how to retrieve the request data from
12
- * cache and network.
13
- *
14
- * Defaults to `FetchPolicy.CacheBeforeNetwork`.
15
- */
16
- fetchPolicy?: $ElementType<typeof FetchPolicy, $Keys<typeof FetchPolicy>>,
17
-
18
- /**
19
- * When `true`, the effect will not be executed; otherwise, the effect will
20
- * be executed.
21
- *
22
- * If this is set to `true` while the effect is still pending, the pending
23
- * effect will be cancelled.
24
- *
25
- * Default is `false`.
26
- */
27
- skip?: boolean,
28
-
29
- /**
30
- * When `true`, the effect will not reset the result to the loading status
31
- * while executing if the requestId changes, instead, returning
32
- * the existing result from before the change; otherwise, the result will
33
- * be set to loading status.
34
- *
35
- * If the status is loading when the changes are made, it will remain as
36
- * loading; old pending effects are discarded on changes and as such this
37
- * value has no effect in that case.
38
- */
39
- retainResultOnChange?: boolean,
40
-
41
- /**
42
- * Callback that is invoked if the result for the given hook has changed.
43
- *
44
- * When defined, the hook will invoke this callback whenever it has reason
45
- * to change the result and will not otherwise affect component rendering
46
- * directly.
47
- *
48
- * When not defined, the hook will ensure the component re-renders to pick
49
- * up the latest result.
50
- */
51
- onResultChanged?: (result: Result<TData>) => void,
52
-
53
- /**
54
- * Scope to use with the shared cache.
55
- *
56
- * When specified, the given scope will be used to isolate this hook's
57
- * cached results. Otherwise, a shared default scope will be used.
58
- *
59
- * Changing this value after the first call is not supported.
60
- */
61
- scope?: string,
62
- |};
63
- /**
64
- * Hook to execute and cache an async operation on the client.
65
- *
66
- * This hook executes the given handler on the client if there is no
67
- * cached result to use.
68
- *
69
- * Results are cached so they can be shared between equivalent invocations.
70
- * In-flight requests are also shared, so that concurrent calls will
71
- * behave as one might exect. Cache updates invoked by one hook instance
72
- * do not trigger renders in components that use the same requestID; however,
73
- * that should not matter since concurrent requests will share the same
74
- * in-flight request, and subsequent renders will grab from the cache.
75
- *
76
- * Once the request has been tried once and a non-loading response has been
77
- * cached, the request will not executed made again.
78
- */
79
- declare export var useCachedEffect: <TData: ValidCacheData>(
80
- requestId: string,
81
- handler: () => Promise<TData>,
82
- options?: CachedEffectOptions<TData>
83
- ) => [Result<TData>, () => void];
@@ -1,14 +0,0 @@
1
- /**
2
- * Flowtype definitions for data
3
- * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.21.0
5
- * @flow
6
- */
7
- import type { GqlRouterConfiguration, GqlContext } from "../util/gql-types";
8
-
9
- /**
10
- * Construct a GqlRouterContext from the current one and partial context.
11
- */
12
- declare export var useGqlRouterContext: <TContext: GqlContext>(
13
- contextOverrides?: $Rest<TContext, {}>
14
- ) => GqlRouterConfiguration<TContext>;
@@ -1,28 +0,0 @@
1
- /**
2
- * Flowtype definitions for data
3
- * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.21.0
5
- * @flow
6
- */
7
- import type {
8
- GqlContext,
9
- GqlOperation,
10
- GqlFetchOptions,
11
- } from "../util/gql-types";
12
-
13
- /**
14
- * Hook to obtain a gqlFetch function for performing GraphQL requests.
15
- *
16
- * The fetch function will resolve null if the request was aborted, otherwise
17
- * it will resolve the data returned by the GraphQL server.
18
- *
19
- * Context is merged with the default context provided to the GqlRouter.
20
- * Values in the partial context given to the returned fetch function will
21
- * only be included if they have a value other than undefined.
22
- */
23
- declare export var useGql: <TContext: GqlContext>(
24
- context?: $Rest<TContext, {}>
25
- ) => <TData, TVariables: { [key: any]: any }>(
26
- operation: GqlOperation<TData, TVariables>,
27
- options?: GqlFetchOptions<TVariables, TContext> | void
28
- ) => Promise<TData>;
@@ -1,122 +0,0 @@
1
- /**
2
- * Flowtype definitions for data
3
- * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.21.0
5
- * @flow
6
- */
7
- import type { Result, ValidCacheData } from "../util/types";
8
-
9
- /**
10
- * Policies to define how a hydratable effect should behave client-side.
11
- */
12
- declare export var WhenClientSide: {|
13
- /**
14
- * The result from executing the effect server-side will not be hydrated.
15
- * The effect will always be executed client-side.
16
- *
17
- * This should only be used if there is something else that is responsible
18
- * for properly hydrating this component (for example, the action invokes
19
- * Apollo which manages its own cache to ensure things render properly).
20
- */
21
- +DoNotHydrate: "DoNotHydrate",
22
-
23
- /**
24
- * The result from executing the effect server-side will be hydrated.
25
- * The effect will only execute client-side if there was no result to
26
- * be hydrated (i.e. both error and success hydration results prevent the
27
- * effect running client-side).
28
- */
29
- +ExecuteWhenNoResult: "ExecuteWhenNoResult",
30
-
31
- /**
32
- * The result from executing the effect server-side will be hydrated.
33
- * If the hydrated result is a success result, the effect will not be
34
- * executed client-side.
35
- * If the hydrated result was not a success result, or there was no
36
- * hydrated result, the effect will not be executed.
37
- */
38
- +ExecuteWhenNoSuccessResult: "ExecuteWhenNoSuccessResult",
39
-
40
- /**
41
- * The result from executing the effect server-side will be hydrated.
42
- * The effect will always be executed client-side, regardless of the
43
- * hydrated result status.
44
- */
45
- +AlwaysExecute: "AlwaysExecute",
46
- |};
47
- declare type HydratableEffectOptions<TData: ValidCacheData> = {|
48
- /**
49
- * How the hook should behave when rendering client-side for the first time.
50
- *
51
- * This controls how the hook hydrates and executes when client-side.
52
- *
53
- * Default is `WhenClientSide.ExecuteWhenNoSuccessResult`.
54
- *
55
- * Changing this value after the first call is irrelevant as it only
56
- * affects the initial render behavior.
57
- */
58
- clientBehavior?: $ElementType<
59
- typeof WhenClientSide,
60
- $Keys<typeof WhenClientSide>
61
- >,
62
-
63
- /**
64
- * When `true`, the effect will not be executed; otherwise, the effect will
65
- * be executed.
66
- *
67
- * If this is set to `true` while the effect is still pending, the pending
68
- * effect will be cancelled.
69
- *
70
- * Default is `false`.
71
- */
72
- skip?: boolean,
73
-
74
- /**
75
- * When `true`, the effect will not reset the result to the loading status
76
- * while executing if the requestId changes, instead, returning
77
- * the existing result from before the change; otherwise, the result will
78
- * be set to loading status.
79
- *
80
- * If the status is loading when the changes are made, it will remain as
81
- * loading; old pending effects are discarded on changes and as such this
82
- * value has no effect in that case.
83
- */
84
- retainResultOnChange?: boolean,
85
-
86
- /**
87
- * Callback that is invoked if the result for the given hook has changed.
88
- *
89
- * When defined, the hook will invoke this callback whenever it has reason
90
- * to change the result and will not otherwise affect component rendering
91
- * directly.
92
- *
93
- * When not defined, the hook will ensure the component re-renders to pick
94
- * up the latest result.
95
- */
96
- onResultChanged?: (result: Result<TData>) => void,
97
-
98
- /**
99
- * Scope to use with the shared cache.
100
- *
101
- * When specified, the given scope will be used to isolate this hook's
102
- * cached results. Otherwise, a shared default scope will be used.
103
- *
104
- * Changing this value after the first call is not supported.
105
- */
106
- scope?: string,
107
- |};
108
- /**
109
- * Hook to execute an async operation on server and client.
110
- *
111
- * This hook executes the given handler on the server and on the client,
112
- * and, depending on the given options, can hydrate the server-side result.
113
- *
114
- * Results are cached on the client so they can be shared between equivalent
115
- * invocations. Cache changes from one hook instance do not trigger renders
116
- * in components that use the same requestID.
117
- */
118
- declare export var useHydratableEffect: <TData: ValidCacheData>(
119
- requestId: string,
120
- handler: () => Promise<TData>,
121
- options?: HydratableEffectOptions<TData>
122
- ) => Result<TData>;
@@ -1,24 +0,0 @@
1
- /**
2
- * Flowtype definitions for data
3
- * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.21.0
5
- * @flow
6
- */
7
- import type { ValidCacheData } from "../util/types";
8
-
9
- /**
10
- * Allow request handling to be intercepted.
11
- *
12
- * Hook to take a uniquely identified request handler and return a
13
- * method that will support request interception from the InterceptRequest
14
- * component.
15
- *
16
- * If you want request interception to be supported with `useServerEffect` or
17
- * any client-side effect that uses the handler, call this first to generate
18
- * an intercepted handler, and then invoke `useServerEffect` (or other things)
19
- * with that intercepted handler.
20
- */
21
- declare export var useRequestInterception: <TData: ValidCacheData>(
22
- requestId: string,
23
- handler: () => Promise<TData>
24
- ) => () => Promise<TData>;
@@ -1,49 +0,0 @@
1
- /**
2
- * Flowtype definitions for data
3
- * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.21.0
5
- * @flow
6
- */
7
- import type { Result, ValidCacheData } from "../util/types";
8
- declare type ServerEffectOptions = {|
9
- /**
10
- * When `true`, the result of the effect when fulfilled using Wonder Blocks
11
- * Data will be stored in the hydration cache for hydrating client-side;
12
- * otherwise, the result will be stored in the server-side-only cache.
13
- *
14
- * This should only be set to `false` if something else will be responsible
15
- * for hydration of the data on the client-side (for example, if Apollo's
16
- * hydration support is used).
17
- *
18
- * Default is `true`.
19
- */
20
- hydrate?: boolean,
21
-
22
- /**
23
- * When `true`, the effect will not be tracked for fulfillment; otherwise,
24
- * the effect will be tracked for fulfillment.
25
- *
26
- * Default is `false`.
27
- */
28
- skip?: boolean,
29
- |};
30
- /**
31
- * Hook to perform an asynchronous action during server-side rendering.
32
- *
33
- * This hook registers an asynchronous action to be performed during
34
- * server-side rendering. The action is performed only once, and the result
35
- * is cached against the given identifier so that subsequent calls return that
36
- * cached result allowing components to render more of the component.
37
- *
38
- * This hook requires the Wonder Blocks Data functionality for resolving
39
- * pending requests, as well as support for the hydration cache to be
40
- * embedded into a page so that the result can by hydrated (if that is a
41
- * requirement).
42
- *
43
- * The asynchronous action is never invoked on the client-side.
44
- */
45
- declare export var useServerEffect: <TData: ValidCacheData>(
46
- requestId: string,
47
- handler: () => Promise<TData>,
48
- options?: ServerEffectOptions
49
- ) => Result<TData> | null | void;
@@ -1,42 +0,0 @@
1
- /**
2
- * Flowtype definitions for data
3
- * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.21.0
5
- * @flow
6
- */
7
- import type { ValidCacheData, ScopedCache } from "../util/types";
8
-
9
- /**
10
- * A function for inserting a value into the cache or clearing it.
11
- */
12
- declare type CacheValueFn<TValue: ValidCacheData> = (
13
- value?: TValue | null | void
14
- ) => void;
15
- /**
16
- * Access to the shared in-memory cache.
17
- *
18
- * This is the cache used by `useSharedCache` and related hooks and
19
- * components.
20
- */
21
- declare export var SharedCache: ScopedCache;
22
- /**
23
- * Hook to retrieve data from and store data in an in-memory cache.
24
- * @returns {[?ReadOnlyCacheValue, CacheValueFn]} Returns an array containing the current cache entry (or undefined), a
25
- * function to set the cache entry (passing null or undefined to this function
26
- * will delete the entry).
27
- *
28
- * NOTE: Unlike useState or useReducer, we don't automatically update folks
29
- * if the value they reference changes. We might add it later (if we need to),
30
- * but the likelihood here is that things won't be changing in this cache in a
31
- * way where we would need that. If we do (and likely only in specific
32
- * circumstances), we should consider adding a simple boolean useState that can
33
- * be toggled to cause a rerender whenever the referenced cached data changes
34
- * so that callers can re-render on cache changes. However, we should make
35
- * sure this toggling is optional - or we could use a callback argument, to
36
- * achieve this on an as-needed basis.
37
- */
38
- declare export var useSharedCache: <TValue: ValidCacheData>(
39
- id: string,
40
- scope: string,
41
- initialValue?: TValue | (() => TValue | null | void) | null | void
42
- ) => [TValue | null | void, CacheValueFn<TValue>];
@@ -1,47 +0,0 @@
1
- /**
2
- * Flowtype definitions for data
3
- * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.21.0
5
- * @flow
6
- */
7
- declare export { FetchPolicy } from "./util/types";
8
- export type {
9
- ErrorOptions,
10
- ResponseCache,
11
- CachedResponse,
12
- Result,
13
- RawScopedCache,
14
- ValidCacheData,
15
- ScopedCache,
16
- } from "./util/types";
17
- declare export * from "./util/hydration-cache-api";
18
- declare export * from "./util/request-api";
19
- declare export { purgeCaches } from "./util/purge-caches";
20
- declare export { default as TrackData } from "./components/track-data";
21
- declare export { default as Data } from "./components/data";
22
- declare export { default as InterceptRequests } from "./components/intercept-requests";
23
- declare export { DataError, DataErrors } from "./util/data-error";
24
- declare export { useServerEffect } from "./hooks/use-server-effect";
25
- declare export { useCachedEffect } from "./hooks/use-cached-effect";
26
- declare export { useSharedCache, SharedCache } from "./hooks/use-shared-cache";
27
- declare export {
28
- useHydratableEffect,
29
- WhenClientSide,
30
- } from "./hooks/use-hydratable-effect";
31
- declare export { ScopedInMemoryCache } from "./util/scoped-in-memory-cache";
32
- declare export { SerializableInMemoryCache } from "./util/serializable-in-memory-cache";
33
- declare export { Status } from "./util/status";
34
- declare export { getGqlRequestId } from "./util/get-gql-request-id";
35
- declare export { getGqlDataFromResponse } from "./util/get-gql-data-from-response";
36
- declare export { graphQLDocumentNodeParser } from "./util/graphql-document-node-parser";
37
- declare export { toGqlOperation } from "./util/to-gql-operation";
38
- declare export { GqlRouter } from "./components/gql-router";
39
- declare export { useGql } from "./hooks/use-gql";
40
- declare export { GqlError, GqlErrors } from "./util/gql-error";
41
- export type {
42
- GqlContext,
43
- GqlOperation,
44
- GqlOperationType,
45
- GqlFetchOptions,
46
- GqlFetchFn,
47
- } from "./util/gql-types";
@@ -1,62 +0,0 @@
1
- /**
2
- * Flowtype definitions for data
3
- * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.21.0
5
- * @flow
6
- */
7
- import { KindError } from "@khanacademy/wonder-stuff-core";
8
- import type { ErrorOptions } from "./types";
9
-
10
- /**
11
- * Error kinds for DataError.
12
- */
13
- declare export var DataErrors: $ReadOnly<{|
14
- /**
15
- * The kind of error is not known.
16
- */
17
- Unknown: "Unknown",
18
-
19
- /**
20
- * The error is internal to the executing code.
21
- */
22
- Internal: "Internal",
23
-
24
- /**
25
- * There was a problem with the provided input.
26
- */
27
- InvalidInput: "InvalidInput",
28
-
29
- /**
30
- * A network error occurred.
31
- */
32
- Network: "Network",
33
-
34
- /**
35
- * There was a problem due to the state of the system not matching the
36
- * requested operation or input.
37
- */
38
- NotAllowed: "NotAllowed",
39
-
40
- /**
41
- * Response could not be parsed.
42
- */
43
- Parse: "Parse",
44
-
45
- /**
46
- * An error that occurred during SSR and was hydrated from cache
47
- */
48
- Hydrated: "Hydrated",
49
- |}>;
50
- /**
51
- * An error from the Wonder Blocks Data API.
52
- *
53
- * Errors of this type will have names of the format:
54
- * `${kind}DataError`
55
- */
56
- declare export class DataError extends KindError {
57
- constructor(
58
- message: string,
59
- kind: $ElementType<typeof DataErrors, $Keys<typeof DataErrors>>,
60
- x?: ErrorOptions
61
- ): this;
62
- }
@@ -1,12 +0,0 @@
1
- /**
2
- * Flowtype definitions for data
3
- * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.21.0
5
- * @flow
6
- */
7
- /**
8
- * Validate a GQL operation response and extract the data.
9
- */
10
- declare export var getGqlDataFromResponse: <TData>(
11
- response: Response
12
- ) => Promise<TData>;
@@ -1,16 +0,0 @@
1
- /**
2
- * Flowtype definitions for data
3
- * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.21.0
5
- * @flow
6
- */
7
- import type { GqlOperation, GqlContext } from "./gql-types";
8
-
9
- /**
10
- * Get an identifier for a given request.
11
- */
12
- declare export var getGqlRequestId: <TData, TVariables: { [key: any]: any }>(
13
- operation: GqlOperation<TData, TVariables>,
14
- variables: TVariables | null | void,
15
- context: GqlContext
16
- ) => string;
@@ -1,41 +0,0 @@
1
- /**
2
- * Flowtype definitions for data
3
- * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.21.0
5
- * @flow
6
- */
7
- import { KindError } from "@khanacademy/wonder-stuff-core";
8
- import type { ErrorOptions } from "./types";
9
-
10
- /**
11
- * Error kinds for GqlError.
12
- */
13
- declare export var GqlErrors: $ReadOnly<{|
14
- /**
15
- * An internal framework error.
16
- */
17
- Internal: "Internal",
18
-
19
- /**
20
- * Response does not have the correct structure for a GraphQL response.
21
- */
22
- BadResponse: "BadResponse",
23
-
24
- /**
25
- * A valid GraphQL result with errors field in the payload.
26
- */
27
- ErrorResult: "ErrorResult",
28
- |}>;
29
- /**
30
- * An error from the GQL API.
31
- *
32
- * Errors of this type will have names of the format:
33
- * `${kind}GqlError`
34
- */
35
- declare export class GqlError extends KindError {
36
- constructor(
37
- message: string,
38
- kind: $ElementType<typeof GqlErrors, $Keys<typeof GqlErrors>>,
39
- x?: ErrorOptions
40
- ): this;
41
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * Flowtype definitions for data
3
- * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.21.0
5
- * @flow
6
- */
7
- import * as React from "react";
8
- import type { GqlRouterConfiguration } from "./gql-types";
9
- declare var GqlRouterContext: React.Context<GqlRouterConfiguration<any> | null | void>;
10
- declare export { GqlRouterContext };
@@ -1,50 +0,0 @@
1
- /**
2
- * Flowtype definitions for data
3
- * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.21.0
5
- * @flow
6
- */
7
- /**
8
- * Operation types.
9
- */
10
- export type GqlOperationType = "mutation" | "query";
11
- /**
12
- * A GraphQL operation.
13
- */
14
- export type GqlOperation<TData, TVariables: { ... } = Empty> = {
15
- type: GqlOperationType,
16
- id: string,
17
- [key: string]: mixed,
18
- };
19
- export type GqlContext = {
20
- [key: string]: string,
21
- };
22
- /**
23
- * Functions that make fetches of GQL operations.
24
- */
25
- export type GqlFetchFn<
26
- TData,
27
- TVariables: { [key: any]: any },
28
- TContext: GqlContext
29
- > = (
30
- operation: GqlOperation<TData, TVariables>,
31
- variables: TVariables | null | void,
32
- context: TContext
33
- ) => Promise<Response>;
34
- /**
35
- * The configuration stored in the GqlRouterContext context.
36
- */
37
- export type GqlRouterConfiguration<TContext: GqlContext> = {|
38
- fetch: GqlFetchFn<any, any, any>,
39
- defaultContext: TContext,
40
- |};
41
- /**
42
- * Options for configuring a GQL fetch.
43
- */
44
- export type GqlFetchOptions<
45
- TVariables: { [key: any]: any },
46
- TContext: GqlContext
47
- > = {|
48
- variables?: TVariables,
49
- context?: $Rest<TContext, {}>,
50
- |};
@@ -1,29 +0,0 @@
1
- /**
2
- * Flowtype definitions for data
3
- * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.21.0
5
- * @flow
6
- */
7
- import type { DocumentNode, VariableDefinitionNode } from "./graphql-types";
8
- declare export var DocumentTypes: $ReadOnly<{|
9
- query: "query",
10
- mutation: "mutation",
11
- |}>;
12
- export type DocumentType = $ElementType<
13
- typeof DocumentTypes,
14
- $Keys<typeof DocumentTypes>
15
- >;
16
- export interface IDocumentDefinition {
17
- type: DocumentType;
18
- name: string;
19
- variables: $ReadOnlyArray<VariableDefinitionNode>;
20
- }
21
- /**
22
- * Parse a GraphQL document node to determine some info about it.
23
- *
24
- * This is based on:
25
- * https://github.com/apollographql/react-apollo/blob/3bc993b2ea91704bd6a2667f42d1940656c071ff/src/parser.ts
26
- */
27
- declare export function graphQLDocumentNodeParser(
28
- document: DocumentNode
29
- ): IDocumentDefinition;
@@ -1,30 +0,0 @@
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.
7
- export interface DefinitionNode {
8
- +kind: string;
9
- }
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
- };