-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Note: Typescript files with only types, are used only in compilation phase and not going to be imported on compiled javascript. Closes #1074
- Loading branch information
Showing
8 changed files
with
82 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { Document } from 'graphql'; | ||
import { | ||
QueryStoreValue, | ||
NetworkStatus, | ||
} from '../queries/store'; | ||
|
||
export interface SubscriptionOptions { | ||
document: Document; | ||
variables?: { [key: string]: any }; | ||
}; | ||
|
||
export type QueryListener = (queryStoreValue: QueryStoreValue) => void; | ||
|
||
export type ApolloQueryResult = { | ||
data: any; | ||
loading: boolean; | ||
networkStatus: NetworkStatus; | ||
|
||
// This type is different from the GraphQLResult type because it doesn't include errors. | ||
// Those are thrown via the standard promise/observer catch mechanism. | ||
}; | ||
|
||
// A result transformer is given the data that is to be returned from the store from a query or | ||
// mutation, and can modify or observe it before the value is provided to your application. | ||
// | ||
// For watched queries, the transformer is only called when the data retrieved from the server is | ||
// different from previous. | ||
// | ||
// If the transformer wants to mutate results (say, by setting the prototype of result data), it | ||
// will likely need to be paired with a custom resultComparator. By default, Apollo performs a | ||
// deep equality comparsion on results, and skips those that are considered equal - reducing | ||
// re-renders. | ||
export type ResultTransformer = (resultData: ApolloQueryResult) => ApolloQueryResult; | ||
|
||
// Controls how Apollo compares two query results and considers their equality. Two equal results | ||
// will not trigger re-renders. | ||
export type ResultComparator = (result1: ApolloQueryResult, result2: ApolloQueryResult) => boolean; | ||
|
||
export enum FetchType { | ||
normal = 1, | ||
refetch = 2, | ||
poll = 3, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters