apollo-client
Advanced tools
Comparing version 2.4.6 to 2.4.7
@@ -23,2 +23,4 @@ import { ApolloLink, FetchResult, GraphQLRequest } from 'apollo-link'; | ||
defaultOptions?: DefaultOptions; | ||
name?: string; | ||
version?: string; | ||
}; | ||
@@ -38,2 +40,3 @@ export default class ApolloClient<TCacheShape> implements DataProxy { | ||
private resetStoreCallbacks; | ||
private clientAwareness; | ||
constructor(options: ApolloClientOptions<TCacheShape>); | ||
@@ -40,0 +43,0 @@ watchQuery<T, TVariables = OperationVariables>(options: WatchQueryOptions<TVariables>): ObservableQuery<T>; |
@@ -23,3 +23,4 @@ var __assign = (this && this.__assign) || function () { | ||
this.resetStoreCallbacks = []; | ||
var link = options.link, cache = options.cache, _a = options.ssrMode, ssrMode = _a === void 0 ? false : _a, _b = options.ssrForceFetchDelay, ssrForceFetchDelay = _b === void 0 ? 0 : _b, connectToDevTools = options.connectToDevTools, _c = options.queryDeduplication, queryDeduplication = _c === void 0 ? true : _c, defaultOptions = options.defaultOptions; | ||
this.clientAwareness = {}; | ||
var link = options.link, cache = options.cache, _a = options.ssrMode, ssrMode = _a === void 0 ? false : _a, _b = options.ssrForceFetchDelay, ssrForceFetchDelay = _b === void 0 ? 0 : _b, connectToDevTools = options.connectToDevTools, _c = options.queryDeduplication, queryDeduplication = _c === void 0 ? true : _c, defaultOptions = options.defaultOptions, clientAwarenessName = options.name, clientAwarenessVersion = options.version; | ||
if (!link || !cache) { | ||
@@ -79,2 +80,8 @@ throw new Error("\n In order to initialize Apollo Client, you must specify link & cache properties on the config object.\n This is part of the required upgrade when migrating from Apollo Client 1.0 to Apollo Client 2.0.\n For more information, please visit:\n https://www.apollographql.com/docs/react/basics/setup.html\n to help you get started.\n "); | ||
this.version = version; | ||
if (clientAwarenessName) { | ||
this.clientAwareness.name = clientAwarenessName; | ||
} | ||
if (clientAwarenessVersion) { | ||
this.clientAwareness.version = clientAwarenessVersion; | ||
} | ||
} | ||
@@ -150,2 +157,3 @@ ApolloClient.prototype.watchQuery = function (options) { | ||
ssrMode: this.ssrMode, | ||
clientAwareness: this.clientAwareness, | ||
onBroadcast: function () { | ||
@@ -188,3 +196,5 @@ if (_this.devToolsHookCb) { | ||
var queryManager = this.queryManager; | ||
return Promise.resolve().then(function () { return (queryManager ? queryManager.clearStore() : Promise.resolve(null)); }); | ||
return Promise.resolve().then(function () { | ||
return queryManager ? queryManager.clearStore() : Promise.resolve(null); | ||
}); | ||
}; | ||
@@ -191,0 +201,0 @@ ApolloClient.prototype.onResetStore = function (cb) { |
@@ -34,2 +34,3 @@ import { ApolloLink, FetchResult } from 'apollo-link'; | ||
private queryDeduplication; | ||
private clientAwareness; | ||
private onBroadcast; | ||
@@ -40,3 +41,3 @@ private idCounter; | ||
private queryIdsByName; | ||
constructor({ link, queryDeduplication, store, onBroadcast, ssrMode, }: { | ||
constructor({ link, queryDeduplication, store, onBroadcast, ssrMode, clientAwareness, }: { | ||
link: ApolloLink; | ||
@@ -47,2 +48,3 @@ queryDeduplication?: boolean; | ||
ssrMode?: boolean; | ||
clientAwareness?: Record<string, string>; | ||
}); | ||
@@ -49,0 +51,0 @@ mutate<T>({ mutation, variables, optimisticResponse, updateQueries: updateQueriesByName, refetchQueries, awaitRefetchQueries, update: updateWithProxyFn, errorPolicy, fetchPolicy, context, }: MutationOptions): Promise<FetchResult<T>>; |
@@ -62,5 +62,6 @@ var __assign = (this && this.__assign) || function () { | ||
function QueryManager(_a) { | ||
var link = _a.link, _b = _a.queryDeduplication, queryDeduplication = _b === void 0 ? false : _b, store = _a.store, _c = _a.onBroadcast, onBroadcast = _c === void 0 ? function () { return undefined; } : _c, _d = _a.ssrMode, ssrMode = _d === void 0 ? false : _d; | ||
var link = _a.link, _b = _a.queryDeduplication, queryDeduplication = _b === void 0 ? false : _b, store = _a.store, _c = _a.onBroadcast, onBroadcast = _c === void 0 ? function () { return undefined; } : _c, _d = _a.ssrMode, ssrMode = _d === void 0 ? false : _d, _e = _a.clientAwareness, clientAwareness = _e === void 0 ? {} : _e; | ||
this.mutationStore = new MutationStore(); | ||
this.queryStore = new QueryStore(); | ||
this.clientAwareness = {}; | ||
this.idCounter = 1; | ||
@@ -75,2 +76,3 @@ this.queries = new Map(); | ||
this.onBroadcast = onBroadcast; | ||
this.clientAwareness = clientAwareness; | ||
this.scheduler = new QueryScheduler({ queryManager: this, ssrMode: ssrMode }); | ||
@@ -827,3 +829,3 @@ } | ||
QueryManager.prototype.getQuery = function (queryId) { | ||
return this.queries.get(queryId) || { | ||
return (this.queries.get(queryId) || { | ||
listeners: [], | ||
@@ -836,3 +838,3 @@ invalidated: false, | ||
subscriptions: [], | ||
}; | ||
}); | ||
}; | ||
@@ -866,3 +868,3 @@ QueryManager.prototype.setQuery = function (queryId, updater) { | ||
} | ||
} }), | ||
}, clientAwareness: this.clientAwareness }), | ||
}; | ||
@@ -869,0 +871,0 @@ }; |
{ | ||
"name": "apollo-client", | ||
"version": "2.4.6", | ||
"version": "2.4.7", | ||
"description": "A simple yet functional GraphQL client.", | ||
@@ -28,6 +28,6 @@ "main": "bundle.umd.js", | ||
"@types/zen-observable": "^0.8.0", | ||
"apollo-cache": "1.1.20", | ||
"apollo-cache": "1.1.21", | ||
"apollo-link": "^1.0.0", | ||
"apollo-link-dedup": "^1.0.0", | ||
"apollo-utilities": "1.0.25", | ||
"apollo-utilities": "1.0.26", | ||
"symbol-observable": "^1.0.2", | ||
@@ -34,0 +34,0 @@ "zen-observable": "^0.8.0" |
@@ -1,2 +0,2 @@ | ||
export declare const version = "2.4.6"; | ||
export declare const version = "2.4.7"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -1,1 +0,1 @@ | ||
exports.version = "2.4.6" | ||
exports.version = "2.4.7" |
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 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
471955
4543
+ Addedapollo-cache@1.1.21(transitive)
+ Addedapollo-utilities@1.0.26(transitive)
- Removedapollo-cache@1.1.20(transitive)
- Removedapollo-utilities@1.0.25(transitive)
Updatedapollo-cache@1.1.21
Updatedapollo-utilities@1.0.26