@apollo/client 3.14.0-alpha.0 → 3.14.0-alpha.1

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 (198) hide show
  1. package/.changeset/breezy-lions-rule.md +5 -0
  2. package/.changeset/great-jobs-fetch.md +5 -0
  3. package/.changeset/pre.json +4 -1
  4. package/.changeset/tidy-bulldogs-exercise.md +5 -0
  5. package/CHANGELOG.md +10 -0
  6. package/apollo-client.cjs +187 -119
  7. package/apollo-client.cjs.map +1 -1
  8. package/apollo-client.min.cjs +1 -1
  9. package/cache/cache.cjs +7 -2
  10. package/cache/cache.cjs.map +1 -1
  11. package/cache/cache.cjs.native.js +7 -2
  12. package/cache/inmemory/inMemoryCache.d.ts +8 -0
  13. package/cache/inmemory/inMemoryCache.js +3 -0
  14. package/cache/inmemory/inMemoryCache.js.map +1 -1
  15. package/core/ApolloClient.d.ts +9 -9
  16. package/core/ApolloClient.js +6 -1
  17. package/core/ApolloClient.js.map +1 -1
  18. package/core/LocalState.js +2 -2
  19. package/core/ObservableQuery.d.ts +51 -6
  20. package/core/ObservableQuery.js +89 -13
  21. package/core/ObservableQuery.js.map +1 -1
  22. package/core/QueryInfo.js +6 -3
  23. package/core/QueryInfo.js.map +1 -1
  24. package/core/QueryManager.js +14 -12
  25. package/core/QueryManager.js.map +1 -1
  26. package/core/core.cjs +85 -33
  27. package/core/core.cjs.map +1 -1
  28. package/core/core.cjs.native.js +85 -33
  29. package/core/types.d.ts +177 -3
  30. package/core/types.js.map +1 -1
  31. package/core/watchQueryOptions.d.ts +10 -2
  32. package/core/watchQueryOptions.js.map +1 -1
  33. package/dev/dev.cjs +149 -97
  34. package/dev/dev.cjs.map +1 -1
  35. package/dev/dev.cjs.native.js +149 -97
  36. package/errors/errors.cjs.map +1 -1
  37. package/errors/index.d.ts +19 -0
  38. package/errors/index.js +19 -0
  39. package/errors/index.js.map +1 -1
  40. package/invariantErrorCodes.js +161 -96
  41. package/link/batch-http/batch-http.cjs +9 -0
  42. package/link/batch-http/batch-http.cjs.map +1 -1
  43. package/link/batch-http/batch-http.cjs.native.js +9 -0
  44. package/link/batch-http/batchHttpLink.js +9 -0
  45. package/link/batch-http/batchHttpLink.js.map +1 -1
  46. package/link/core/ApolloLink.d.ts +8 -0
  47. package/link/core/ApolloLink.js +19 -2
  48. package/link/core/ApolloLink.js.map +1 -1
  49. package/link/core/core.cjs +24 -2
  50. package/link/core/core.cjs.map +1 -1
  51. package/link/core/core.cjs.native.js +24 -2
  52. package/link/core/types.d.ts +20 -0
  53. package/link/core/types.js.map +1 -1
  54. package/link/error/index.d.ts +48 -0
  55. package/link/error/index.js.map +1 -1
  56. package/link/http/checkFetcher.js +1 -1
  57. package/link/http/createHttpLink.js +4 -1
  58. package/link/http/createHttpLink.js.map +1 -1
  59. package/link/http/http.cjs +6 -3
  60. package/link/http/http.cjs.map +1 -1
  61. package/link/http/http.cjs.native.js +6 -3
  62. package/link/http/serializeFetchParameter.js +1 -1
  63. package/link/persisted-queries/index.d.ts +38 -0
  64. package/link/persisted-queries/index.js +2 -2
  65. package/link/persisted-queries/index.js.map +1 -1
  66. package/link/persisted-queries/persisted-queries.cjs +2 -2
  67. package/link/persisted-queries/persisted-queries.cjs.map +1 -1
  68. package/link/persisted-queries/persisted-queries.cjs.native.js +2 -2
  69. package/link/utils/fromError.d.ts +16 -0
  70. package/link/utils/fromError.js +16 -0
  71. package/link/utils/fromError.js.map +1 -1
  72. package/link/utils/fromPromise.d.ts +16 -0
  73. package/link/utils/fromPromise.js +16 -0
  74. package/link/utils/fromPromise.js.map +1 -1
  75. package/link/utils/throwServerError.d.ts +30 -0
  76. package/link/utils/throwServerError.js +17 -0
  77. package/link/utils/throwServerError.js.map +1 -1
  78. package/link/utils/toPromise.d.ts +16 -0
  79. package/link/utils/toPromise.js +17 -1
  80. package/link/utils/toPromise.js.map +1 -1
  81. package/link/utils/utils.cjs +2 -2
  82. package/link/utils/utils.cjs.map +1 -1
  83. package/link/utils/utils.cjs.native.js +2 -2
  84. package/link/utils/validateOperation.js +1 -1
  85. package/masking/maskDefinition.js +2 -2
  86. package/masking/maskFragment.js +2 -2
  87. package/masking/maskOperation.js +1 -1
  88. package/masking/masking.cjs +6 -6
  89. package/masking/masking.cjs.map +1 -1
  90. package/masking/masking.cjs.native.js +6 -6
  91. package/masking/utils.js +1 -1
  92. package/masking/utils.js.map +1 -1
  93. package/package.json +1 -1
  94. package/react/components/Mutation.js +1 -1
  95. package/react/components/Query.js +1 -1
  96. package/react/components/Subscription.js +1 -1
  97. package/react/components/components.cjs +6 -4
  98. package/react/components/components.cjs.map +1 -1
  99. package/react/components/components.cjs.native.js +6 -4
  100. package/react/context/ApolloConsumer.js +1 -1
  101. package/react/context/ApolloContext.js +2 -2
  102. package/react/context/ApolloProvider.js +1 -1
  103. package/react/context/context.cjs +4 -4
  104. package/react/context/context.cjs.map +1 -1
  105. package/react/context/context.cjs.native.js +4 -4
  106. package/react/hoc/graphql.js +1 -1
  107. package/react/hoc/hoc-utils.js +1 -1
  108. package/react/hoc/hoc.cjs +9 -7
  109. package/react/hoc/hoc.cjs.map +1 -1
  110. package/react/hoc/hoc.cjs.native.js +9 -7
  111. package/react/hoc/mutation-hoc.js +1 -1
  112. package/react/hoc/query-hoc.js +1 -1
  113. package/react/hoc/subscription-hoc.js +1 -1
  114. package/react/hoc/withApollo.js +1 -1
  115. package/react/hooks/hooks.cjs +18 -16
  116. package/react/hooks/hooks.cjs.map +1 -1
  117. package/react/hooks/hooks.cjs.native.js +18 -16
  118. package/react/hooks/internal/useWarnRemoved.d.ts +2 -1
  119. package/react/hooks/internal/useWarnRemoved.js.map +1 -1
  120. package/react/hooks/internal/useWarnRemovedOption.js +1 -1
  121. package/react/hooks/useApolloClient.js +1 -1
  122. package/react/hooks/useLazyQuery.js +2 -2
  123. package/react/hooks/useLoadableQuery.js +2 -2
  124. package/react/hooks/useQuery.js +1 -1
  125. package/react/hooks/useSubscription.js +3 -3
  126. package/react/hooks/useSuspenseQuery.js +2 -2
  127. package/react/hooks/useSyncExternalStore.js +1 -1
  128. package/react/internal/cache/QueryReference.d.ts +1 -0
  129. package/react/internal/cache/QueryReference.js +5 -2
  130. package/react/internal/cache/QueryReference.js.map +1 -1
  131. package/react/internal/internal.cjs +16 -3
  132. package/react/internal/internal.cjs.map +1 -1
  133. package/react/internal/internal.cjs.native.js +16 -3
  134. package/react/parser/index.js +6 -6
  135. package/react/parser/parser.cjs +9 -7
  136. package/react/parser/parser.cjs.map +1 -1
  137. package/react/parser/parser.cjs.native.js +9 -7
  138. package/react/react.cjs +4 -2
  139. package/react/react.cjs.map +1 -1
  140. package/react/react.cjs.native.js +4 -2
  141. package/react/types/types.d.ts +40 -0
  142. package/react/types/types.documentation.d.ts +1 -1
  143. package/react/types/types.documentation.js.map +1 -1
  144. package/react/types/types.js.map +1 -1
  145. package/testing/core/core.cjs +17 -3
  146. package/testing/core/core.cjs.map +1 -1
  147. package/testing/core/core.cjs.native.js +17 -3
  148. package/testing/core/itAsync.d.ts +5 -0
  149. package/testing/core/itAsync.js +5 -0
  150. package/testing/core/itAsync.js.map +1 -1
  151. package/testing/core/mocking/mockClient.d.ts +4 -0
  152. package/testing/core/mocking/mockClient.js +4 -0
  153. package/testing/core/mocking/mockClient.js.map +1 -1
  154. package/testing/core/mocking/mockLink.d.ts +10 -0
  155. package/testing/core/mocking/mockLink.js +23 -4
  156. package/testing/core/mocking/mockLink.js.map +1 -1
  157. package/testing/core/mocking/mockSubscriptionLink.d.ts +4 -0
  158. package/testing/core/mocking/mockSubscriptionLink.js +4 -0
  159. package/testing/core/mocking/mockSubscriptionLink.js.map +1 -1
  160. package/testing/core/subscribeAndCount.d.ts +4 -0
  161. package/testing/core/subscribeAndCount.js +4 -0
  162. package/testing/core/subscribeAndCount.js.map +1 -1
  163. package/testing/experimental/createSchemaFetch.d.ts +1 -1
  164. package/testing/experimental/createSchemaFetch.js +1 -1
  165. package/testing/experimental/createSchemaFetch.js.map +1 -1
  166. package/testing/experimental/createTestSchema.d.ts +1 -1
  167. package/testing/experimental/createTestSchema.js +1 -1
  168. package/testing/experimental/createTestSchema.js.map +1 -1
  169. package/testing/experimental/experimental.cjs.map +1 -1
  170. package/testing/testing.cjs +4 -2
  171. package/testing/testing.cjs.map +1 -1
  172. package/testing/testing.cjs.native.js +4 -2
  173. package/utilities/deprecation/index.d.ts +83 -3
  174. package/utilities/deprecation/index.js +15 -3
  175. package/utilities/deprecation/index.js.map +1 -1
  176. package/utilities/globals/globals.cjs +1 -1
  177. package/utilities/globals/globals.cjs.map +1 -1
  178. package/utilities/globals/globals.cjs.native.js +1 -1
  179. package/utilities/graphql/DocumentTransform.js +1 -1
  180. package/utilities/graphql/directives.js +7 -7
  181. package/utilities/graphql/fragments.js +3 -3
  182. package/utilities/graphql/getFromAST.js +8 -8
  183. package/utilities/graphql/storeUtils.js +1 -1
  184. package/utilities/graphql/transform.js +2 -2
  185. package/utilities/observables/asyncMap.d.ts +13 -0
  186. package/utilities/observables/asyncMap.js +13 -0
  187. package/utilities/observables/asyncMap.js.map +1 -1
  188. package/utilities/observables/iteration.d.ts +4 -0
  189. package/utilities/observables/iteration.js +4 -0
  190. package/utilities/observables/iteration.js.map +1 -1
  191. package/utilities/subscriptions/urql/index.d.ts +5 -0
  192. package/utilities/subscriptions/urql/index.js +5 -0
  193. package/utilities/subscriptions/urql/index.js.map +1 -1
  194. package/utilities/subscriptions/urql/urql.cjs.map +1 -1
  195. package/utilities/utilities.cjs +22 -22
  196. package/utilities/utilities.cjs.map +1 -1
  197. package/utilities/utilities.cjs.native.js +22 -22
  198. package/version.js +1 -1
@@ -22,7 +22,7 @@ function shouldInclude(_a, variables) {
22
22
  if (ifArgument.value.kind === "Variable") {
23
23
  evaledValue =
24
24
  variables && variables[ifArgument.value.name.value];
25
- globals.invariant(evaledValue !== void 0, 93, directive.name.value);
25
+ globals.invariant(evaledValue !== void 0, 106, directive.name.value);
26
26
  }
27
27
  else {
28
28
  evaledValue = ifArgument.value.value;
@@ -72,12 +72,12 @@ function getInclusionDirectives(directives) {
72
72
  return;
73
73
  var directiveArguments = directive.arguments;
74
74
  var directiveName = directive.name.value;
75
- globals.invariant(directiveArguments && directiveArguments.length === 1, 94, directiveName);
75
+ globals.invariant(directiveArguments && directiveArguments.length === 1, 107, directiveName);
76
76
  var ifArgument = directiveArguments[0];
77
- globals.invariant(ifArgument.name && ifArgument.name.value === "if", 95, directiveName);
77
+ globals.invariant(ifArgument.name && ifArgument.name.value === "if", 108, directiveName);
78
78
  var ifValue = ifArgument.value;
79
79
  globals.invariant(ifValue &&
80
- (ifValue.kind === "Variable" || ifValue.kind === "BooleanValue"), 96, directiveName);
80
+ (ifValue.kind === "Variable" || ifValue.kind === "BooleanValue"), 109, directiveName);
81
81
  result.push({ directive: directive, ifArgument: ifArgument });
82
82
  });
83
83
  }
@@ -99,13 +99,13 @@ function getFragmentMaskMode(fragment) {
99
99
  if (globalThis.__DEV__ !== false) {
100
100
  if (modeArg) {
101
101
  if (modeArg.value.kind === graphql.Kind.VARIABLE) {
102
- globalThis.__DEV__ !== false && globals.invariant.warn(97);
102
+ globalThis.__DEV__ !== false && globals.invariant.warn(110);
103
103
  }
104
104
  else if (modeArg.value.kind !== graphql.Kind.STRING) {
105
- globalThis.__DEV__ !== false && globals.invariant.warn(98);
105
+ globalThis.__DEV__ !== false && globals.invariant.warn(111);
106
106
  }
107
107
  else if (modeArg.value.value !== "migrate") {
108
- globalThis.__DEV__ !== false && globals.invariant.warn(99, modeArg.value.value);
108
+ globalThis.__DEV__ !== false && globals.invariant.warn(112, modeArg.value.value);
109
109
  }
110
110
  }
111
111
  }
@@ -144,7 +144,7 @@ function getFragmentQueryDocument(document, fragmentName) {
144
144
  document.definitions.forEach(function (definition) {
145
145
  if (definition.kind === "OperationDefinition") {
146
146
  throw globals.newInvariantError(
147
- 100,
147
+ 113,
148
148
  definition.operation,
149
149
  definition.name ? " named '".concat(definition.name.value, "'") : ""
150
150
  );
@@ -154,7 +154,7 @@ function getFragmentQueryDocument(document, fragmentName) {
154
154
  }
155
155
  });
156
156
  if (typeof actualFragmentName === "undefined") {
157
- globals.invariant(fragments.length === 1, 101, fragments.length);
157
+ globals.invariant(fragments.length === 1, 114, fragments.length);
158
158
  actualFragmentName = fragments[0].name.value;
159
159
  }
160
160
  var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
@@ -195,7 +195,7 @@ function getFragmentFromSelection(selection, fragmentMap) {
195
195
  return fragmentMap(fragmentName);
196
196
  }
197
197
  var fragment = fragmentMap && fragmentMap[fragmentName];
198
- globals.invariant(fragment, 102, fragmentName);
198
+ globals.invariant(fragment, 115, fragmentName);
199
199
  return fragment || null;
200
200
  }
201
201
  default:
@@ -368,7 +368,7 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
368
368
  argObj[name.value] = null;
369
369
  }
370
370
  else {
371
- throw globals.newInvariantError(111, name.value, value.kind);
371
+ throw globals.newInvariantError(124, name.value, value.kind);
372
372
  }
373
373
  }
374
374
  function storeKeyNameFromField(field, variables) {
@@ -502,16 +502,16 @@ function isInlineFragment(selection) {
502
502
  }
503
503
 
504
504
  function checkDocument(doc) {
505
- globals.invariant(doc && doc.kind === "Document", 103);
505
+ globals.invariant(doc && doc.kind === "Document", 116);
506
506
  var operations = doc.definitions
507
507
  .filter(function (d) { return d.kind !== "FragmentDefinition"; })
508
508
  .map(function (definition) {
509
509
  if (definition.kind !== "OperationDefinition") {
510
- throw globals.newInvariantError(104, definition.kind);
510
+ throw globals.newInvariantError(117, definition.kind);
511
511
  }
512
512
  return definition;
513
513
  });
514
- globals.invariant(operations.length <= 1, 105, operations.length);
514
+ globals.invariant(operations.length <= 1, 118, operations.length);
515
515
  return doc;
516
516
  }
517
517
  function getOperationDefinition(doc) {
@@ -534,14 +534,14 @@ function getFragmentDefinitions(doc) {
534
534
  }
535
535
  function getQueryDefinition(doc) {
536
536
  var queryDef = getOperationDefinition(doc);
537
- globals.invariant(queryDef && queryDef.operation === "query", 106);
537
+ globals.invariant(queryDef && queryDef.operation === "query", 119);
538
538
  return queryDef;
539
539
  }
540
540
  function getFragmentDefinition(doc) {
541
- globals.invariant(doc.kind === "Document", 107);
542
- globals.invariant(doc.definitions.length <= 1, 108);
541
+ globals.invariant(doc.kind === "Document", 120);
542
+ globals.invariant(doc.definitions.length <= 1, 121);
543
543
  var fragmentDef = doc.definitions[0];
544
- globals.invariant(fragmentDef.kind === "FragmentDefinition", 109);
544
+ globals.invariant(fragmentDef.kind === "FragmentDefinition", 122);
545
545
  return fragmentDef;
546
546
  }
547
547
  function getMainDefinition(queryDoc) {
@@ -564,7 +564,7 @@ function getMainDefinition(queryDoc) {
564
564
  if (fragmentDefinition) {
565
565
  return fragmentDefinition;
566
566
  }
567
- throw globals.newInvariantError(110);
567
+ throw globals.newInvariantError(123);
568
568
  }
569
569
  function getDefaultValues(definition) {
570
570
  var defaultValues = Object.create(null);
@@ -615,7 +615,7 @@ var DocumentTransform = (function () {
615
615
  makeCacheKey: function (document) {
616
616
  var cacheKeys = _this.getCacheKey(document);
617
617
  if (cacheKeys) {
618
- globals.invariant(Array.isArray(cacheKeys), 92);
618
+ globals.invariant(Array.isArray(cacheKeys), 105);
619
619
  return stableCacheKeys_1.lookupArray(cacheKeys);
620
620
  }
621
621
  },
@@ -745,7 +745,7 @@ function removeDirectivesFromDocument(directives, doc) {
745
745
  return getInUseByFragmentName(ancestor.name.value);
746
746
  }
747
747
  }
748
- globalThis.__DEV__ !== false && globals.invariant.error(112);
748
+ globalThis.__DEV__ !== false && globals.invariant.error(125);
749
749
  return null;
750
750
  };
751
751
  var operationCount = 0;
@@ -935,7 +935,7 @@ var connectionRemoveConfig = {
935
935
  if (willRemove) {
936
936
  if (!directive.arguments ||
937
937
  !directive.arguments.some(function (arg) { return arg.name.value === "key"; })) {
938
- globalThis.__DEV__ !== false && globals.invariant.warn(113);
938
+ globalThis.__DEV__ !== false && globals.invariant.warn(126);
939
939
  }
940
940
  }
941
941
  return willRemove;
package/version.js CHANGED
@@ -1,2 +1,2 @@
1
- export var version = "3.14.0-alpha.0";
1
+ export var version = "3.14.0-alpha.1";
2
2
  //# sourceMappingURL=version.js.map