apollo-client
Advanced tools
Comparing version 2.2.8 to 2.3.0
@@ -301,3 +301,3 @@ var __extends = (this && this.__extends) || (function () { | ||
this.isTornDown = false; | ||
var newVariables = variables; | ||
var newVariables = variables ? variables : this.variables; | ||
if (isEqual(newVariables, this.variables) && !tryFetch) { | ||
@@ -304,0 +304,0 @@ // If we have no observers, then we don't actually want to make a network |
@@ -23,3 +23,2 @@ import { ApolloLink, FetchResult } from 'apollo-link'; | ||
export interface QueryPromise { | ||
promise: Promise<ApolloQueryResult<any>>; | ||
resolve: (result: ApolloQueryResult<any>) => void; | ||
@@ -57,3 +56,3 @@ reject: (error: Error) => void; | ||
updateQueryWatch(queryId: string, document: DocumentNode, options: WatchQueryOptions): () => void; | ||
addFetchQueryPromise<T>(requestId: number, promise: Promise<ApolloQueryResult<T>>, resolve: (result: ApolloQueryResult<T>) => void, reject: (error: Error) => void): void; | ||
addFetchQueryPromise<T>(requestId: number, resolve: (result: ApolloQueryResult<T>) => void, reject: (error: Error) => void): void; | ||
removeFetchQueryPromise(requestId: number): void; | ||
@@ -60,0 +59,0 @@ addObservableQuery<T>(queryId: string, observableQuery: ObservableQuery<T>): void; |
@@ -216,3 +216,2 @@ var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
queryId: queryId, | ||
queryString: print(query), | ||
document: query, | ||
@@ -351,3 +350,3 @@ storePreviousVariables: shouldFetch, | ||
'for the query ' + | ||
queryStoreValue.queryString); | ||
print(queryStoreValue.document)); | ||
} | ||
@@ -489,4 +488,4 @@ } | ||
var requestId = this.idCounter; | ||
var resPromise = new Promise(function (resolve, reject) { | ||
_this.addFetchQueryPromise(requestId, resPromise, resolve, reject); | ||
return new Promise(function (resolve, reject) { | ||
_this.addFetchQueryPromise(requestId, resolve, reject); | ||
return _this.watchQuery(options, false) | ||
@@ -503,3 +502,2 @@ .result() | ||
}); | ||
return resPromise; | ||
}; | ||
@@ -552,5 +550,4 @@ QueryManager.prototype.generateQueryId = function () { | ||
// Adds a promise to this.fetchQueryPromises for a given request ID. | ||
QueryManager.prototype.addFetchQueryPromise = function (requestId, promise, resolve, reject) { | ||
QueryManager.prototype.addFetchQueryPromise = function (requestId, resolve, reject) { | ||
this.fetchQueryPromises.set(requestId.toString(), { | ||
promise: promise, | ||
resolve: resolve, | ||
@@ -780,4 +777,4 @@ reject: reject, | ||
var errorsFromStore; | ||
var retPromise = new Promise(function (resolve, reject) { | ||
_this.addFetchQueryPromise(requestId, retPromise, resolve, reject); | ||
return new Promise(function (resolve, reject) { | ||
_this.addFetchQueryPromise(requestId, resolve, reject); | ||
var subscription = execute(_this.deduplicator, operation).subscribe({ | ||
@@ -869,3 +866,2 @@ next: function (result) { | ||
}); | ||
return retPromise; | ||
}; | ||
@@ -872,0 +868,0 @@ // Refetches a query given that query's name. Refetches |
import { DocumentNode, GraphQLError, ExecutionResult } from 'graphql'; | ||
import { NetworkStatus } from '../core/networkStatus'; | ||
export declare type QueryStoreValue = { | ||
queryString: string; | ||
document: DocumentNode; | ||
@@ -21,3 +20,2 @@ variables: Object; | ||
queryId: string; | ||
queryString: string; | ||
document: DocumentNode; | ||
@@ -24,0 +22,0 @@ storePreviousVariables: boolean; |
@@ -9,2 +9,3 @@ var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
}; | ||
import { print } from 'graphql/language/printer'; | ||
import { isEqual } from 'apollo-utilities'; | ||
@@ -24,3 +25,5 @@ import { NetworkStatus } from '../core/networkStatus'; | ||
var previousQuery = this.store[query.queryId]; | ||
if (previousQuery && previousQuery.queryString !== query.queryString) { | ||
if (previousQuery && | ||
previousQuery.document !== query.document && | ||
print(previousQuery.document) !== print(query.document)) { | ||
// XXX we're throwing an error here to catch bugs where a query gets overwritten by a new one. | ||
@@ -64,3 +67,2 @@ // we should implement a separate action for refetching so that QUERY_INIT may never overwrite | ||
this.store[query.queryId] = { | ||
queryString: query.queryString, | ||
document: query.document, | ||
@@ -67,0 +69,0 @@ variables: query.variables, |
{ | ||
"name": "apollo-client", | ||
"version": "2.2.8", | ||
"version": "2.3.0", | ||
"description": "A simple yet functional GraphQL client.", | ||
@@ -27,8 +27,8 @@ "main": "bundle.umd.js", | ||
"@types/zen-observable": "^0.5.3", | ||
"apollo-cache": "^1.1.7", | ||
"apollo-cache": "^1.1.8", | ||
"apollo-link": "^1.0.0", | ||
"apollo-link-dedup": "^1.0.0", | ||
"apollo-utilities": "^1.0.11", | ||
"apollo-utilities": "^1.0.12", | ||
"symbol-observable": "^1.0.2", | ||
"zen-observable": "^0.7.0" | ||
"zen-observable": "^0.8.0" | ||
}, | ||
@@ -40,26 +40,26 @@ "peerDependencies": { | ||
"@types/benchmark": "1.0.31", | ||
"@types/graphql": "0.12.5", | ||
"@types/graphql": "0.12.7", | ||
"@types/isomorphic-fetch": "0.0.34", | ||
"@types/jest": "21.1.10", | ||
"@types/lodash": "4.14.105", | ||
"@types/node": "8.9.5", | ||
"apollo-cache-inmemory": "^1.1.12", | ||
"@types/lodash": "4.14.108", | ||
"@types/node": "8.10.11", | ||
"apollo-cache-inmemory": "^1.2.0", | ||
"benchmark": "2.1.4", | ||
"browserify": "15.2.0", | ||
"bundlesize": "0.16.0", | ||
"bundlesize": "0.17.0", | ||
"danger": "1.1.0", | ||
"flow-bin": "0.68.0", | ||
"flow-bin": "0.71.0", | ||
"github": "12.1.0", | ||
"graphql": "0.13.2", | ||
"graphql-tag": "2.8.0", | ||
"graphql-tag": "2.9.2", | ||
"isomorphic-fetch": "2.2.1", | ||
"jest": "20.0.4", | ||
"lint-staged": "6.1.0", | ||
"lodash": "4.17.5", | ||
"rollup": "0.56.4", | ||
"rxjs": "5.5.7", | ||
"lodash": "4.17.10", | ||
"rollup": "0.58.2", | ||
"rxjs": "5.5.10", | ||
"ts-jest": "20.0.14", | ||
"tslint": "5.9.1", | ||
"typescript": "2.4.2", | ||
"uglify-js": "3.3.16", | ||
"uglify-js": "3.3.23", | ||
"webpack": "3.10.0", | ||
@@ -69,4 +69,4 @@ "webpack-bundle-analyzer": "2.11.1" | ||
"optionalDependencies": { | ||
"@types/async": "2.0.47" | ||
"@types/async": "2.0.49" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# [Apollo client](https://www.apollographql.com/client/) [](https://badge.fury.io/js/apollo-client) [](http://www.apollostack.com/#slack) [](https://www.codetriage.com/apollographql/apollo-client) | ||
# [Apollo Client](https://www.apollographql.com/client/) [](https://badge.fury.io/js/apollo-client) [](http://www.apollostack.com/#slack) [](https://www.codetriage.com/apollographql/apollo-client) | ||
@@ -25,3 +25,3 @@ Apollo Client is a fully-featured caching GraphQL client with integrations for React, Angular, and more. It allows you to easily build UI components that fetch data via GraphQL. To get the most value out of `apollo-client`, you should use it with one of its view layer integrations. | ||
# installing the preset package | ||
npm install apollo-client-preset graphql-tag graphql --save | ||
npm install apollo-boost graphql-tag graphql --save | ||
# installing each piece independently | ||
@@ -37,6 +37,6 @@ npm install apollo-client apollo-cache-inmemory apollo-link-http graphql-tag graphql --save | ||
You get started by constructing an instance of the core class [`ApolloClient`][]. If you load `ApolloClient` from the [`apollo-client-preset`][] package, it will be configured with a few reasonable defaults such as our standard in-memory cache and a link to a GraphQL API at `/graphql`. | ||
You get started by constructing an instance of the core class [`ApolloClient`][]. If you load `ApolloClient` from the [`apollo-boost`][] package, it will be configured with a few reasonable defaults such as our standard in-memory cache and a link to a GraphQL API at `/graphql`. | ||
```js | ||
import ApolloClient from 'apollo-client-preset'; | ||
import ApolloClient from 'apollo-boost'; | ||
@@ -47,12 +47,9 @@ const client = new ApolloClient(); | ||
To point `ApolloClient` at a different URL, just create your own `HttpLink` instance, like so, replacing `https://graphql.example.com` with your GraphQL API's URL: | ||
To point `ApolloClient` at a different URL, add your GraphQL API's URL to the `uri` config property: | ||
```js | ||
import { ApolloClient } from 'apollo-client'; | ||
import { HttpLink } from 'apollo-link-http'; | ||
import { InMemoryCache } from 'apollo-cache-inmemory'; | ||
import ApolloClient from 'apollo-boost'; | ||
const client = new ApolloClient({ | ||
link: new HttpLink({ uri: 'https://graphql.example.com' }), | ||
cache: new InMemoryCache() | ||
uri: 'https://graphql.example.com' | ||
}); | ||
@@ -83,10 +80,9 @@ ``` | ||
To learn more about all of the features available to you through the `apollo-client` package, be sure to read through the [**`apollo-client` API reference**][]. | ||
To learn more about all of the features available to you through the `apollo-client` package, be sure to read through the [**`apollo-client` API reference**][https://www.apollographql.com/docs/react/api/apollo-client.html]. | ||
[`ApolloClient`]: http://apollographql.com/docs/react | ||
[`apollo-client-preset`]: https://www.npmjs.com/package/apollo-client-preset | ||
[`ApolloClient`]: https://www.apollographql.com/docs/react/api/apollo-client.html | ||
[`apollo-boost`]: https://www.apollographql.com/docs/react/essentials/get-started.html#apollo-boost | ||
[reactively watching queries with `watchQuery`]: http://apollographql.com/docs/react/reference/index.html#ApolloClient\.watchQuery | ||
[changing data on your server with `mutate`]: http://apollographql.com/docs/react/basics/mutations | ||
[reading a fragment from your local cache with `readFragment`]: https://www.apollographql.com/docs/react/basics/caching.html#readfragment | ||
[**`apollo-client` API reference**]: http://apollographql.com/docs/react/reference/index.html | ||
[changing data on your server with `mutate`]: https://www.apollographql.com/docs/react/essentials/mutations.html | ||
[reading a fragment from your local cache with `readFragment`]: https://www.apollographql.com/docs/react/advanced/caching.html#direct | ||
@@ -93,0 +89,0 @@ ## Learn how to use Apollo Client with your favorite framework |
@@ -1,1 +0,1 @@ | ||
export declare const version = "2.2.8"; | ||
export declare const version = "2.3.0"; |
@@ -1,1 +0,1 @@ | ||
exports.version = "2.2.8" | ||
exports.version = "2.3.0" |
Sorry, the diff of this file is too big to display
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
496332
5411
126
1
+ Added@types/async@2.0.49(transitive)
- Removed@types/async@2.0.47(transitive)
- Removedzen-observable@0.7.1(transitive)
Updatedapollo-cache@^1.1.8
Updatedapollo-utilities@^1.0.12
Updatedzen-observable@^0.8.0