apollo-client
Advanced tools
Comparing version 0.5.0 to 0.5.1
/// <reference types="chai" /> | ||
/// <reference types="es6-shim" /> | ||
/// <reference types="typed-graphql" /> | ||
import { NetworkInterface } from './transport/networkInterface'; | ||
import { Document, FragmentDefinition } from 'graphql'; | ||
import { ApolloStore, ApolloReducerConfig, Store } from './store'; | ||
@@ -10,5 +7,5 @@ import { QueryManager, ApolloQueryResult, ResultComparator, ResultTransformer } from './core/QueryManager'; | ||
import { Observable } from './util/Observable'; | ||
import { DeprecatedWatchQueryOptions, DeprecatedSubscriptionOptions } from './core/watchQueryOptions'; | ||
import { DeprecatedWatchQueryOptions, DeprecatedSubscriptionOptions, MutationOptions } from './core/watchQueryOptions'; | ||
import { IdGetter } from './data/extensions'; | ||
import { MutationBehavior, MutationBehaviorReducerMap, MutationQueryReducersMap } from './data/mutationResults'; | ||
import { MutationBehaviorReducerMap } from './data/mutationResults'; | ||
export declare type ApolloStateSelector = (state: any) => Store; | ||
@@ -45,11 +42,3 @@ export default class ApolloClient { | ||
query(options: DeprecatedWatchQueryOptions): Promise<ApolloQueryResult>; | ||
mutate(options: { | ||
mutation: Document; | ||
variables?: Object; | ||
resultBehaviors?: MutationBehavior[]; | ||
fragments?: FragmentDefinition[]; | ||
optimisticResponse?: Object; | ||
updateQueries?: MutationQueryReducersMap; | ||
refetchQueries?: string[]; | ||
}): Promise<ApolloQueryResult>; | ||
mutate(options: MutationOptions): Promise<ApolloQueryResult>; | ||
subscribe(options: DeprecatedSubscriptionOptions): Observable<any>; | ||
@@ -56,0 +45,0 @@ reducer(): Function; |
@@ -74,2 +74,3 @@ "use strict"; | ||
this.setStore = this.setStore.bind(this); | ||
this.resetStore = this.resetStore.bind(this); | ||
} | ||
@@ -76,0 +77,0 @@ ApolloClient.prototype.watchQuery = function (options) { |
/// <reference types="chai" /> | ||
/// <reference types="es6-shim" /> | ||
import { ModifiableWatchQueryOptions, WatchQueryOptions, FetchMoreQueryOptions, SubscribeToMoreOptions } from './watchQueryOptions'; | ||
@@ -4,0 +3,0 @@ import { Observable } from '../util/Observable'; |
@@ -54,3 +54,3 @@ "use strict"; | ||
ObservableQuery.prototype.currentResult = function () { | ||
var _a = this.queryManager.getCurrentQueryResult(this), data = _a.data, partial = _a.partial; | ||
var _a = this.queryManager.getCurrentQueryResult(this, true), data = _a.data, partial = _a.partial; | ||
var queryStoreValue = this.queryManager.getApolloState().queries[this.queryId]; | ||
@@ -146,3 +146,8 @@ if (queryStoreValue && (queryStoreValue.graphQLErrors || queryStoreValue.networkError)) { | ||
error: function (err) { | ||
console.error(err); | ||
if (options.onError) { | ||
options.onError(err); | ||
} | ||
else { | ||
console.error('Unhandled GraphQL subscription errror', err); | ||
} | ||
}, | ||
@@ -149,0 +154,0 @@ }); |
/// <reference types="typed-graphql" /> | ||
/// <reference types="node" /> | ||
/// <reference types="chai" /> | ||
/// <reference types="es6-shim" /> | ||
import { NetworkInterface } from '../transport/networkInterface'; | ||
@@ -6,0 +5,0 @@ import { ApolloStore, Store, ApolloReducerConfig } from '../store'; |
/// <reference types="typed-graphql" /> | ||
/// <reference types="chai" /> | ||
/// <reference types="node" /> | ||
import { Document, FragmentDefinition } from 'graphql'; | ||
import { OperationResultReducer } from '../data/mutationResults'; | ||
import { OperationResultReducer, MutationBehavior, MutationQueryReducersMap } from '../data/mutationResults'; | ||
export interface ModifiableWatchQueryOptions { | ||
@@ -43,2 +44,3 @@ variables?: { | ||
}) => Object; | ||
onError?: (error: Error) => void; | ||
}; | ||
@@ -52,1 +54,10 @@ export interface DeprecatedSubscriptionOptions { | ||
} | ||
export interface MutationOptions { | ||
mutation: Document; | ||
variables?: Object; | ||
resultBehaviors?: MutationBehavior[]; | ||
fragments?: FragmentDefinition[]; | ||
optimisticResponse?: Object; | ||
updateQueries?: MutationQueryReducersMap; | ||
refetchQueries?: string[]; | ||
} |
@@ -7,3 +7,3 @@ import { Request, createNetworkInterface } from './transport/networkInterface'; | ||
import { Subscription } from './util/Observable'; | ||
import { WatchQueryOptions } from './core/watchQueryOptions'; | ||
import { WatchQueryOptions, MutationOptions, DeprecatedSubscriptionOptions } from './core/watchQueryOptions'; | ||
import { readQueryFromStore } from './data/readFromStore'; | ||
@@ -17,3 +17,3 @@ import { writeQueryToStore } from './data/writeToStore'; | ||
import { ApolloQueryResult } from './core/QueryManager'; | ||
export { createNetworkInterface, createBatchingNetworkInterface, createApolloStore, createApolloReducer, readQueryFromStore, writeQueryToStore, print as printAST, createFragmentMap, ApolloError, createFragment, clearFragmentDefinitions, disableFragmentWarnings, enableFragmentWarnings, getQueryDefinition, getFragmentDefinitions, FragmentMap, Request, ApolloQueryResult, WatchQueryOptions, ObservableQuery, MutationBehavior, MutationQueryReducersMap, Subscription, ApolloStore, ApolloClient }; | ||
export { createNetworkInterface, createBatchingNetworkInterface, createApolloStore, createApolloReducer, readQueryFromStore, writeQueryToStore, print as printAST, createFragmentMap, ApolloError, createFragment, clearFragmentDefinitions, disableFragmentWarnings, enableFragmentWarnings, getQueryDefinition, getFragmentDefinitions, FragmentMap, Request, ApolloQueryResult, WatchQueryOptions, MutationOptions, ObservableQuery, MutationBehavior, MutationQueryReducersMap, Subscription, DeprecatedSubscriptionOptions as SubscriptionOptions, ApolloStore, ApolloClient }; | ||
export default ApolloClient; |
{ | ||
"name": "apollo-client", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "A simple yet functional GraphQL client.", | ||
@@ -23,3 +23,2 @@ "main": "index.js", | ||
"dependencies": { | ||
"es6-promise": "^4.0.3", | ||
"graphql-anywhere": "^0.2.4", | ||
@@ -52,3 +51,2 @@ "graphql-tag": "^0.1.13", | ||
"@types/chai-as-promised": "0.0.28", | ||
"@types/es6-shim": "^0.31.32", | ||
"@types/mocha": "^2.2.31", | ||
@@ -77,3 +75,3 @@ "browserify": "^13.0.0", | ||
"typed-graphql": "1.0.2", | ||
"typescript": "2.0.3", | ||
"typescript": "2.0.8", | ||
"uglify-js": "^2.6.2" | ||
@@ -80,0 +78,0 @@ }, |
@@ -128,3 +128,3 @@ "use strict"; | ||
}).reduce(function (res, key) { | ||
res[key] = state[key]; | ||
res[key] = assign({}, state[key], { loading: true, networkStatus: NetworkStatus.loading }); | ||
return res; | ||
@@ -131,0 +131,0 @@ }, {}); |
@@ -1,2 +0,1 @@ | ||
/// <reference types="es6-shim" /> | ||
import { QueryManager, QueryListener, FetchType } from '../core/QueryManager'; | ||
@@ -3,0 +2,0 @@ import { ObservableQuery } from '../core/ObservableQuery'; |
/// <reference types="isomorphic-fetch" /> | ||
/// <reference types="es6-shim" /> | ||
/// <reference types="typed-graphql" /> | ||
@@ -4,0 +3,0 @@ import { GraphQLResult } from 'graphql'; |
@@ -54,5 +54,4 @@ "use strict"; | ||
var results = []; | ||
responsesAndOptions.forEach(function (_a) { | ||
var response = _a.response; | ||
results.push(response); | ||
responsesAndOptions.forEach(function (result) { | ||
results.push(result.response); | ||
}); | ||
@@ -59,0 +58,0 @@ resolve(results); |
@@ -1,2 +0,1 @@ | ||
/// <reference types="es6-shim" /> | ||
/// <reference types="typed-graphql" /> | ||
@@ -3,0 +2,0 @@ /// <reference types="node" /> |
/// <reference types="typed-graphql" /> | ||
/// <reference types="chai" /> | ||
/// <reference types="es6-shim" /> | ||
/// <reference types="isomorphic-fetch" /> | ||
@@ -38,4 +37,4 @@ import 'whatwg-fetch'; | ||
_afterwares: AfterwareInterface[]; | ||
use(middlewares: MiddlewareInterface[]): any; | ||
useAfter(afterwares: AfterwareInterface[]): any; | ||
use(middlewares: MiddlewareInterface[]): HTTPNetworkInterface; | ||
useAfter(afterwares: AfterwareInterface[]): HTTPNetworkInterface; | ||
} | ||
@@ -61,4 +60,4 @@ export interface RequestAndOptions { | ||
query(request: Request): Promise<GraphQLResult>; | ||
use(middlewares: MiddlewareInterface[]): void; | ||
useAfter(afterwares: AfterwareInterface[]): void; | ||
use(middlewares: MiddlewareInterface[]): HTTPNetworkInterface; | ||
useAfter(afterwares: AfterwareInterface[]): HTTPNetworkInterface; | ||
} | ||
@@ -65,0 +64,0 @@ export interface NetworkInterfaceOptions { |
@@ -119,2 +119,3 @@ "use strict"; | ||
}); | ||
return this; | ||
}; | ||
@@ -131,2 +132,3 @@ HTTPFetchNetworkInterface.prototype.useAfter = function (afterwares) { | ||
}); | ||
return this; | ||
}; | ||
@@ -133,0 +135,0 @@ return HTTPFetchNetworkInterface; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
258761
30
27
3779
- Removedes6-promise@^4.0.3
- Removedes6-promise@4.2.8(transitive)