@apollo/client 3.7.5 → 3.7.6

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 (213) hide show
  1. package/apollo-client.cjs +102 -52
  2. package/apollo-client.cjs.map +1 -1
  3. package/apollo-client.min.cjs +1 -1
  4. package/cache/core/cache.d.ts +1 -1
  5. package/cache/core/cache.d.ts.map +1 -1
  6. package/cache/core/cache.js.map +1 -1
  7. package/cache/core/types/common.d.ts +7 -7
  8. package/cache/core/types/common.d.ts.map +1 -1
  9. package/cache/inmemory/entityStore.d.ts +1 -1
  10. package/cache/inmemory/entityStore.d.ts.map +1 -1
  11. package/cache/inmemory/helpers.js.map +1 -1
  12. package/cache/inmemory/inMemoryCache.d.ts +3 -2
  13. package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
  14. package/cache/inmemory/inMemoryCache.js.map +1 -1
  15. package/cache/inmemory/policies.d.ts +12 -12
  16. package/cache/inmemory/policies.d.ts.map +1 -1
  17. package/cache/inmemory/policies.js.map +1 -1
  18. package/cache/inmemory/reactiveVars.d.ts +1 -1
  19. package/cache/inmemory/reactiveVars.d.ts.map +1 -1
  20. package/cache/inmemory/readFromStore.d.ts +2 -2
  21. package/cache/inmemory/readFromStore.d.ts.map +1 -1
  22. package/cache/inmemory/types.d.ts +4 -4
  23. package/cache/inmemory/types.d.ts.map +1 -1
  24. package/cache/inmemory/writeToStore.d.ts +1 -1
  25. package/cache/inmemory/writeToStore.d.ts.map +1 -1
  26. package/cache/inmemory/writeToStore.js.map +1 -1
  27. package/core/ApolloClient.d.ts +5 -5
  28. package/core/ApolloClient.d.ts.map +1 -1
  29. package/core/ApolloClient.js.map +1 -1
  30. package/core/LocalState.d.ts +9 -6
  31. package/core/LocalState.d.ts.map +1 -1
  32. package/core/LocalState.js +61 -14
  33. package/core/LocalState.js.map +1 -1
  34. package/core/ObservableQuery.d.ts +5 -5
  35. package/core/ObservableQuery.d.ts.map +1 -1
  36. package/core/ObservableQuery.js +1 -1
  37. package/core/ObservableQuery.js.map +1 -1
  38. package/core/QueryInfo.d.ts +1 -1
  39. package/core/QueryInfo.d.ts.map +1 -1
  40. package/core/QueryManager.d.ts +7 -7
  41. package/core/QueryManager.d.ts.map +1 -1
  42. package/core/QueryManager.js +12 -9
  43. package/core/QueryManager.js.map +1 -1
  44. package/core/core.cjs +74 -24
  45. package/core/core.cjs.map +1 -1
  46. package/core/core.cjs.native.js +74 -24
  47. package/core/types.d.ts +16 -16
  48. package/core/types.d.ts.map +1 -1
  49. package/core/watchQueryOptions.d.ts +9 -9
  50. package/core/watchQueryOptions.d.ts.map +1 -1
  51. package/core/watchQueryOptions.js.map +1 -1
  52. package/errors/index.d.ts +2 -2
  53. package/errors/index.d.ts.map +1 -1
  54. package/invariantErrorCodes.js +48 -43
  55. package/link/batch/batch.cjs +5 -3
  56. package/link/batch/batch.cjs.map +1 -1
  57. package/link/batch/batch.cjs.native.js +5 -3
  58. package/link/batch/batching.d.ts +2 -2
  59. package/link/batch/batching.d.ts.map +1 -1
  60. package/link/batch/batching.js +5 -3
  61. package/link/batch/batching.js.map +1 -1
  62. package/link/context/index.d.ts +1 -1
  63. package/link/context/index.d.ts.map +1 -1
  64. package/link/core/ApolloLink.js +1 -1
  65. package/link/core/core.cjs +1 -1
  66. package/link/core/core.cjs.map +1 -1
  67. package/link/core/core.cjs.native.js +1 -1
  68. package/link/core/types.d.ts +6 -6
  69. package/link/core/types.d.ts.map +1 -1
  70. package/link/http/checkFetcher.js +1 -1
  71. package/link/http/createHttpLink.js.map +1 -1
  72. package/link/http/http.cjs +2 -2
  73. package/link/http/http.cjs.map +1 -1
  74. package/link/http/http.cjs.native.js +2 -2
  75. package/link/http/iterators/async.js.map +1 -1
  76. package/link/http/iterators/nodeStream.js.map +1 -1
  77. package/link/http/iterators/promise.js.map +1 -1
  78. package/link/http/iterators/reader.js.map +1 -1
  79. package/link/http/parseAndCheckHttpResponse.d.ts +2 -2
  80. package/link/http/parseAndCheckHttpResponse.d.ts.map +1 -1
  81. package/link/http/parseAndCheckHttpResponse.js.map +1 -1
  82. package/link/http/serializeFetchParameter.d.ts +1 -1
  83. package/link/http/serializeFetchParameter.d.ts.map +1 -1
  84. package/link/http/serializeFetchParameter.js +1 -1
  85. package/link/persisted-queries/index.d.ts +2 -2
  86. package/link/persisted-queries/index.d.ts.map +1 -1
  87. package/link/persisted-queries/index.js +2 -2
  88. package/link/persisted-queries/persisted-queries.cjs +2 -2
  89. package/link/persisted-queries/persisted-queries.cjs.map +1 -1
  90. package/link/persisted-queries/persisted-queries.cjs.native.js +2 -2
  91. package/link/utils/throwServerError.d.ts +1 -1
  92. package/link/utils/throwServerError.d.ts.map +1 -1
  93. package/link/utils/utils.cjs +1 -1
  94. package/link/utils/utils.cjs.map +1 -1
  95. package/link/utils/utils.cjs.native.js +1 -1
  96. package/link/utils/validateOperation.js +1 -1
  97. package/package.json +9 -9
  98. package/react/components/Query.d.ts +2 -2
  99. package/react/components/Query.d.ts.map +1 -1
  100. package/react/components/Query.js.map +1 -1
  101. package/react/components/Subscription.d.ts +2 -2
  102. package/react/components/Subscription.d.ts.map +1 -1
  103. package/react/components/Subscription.js.map +1 -1
  104. package/react/components/types.d.ts +2 -2
  105. package/react/components/types.d.ts.map +1 -1
  106. package/react/components/types.js.map +1 -1
  107. package/react/context/ApolloConsumer.js +1 -1
  108. package/react/context/ApolloProvider.js +1 -1
  109. package/react/context/context.cjs +2 -2
  110. package/react/context/context.cjs.map +1 -1
  111. package/react/context/context.cjs.native.js +2 -2
  112. package/react/hoc/graphql.d.ts +2 -1
  113. package/react/hoc/graphql.d.ts.map +1 -1
  114. package/react/hoc/graphql.js.map +1 -1
  115. package/react/hoc/hoc-utils.d.ts +1 -1
  116. package/react/hoc/hoc-utils.d.ts.map +1 -1
  117. package/react/hoc/hoc-utils.js +1 -1
  118. package/react/hoc/hoc.cjs +2 -2
  119. package/react/hoc/hoc.cjs.map +1 -1
  120. package/react/hoc/hoc.cjs.native.js +2 -2
  121. package/react/hoc/mutation-hoc.d.ts +2 -2
  122. package/react/hoc/mutation-hoc.d.ts.map +1 -1
  123. package/react/hoc/mutation-hoc.js.map +1 -1
  124. package/react/hoc/query-hoc.d.ts +1 -1
  125. package/react/hoc/query-hoc.d.ts.map +1 -1
  126. package/react/hoc/query-hoc.js.map +1 -1
  127. package/react/hoc/subscription-hoc.d.ts +1 -1
  128. package/react/hoc/subscription-hoc.d.ts.map +1 -1
  129. package/react/hoc/subscription-hoc.js.map +1 -1
  130. package/react/hoc/types.d.ts +6 -6
  131. package/react/hoc/types.d.ts.map +1 -1
  132. package/react/hoc/types.js.map +1 -1
  133. package/react/hoc/withApollo.js +1 -1
  134. package/react/hooks/hooks.cjs +1 -1
  135. package/react/hooks/hooks.cjs.map +1 -1
  136. package/react/hooks/hooks.cjs.native.js +1 -1
  137. package/react/hooks/useApolloClient.js +1 -1
  138. package/react/hooks/useLazyQuery.d.ts +1 -1
  139. package/react/hooks/useLazyQuery.d.ts.map +1 -1
  140. package/react/hooks/useLazyQuery.js.map +1 -1
  141. package/react/hooks/useQuery.d.ts +3 -3
  142. package/react/hooks/useQuery.d.ts.map +1 -1
  143. package/react/hooks/useQuery.js.map +1 -1
  144. package/react/hooks/useSubscription.d.ts +1 -1
  145. package/react/hooks/useSubscription.d.ts.map +1 -1
  146. package/react/hooks/useSubscription.js.map +1 -1
  147. package/react/hooks/useSyncExternalStore.d.ts +1 -1
  148. package/react/hooks/useSyncExternalStore.d.ts.map +1 -1
  149. package/react/parser/index.js +5 -5
  150. package/react/parser/parser.cjs +5 -5
  151. package/react/parser/parser.cjs.map +1 -1
  152. package/react/parser/parser.cjs.native.js +5 -5
  153. package/react/ssr/RenderPromises.d.ts +4 -4
  154. package/react/ssr/RenderPromises.d.ts.map +1 -1
  155. package/react/ssr/RenderPromises.js.map +1 -1
  156. package/react/ssr/getDataFromTree.d.ts +1 -1
  157. package/react/ssr/getDataFromTree.d.ts.map +1 -1
  158. package/react/types/types.d.ts +17 -17
  159. package/react/types/types.d.ts.map +1 -1
  160. package/react/types/types.js.map +1 -1
  161. package/testing/core/core.cjs +1 -1
  162. package/testing/core/core.cjs.map +1 -1
  163. package/testing/core/core.cjs.native.js +1 -1
  164. package/testing/core/mocking/mockFetch.js.map +1 -1
  165. package/testing/core/mocking/mockLink.d.ts +1 -1
  166. package/testing/core/mocking/mockLink.d.ts.map +1 -1
  167. package/testing/core/mocking/mockLink.js +1 -1
  168. package/testing/core/observableToPromise.d.ts +2 -2
  169. package/testing/core/observableToPromise.d.ts.map +1 -1
  170. package/testing/core/observableToPromise.js.map +1 -1
  171. package/utilities/common/cloneDeep.js.map +1 -1
  172. package/utilities/common/errorHandling.d.ts +2 -2
  173. package/utilities/common/errorHandling.d.ts.map +1 -1
  174. package/utilities/common/errorHandling.js.map +1 -1
  175. package/utilities/common/incrementalResult.d.ts +4 -4
  176. package/utilities/common/incrementalResult.d.ts.map +1 -1
  177. package/utilities/common/incrementalResult.js.map +1 -1
  178. package/utilities/common/mergeDeep.d.ts +2 -2
  179. package/utilities/common/mergeDeep.d.ts.map +1 -1
  180. package/utilities/common/mergeOptions.d.ts +2 -2
  181. package/utilities/common/mergeOptions.d.ts.map +1 -1
  182. package/utilities/common/mergeOptions.js.map +1 -1
  183. package/utilities/globals/globals.cjs +1 -1
  184. package/utilities/globals/globals.cjs.map +1 -1
  185. package/utilities/globals/globals.cjs.native.js +1 -1
  186. package/utilities/globals/index.js +1 -1
  187. package/utilities/graphql/directives.d.ts +2 -2
  188. package/utilities/graphql/directives.d.ts.map +1 -1
  189. package/utilities/graphql/directives.js +4 -4
  190. package/utilities/graphql/directives.js.map +1 -1
  191. package/utilities/graphql/fragments.d.ts +1 -1
  192. package/utilities/graphql/fragments.d.ts.map +1 -1
  193. package/utilities/graphql/fragments.js +3 -3
  194. package/utilities/graphql/getFromAST.js +8 -8
  195. package/utilities/graphql/storeUtils.d.ts +3 -3
  196. package/utilities/graphql/storeUtils.d.ts.map +1 -1
  197. package/utilities/graphql/storeUtils.js +1 -1
  198. package/utilities/graphql/storeUtils.js.map +1 -1
  199. package/utilities/graphql/transform.d.ts +9 -9
  200. package/utilities/graphql/transform.d.ts.map +1 -1
  201. package/utilities/graphql/transform.js.map +1 -1
  202. package/utilities/observables/Concast.d.ts +5 -5
  203. package/utilities/observables/Concast.d.ts.map +1 -1
  204. package/utilities/observables/asyncMap.js.map +1 -1
  205. package/utilities/policies/pagination.d.ts +7 -7
  206. package/utilities/policies/pagination.d.ts.map +1 -1
  207. package/utilities/policies/pagination.js.map +1 -1
  208. package/utilities/types/IsStrictlyAny.d.ts +3 -3
  209. package/utilities/types/IsStrictlyAny.d.ts.map +1 -1
  210. package/utilities/utilities.cjs +16 -16
  211. package/utilities/utilities.cjs.map +1 -1
  212. package/utilities/utilities.cjs.native.js +16 -16
  213. package/version.js +1 -1
package/apollo-client.cjs CHANGED
@@ -45,7 +45,7 @@ function shouldInclude(_a, variables) {
45
45
  var evaledValue = false;
46
46
  if (ifArgument.value.kind === 'Variable') {
47
47
  evaledValue = variables && variables[ifArgument.value.name.value];
48
- __DEV__ ? tsInvariant.invariant(evaledValue !== void 0, "Invalid variable referenced in @".concat(directive.name.value, " directive.")) : tsInvariant.invariant(evaledValue !== void 0, 39);
48
+ __DEV__ ? tsInvariant.invariant(evaledValue !== void 0, "Invalid variable referenced in @".concat(directive.name.value, " directive.")) : tsInvariant.invariant(evaledValue !== void 0, 40);
49
49
  }
50
50
  else {
51
51
  evaledValue = ifArgument.value.value;
@@ -81,13 +81,13 @@ function getInclusionDirectives(directives) {
81
81
  return;
82
82
  var directiveArguments = directive.arguments;
83
83
  var directiveName = directive.name.value;
84
- __DEV__ ? tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @".concat(directiveName, " directive.")) : tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, 40);
84
+ __DEV__ ? tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @".concat(directiveName, " directive.")) : tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, 41);
85
85
  var ifArgument = directiveArguments[0];
86
- __DEV__ ? tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @".concat(directiveName, " directive.")) : tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', 41);
86
+ __DEV__ ? tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @".concat(directiveName, " directive.")) : tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', 42);
87
87
  var ifValue = ifArgument.value;
88
88
  __DEV__ ? tsInvariant.invariant(ifValue &&
89
89
  (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @".concat(directiveName, " directive must be a variable or a boolean value.")) : tsInvariant.invariant(ifValue &&
90
- (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 42);
90
+ (ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 43);
91
91
  result.push({ directive: directive, ifArgument: ifArgument });
92
92
  });
93
93
  }
@@ -100,14 +100,14 @@ function getFragmentQueryDocument(document, fragmentName) {
100
100
  document.definitions.forEach(function (definition) {
101
101
  if (definition.kind === 'OperationDefinition') {
102
102
  throw __DEV__ ? new tsInvariant.InvariantError("Found a ".concat(definition.operation, " operation").concat(definition.name ? " named '".concat(definition.name.value, "'") : '', ". ") +
103
- 'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new tsInvariant.InvariantError(43);
103
+ 'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new tsInvariant.InvariantError(44);
104
104
  }
105
105
  if (definition.kind === 'FragmentDefinition') {
106
106
  fragments.push(definition);
107
107
  }
108
108
  });
109
109
  if (typeof actualFragmentName === 'undefined') {
110
- __DEV__ ? tsInvariant.invariant(fragments.length === 1, "Found ".concat(fragments.length, " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")) : tsInvariant.invariant(fragments.length === 1, 44);
110
+ __DEV__ ? tsInvariant.invariant(fragments.length === 1, "Found ".concat(fragments.length, " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")) : tsInvariant.invariant(fragments.length === 1, 45);
111
111
  actualFragmentName = fragments[0].name.value;
112
112
  }
113
113
  var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
@@ -148,7 +148,7 @@ function getFragmentFromSelection(selection, fragmentMap) {
148
148
  return fragmentMap(fragmentName);
149
149
  }
150
150
  var fragment = fragmentMap && fragmentMap[fragmentName];
151
- __DEV__ ? tsInvariant.invariant(fragment, "No fragment named ".concat(fragmentName)) : tsInvariant.invariant(fragment, 45);
151
+ __DEV__ ? tsInvariant.invariant(fragment, "No fragment named ".concat(fragmentName)) : tsInvariant.invariant(fragment, 46);
152
152
  return fragment || null;
153
153
  }
154
154
  default:
@@ -232,7 +232,7 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
232
232
  else {
233
233
  throw __DEV__ ? new tsInvariant.InvariantError("The inline argument \"".concat(name.value, "\" of kind \"").concat(value.kind, "\"") +
234
234
  'is not supported. Use variables instead of inline arguments to ' +
235
- 'overcome this limitation.') : new tsInvariant.InvariantError(54);
235
+ 'overcome this limitation.') : new tsInvariant.InvariantError(55);
236
236
  }
237
237
  }
238
238
  function storeKeyNameFromField(field, variables) {
@@ -366,16 +366,16 @@ function isInlineFragment(selection) {
366
366
  }
367
367
 
368
368
  function checkDocument(doc) {
369
- __DEV__ ? tsInvariant.invariant(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : tsInvariant.invariant(doc && doc.kind === 'Document', 46);
369
+ __DEV__ ? tsInvariant.invariant(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : tsInvariant.invariant(doc && doc.kind === 'Document', 47);
370
370
  var operations = doc.definitions
371
371
  .filter(function (d) { return d.kind !== 'FragmentDefinition'; })
372
372
  .map(function (definition) {
373
373
  if (definition.kind !== 'OperationDefinition') {
374
- throw __DEV__ ? new tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"".concat(definition.kind, "\"")) : new tsInvariant.InvariantError(47);
374
+ throw __DEV__ ? new tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"".concat(definition.kind, "\"")) : new tsInvariant.InvariantError(48);
375
375
  }
376
376
  return definition;
377
377
  });
378
- __DEV__ ? tsInvariant.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains ".concat(operations.length, " operations")) : tsInvariant.invariant(operations.length <= 1, 48);
378
+ __DEV__ ? tsInvariant.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains ".concat(operations.length, " operations")) : tsInvariant.invariant(operations.length <= 1, 49);
379
379
  return doc;
380
380
  }
381
381
  function getOperationDefinition(doc) {
@@ -394,14 +394,14 @@ function getFragmentDefinitions(doc) {
394
394
  }
395
395
  function getQueryDefinition(doc) {
396
396
  var queryDef = getOperationDefinition(doc);
397
- __DEV__ ? tsInvariant.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : tsInvariant.invariant(queryDef && queryDef.operation === 'query', 49);
397
+ __DEV__ ? tsInvariant.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : tsInvariant.invariant(queryDef && queryDef.operation === 'query', 50);
398
398
  return queryDef;
399
399
  }
400
400
  function getFragmentDefinition(doc) {
401
- __DEV__ ? tsInvariant.invariant(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : tsInvariant.invariant(doc.kind === 'Document', 50);
402
- __DEV__ ? tsInvariant.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : tsInvariant.invariant(doc.definitions.length <= 1, 51);
401
+ __DEV__ ? tsInvariant.invariant(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : tsInvariant.invariant(doc.kind === 'Document', 51);
402
+ __DEV__ ? tsInvariant.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : tsInvariant.invariant(doc.definitions.length <= 1, 52);
403
403
  var fragmentDef = doc.definitions[0];
404
- __DEV__ ? tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 52);
404
+ __DEV__ ? tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 53);
405
405
  return fragmentDef;
406
406
  }
407
407
  function getMainDefinition(queryDoc) {
@@ -424,7 +424,7 @@ function getMainDefinition(queryDoc) {
424
424
  if (fragmentDefinition) {
425
425
  return fragmentDefinition;
426
426
  }
427
- throw __DEV__ ? new tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new tsInvariant.InvariantError(53);
427
+ throw __DEV__ ? new tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new tsInvariant.InvariantError(54);
428
428
  }
429
429
  function getDefaultValues(definition) {
430
430
  var defaultValues = Object.create(null);
@@ -1196,7 +1196,7 @@ function validateOperation(operation) {
1196
1196
  for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {
1197
1197
  var key = _a[_i];
1198
1198
  if (OPERATION_FIELDS.indexOf(key) < 0) {
1199
- throw __DEV__ ? new tsInvariant.InvariantError("illegal argument: ".concat(key)) : new tsInvariant.InvariantError(26);
1199
+ throw __DEV__ ? new tsInvariant.InvariantError("illegal argument: ".concat(key)) : new tsInvariant.InvariantError(27);
1200
1200
  }
1201
1201
  }
1202
1202
  return operation;
@@ -1319,7 +1319,7 @@ var ApolloLink = (function () {
1319
1319
  return ApolloLink.concat(this, next);
1320
1320
  };
1321
1321
  ApolloLink.prototype.request = function (operation, forward) {
1322
- throw __DEV__ ? new tsInvariant.InvariantError('request is not implemented') : new tsInvariant.InvariantError(21);
1322
+ throw __DEV__ ? new tsInvariant.InvariantError('request is not implemented') : new tsInvariant.InvariantError(22);
1323
1323
  };
1324
1324
  ApolloLink.prototype.onError = function (error, observer) {
1325
1325
  if (observer && observer.error) {
@@ -1345,7 +1345,7 @@ var concat = ApolloLink.concat;
1345
1345
 
1346
1346
  var execute = ApolloLink.execute;
1347
1347
 
1348
- var version = '3.7.5';
1348
+ var version = '3.7.6';
1349
1349
 
1350
1350
  function isNodeResponse(value) {
1351
1351
  return !!value.body;
@@ -1661,7 +1661,7 @@ var serializeFetchParameter = function (p, label) {
1661
1661
  serialized = JSON.stringify(p);
1662
1662
  }
1663
1663
  catch (e) {
1664
- var parseError = __DEV__ ? new tsInvariant.InvariantError("Network request failed. ".concat(label, " is not serializable: ").concat(e.message)) : new tsInvariant.InvariantError(23);
1664
+ var parseError = __DEV__ ? new tsInvariant.InvariantError("Network request failed. ".concat(label, " is not serializable: ").concat(e.message)) : new tsInvariant.InvariantError(24);
1665
1665
  parseError.parseError = e;
1666
1666
  throw parseError;
1667
1667
  }
@@ -1744,7 +1744,7 @@ function removeDuplicateHeaders(headers, preserveHeaderCase) {
1744
1744
 
1745
1745
  var checkFetcher = function (fetcher) {
1746
1746
  if (!fetcher && typeof fetch === 'undefined') {
1747
- throw __DEV__ ? new tsInvariant.InvariantError("\n\"fetch\" has not been found globally and no fetcher has been configured. To fix this, install a fetch package (like https://www.npmjs.com/package/cross-fetch), instantiate the fetcher, and pass it into your HttpLink constructor. For example:\n\nimport fetch from 'cross-fetch';\nimport { ApolloClient, HttpLink } from '@apollo/client';\nconst client = new ApolloClient({\n link: new HttpLink({ uri: '/graphql', fetch })\n});\n ") : new tsInvariant.InvariantError(22);
1747
+ throw __DEV__ ? new tsInvariant.InvariantError("\n\"fetch\" has not been found globally and no fetcher has been configured. To fix this, install a fetch package (like https://www.npmjs.com/package/cross-fetch), instantiate the fetcher, and pass it into your HttpLink constructor. For example:\n\nimport fetch from 'cross-fetch';\nimport { ApolloClient, HttpLink } from '@apollo/client';\nconst client = new ApolloClient({\n link: new HttpLink({ uri: '/graphql', fetch })\n});\n ") : new tsInvariant.InvariantError(23);
1748
1748
  }
1749
1749
  };
1750
1750
 
@@ -4622,7 +4622,7 @@ var ObservableQuery = (function (_super) {
4622
4622
  pollingInfo.interval === pollInterval) {
4623
4623
  return;
4624
4624
  }
4625
- __DEV__ ? tsInvariant.invariant(pollInterval, 'Attempted to start a polling query without a polling interval.') : tsInvariant.invariant(pollInterval, 12);
4625
+ __DEV__ ? tsInvariant.invariant(pollInterval, 'Attempted to start a polling query without a polling interval.') : tsInvariant.invariant(pollInterval, 13);
4626
4626
  var info = pollingInfo || (this.pollingInfo = {});
4627
4627
  info.interval = pollInterval;
4628
4628
  var maybeFetch = function () {
@@ -4768,6 +4768,7 @@ function logMissingFieldErrors(missing) {
4768
4768
  var LocalState = (function () {
4769
4769
  function LocalState(_a) {
4770
4770
  var cache = _a.cache, client = _a.client, resolvers = _a.resolvers, fragmentMatcher = _a.fragmentMatcher;
4771
+ this.selectionsToResolveCache = new WeakMap();
4771
4772
  this.cache = cache;
4772
4773
  if (client) {
4773
4774
  this.client = client;
@@ -4878,13 +4879,13 @@ var LocalState = (function () {
4878
4879
  if (fragmentMatcher === void 0) { fragmentMatcher = function () { return true; }; }
4879
4880
  if (onlyRunForcedResolvers === void 0) { onlyRunForcedResolvers = false; }
4880
4881
  return tslib.__awaiter(this, void 0, void 0, function () {
4881
- var mainDefinition, fragments, fragmentMap, definitionOperation, defaultOperationType, _a, cache, client, execContext;
4882
+ var mainDefinition, fragments, fragmentMap, selectionsToResolve, definitionOperation, defaultOperationType, _a, cache, client, execContext, isClientFieldDescendant;
4882
4883
  return tslib.__generator(this, function (_b) {
4883
4884
  mainDefinition = getMainDefinition(document);
4884
4885
  fragments = getFragmentDefinitions(document);
4885
4886
  fragmentMap = createFragmentMap(fragments);
4886
- definitionOperation = mainDefinition
4887
- .operation;
4887
+ selectionsToResolve = this.collectSelectionsToResolve(mainDefinition, fragmentMap);
4888
+ definitionOperation = mainDefinition.operation;
4888
4889
  defaultOperationType = definitionOperation
4889
4890
  ? definitionOperation.charAt(0).toUpperCase() +
4890
4891
  definitionOperation.slice(1)
@@ -4897,16 +4898,18 @@ var LocalState = (function () {
4897
4898
  fragmentMatcher: fragmentMatcher,
4898
4899
  defaultOperationType: defaultOperationType,
4899
4900
  exportedVariables: {},
4901
+ selectionsToResolve: selectionsToResolve,
4900
4902
  onlyRunForcedResolvers: onlyRunForcedResolvers,
4901
4903
  };
4902
- return [2, this.resolveSelectionSet(mainDefinition.selectionSet, rootValue, execContext).then(function (result) { return ({
4904
+ isClientFieldDescendant = false;
4905
+ return [2, this.resolveSelectionSet(mainDefinition.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (result) { return ({
4903
4906
  result: result,
4904
4907
  exportedVariables: execContext.exportedVariables,
4905
4908
  }); })];
4906
4909
  });
4907
4910
  });
4908
4911
  };
4909
- LocalState.prototype.resolveSelectionSet = function (selectionSet, rootValue, execContext) {
4912
+ LocalState.prototype.resolveSelectionSet = function (selectionSet, isClientFieldDescendant, rootValue, execContext) {
4910
4913
  return tslib.__awaiter(this, void 0, void 0, function () {
4911
4914
  var fragmentMap, context, variables, resultsToMerge, execute;
4912
4915
  var _this = this;
@@ -4916,11 +4919,14 @@ var LocalState = (function () {
4916
4919
  execute = function (selection) { return tslib.__awaiter(_this, void 0, void 0, function () {
4917
4920
  var fragment, typeCondition;
4918
4921
  return tslib.__generator(this, function (_a) {
4922
+ if (!isClientFieldDescendant && !execContext.selectionsToResolve.has(selection)) {
4923
+ return [2];
4924
+ }
4919
4925
  if (!shouldInclude(selection, variables)) {
4920
4926
  return [2];
4921
4927
  }
4922
4928
  if (isField(selection)) {
4923
- return [2, this.resolveField(selection, rootValue, execContext).then(function (fieldResult) {
4929
+ return [2, this.resolveField(selection, isClientFieldDescendant, rootValue, execContext).then(function (fieldResult) {
4924
4930
  var _a;
4925
4931
  if (typeof fieldResult !== 'undefined') {
4926
4932
  resultsToMerge.push((_a = {},
@@ -4939,7 +4945,7 @@ var LocalState = (function () {
4939
4945
  if (fragment && fragment.typeCondition) {
4940
4946
  typeCondition = fragment.typeCondition.name.value;
4941
4947
  if (execContext.fragmentMatcher(rootValue, typeCondition, context)) {
4942
- return [2, this.resolveSelectionSet(fragment.selectionSet, rootValue, execContext).then(function (fragmentResult) {
4948
+ return [2, this.resolveSelectionSet(fragment.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (fragmentResult) {
4943
4949
  resultsToMerge.push(fragmentResult);
4944
4950
  })];
4945
4951
  }
@@ -4953,7 +4959,7 @@ var LocalState = (function () {
4953
4959
  });
4954
4960
  });
4955
4961
  };
4956
- LocalState.prototype.resolveField = function (field, rootValue, execContext) {
4962
+ LocalState.prototype.resolveField = function (field, isClientFieldDescendant, rootValue, execContext) {
4957
4963
  return tslib.__awaiter(this, void 0, void 0, function () {
4958
4964
  var variables, fieldName, aliasedFieldName, aliasUsed, defaultResult, resultPromise, resolverType, resolverMap, resolve;
4959
4965
  var _this = this;
@@ -4981,6 +4987,7 @@ var LocalState = (function () {
4981
4987
  }
4982
4988
  }
4983
4989
  return [2, resultPromise.then(function (result) {
4990
+ var _a, _b;
4984
4991
  if (result === void 0) { result = defaultResult; }
4985
4992
  if (field.directives) {
4986
4993
  field.directives.forEach(function (directive) {
@@ -4999,30 +5006,70 @@ var LocalState = (function () {
4999
5006
  if (result == null) {
5000
5007
  return result;
5001
5008
  }
5009
+ var isClientField = (_b = (_a = field.directives) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d.name.value === 'client'; })) !== null && _b !== void 0 ? _b : false;
5002
5010
  if (Array.isArray(result)) {
5003
- return _this.resolveSubSelectedArray(field, result, execContext);
5011
+ return _this.resolveSubSelectedArray(field, isClientFieldDescendant || isClientField, result, execContext);
5004
5012
  }
5005
5013
  if (field.selectionSet) {
5006
- return _this.resolveSelectionSet(field.selectionSet, result, execContext);
5014
+ return _this.resolveSelectionSet(field.selectionSet, isClientFieldDescendant || isClientField, result, execContext);
5007
5015
  }
5008
5016
  })];
5009
5017
  });
5010
5018
  });
5011
5019
  };
5012
- LocalState.prototype.resolveSubSelectedArray = function (field, result, execContext) {
5020
+ LocalState.prototype.resolveSubSelectedArray = function (field, isClientFieldDescendant, result, execContext) {
5013
5021
  var _this = this;
5014
5022
  return Promise.all(result.map(function (item) {
5015
5023
  if (item === null) {
5016
5024
  return null;
5017
5025
  }
5018
5026
  if (Array.isArray(item)) {
5019
- return _this.resolveSubSelectedArray(field, item, execContext);
5027
+ return _this.resolveSubSelectedArray(field, isClientFieldDescendant, item, execContext);
5020
5028
  }
5021
5029
  if (field.selectionSet) {
5022
- return _this.resolveSelectionSet(field.selectionSet, item, execContext);
5030
+ return _this.resolveSelectionSet(field.selectionSet, isClientFieldDescendant, item, execContext);
5023
5031
  }
5024
5032
  }));
5025
5033
  };
5034
+ LocalState.prototype.collectSelectionsToResolve = function (mainDefinition, fragmentMap) {
5035
+ var isSingleASTNode = function (node) { return !Array.isArray(node); };
5036
+ var selectionsToResolveCache = this.selectionsToResolveCache;
5037
+ function collectByDefinition(definitionNode) {
5038
+ if (!selectionsToResolveCache.has(definitionNode)) {
5039
+ var matches_1 = new Set();
5040
+ selectionsToResolveCache.set(definitionNode, matches_1);
5041
+ graphql.visit(definitionNode, {
5042
+ Directive: function (node, _, __, ___, ancestors) {
5043
+ if (node.name.value === 'client') {
5044
+ ancestors.forEach(function (node) {
5045
+ if (isSingleASTNode(node) && graphql.isSelectionNode(node)) {
5046
+ matches_1.add(node);
5047
+ }
5048
+ });
5049
+ }
5050
+ },
5051
+ FragmentSpread: function (spread, _, __, ___, ancestors) {
5052
+ var fragment = fragmentMap[spread.name.value];
5053
+ __DEV__ ? tsInvariant.invariant(fragment, "No fragment named ".concat(spread.name.value)) : tsInvariant.invariant(fragment, 12);
5054
+ var fragmentSelections = collectByDefinition(fragment);
5055
+ if (fragmentSelections.size > 0) {
5056
+ ancestors.forEach(function (node) {
5057
+ if (isSingleASTNode(node) && graphql.isSelectionNode(node)) {
5058
+ matches_1.add(node);
5059
+ }
5060
+ });
5061
+ matches_1.add(spread);
5062
+ fragmentSelections.forEach(function (selection) {
5063
+ matches_1.add(selection);
5064
+ });
5065
+ }
5066
+ }
5067
+ });
5068
+ }
5069
+ return selectionsToResolveCache.get(definitionNode);
5070
+ }
5071
+ return collectByDefinition(mainDefinition);
5072
+ };
5026
5073
  return LocalState;
5027
5074
  }());
5028
5075
 
@@ -5333,7 +5380,7 @@ var QueryManager = (function () {
5333
5380
  this.queries.forEach(function (_info, queryId) {
5334
5381
  _this.stopQueryNoBroadcast(queryId);
5335
5382
  });
5336
- this.cancelPendingFetches(__DEV__ ? new tsInvariant.InvariantError('QueryManager stopped while query was in flight') : new tsInvariant.InvariantError(13));
5383
+ this.cancelPendingFetches(__DEV__ ? new tsInvariant.InvariantError('QueryManager stopped while query was in flight') : new tsInvariant.InvariantError(14));
5337
5384
  };
5338
5385
  QueryManager.prototype.cancelPendingFetches = function (error) {
5339
5386
  this.fetchCancelFns.forEach(function (cancel) { return cancel(error); });
@@ -5347,10 +5394,10 @@ var QueryManager = (function () {
5347
5394
  return tslib.__generator(this, function (_j) {
5348
5395
  switch (_j.label) {
5349
5396
  case 0:
5350
- __DEV__ ? tsInvariant.invariant(mutation, 'mutation option is required. You must specify your GraphQL document in the mutation option.') : tsInvariant.invariant(mutation, 14);
5397
+ __DEV__ ? tsInvariant.invariant(mutation, 'mutation option is required. You must specify your GraphQL document in the mutation option.') : tsInvariant.invariant(mutation, 15);
5351
5398
  __DEV__ ? tsInvariant.invariant(fetchPolicy === 'network-only' ||
5352
5399
  fetchPolicy === 'no-cache', "Mutations support only 'network-only' or 'no-cache' fetchPolicy strings. The default `network-only` behavior automatically writes mutation results to the cache. Passing `no-cache` skips the cache write.") : tsInvariant.invariant(fetchPolicy === 'network-only' ||
5353
- fetchPolicy === 'no-cache', 15);
5400
+ fetchPolicy === 'no-cache', 16);
5354
5401
  mutationId = this.generateMutationId();
5355
5402
  _h = this.transform(mutation), document = _h.document, hasClientExports = _h.hasClientExports;
5356
5403
  mutation = this.cache.transformForLink(document);
@@ -5467,7 +5514,10 @@ var QueryManager = (function () {
5467
5514
  optimistic: false,
5468
5515
  returnPartialData: true,
5469
5516
  });
5470
- var mergedData = mergeIncrementalData(diff.result, result);
5517
+ var mergedData = void 0;
5518
+ if (diff.result) {
5519
+ mergedData = mergeIncrementalData(diff.result, result);
5520
+ }
5471
5521
  if (typeof mergedData !== 'undefined') {
5472
5522
  result.data = mergedData;
5473
5523
  cacheWrites.push({
@@ -5669,10 +5719,10 @@ var QueryManager = (function () {
5669
5719
  var _this = this;
5670
5720
  if (queryId === void 0) { queryId = this.generateQueryId(); }
5671
5721
  __DEV__ ? tsInvariant.invariant(options.query, 'query option is required. You must specify your GraphQL document ' +
5672
- 'in the query option.') : tsInvariant.invariant(options.query, 16);
5673
- __DEV__ ? tsInvariant.invariant(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.') : tsInvariant.invariant(options.query.kind === 'Document', 17);
5674
- __DEV__ ? tsInvariant.invariant(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.') : tsInvariant.invariant(!options.returnPartialData, 18);
5675
- __DEV__ ? tsInvariant.invariant(!options.pollInterval, 'pollInterval option only supported on watchQuery.') : tsInvariant.invariant(!options.pollInterval, 19);
5722
+ 'in the query option.') : tsInvariant.invariant(options.query, 17);
5723
+ __DEV__ ? tsInvariant.invariant(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.') : tsInvariant.invariant(options.query.kind === 'Document', 18);
5724
+ __DEV__ ? tsInvariant.invariant(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.') : tsInvariant.invariant(!options.returnPartialData, 19);
5725
+ __DEV__ ? tsInvariant.invariant(!options.pollInterval, 'pollInterval option only supported on watchQuery.') : tsInvariant.invariant(!options.pollInterval, 20);
5676
5726
  return this.fetchQuery(queryId, options).finally(function () { return _this.stopQuery(queryId); });
5677
5727
  };
5678
5728
  QueryManager.prototype.generateQueryId = function () {
@@ -5697,7 +5747,7 @@ var QueryManager = (function () {
5697
5747
  if (options === void 0) { options = {
5698
5748
  discardWatches: true,
5699
5749
  }; }
5700
- this.cancelPendingFetches(__DEV__ ? new tsInvariant.InvariantError('Store reset while query was in flight (not completed in link chain)') : new tsInvariant.InvariantError(20));
5750
+ this.cancelPendingFetches(__DEV__ ? new tsInvariant.InvariantError('Store reset while query was in flight (not completed in link chain)') : new tsInvariant.InvariantError(21));
5701
5751
  this.queries.forEach(function (queryInfo) {
5702
5752
  if (queryInfo.observableQuery) {
5703
5753
  queryInfo.networkStatus = exports.NetworkStatus.loading;
@@ -6426,7 +6476,7 @@ var ApolloConsumer = function (props) {
6426
6476
  var ApolloContext = getApolloContext();
6427
6477
  return (React__namespace.createElement(ApolloContext.Consumer, null, function (context) {
6428
6478
  __DEV__ ? tsInvariant.invariant(context && context.client, 'Could not find "client" in the context of ApolloConsumer. ' +
6429
- 'Wrap the root component in an <ApolloProvider>.') : tsInvariant.invariant(context && context.client, 27);
6479
+ 'Wrap the root component in an <ApolloProvider>.') : tsInvariant.invariant(context && context.client, 28);
6430
6480
  return props.children(context.client);
6431
6481
  }));
6432
6482
  };
@@ -6440,7 +6490,7 @@ var ApolloProvider = function (_a) {
6440
6490
  context = Object.assign({}, context, { client: client });
6441
6491
  }
6442
6492
  __DEV__ ? tsInvariant.invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +
6443
- 'sure you pass in your client via the "client" prop.') : tsInvariant.invariant(context.client, 28);
6493
+ 'sure you pass in your client via the "client" prop.') : tsInvariant.invariant(context.client, 29);
6444
6494
  return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children));
6445
6495
  }));
6446
6496
  };
@@ -6450,7 +6500,7 @@ function useApolloClient(override) {
6450
6500
  var client = override || context.client;
6451
6501
  __DEV__ ? tsInvariant.invariant(!!client, 'Could not find "client" in the context or passed in as an option. ' +
6452
6502
  'Wrap the root component in an <ApolloProvider>, or pass an ApolloClient ' +
6453
- 'instance in via options.') : tsInvariant.invariant(!!client, 31);
6503
+ 'instance in via options.') : tsInvariant.invariant(!!client, 32);
6454
6504
  return client;
6455
6505
  }
6456
6506
 
@@ -6528,7 +6578,7 @@ function parser(document) {
6528
6578
  var variables, type, name;
6529
6579
  __DEV__ ? tsInvariant.invariant(!!document && !!document.kind, "Argument of ".concat(document, " passed to parser was not a valid GraphQL ") +
6530
6580
  "DocumentNode. You may need to use 'graphql-tag' or another method " +
6531
- "to convert your operation into a document") : tsInvariant.invariant(!!document && !!document.kind, 32);
6581
+ "to convert your operation into a document") : tsInvariant.invariant(!!document && !!document.kind, 33);
6532
6582
  var fragments = [];
6533
6583
  var queries = [];
6534
6584
  var mutations = [];
@@ -6556,11 +6606,11 @@ function parser(document) {
6556
6606
  __DEV__ ? tsInvariant.invariant(!fragments.length ||
6557
6607
  (queries.length || mutations.length || subscriptions.length), "Passing only a fragment to 'graphql' is not yet supported. " +
6558
6608
  "You must include a query, subscription or mutation as well") : tsInvariant.invariant(!fragments.length ||
6559
- (queries.length || mutations.length || subscriptions.length), 33);
6609
+ (queries.length || mutations.length || subscriptions.length), 34);
6560
6610
  __DEV__ ? tsInvariant.invariant(queries.length + mutations.length + subscriptions.length <= 1, "react-apollo only supports a query, subscription, or a mutation per HOC. " +
6561
6611
  "".concat(document, " had ").concat(queries.length, " queries, ").concat(subscriptions.length, " ") +
6562
6612
  "subscriptions and ".concat(mutations.length, " mutations. ") +
6563
- "You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(queries.length + mutations.length + subscriptions.length <= 1, 34);
6613
+ "You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(queries.length + mutations.length + subscriptions.length <= 1, 35);
6564
6614
  type = queries.length ? exports.DocumentType.Query : exports.DocumentType.Mutation;
6565
6615
  if (!queries.length && !mutations.length)
6566
6616
  type = exports.DocumentType.Subscription;
@@ -6571,7 +6621,7 @@ function parser(document) {
6571
6621
  : subscriptions;
6572
6622
  __DEV__ ? tsInvariant.invariant(definitions.length === 1, "react-apollo only supports one definition per HOC. ".concat(document, " had ") +
6573
6623
  "".concat(definitions.length, " definitions. ") +
6574
- "You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(definitions.length === 1, 35);
6624
+ "You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(definitions.length === 1, 36);
6575
6625
  var definition = definitions[0];
6576
6626
  variables = definition.variableDefinitions || [];
6577
6627
  if (definition.name && definition.name.kind === 'Name') {
@@ -6589,7 +6639,7 @@ function verifyDocumentType(document, type) {
6589
6639
  var requiredOperationName = operationName(type);
6590
6640
  var usedOperationName = operationName(operation.type);
6591
6641
  __DEV__ ? tsInvariant.invariant(operation.type === type, "Running a ".concat(requiredOperationName, " requires a graphql ") +
6592
- "".concat(requiredOperationName, ", but a ").concat(usedOperationName, " was used instead.")) : tsInvariant.invariant(operation.type === type, 36);
6642
+ "".concat(requiredOperationName, ", but a ").concat(usedOperationName, " was used instead.")) : tsInvariant.invariant(operation.type === type, 37);
6593
6643
  }
6594
6644
 
6595
6645
  var hasOwnProperty = Object.prototype.hasOwnProperty;