@shopify/react-graphql
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -10,2 +10,8 @@ # Changelog | ||
## 1.1.0 - 2019-02-10 | ||
### Added | ||
- Added some additional generic types for extracting default from queries. | ||
## 1.0.1 - 2019-02-10 | ||
@@ -12,0 +18,0 @@ |
@@ -1,24 +0,7 @@ | ||
import * as React from 'react'; | ||
import { LoadProps } from '@shopify/async'; | ||
import { Omit, IfEmptyObject, IfAllNullableKeys } from '@shopify/useful-types'; | ||
import { DocumentNode } from 'graphql-typed'; | ||
import { Props as QueryProps } from './Query'; | ||
import { AsyncQueryComponentType } from './types'; | ||
interface QueryComponentOptions<Data, Variables> extends LoadProps<DocumentNode<Data, Variables>> { | ||
} | ||
declare type VariableOptions<Variables> = IfEmptyObject<Variables, { | ||
variables?: never; | ||
}, IfAllNullableKeys<Variables, { | ||
variables?: Variables; | ||
}, { | ||
variables: Variables; | ||
}>>; | ||
export interface AsyncQueryComponentType<Data, Variables> { | ||
(props: Omit<QueryProps<Data, Variables>, 'query' | 'variables'> & VariableOptions<Variables>): React.ReactElement<{}>; | ||
Prefetch(props: VariableOptions<Variables>): React.ReactElement<{}>; | ||
Preload(): React.ReactElement<{}>; | ||
KeepFresh(props: VariableOptions<Variables> & { | ||
pollInterval?: number; | ||
}): React.ReactElement<{}>; | ||
} | ||
export declare function createAsyncQueryComponent<Data, Variables>({ id, load, }: QueryComponentOptions<Data, Variables>): AsyncQueryComponentType<Data, Variables>; | ||
export {}; |
export { Query } from './Query'; | ||
export { Prefetch, Props as PrefetchProps } from './Prefetch'; | ||
export { createAsyncQueryComponent } from './async'; | ||
export { AsyncQueryComponentType, GraphQLData, GraphQLVariables, QueryProps, } from './types'; |
/// <reference types="react" /> | ||
import { Props as QueryProps } from './Query'; | ||
import { QueryProps } from './types'; | ||
export declare type Props<T> = Pick<QueryProps<T>, 'query' | 'variables' | 'onError' | 'onCompleted' | 'pollInterval'> & { | ||
@@ -4,0 +4,0 @@ ignoreCache?: boolean; |
@@ -1,31 +0,7 @@ | ||
import { DocumentNode } from 'graphql-typed'; | ||
import * as React from 'react'; | ||
import { QueryResult } from 'react-apollo'; | ||
import { FetchPolicy, ErrorPolicy, OperationVariables, ApolloError, ApolloClient } from 'apollo-client'; | ||
import { IfEmptyObject, IfAllNullableKeys } from '@shopify/useful-types'; | ||
export declare type Props<Data = any, Variables = OperationVariables> = { | ||
children: (result: QueryResult<Data, Variables>) => React.ReactNode; | ||
fetchPolicy?: FetchPolicy; | ||
errorPolicy?: ErrorPolicy; | ||
notifyOnNetworkStatusChange?: boolean; | ||
pollInterval?: number; | ||
query: DocumentNode<Data, Variables>; | ||
ssr?: boolean; | ||
displayName?: string; | ||
skip?: boolean; | ||
client?: ApolloClient<Object>; | ||
context?: Record<string, any>; | ||
partialRefetch?: boolean; | ||
onCompleted?: (data: Data | {}) => void; | ||
onError?: (error: ApolloError) => void; | ||
} & IfEmptyObject<Variables, { | ||
variables?: never; | ||
}, IfAllNullableKeys<Variables, { | ||
variables?: Variables; | ||
}, { | ||
variables: Variables; | ||
}>>; | ||
declare class QueryTypeClass<Data = any, Variables = OperationVariables> extends React.Component<Props<Data, Variables>> { | ||
import { OperationVariables } from 'apollo-client'; | ||
import { QueryProps } from './types'; | ||
declare class QueryTypeClass<Data = any, Variables = OperationVariables> extends React.Component<QueryProps<Data, Variables>> { | ||
} | ||
export declare const Query: typeof QueryTypeClass; | ||
export {}; |
{ | ||
"name": "@shopify/react-graphql", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Tools for creating type-safe and asynchronous GraphQL components for React.", |
12915
13