@apollo/client 3.3.15 → 3.3.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +13 -1
  2. package/apollo-client.cjs.js +31 -28
  3. package/apollo-client.cjs.js.map +1 -1
  4. package/apollo-client.cjs.min.js +1 -1
  5. package/cache/cache.cjs.js +3 -9
  6. package/cache/cache.cjs.js.map +1 -1
  7. package/cache/inmemory/reactiveVars.d.ts.map +1 -1
  8. package/cache/inmemory/reactiveVars.js +3 -9
  9. package/cache/inmemory/reactiveVars.js.map +1 -1
  10. package/cache/package.json +2 -1
  11. package/core/core.cjs.js +8 -8
  12. package/core/core.cjs.js.map +1 -1
  13. package/core/index.d.ts +1 -3
  14. package/core/index.d.ts.map +1 -1
  15. package/core/index.js +1 -3
  16. package/core/index.js.map +1 -1
  17. package/core/package.json +2 -1
  18. package/errors/package.json +2 -1
  19. package/invariantErrorCodes.js +1 -1
  20. package/link/batch/batch.cjs.js +10 -4
  21. package/link/batch/batch.cjs.js.map +1 -1
  22. package/link/batch/batchLink.d.ts +1 -0
  23. package/link/batch/batchLink.d.ts.map +1 -1
  24. package/link/batch/batchLink.js +2 -1
  25. package/link/batch/batchLink.js.map +1 -1
  26. package/link/batch/batching.d.ts +4 -1
  27. package/link/batch/batching.d.ts.map +1 -1
  28. package/link/batch/batching.js +8 -3
  29. package/link/batch/batching.js.map +1 -1
  30. package/link/batch/package.json +2 -1
  31. package/link/batch-http/batch-http.cjs.js +3 -1
  32. package/link/batch-http/batch-http.cjs.js.map +1 -1
  33. package/link/batch-http/batchHttpLink.d.ts +3 -5
  34. package/link/batch-http/batchHttpLink.d.ts.map +1 -1
  35. package/link/batch-http/batchHttpLink.js +3 -1
  36. package/link/batch-http/batchHttpLink.js.map +1 -1
  37. package/link/batch-http/package.json +2 -1
  38. package/link/context/package.json +2 -1
  39. package/link/core/package.json +2 -1
  40. package/link/error/package.json +2 -1
  41. package/link/http/package.json +2 -1
  42. package/link/persisted-queries/package.json +2 -1
  43. package/link/retry/package.json +2 -1
  44. package/link/schema/package.json +2 -1
  45. package/link/utils/package.json +2 -1
  46. package/link/ws/package.json +2 -1
  47. package/package.json +14 -16
  48. package/react/components/package.json +2 -1
  49. package/react/context/package.json +2 -1
  50. package/react/data/MutationData.d.ts.map +1 -1
  51. package/react/data/MutationData.js +11 -5
  52. package/react/data/MutationData.js.map +1 -1
  53. package/react/data/data.cjs.js +11 -5
  54. package/react/data/data.cjs.js.map +1 -1
  55. package/react/data/package.json +2 -1
  56. package/react/hoc/package.json +2 -1
  57. package/react/hooks/hooks.cjs.js +9 -4
  58. package/react/hooks/hooks.cjs.js.map +1 -1
  59. package/react/hooks/package.json +2 -1
  60. package/react/hooks/useReactiveVar.d.ts.map +1 -1
  61. package/react/hooks/useReactiveVar.js +10 -5
  62. package/react/hooks/useReactiveVar.js.map +1 -1
  63. package/react/package.json +2 -1
  64. package/react/parser/package.json +2 -1
  65. package/react/ssr/package.json +2 -1
  66. package/testing/package.json +2 -1
  67. package/utilities/package.json +2 -1
  68. package/version.js +1 -1
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  [![npm version](https://badge.fury.io/js/%40apollo%2Fclient.svg)](https://badge.fury.io/js/%40apollo%2Fclient)
6
6
  [![Build Status](https://circleci.com/gh/apollographql/apollo-client.svg?style=svg)](https://circleci.com/gh/apollographql/apollo-client)
7
- [![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/apollo)
7
+ [![Join the community](https://img.shields.io/discourse/status?label=Join%20the%20community&server=https%3A%2F%2Fcommunity.apollographql.com)](https://community.apollographql.com)
8
8
 
9
9
  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.
10
10
 
@@ -21,3 +21,15 @@ The Apollo Client API reference can be found at: <br/>
21
21
  - [@benjamn](https://github.com/benjamn) (Apollo)
22
22
  - [@hwillson](https://github.com/hwillson) (Apollo)
23
23
  - [@jcreighton](https://github.com/jcreighton) (Apollo)
24
+ - [@brainkim](https://github.com/brainkim) (Apollo)
25
+
26
+ ## Who is Apollo?
27
+
28
+ [Apollo Graph, Inc.](https://apollographql.com/) creates industry-leading tools for building applications with GraphQL:
29
+
30
+ - [Apollo Client](https://www.apollographql.com/apollo-client/) – The most popular GraphQL client for the web. Apollo also builds and maintains [Apollo iOS](https://github.com/apollographql/apollo-ios) and [Apollo Android](https://github.com/apollographql/apollo-android).
31
+ - [Apollo Server](https://www.apollographql.com/docs/apollo-server/) – Build a production-ready JavaScript GraphQL server with a schema-first approach.
32
+ - [Apollo Studio](https://www.apollographql.com/studio/develop/) – A turnkey portal for GraphQL developers, featuring a powerful GraphQL IDE (the [Apollo Explorer](https://www.apollographql.com/docs/studio/explorer/)), metrics reporting, schema search, and documentation.
33
+ - [Apollo Federation](https://www.apollographql.com/apollo-federation) – Create and manage a single data graph composed of subgraphs that can be developed independently.
34
+
35
+ We are fully committed to advancing the frontier of graph development with open-source libraries, hosted software tooling, developer extensions, and community contributions.
@@ -13,7 +13,8 @@ require('symbol-observable');
13
13
  var equality = require('@wry/equality');
14
14
  var optimism = require('optimism');
15
15
  var context = require('@wry/context');
16
- var gql = _interopDefault(require('graphql-tag'));
16
+ var graphqlTag = require('graphql-tag');
17
+ var graphqlTag__default = _interopDefault(graphqlTag);
17
18
  var React = require('react');
18
19
  var React__default = _interopDefault(React);
19
20
 
@@ -1234,7 +1235,7 @@ var concat = ApolloLink.concat;
1234
1235
 
1235
1236
  var execute = ApolloLink.execute;
1236
1237
 
1237
- var version = '3.3.15';
1238
+ var version = '3.3.19';
1238
1239
 
1239
1240
  var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
1240
1241
  function parseAndCheckHttpResponse(operations) {
@@ -2978,14 +2979,6 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
2978
2979
  }
2979
2980
 
2980
2981
  var cacheSlot = new context.Slot();
2981
- function consumeAndIterate(set, callback) {
2982
- if (set.size) {
2983
- var items_1 = [];
2984
- set.forEach(function (item) { return items_1.push(item); });
2985
- set.clear();
2986
- items_1.forEach(callback);
2987
- }
2988
- }
2989
2982
  var cacheInfoMap = new WeakMap();
2990
2983
  function getCacheInfo(cache) {
2991
2984
  var info = cacheInfoMap.get(cache);
@@ -3014,7 +3007,9 @@ function makeVar(value) {
3014
3007
  getCacheInfo(cache).dep.dirty(rv);
3015
3008
  broadcast(cache);
3016
3009
  });
3017
- consumeAndIterate(listeners, function (listener) { return listener(value); });
3010
+ var oldListeners = Array.from(listeners);
3011
+ listeners.clear();
3012
+ oldListeners.forEach(function (listener) { return listener(value); });
3018
3013
  }
3019
3014
  }
3020
3015
  else {
@@ -5155,9 +5150,6 @@ var ApolloClient = (function () {
5155
5150
  return ApolloClient;
5156
5151
  }());
5157
5152
 
5158
- tsInvariant.setVerbosity("log");
5159
- var resetCaches = gql.resetCaches, disableFragmentWarnings = gql.disableFragmentWarnings, enableExperimentalFragmentVariables = gql.enableExperimentalFragmentVariables, disableExperimentalFragmentVariables = gql.disableExperimentalFragmentVariables;
5160
-
5161
5153
  var cache = new (canUseWeakMap ? WeakMap : Map)();
5162
5154
  function getApolloContext() {
5163
5155
  var context = cache.get(React__default.createContext);
@@ -5452,9 +5444,18 @@ var MutationData = (function (_super) {
5452
5444
  return response;
5453
5445
  })
5454
5446
  .catch(function (error) {
5447
+ var onError = _this.getOptions().onError;
5455
5448
  _this.onMutationError(error, mutationId);
5456
- if (!_this.getOptions().onError)
5449
+ if (onError) {
5450
+ onError(error);
5451
+ return {
5452
+ data: undefined,
5453
+ errors: error,
5454
+ };
5455
+ }
5456
+ else {
5457
5457
  throw error;
5458
+ }
5458
5459
  });
5459
5460
  };
5460
5461
  _this.verifyDocumentType(options.mutation, exports.DocumentType.Mutation);
@@ -5510,7 +5511,6 @@ var MutationData = (function (_super) {
5510
5511
  callOncomplete();
5511
5512
  };
5512
5513
  MutationData.prototype.onMutationError = function (error, mutationId) {
5513
- var onError = this.getOptions().onError;
5514
5514
  if (this.isMostRecentMutation(mutationId)) {
5515
5515
  this.updateResult({
5516
5516
  loading: false,
@@ -5519,9 +5519,6 @@ var MutationData = (function (_super) {
5519
5519
  called: true
5520
5520
  });
5521
5521
  }
5522
- if (onError) {
5523
- onError(error);
5524
- }
5525
5522
  };
5526
5523
  MutationData.prototype.generateNewMutationId = function () {
5527
5524
  return ++this.mostRecentMutationId;
@@ -5534,6 +5531,7 @@ var MutationData = (function (_super) {
5534
5531
  (!this.previousResult || !equality.equal(this.previousResult, result))) {
5535
5532
  this.setResult(result);
5536
5533
  this.previousResult = result;
5534
+ return result;
5537
5535
  }
5538
5536
  };
5539
5537
  return MutationData;
@@ -5943,17 +5941,26 @@ function useSubscription(subscription, options) {
5943
5941
 
5944
5942
  function useReactiveVar(rv) {
5945
5943
  var value = rv();
5946
- var _a = React.useState(value), setValue = _a[1];
5947
- React.useEffect(function () { return rv.onNextChange(setValue); }, [value]);
5944
+ var setValue = React.useState(value)[1];
5948
5945
  React.useEffect(function () {
5949
- setValue(rv());
5950
- }, []);
5946
+ var probablySameValue = rv();
5947
+ if (value !== probablySameValue) {
5948
+ setValue(probablySameValue);
5949
+ }
5950
+ else {
5951
+ return rv.onNextChange(setValue);
5952
+ }
5953
+ }, [value]);
5951
5954
  return value;
5952
5955
  }
5953
5956
 
5954
5957
  exports.setLogVerbosity = tsInvariant.setVerbosity;
5955
5958
  exports.Observable = Observable;
5956
- exports.gql = gql;
5959
+ exports.disableExperimentalFragmentVariables = graphqlTag.disableExperimentalFragmentVariables;
5960
+ exports.disableFragmentWarnings = graphqlTag.disableFragmentWarnings;
5961
+ exports.enableExperimentalFragmentVariables = graphqlTag.enableExperimentalFragmentVariables;
5962
+ exports.gql = graphqlTag__default;
5963
+ exports.resetCaches = graphqlTag.resetCaches;
5957
5964
  exports.ApolloCache = ApolloCache;
5958
5965
  exports.ApolloClient = ApolloClient;
5959
5966
  exports.ApolloConsumer = ApolloConsumer;
@@ -5969,10 +5976,7 @@ exports.concat = concat;
5969
5976
  exports.createHttpLink = createHttpLink;
5970
5977
  exports.createSignalIfSupported = createSignalIfSupported;
5971
5978
  exports.defaultDataIdFromObject = defaultDataIdFromObject;
5972
- exports.disableExperimentalFragmentVariables = disableExperimentalFragmentVariables;
5973
- exports.disableFragmentWarnings = disableFragmentWarnings;
5974
5979
  exports.empty = empty;
5975
- exports.enableExperimentalFragmentVariables = enableExperimentalFragmentVariables;
5976
5980
  exports.execute = execute;
5977
5981
  exports.fallbackHttpConfig = fallbackHttpConfig;
5978
5982
  exports.from = from;
@@ -5988,7 +5992,6 @@ exports.operationName = operationName;
5988
5992
  exports.parseAndCheckHttpResponse = parseAndCheckHttpResponse;
5989
5993
  exports.parser = parser;
5990
5994
  exports.resetApolloContext = getApolloContext;
5991
- exports.resetCaches = resetCaches;
5992
5995
  exports.rewriteURIForGET = rewriteURIForGET;
5993
5996
  exports.selectHttpOptionsAndBody = selectHttpOptionsAndBody;
5994
5997
  exports.selectURI = selectURI;