@apollo/client 4.0.10 → 4.0.11

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/CHANGELOG.md +13 -0
  2. package/__cjs/cache/core/cache.cjs +1 -1
  3. package/__cjs/cache/inmemory/entityStore.cjs +3 -3
  4. package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
  5. package/__cjs/cache/inmemory/policies.cjs +4 -4
  6. package/__cjs/cache/inmemory/policies.cjs.map +1 -1
  7. package/__cjs/cache/inmemory/readFromStore.cjs +2 -2
  8. package/__cjs/cache/inmemory/writeToStore.cjs +4 -4
  9. package/__cjs/core/ApolloClient.cjs.map +1 -1
  10. package/__cjs/core/ApolloClient.d.cts +16 -1
  11. package/__cjs/core/ObservableQuery.cjs +18 -7
  12. package/__cjs/core/ObservableQuery.cjs.map +1 -1
  13. package/__cjs/core/ObservableQuery.d.cts +1 -0
  14. package/__cjs/core/QueryManager.cjs +13 -13
  15. package/__cjs/core/QueryManager.cjs.map +1 -1
  16. package/__cjs/invariantErrorCodes.cjs +39 -33
  17. package/__cjs/link/http/parseAndCheckHttpResponse.cjs +1 -1
  18. package/__cjs/link/http/parseAndCheckHttpResponse.cjs.map +1 -1
  19. package/__cjs/react/hooks/useLazyQuery.cjs +1 -0
  20. package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
  21. package/__cjs/react/hooks/useQuery.cjs +7 -4
  22. package/__cjs/react/hooks/useQuery.cjs.map +1 -1
  23. package/__cjs/react/hooks/useSuspenseQuery.cjs +2 -0
  24. package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
  25. package/__cjs/utilities/internal/constants.cjs +13 -0
  26. package/__cjs/utilities/internal/constants.cjs.map +1 -0
  27. package/__cjs/utilities/internal/constants.d.cts +10 -0
  28. package/__cjs/utilities/internal/index.cjs +4 -2
  29. package/__cjs/utilities/internal/index.cjs.map +1 -1
  30. package/__cjs/utilities/internal/index.d.cts +1 -0
  31. package/__cjs/version.cjs +1 -1
  32. package/cache/core/cache.js +1 -1
  33. package/cache/inmemory/entityStore.js +3 -3
  34. package/cache/inmemory/key-extractor.js +1 -1
  35. package/cache/inmemory/policies.js +4 -4
  36. package/cache/inmemory/policies.js.map +1 -1
  37. package/cache/inmemory/readFromStore.js +2 -2
  38. package/cache/inmemory/writeToStore.js +4 -4
  39. package/core/ApolloClient.d.ts +16 -1
  40. package/core/ApolloClient.js.map +1 -1
  41. package/core/ObservableQuery.d.ts +1 -0
  42. package/core/ObservableQuery.js +19 -8
  43. package/core/ObservableQuery.js.map +1 -1
  44. package/core/QueryManager.js +13 -13
  45. package/core/QueryManager.js.map +1 -1
  46. package/invariantErrorCodes.js +39 -33
  47. package/link/http/parseAndCheckHttpResponse.js +1 -1
  48. package/link/http/parseAndCheckHttpResponse.js.map +1 -1
  49. package/package.json +1 -1
  50. package/react/hooks/useLazyQuery.js +2 -1
  51. package/react/hooks/useLazyQuery.js.map +1 -1
  52. package/react/hooks/useQuery.js +8 -5
  53. package/react/hooks/useQuery.js.map +1 -1
  54. package/react/hooks/useSuspenseQuery.js +2 -0
  55. package/react/hooks/useSuspenseQuery.js.map +1 -1
  56. package/react/hooks-compiled/useLazyQuery.js +2 -1
  57. package/react/hooks-compiled/useLazyQuery.js.map +1 -1
  58. package/react/hooks-compiled/useQuery.js +9 -5
  59. package/react/hooks-compiled/useQuery.js.map +1 -1
  60. package/react/hooks-compiled/useSuspenseQuery.js +3 -1
  61. package/react/hooks-compiled/useSuspenseQuery.js.map +1 -1
  62. package/utilities/internal/constants.d.ts +10 -0
  63. package/utilities/internal/constants.js +10 -0
  64. package/utilities/internal/constants.js.map +1 -0
  65. package/utilities/internal/index.d.ts +1 -0
  66. package/utilities/internal/index.js +1 -0
  67. package/utilities/internal/index.js.map +1 -1
  68. package/version.js +1 -1
@@ -92,7 +92,7 @@ export class QueryManager {
92
92
  */
93
93
  stop() {
94
94
  this.obsQueries.forEach((oq) => oq.stop());
95
- this.cancelPendingFetches(newInvariantError(83));
95
+ this.cancelPendingFetches(newInvariantError(84));
96
96
  }
97
97
  cancelPendingFetches(error) {
98
98
  this.fetchCancelFns.forEach((cancel) => cancel(error));
@@ -105,7 +105,7 @@ export class QueryManager {
105
105
  variables = this.getVariables(mutation, variables);
106
106
  if (hasClientExports) {
107
107
  if (__DEV__) {
108
- invariant(this.localState, 84, getOperationName(mutation, "(anonymous)"));
108
+ invariant(this.localState, 85, getOperationName(mutation, "(anonymous)"));
109
109
  }
110
110
  variables = await this.localState.getExportedVariables({
111
111
  client: this.client,
@@ -342,7 +342,7 @@ export class QueryManager {
342
342
  // depend on values that previously existed in the data portion of the
343
343
  // store. So, we cancel the promises and observers that we have issued
344
344
  // so far and not yet resolved (in the case of queries).
345
- this.cancelPendingFetches(newInvariantError(85));
345
+ this.cancelPendingFetches(newInvariantError(86));
346
346
  this.obsQueries.forEach((observableQuery) => {
347
347
  // Set loading to true so listeners don't trigger unless they want
348
348
  // results with partial data.
@@ -412,10 +412,10 @@ export class QueryManager {
412
412
  if (!included) {
413
413
  const queryName = queryNames.get(nameOrQueryString);
414
414
  if (queryName) {
415
- __DEV__ && invariant.warn(86, queryName);
415
+ __DEV__ && invariant.warn(87, queryName);
416
416
  }
417
417
  else {
418
- __DEV__ && invariant.warn(87);
418
+ __DEV__ && invariant.warn(88);
419
419
  }
420
420
  }
421
421
  });
@@ -444,7 +444,7 @@ export class QueryManager {
444
444
  if (__DEV__) {
445
445
  invariant(
446
446
  !this.getDocumentInfo(query).hasClientExports || this.localState,
447
- 88,
447
+ 89,
448
448
  getOperationName(query, "(anonymous)")
449
449
  );
450
450
  }
@@ -588,14 +588,14 @@ export class QueryManager {
588
588
  if (__DEV__) {
589
589
  invariant(
590
590
  this.localState,
591
- 89,
591
+ 90,
592
592
  operation[0].toUpperCase() + operation.slice(1),
593
593
  operationName ?? "(anonymous)"
594
594
  );
595
595
  }
596
596
  invariant(
597
597
  !hasIncrementalDirective,
598
- 90,
598
+ 91,
599
599
  operation[0].toUpperCase() + operation.slice(1),
600
600
  operationName ?? "(anonymous)"
601
601
  );
@@ -762,7 +762,7 @@ export class QueryManager {
762
762
  // we deprecated and removed LocalState.
763
763
  if (this.getDocumentInfo(normalized.query).hasClientExports) {
764
764
  if (__DEV__) {
765
- invariant(this.localState, 91, getOperationName(normalized.query, "(anonymous)"));
765
+ invariant(this.localState, 92, getOperationName(normalized.query, "(anonymous)"));
766
766
  }
767
767
  observable = from(this.localState.getExportedVariables({
768
768
  client: this.client,
@@ -797,7 +797,7 @@ export class QueryManager {
797
797
  const includedQueriesByOq = new Map();
798
798
  if (include) {
799
799
  this.getObservableQueries(include).forEach((oq) => {
800
- if (oq.options.fetchPolicy === "cache-only") {
800
+ if (oq.options.fetchPolicy === "cache-only" || oq["variablesUnknown"]) {
801
801
  return;
802
802
  }
803
803
  const current = oq.getCurrentResult();
@@ -935,7 +935,7 @@ export class QueryManager {
935
935
  !isFullyUnmaskedOperation(document) &&
936
936
  !this.noCacheWarningsByCause.has(cause)) {
937
937
  this.noCacheWarningsByCause.add(cause);
938
- __DEV__ && invariant.warn(92, getOperationName(document, `Unnamed ${operationType ?? "operation"}`));
938
+ __DEV__ && invariant.warn(93, getOperationName(document, `Unnamed ${operationType ?? "operation"}`));
939
939
  }
940
940
  }
941
941
  return (this.dataMasking ?
@@ -993,7 +993,7 @@ export class QueryManager {
993
993
  (diff.complete || returnPartialData) &&
994
994
  this.getDocumentInfo(query).hasForcedResolvers) {
995
995
  if (__DEV__) {
996
- invariant(this.localState, 93, getOperationName(query, "(anonymous)"));
996
+ invariant(this.localState, 94, getOperationName(query, "(anonymous)"));
997
997
  }
998
998
  onCacheHit();
999
999
  return from(this.localState.execute({
@@ -1084,7 +1084,7 @@ function validateDidEmitValue() {
1084
1084
  didEmitValue = true;
1085
1085
  },
1086
1086
  complete() {
1087
- invariant(didEmitValue, 94);
1087
+ invariant(didEmitValue, 95);
1088
1088
  },
1089
1089
  });
1090
1090
  }