@apollo/client 4.0.0-alpha.3 → 4.0.0-alpha.5

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 (247) hide show
  1. package/.changeset/eighty-squids-fix.md +15 -0
  2. package/.changeset/eleven-kangaroos-jump.md +5 -0
  3. package/.changeset/forty-shrimps-fry.md +5 -0
  4. package/.changeset/funny-jeans-invent.md +16 -0
  5. package/.changeset/grumpy-vans-type.md +5 -0
  6. package/.changeset/khaki-spies-work.md +11 -0
  7. package/.changeset/light-apes-rescue.md +5 -0
  8. package/.changeset/little-spoons-kick.md +7 -0
  9. package/.changeset/loud-cows-raise.md +7 -0
  10. package/.changeset/many-buses-allow.md +5 -0
  11. package/.changeset/odd-lemons-relax.md +5 -0
  12. package/.changeset/poor-eels-punch.md +5 -0
  13. package/.changeset/pre.json +18 -0
  14. package/.changeset/real-teachers-peel.md +5 -0
  15. package/.changeset/slimy-chicken-melt.md +5 -0
  16. package/.changeset/thick-books-grin.md +5 -0
  17. package/.changeset/tough-rockets-allow.md +5 -0
  18. package/.changeset/tricky-tables-shave.md +5 -0
  19. package/.changeset/warm-ties-sit.md +7 -0
  20. package/CHANGELOG.md +84 -0
  21. package/__cjs/cache/core/cache.cjs +1 -1
  22. package/__cjs/cache/inmemory/entityStore.cjs +3 -3
  23. package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
  24. package/__cjs/cache/inmemory/policies.cjs +4 -4
  25. package/__cjs/cache/inmemory/readFromStore.cjs +2 -2
  26. package/__cjs/cache/inmemory/writeToStore.cjs +4 -4
  27. package/__cjs/core/ApolloClient.cjs +25 -16
  28. package/__cjs/core/ApolloClient.cjs.map +1 -1
  29. package/__cjs/core/ApolloClient.d.cts +17 -5
  30. package/__cjs/core/LocalState.cjs +2 -2
  31. package/__cjs/core/ObservableQuery.cjs +44 -22
  32. package/__cjs/core/ObservableQuery.cjs.map +1 -1
  33. package/__cjs/core/ObservableQuery.d.cts +6 -3
  34. package/__cjs/core/QueryManager.cjs +72 -35
  35. package/__cjs/core/QueryManager.cjs.map +1 -1
  36. package/__cjs/core/QueryManager.d.cts +14 -3
  37. package/__cjs/core/types.d.cts +32 -0
  38. package/__cjs/core/watchQueryOptions.d.cts +18 -25
  39. package/__cjs/invariantErrorCodes.cjs +57 -77
  40. package/__cjs/link/core/ApolloLink.cjs +2 -2
  41. package/__cjs/link/http/checkFetcher.cjs +1 -1
  42. package/__cjs/link/http/createHttpLink.cjs +1 -1
  43. package/__cjs/link/http/parseAndCheckHttpResponse.cjs +1 -1
  44. package/__cjs/link/http/serializeFetchParameter.cjs +1 -1
  45. package/__cjs/link/persisted-queries/index.cjs +2 -2
  46. package/__cjs/link/utils/validateOperation.cjs +1 -1
  47. package/__cjs/masking/maskDefinition.cjs +2 -2
  48. package/__cjs/masking/maskFragment.cjs +2 -2
  49. package/__cjs/masking/maskOperation.cjs +1 -1
  50. package/__cjs/masking/utils.cjs +1 -1
  51. package/__cjs/react/context/ApolloConsumer.cjs +1 -1
  52. package/__cjs/react/context/ApolloContext.cjs +1 -1
  53. package/__cjs/react/context/ApolloContext.cjs.map +1 -1
  54. package/__cjs/react/context/ApolloContext.d.cts +2 -2
  55. package/__cjs/react/context/ApolloProvider.cjs +1 -1
  56. package/__cjs/react/hooks/index.cjs +13 -8
  57. package/__cjs/react/hooks/index.cjs.map +1 -1
  58. package/__cjs/react/hooks/index.d.cts +6 -12
  59. package/__cjs/react/hooks/internal/wrapHook.cjs +26 -5
  60. package/__cjs/react/hooks/internal/wrapHook.cjs.map +1 -1
  61. package/__cjs/react/hooks/internal/wrapHook.d.cts +3 -1
  62. package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
  63. package/__cjs/react/hooks/useBackgroundQuery.d.cts +146 -43
  64. package/__cjs/react/hooks/useFragment.cjs.map +1 -1
  65. package/__cjs/react/hooks/useFragment.d.cts +51 -26
  66. package/__cjs/react/hooks/useLazyQuery.cjs +1 -1
  67. package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
  68. package/__cjs/react/hooks/useLazyQuery.d.cts +263 -262
  69. package/__cjs/react/hooks/useLoadableQuery.cjs.map +1 -1
  70. package/__cjs/react/hooks/useLoadableQuery.d.cts +105 -32
  71. package/__cjs/react/hooks/useMutation.cjs +14 -19
  72. package/__cjs/react/hooks/useMutation.cjs.map +1 -1
  73. package/__cjs/react/hooks/useMutation.d.cts +198 -3
  74. package/__cjs/react/hooks/useQuery.cjs +82 -189
  75. package/__cjs/react/hooks/useQuery.cjs.map +1 -1
  76. package/__cjs/react/hooks/useQuery.d.cts +283 -4
  77. package/__cjs/react/hooks/useQueryRefHandlers.cjs.map +1 -1
  78. package/__cjs/react/hooks/useQueryRefHandlers.d.cts +21 -20
  79. package/__cjs/react/hooks/useReadQuery.cjs.map +1 -1
  80. package/__cjs/react/hooks/useReadQuery.d.cts +26 -24
  81. package/__cjs/react/hooks/useSubscription.cjs +8 -57
  82. package/__cjs/react/hooks/useSubscription.cjs.map +1 -1
  83. package/__cjs/react/hooks/useSubscription.d.cts +96 -9
  84. package/__cjs/react/hooks/useSuspenseFragment.cjs.map +1 -1
  85. package/__cjs/react/hooks/useSuspenseFragment.d.cts +40 -37
  86. package/__cjs/react/hooks/useSuspenseQuery.cjs +2 -2
  87. package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
  88. package/__cjs/react/hooks/useSuspenseQuery.d.cts +202 -35
  89. package/__cjs/react/hooks/useSyncExternalStore.cjs +1 -1
  90. package/__cjs/react/index.cjs.map +1 -1
  91. package/__cjs/react/index.d.cts +2 -1
  92. package/__cjs/react/internal/index.cjs +3 -1
  93. package/__cjs/react/internal/index.cjs.map +1 -1
  94. package/__cjs/react/internal/index.d.cts +2 -0
  95. package/__cjs/react/internal/types.d.cts +46 -0
  96. package/__cjs/react/query-preloader/createQueryPreloader.cjs.map +1 -1
  97. package/__cjs/react/query-preloader/createQueryPreloader.d.cts +2 -3
  98. package/__cjs/react/ssr/getDataFromTree.cjs +43 -12
  99. package/__cjs/react/ssr/getDataFromTree.cjs.map +1 -1
  100. package/__cjs/react/ssr/getDataFromTree.d.cts +5 -0
  101. package/__cjs/react/ssr/index.cjs +1 -3
  102. package/__cjs/react/ssr/index.cjs.map +1 -1
  103. package/__cjs/react/ssr/index.d.cts +0 -1
  104. package/__cjs/react/ssr/useSSRQuery.cjs +60 -0
  105. package/__cjs/react/ssr/useSSRQuery.cjs.map +1 -0
  106. package/__cjs/react/ssr/useSSRQuery.d.cts +5 -0
  107. package/__cjs/react/types/deprecated.cjs +3 -0
  108. package/__cjs/react/types/deprecated.cjs.map +1 -0
  109. package/__cjs/react/types/deprecated.d.cts +65 -0
  110. package/__cjs/react/types/types.documentation.d.cts +4 -12
  111. package/__cjs/testing/matchers/index.cjs +4 -0
  112. package/__cjs/testing/matchers/index.cjs.map +1 -1
  113. package/__cjs/testing/matchers/toEmitStrictTyped.cjs +42 -0
  114. package/__cjs/testing/matchers/toEmitStrictTyped.cjs.map +1 -0
  115. package/__cjs/testing/matchers/toEmitStrictTyped.d.cts +7 -0
  116. package/__cjs/testing/matchers/toEqualLazyQueryResult.cjs.map +1 -1
  117. package/__cjs/testing/matchers/toEqualLazyQueryResult.d.cts +2 -2
  118. package/__cjs/testing/matchers/toEqualQueryResult.cjs.map +1 -1
  119. package/__cjs/testing/matchers/toEqualQueryResult.d.cts +2 -2
  120. package/__cjs/testing/matchers/toEqualStrictTyped.cjs +26 -0
  121. package/__cjs/testing/matchers/toEqualStrictTyped.cjs.map +1 -0
  122. package/__cjs/testing/matchers/toEqualStrictTyped.d.cts +3 -0
  123. package/__cjs/testing/matchers/utils/getSerializableProperties.cjs +23 -0
  124. package/__cjs/testing/matchers/utils/getSerializableProperties.cjs.map +1 -0
  125. package/__cjs/testing/matchers/utils/getSerializableProperties.d.cts +2 -0
  126. package/__cjs/version.cjs +1 -1
  127. package/__cjs/version.d.cts +1 -1
  128. package/cache/core/cache.js +1 -1
  129. package/cache/inmemory/entityStore.js +3 -3
  130. package/cache/inmemory/key-extractor.js +1 -1
  131. package/cache/inmemory/policies.js +4 -4
  132. package/cache/inmemory/readFromStore.js +2 -2
  133. package/cache/inmemory/writeToStore.js +4 -4
  134. package/core/ApolloClient.d.ts +17 -5
  135. package/core/ApolloClient.js +25 -16
  136. package/core/ApolloClient.js.map +1 -1
  137. package/core/LocalState.js +2 -2
  138. package/core/ObservableQuery.d.ts +6 -3
  139. package/core/ObservableQuery.js +44 -22
  140. package/core/ObservableQuery.js.map +1 -1
  141. package/core/QueryManager.d.ts +14 -3
  142. package/core/QueryManager.js +73 -36
  143. package/core/QueryManager.js.map +1 -1
  144. package/core/types.d.ts +32 -0
  145. package/core/watchQueryOptions.d.ts +18 -25
  146. package/invariantErrorCodes.js +57 -77
  147. package/link/core/ApolloLink.js +2 -2
  148. package/link/http/checkFetcher.js +1 -1
  149. package/link/http/createHttpLink.js +1 -1
  150. package/link/http/parseAndCheckHttpResponse.js +1 -1
  151. package/link/http/serializeFetchParameter.js +1 -1
  152. package/link/persisted-queries/index.js +2 -2
  153. package/link/utils/validateOperation.js +1 -1
  154. package/masking/maskDefinition.js +2 -2
  155. package/masking/maskFragment.js +2 -2
  156. package/masking/maskOperation.js +1 -1
  157. package/masking/utils.js +1 -1
  158. package/package.json +1 -1
  159. package/react/context/ApolloConsumer.js +1 -1
  160. package/react/context/ApolloContext.d.ts +2 -2
  161. package/react/context/ApolloContext.js +1 -1
  162. package/react/context/ApolloContext.js.map +1 -1
  163. package/react/context/ApolloProvider.js +1 -1
  164. package/react/hooks/index.d.ts +6 -12
  165. package/react/hooks/index.js +6 -6
  166. package/react/hooks/index.js.map +1 -1
  167. package/react/hooks/internal/wrapHook.d.ts +3 -1
  168. package/react/hooks/internal/wrapHook.js +24 -5
  169. package/react/hooks/internal/wrapHook.js.map +1 -1
  170. package/react/hooks/useBackgroundQuery.d.ts +146 -43
  171. package/react/hooks/useBackgroundQuery.js.map +1 -1
  172. package/react/hooks/useFragment.d.ts +51 -26
  173. package/react/hooks/useFragment.js.map +1 -1
  174. package/react/hooks/useLazyQuery.d.ts +263 -262
  175. package/react/hooks/useLazyQuery.js +1 -1
  176. package/react/hooks/useLazyQuery.js.map +1 -1
  177. package/react/hooks/useLoadableQuery.d.ts +105 -32
  178. package/react/hooks/useLoadableQuery.js.map +1 -1
  179. package/react/hooks/useMutation.d.ts +198 -3
  180. package/react/hooks/useMutation.js +14 -19
  181. package/react/hooks/useMutation.js.map +1 -1
  182. package/react/hooks/useQuery.d.ts +283 -4
  183. package/react/hooks/useQuery.js +83 -190
  184. package/react/hooks/useQuery.js.map +1 -1
  185. package/react/hooks/useQueryRefHandlers.d.ts +21 -20
  186. package/react/hooks/useQueryRefHandlers.js.map +1 -1
  187. package/react/hooks/useReadQuery.d.ts +26 -24
  188. package/react/hooks/useReadQuery.js.map +1 -1
  189. package/react/hooks/useSubscription.d.ts +96 -9
  190. package/react/hooks/useSubscription.js +7 -53
  191. package/react/hooks/useSubscription.js.map +1 -1
  192. package/react/hooks/useSuspenseFragment.d.ts +40 -37
  193. package/react/hooks/useSuspenseFragment.js.map +1 -1
  194. package/react/hooks/useSuspenseQuery.d.ts +202 -35
  195. package/react/hooks/useSuspenseQuery.js +2 -2
  196. package/react/hooks/useSuspenseQuery.js.map +1 -1
  197. package/react/hooks/useSyncExternalStore.js +1 -1
  198. package/react/index.d.ts +2 -1
  199. package/react/index.js.map +1 -1
  200. package/react/internal/index.d.ts +2 -0
  201. package/react/internal/index.js +2 -1
  202. package/react/internal/index.js.map +1 -1
  203. package/react/internal/types.d.ts +46 -0
  204. package/react/query-preloader/createQueryPreloader.d.ts +2 -3
  205. package/react/query-preloader/createQueryPreloader.js.map +1 -1
  206. package/react/ssr/getDataFromTree.d.ts +5 -0
  207. package/react/ssr/getDataFromTree.js +43 -12
  208. package/react/ssr/getDataFromTree.js.map +1 -1
  209. package/react/ssr/index.d.ts +0 -1
  210. package/react/ssr/index.js +0 -1
  211. package/react/ssr/index.js.map +1 -1
  212. package/react/ssr/useSSRQuery.d.ts +5 -0
  213. package/react/ssr/useSSRQuery.js +56 -0
  214. package/react/ssr/useSSRQuery.js.map +1 -0
  215. package/react/types/deprecated.d.ts +65 -0
  216. package/react/types/deprecated.js +2 -0
  217. package/react/types/deprecated.js.map +1 -0
  218. package/react/types/types.documentation.d.ts +4 -12
  219. package/testing/matchers/index.js +4 -0
  220. package/testing/matchers/index.js.map +1 -1
  221. package/testing/matchers/toEmitStrictTyped.d.ts +7 -0
  222. package/testing/matchers/toEmitStrictTyped.js +38 -0
  223. package/testing/matchers/toEmitStrictTyped.js.map +1 -0
  224. package/testing/matchers/toEqualLazyQueryResult.d.ts +2 -2
  225. package/testing/matchers/toEqualLazyQueryResult.js.map +1 -1
  226. package/testing/matchers/toEqualQueryResult.d.ts +2 -2
  227. package/testing/matchers/toEqualQueryResult.js.map +1 -1
  228. package/testing/matchers/toEqualStrictTyped.d.ts +3 -0
  229. package/testing/matchers/toEqualStrictTyped.js +22 -0
  230. package/testing/matchers/toEqualStrictTyped.js.map +1 -0
  231. package/testing/matchers/utils/getSerializableProperties.d.ts +2 -0
  232. package/testing/matchers/utils/getSerializableProperties.js +20 -0
  233. package/testing/matchers/utils/getSerializableProperties.js.map +1 -0
  234. package/version.d.ts +1 -1
  235. package/version.js +1 -1
  236. package/__cjs/react/ssr/RenderPromises.cjs +0 -104
  237. package/__cjs/react/ssr/RenderPromises.cjs.map +0 -1
  238. package/__cjs/react/ssr/RenderPromises.d.cts +0 -22
  239. package/__cjs/react/types/types.d.cts +0 -661
  240. package/react/ssr/RenderPromises.d.ts +0 -22
  241. package/react/ssr/RenderPromises.js +0 -100
  242. package/react/ssr/RenderPromises.js.map +0 -1
  243. package/react/types/types.d.ts +0 -661
  244. /package/__cjs/react/{types → internal}/types.cjs +0 -0
  245. /package/__cjs/react/{types → internal}/types.cjs.map +0 -0
  246. /package/react/{types → internal}/types.js +0 -0
  247. /package/react/{types → internal}/types.js.map +0 -0
package/masking/utils.js CHANGED
@@ -9,7 +9,7 @@ let issuedWarning = false;
9
9
  export function warnOnImproperCacheImplementation() {
10
10
  if (!issuedWarning) {
11
11
  issuedWarning = true;
12
- __DEV__ && invariant.warn(52);
12
+ __DEV__ && invariant.warn(48);
13
13
  }
14
14
  }
15
15
  //# sourceMappingURL=utils.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apollo/client",
3
- "version": "4.0.0-alpha.3",
3
+ "version": "4.0.0-alpha.5",
4
4
  "description": "A fully-featured caching GraphQL client.",
5
5
  "private": false,
6
6
  "keywords": [
@@ -4,7 +4,7 @@ import { getApolloContext } from "./ApolloContext.js";
4
4
  export const ApolloConsumer = (props) => {
5
5
  const ApolloContext = getApolloContext();
6
6
  return (React.createElement(ApolloContext.Consumer, null, (context) => {
7
- invariant(context && context.client, 44);
7
+ invariant(context && context.client, 40);
8
8
  return props.children(context.client);
9
9
  }));
10
10
  };
@@ -1,9 +1,9 @@
1
1
  import type * as ReactTypes from "react";
2
2
  import type { ApolloClient } from "@apollo/client/core";
3
- import type { RenderPromises } from "@apollo/client/react/ssr";
3
+ import type { HookWrappers, wrapperSymbol } from "@apollo/client/react/internal";
4
4
  export interface ApolloContextValue {
5
5
  client?: ApolloClient;
6
- renderPromises?: RenderPromises;
6
+ [wrapperSymbol]?: HookWrappers;
7
7
  }
8
8
  export declare function getApolloContext(): ReactTypes.Context<ApolloContextValue>;
9
9
  //# sourceMappingURL=ApolloContext.d.ts.map
@@ -6,7 +6,7 @@ import { invariant } from "@apollo/client/utilities/invariant";
6
6
  // context), a single Apollo context is created and tracked in global state.
7
7
  const contextKey = Symbol.for("__APOLLO_CONTEXT__");
8
8
  export function getApolloContext() {
9
- invariant("createContext" in React, 45);
9
+ invariant("createContext" in React, 41);
10
10
  let context = React.createContext[contextKey];
11
11
  if (!context) {
12
12
  Object.defineProperty(React.createContext, contextKey, {
@@ -1 +1 @@
1
- {"version":3,"file":"ApolloContext.js","sources":["../../../src/react/context/ApolloContext.ts"],"sourcesContent":["import type * as ReactTypes from \"react\";\nimport * as React from \"react\";\n\nimport type { ApolloClient } from \"@apollo/client/core\";\nimport type { RenderPromises } from \"@apollo/client/react/ssr\";\nimport { invariant } from \"@apollo/client/utilities/invariant\";\n\nexport interface ApolloContextValue {\n client?: ApolloClient;\n renderPromises?: RenderPromises;\n}\n\n// To make sure Apollo Client doesn't create more than one React context\n// (which can lead to problems like having an Apollo Client instance added\n// in one context, then attempting to retrieve it from another different\n// context), a single Apollo context is created and tracked in global state.\nconst contextKey = Symbol.for(\"__APOLLO_CONTEXT__\");\n\nexport function getApolloContext(): ReactTypes.Context<ApolloContextValue> {\n invariant(\n \"createContext\" in React,\n \"Invoking `getApolloContext` in an environment where `React.createContext` is not available.\\n\" +\n \"The Apollo Client functionality you are trying to use is only available in React Client Components.\\n\" +\n 'Please make sure to add \"use client\" at the top of your file.\\n' +\n // TODO: change to React documentation once React documentation contains information about Client Components\n \"For more information, see https://nextjs.org/docs/getting-started/react-essentials#client-components\"\n );\n\n let context = (React.createContext as any)[\n contextKey\n ] as React.Context<ApolloContextValue>;\n if (!context) {\n Object.defineProperty(React.createContext, contextKey, {\n value: (context = React.createContext<ApolloContextValue>({})),\n enumerable: false,\n writable: false,\n configurable: true,\n });\n context.displayName = \"ApolloContext\";\n }\n return context;\n}\n"],"names":[],"mappings":"AACA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAP,CAAA,EAAY,CAAZ,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,EAAuB,CAAvB,CAAA,CAAA,CAAA,CAAA,CAAA,CAA8B;AAI9B,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAA0B,CAA1B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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AAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAyC;IACvC;IACA,CAAF,CAAA,CAAA,CAAA,CAAA,EAAS,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgB;AAChB;"}
1
+ {"version":3,"file":"ApolloContext.js","sources":["../../../src/react/context/ApolloContext.ts"],"sourcesContent":["import type * as ReactTypes from \"react\";\nimport * as React from \"react\";\n\nimport type { ApolloClient } from \"@apollo/client/core\";\nimport type {\n HookWrappers,\n wrapperSymbol,\n} from \"@apollo/client/react/internal\";\nimport { invariant } from \"@apollo/client/utilities/invariant\";\n\nexport interface ApolloContextValue {\n client?: ApolloClient;\n [wrapperSymbol]?: HookWrappers;\n}\n\n// To make sure Apollo Client doesn't create more than one React context\n// (which can lead to problems like having an Apollo Client instance added\n// in one context, then attempting to retrieve it from another different\n// context), a single Apollo context is created and tracked in global state.\nconst contextKey = Symbol.for(\"__APOLLO_CONTEXT__\");\n\nexport function getApolloContext(): ReactTypes.Context<ApolloContextValue> {\n invariant(\n \"createContext\" in React,\n \"Invoking `getApolloContext` in an environment where `React.createContext` is not available.\\n\" +\n \"The Apollo Client functionality you are trying to use is only available in React Client Components.\\n\" +\n 'Please make sure to add \"use client\" at the top of your file.\\n' +\n // TODO: change to React documentation once React documentation contains information about Client Components\n \"For more information, see https://nextjs.org/docs/getting-started/react-essentials#client-components\"\n );\n\n let context = (React.createContext as any)[\n contextKey\n ] as React.Context<ApolloContextValue>;\n if (!context) {\n Object.defineProperty(React.createContext, contextKey, {\n value: (context = React.createContext<ApolloContextValue>({})),\n enumerable: false,\n writable: false,\n configurable: true,\n });\n context.displayName = \"ApolloContext\";\n }\n return context;\n}\n"],"names":[],"mappings":"AACA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAP,CAAA,EAAY,CAAZ,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,EAAuB,CAAvB,CAAA,CAAA,CAAA,CAAA,CAAA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AAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAkB,EAAE,CAApB,CAAA,CAAA,CAAwB;QACxB,CAAK,CAAC;QACF,CAAJ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CAAC,CAAZ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAA0B,CAA1B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAyC;IACvC;IACA,CAAF,CAAA,CAAA,CAAA,CAAA,EAAS,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgB;AAChB;"}
@@ -10,7 +10,7 @@ export const ApolloProvider = ({ client, children, }) => {
10
10
  client: client || parentContext.client,
11
11
  };
12
12
  }, [parentContext, client]);
13
- invariant(context.client, 46);
13
+ invariant(context.client, 42);
14
14
  return (React.createElement(ApolloContext.Provider, { value: context }, children));
15
15
  };
16
16
  //# sourceMappingURL=ApolloProvider.js.map
@@ -1,21 +1,15 @@
1
- export * from "./useApolloClient.js";
2
- export * from "./useLazyQuery.js";
3
- export * from "./useMutation.js";
1
+ export { useApolloClient } from "./useApolloClient.js";
2
+ export { useLazyQuery } from "./useLazyQuery.js";
3
+ export { useMutation } from "./useMutation.js";
4
4
  export { useQuery } from "./useQuery.js";
5
- export * from "./useSubscription.js";
6
- export * from "./useReactiveVar.js";
7
- export * from "./useFragment.js";
8
- export type { UseSuspenseQueryResult } from "./useSuspenseQuery.js";
5
+ export { useSubscription } from "./useSubscription.js";
6
+ export { useReactiveVar } from "./useReactiveVar.js";
7
+ export { useFragment } from "./useFragment.js";
9
8
  export { useSuspenseQuery } from "./useSuspenseQuery.js";
10
- export type { UseBackgroundQueryResult } from "./useBackgroundQuery.js";
11
9
  export { useBackgroundQuery } from "./useBackgroundQuery.js";
12
- export type { UseSuspenseFragmentOptions, UseSuspenseFragmentResult, } from "./useSuspenseFragment.js";
13
10
  export { useSuspenseFragment } from "./useSuspenseFragment.js";
14
- export type { LoadQueryFunction, UseLoadableQueryResult, } from "./useLoadableQuery.js";
15
11
  export { useLoadableQuery } from "./useLoadableQuery.js";
16
- export type { UseQueryRefHandlersResult } from "./useQueryRefHandlers.js";
17
12
  export { useQueryRefHandlers } from "./useQueryRefHandlers.js";
18
- export type { UseReadQueryResult } from "./useReadQuery.js";
19
13
  export { useReadQuery } from "./useReadQuery.js";
20
14
  export { skipToken } from "./constants.js";
21
15
  export type { SkipToken } from "./constants.js";
@@ -1,10 +1,10 @@
1
- export * from "./useApolloClient.js";
2
- export * from "./useLazyQuery.js";
3
- export * from "./useMutation.js";
1
+ export { useApolloClient } from "./useApolloClient.js";
2
+ export { useLazyQuery } from "./useLazyQuery.js";
3
+ export { useMutation } from "./useMutation.js";
4
4
  export { useQuery } from "./useQuery.js";
5
- export * from "./useSubscription.js";
6
- export * from "./useReactiveVar.js";
7
- export * from "./useFragment.js";
5
+ export { useSubscription } from "./useSubscription.js";
6
+ export { useReactiveVar } from "./useReactiveVar.js";
7
+ export { useFragment } from "./useFragment.js";
8
8
  export { useSuspenseQuery } from "./useSuspenseQuery.js";
9
9
  export { useBackgroundQuery } from "./useBackgroundQuery.js";
10
10
  export { useSuspenseFragment } from "./useSuspenseFragment.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/react/hooks/index.ts"],"sourcesContent":["export * from \"./useApolloClient.js\";\nexport * from \"./useLazyQuery.js\";\nexport * from \"./useMutation.js\";\nexport { useQuery } from \"./useQuery.js\";\nexport * from \"./useSubscription.js\";\nexport * from \"./useReactiveVar.js\";\nexport * from \"./useFragment.js\";\nexport type { UseSuspenseQueryResult } from \"./useSuspenseQuery.js\";\nexport { useSuspenseQuery } from \"./useSuspenseQuery.js\";\nexport type { UseBackgroundQueryResult } from \"./useBackgroundQuery.js\";\nexport { useBackgroundQuery } from \"./useBackgroundQuery.js\";\nexport type {\n UseSuspenseFragmentOptions,\n UseSuspenseFragmentResult,\n} from \"./useSuspenseFragment.js\";\nexport { useSuspenseFragment } from \"./useSuspenseFragment.js\";\nexport type {\n LoadQueryFunction,\n UseLoadableQueryResult,\n} from \"./useLoadableQuery.js\";\nexport { useLoadableQuery } from \"./useLoadableQuery.js\";\nexport type { UseQueryRefHandlersResult } from \"./useQueryRefHandlers.js\";\nexport { useQueryRefHandlers } from \"./useQueryRefHandlers.js\";\nexport type { UseReadQueryResult } from \"./useReadQuery.js\";\nexport { useReadQuery } from \"./useReadQuery.js\";\nexport { skipToken } from \"./constants.js\";\nexport type { SkipToken } from \"./constants.js\";\n"],"names":[],"mappings":"AAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAc,CAAd,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAoC;AACpC,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAc,CAAd,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAiC;AACjC,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAc,CAAd,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgC;AAChC,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAyB,CAAzB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAwC;AACxC,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAA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,CAAA,CAAgD;AAChD,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAS,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAA0B,CAA1B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/react/hooks/index.ts"],"sourcesContent":["export { useApolloClient } from \"./useApolloClient.js\";\nexport { useLazyQuery } from \"./useLazyQuery.js\";\nexport { useMutation } from \"./useMutation.js\";\nexport { useQuery } from \"./useQuery.js\";\nexport { useSubscription } from \"./useSubscription.js\";\nexport { useReactiveVar } from \"./useReactiveVar.js\";\nexport { useFragment } from \"./useFragment.js\";\nexport { useSuspenseQuery } from \"./useSuspenseQuery.js\";\nexport { useBackgroundQuery } from \"./useBackgroundQuery.js\";\nexport { useSuspenseFragment } from \"./useSuspenseFragment.js\";\nexport { useLoadableQuery } from \"./useLoadableQuery.js\";\nexport { useQueryRefHandlers } from \"./useQueryRefHandlers.js\";\nexport { useReadQuery } from \"./useReadQuery.js\";\nexport { skipToken } from \"./constants.js\";\nexport type { SkipToken } from \"./constants.js\";\n"],"names":[],"mappings":"AAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAgC,CAAhC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAsD;AACtD,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA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/client/core";
2
2
  import type { ObservableQuery } from "@apollo/client/core";
3
3
  import type { createQueryPreloader } from "@apollo/client/react";
4
4
  import type { useBackgroundQuery, useFragment, useQuery, useQueryRefHandlers, useReadQuery, useSuspenseFragment, useSuspenseQuery } from "@apollo/client/react/hooks";
5
+ export declare const wrapperSymbol: unique symbol;
6
+ type FunctionSignature<T> = T extends (...args: infer A) => infer R ? (...args: A) => R : never;
5
7
  interface WrappableHooks {
6
8
  createQueryPreloader: typeof createQueryPreloader;
7
- useQuery: typeof useQuery;
9
+ useQuery: FunctionSignature<typeof useQuery>;
8
10
  useSuspenseQuery: typeof useSuspenseQuery;
9
11
  useSuspenseFragment: typeof useSuspenseFragment;
10
12
  useBackgroundQuery: typeof useBackgroundQuery;
@@ -1,4 +1,7 @@
1
- const wrapperSymbol = Symbol.for("apollo.hook.wrappers");
1
+ import * as React from "react";
2
+ // direct import to avoid circular dependency
3
+ import { getApolloContext } from "../../context/ApolloContext.js";
4
+ export const wrapperSymbol = Symbol.for("apollo.hook.wrappers");
2
5
  /**
3
6
  * @internal
4
7
  *
@@ -35,9 +38,25 @@ const wrapperSymbol = Symbol.for("apollo.hook.wrappers");
35
38
  * ```
36
39
  */
37
40
  export function wrapHook(hookName, useHook, clientOrObsQuery) {
38
- const queryManager = clientOrObsQuery["queryManager"];
39
- const wrappers = queryManager && queryManager[wrapperSymbol];
40
- const wrapper = wrappers && wrappers[hookName];
41
- return wrapper ? wrapper(useHook) : useHook;
41
+ // Priority-wise, the later entries in this array wrap
42
+ // previous entries and could prevent them (and in the end,
43
+ // even the original hook) from running
44
+ const wrapperSources = [
45
+ clientOrObsQuery["queryManager"],
46
+ // if we are a hook (not `preloadQuery`), we are guaranteed to be inside of
47
+ // a React render and can use context
48
+ hookName.startsWith("use") ?
49
+ // eslint-disable-next-line react-hooks/rules-of-hooks
50
+ React.useContext(getApolloContext())
51
+ : undefined,
52
+ ];
53
+ let wrapped = useHook;
54
+ for (const source of wrapperSources) {
55
+ const wrapper = source?.[wrapperSymbol]?.[hookName];
56
+ if (wrapper) {
57
+ wrapped = wrapper(wrapped);
58
+ }
59
+ }
60
+ return wrapped;
42
61
  }
43
62
  //# sourceMappingURL=wrapHook.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wrapHook.js","sources":["../../../../src/react/hooks/internal/wrapHook.ts"],"sourcesContent":["import type { ApolloClient } from \"@apollo/client/core\";\nimport type { ObservableQuery } from \"@apollo/client/core\";\nimport type { createQueryPreloader } from \"@apollo/client/react\";\nimport type {\n useBackgroundQuery,\n useFragment,\n useQuery,\n useQueryRefHandlers,\n useReadQuery,\n useSuspenseFragment,\n useSuspenseQuery,\n} from \"@apollo/client/react/hooks\";\n\nimport type { QueryManager } from \"../../../core/QueryManager.js\";\n\nconst wrapperSymbol = Symbol.for(\"apollo.hook.wrappers\");\n\ninterface WrappableHooks {\n createQueryPreloader: typeof createQueryPreloader;\n useQuery: typeof useQuery;\n useSuspenseQuery: typeof useSuspenseQuery;\n useSuspenseFragment: typeof useSuspenseFragment;\n useBackgroundQuery: typeof useBackgroundQuery;\n useReadQuery: typeof useReadQuery;\n useFragment: typeof useFragment;\n useQueryRefHandlers: typeof useQueryRefHandlers;\n}\n\n/**\n * @internal\n * Can be used to correctly type the [Symbol.for(\"apollo.hook.wrappers\")] property of\n * `QueryManager`, to override/wrap hook functionality.\n */\nexport type HookWrappers = {\n [K in keyof WrappableHooks]?: (\n originalHook: WrappableHooks[K]\n ) => WrappableHooks[K];\n};\n\ninterface QueryManagerWithWrappers extends QueryManager {\n [wrapperSymbol]?: HookWrappers;\n}\n\n/**\n * @internal\n *\n * Makes an Apollo Client hook \"wrappable\".\n * That means that the Apollo Client instance can expose a \"wrapper\" that will be\n * used to wrap the original hook implementation with additional logic.\n * @example\n * ```tsx\n * // this is already done in `@apollo/client` for all wrappable hooks (see `WrappableHooks`)\n * // following this pattern\n * function useQuery() {\n * return wrapHook('useQuery', _useQuery, options.client)(query, options);\n * }\n * function _useQuery(query, options) {\n * // original implementation\n * }\n *\n * // this is what a library like `@apollo/client-react-streaming` would do\n * class ApolloClientWithStreaming extends ApolloClient {\n * constructor(options) {\n * super(options);\n * this.queryManager[Symbol.for(\"apollo.hook.wrappers\")] = {\n * useQuery: (original) => (query, options) => {\n * console.log(\"useQuery was called with options\", options);\n * return original(query, options);\n * }\n * }\n * }\n * }\n *\n * // this will now log the options and then call the original `useQuery`\n * const client = new ApolloClientWithStreaming({ ... });\n * useQuery(query, { client });\n * ```\n */\nexport function wrapHook<Hook extends (...args: any[]) => any>(\n hookName: keyof WrappableHooks,\n useHook: Hook,\n clientOrObsQuery: ObservableQuery<any> | ApolloClient\n): Hook {\n const queryManager = (\n clientOrObsQuery as unknown as {\n // both `ApolloClient` and `ObservableQuery` have a `queryManager` property\n // but they're both `private`, so we have to cast around for a bit here.\n queryManager: QueryManagerWithWrappers;\n }\n )[\"queryManager\"];\n const wrappers = queryManager && queryManager[wrapperSymbol];\n const wrapper: undefined | ((wrap: Hook) => Hook) =\n wrappers && (wrappers[hookName] as any);\n return wrapper ? wrapper(useHook) : useHook;\n}\n"],"names":[],"mappings":"AAeA,CAAA,CAAA,CAAA,CAAA,EAAM,CAAN,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAsB,CAAtB,CAAA,CAAA,CAAA,CAAA,CAA4B,CAAC,CAA7B,CAAA,CAAgC,CAAC,CAAjC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAuD,CAAC;AA4BxD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCA,CAAA;AACA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAgB,CAAhB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CA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CAAA,CAAA,CAAA,CAA0B,CAAC,CAA3B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAkC,EAAE,EAAE,CAAtC,CAAA,CAAA,CAAA,CAAA,CAAA,CAA6C;AAC7C;"}
1
+ {"version":3,"file":"wrapHook.js","sources":["../../../../src/react/hooks/internal/wrapHook.ts"],"sourcesContent":["import * as React from \"react\";\n\nimport type { ApolloClient } from \"@apollo/client/core\";\nimport type { ObservableQuery } from \"@apollo/client/core\";\nimport type { createQueryPreloader } from \"@apollo/client/react\";\nimport type {\n useBackgroundQuery,\n useFragment,\n useQuery,\n useQueryRefHandlers,\n useReadQuery,\n useSuspenseFragment,\n useSuspenseQuery,\n} from \"@apollo/client/react/hooks\";\n\nimport type { QueryManager } from \"../../../core/QueryManager.js\";\n// direct import to avoid circular dependency\nimport { getApolloContext } from \"../../context/ApolloContext.js\";\n\nexport const wrapperSymbol = Symbol.for(\"apollo.hook.wrappers\");\n\ntype FunctionSignature<T> =\n T extends (...args: infer A) => infer R ? (...args: A) => R : never;\n\ninterface WrappableHooks {\n createQueryPreloader: typeof createQueryPreloader;\n useQuery: FunctionSignature<typeof useQuery>;\n useSuspenseQuery: typeof useSuspenseQuery;\n useSuspenseFragment: typeof useSuspenseFragment;\n useBackgroundQuery: typeof useBackgroundQuery;\n useReadQuery: typeof useReadQuery;\n useFragment: typeof useFragment;\n useQueryRefHandlers: typeof useQueryRefHandlers;\n}\n\n/**\n * @internal\n * Can be used to correctly type the [Symbol.for(\"apollo.hook.wrappers\")] property of\n * `QueryManager`, to override/wrap hook functionality.\n */\nexport type HookWrappers = {\n [K in keyof WrappableHooks]?: (\n originalHook: WrappableHooks[K]\n ) => WrappableHooks[K];\n};\n\ninterface QueryManagerWithWrappers extends QueryManager {\n [wrapperSymbol]?: HookWrappers;\n}\n\n/**\n * @internal\n *\n * Makes an Apollo Client hook \"wrappable\".\n * That means that the Apollo Client instance can expose a \"wrapper\" that will be\n * used to wrap the original hook implementation with additional logic.\n * @example\n * ```tsx\n * // this is already done in `@apollo/client` for all wrappable hooks (see `WrappableHooks`)\n * // following this pattern\n * function useQuery() {\n * return wrapHook('useQuery', _useQuery, options.client)(query, options);\n * }\n * function _useQuery(query, options) {\n * // original implementation\n * }\n *\n * // this is what a library like `@apollo/client-react-streaming` would do\n * class ApolloClientWithStreaming extends ApolloClient {\n * constructor(options) {\n * super(options);\n * this.queryManager[Symbol.for(\"apollo.hook.wrappers\")] = {\n * useQuery: (original) => (query, options) => {\n * console.log(\"useQuery was called with options\", options);\n * return original(query, options);\n * }\n * }\n * }\n * }\n *\n * // this will now log the options and then call the original `useQuery`\n * const client = new ApolloClientWithStreaming({ ... });\n * useQuery(query, { client });\n * ```\n */\nexport function wrapHook<Hook extends (...args: any[]) => any>(\n hookName: keyof WrappableHooks,\n useHook: Hook,\n clientOrObsQuery: ObservableQuery<any> | ApolloClient\n): Hook {\n // Priority-wise, the later entries in this array wrap\n // previous entries and could prevent them (and in the end,\n // even the original hook) from running\n const wrapperSources = [\n (\n clientOrObsQuery as unknown as {\n // both `ApolloClient` and `ObservableQuery` have a `queryManager` property\n // but they're both `private`, so we have to cast around for a bit here.\n queryManager: QueryManagerWithWrappers;\n }\n )[\"queryManager\"],\n // if we are a hook (not `preloadQuery`), we are guaranteed to be inside of\n // a React render and can use context\n hookName.startsWith(\"use\") ?\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useContext(getApolloContext())\n : undefined,\n ];\n\n let wrapped = useHook;\n for (const source of wrapperSources) {\n const wrapper = source?.[wrapperSymbol]?.[hookName];\n if (wrapper) {\n wrapped = wrapper(wrapped) as Hook;\n }\n }\n\n return wrapped;\n}\n"],"names":[],"mappings":"AAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAP,CAAA,EAAY,CAAZ,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,EAAuB,CAAvB,CAAA,CAAA,CAAA,CAAA,CAAA,CAA8B;AAgB9B,CAAA,EAAA,CAAA,CAAA,C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AvC,CAAyC;YACrC,EAAE,CAAN,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAe;IACf,CAAG;IAED,CAAF,CAAA,EAAM,CAAN,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAgB,CAAhB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAuB;IACrB,CAAF,CAAA,EAAA,CAAO,CAAP,CAAA,CAAA,CAAA,EAAa,CAAb,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,EAAuB,CAAvB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAqC,EAAE;QACnC,CAAJ,CAAA,CAAA,CAAA,EAAU,CAAV,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAoB,CAApB,CAAA,CAAA,CAAA,CAAA,CAA0B,CAA1B,CAA4B,CAAC,CAA7B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA0C,CAAC,CAA3C,CAA6C,CAAC,CAA9C,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAsD,CAAC;QACnD,CAAJ,EAAA,CAAQ,CAAR,CAAA,CAAA,CAAA,CAAA,CAAA,CAAe,EAAE;YACX,CAAN,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAgB,CAAhB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAuB,CAAC,CAAxB,CAAA,CAAA,CAAA,CAAA,CAAA,CAA+B,CAAS;QACpC;IACF;IAEA,CAAF,CAAA,CAAA,CAAA,CAAA,EAAS,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgB;AAChB;"}
@@ -1,76 +1,179 @@
1
- import type { DocumentNode, OperationVariables, TypedDocumentNode } from "@apollo/client/core";
1
+ import type { ApolloClient, DefaultContext, DocumentNode, ErrorPolicy, OperationVariables, RefetchWritePolicy, TypedDocumentNode, WatchQueryFetchPolicy } from "@apollo/client/core";
2
2
  import type { SubscribeToMoreFunction } from "@apollo/client/core";
3
- import type { BackgroundQueryHookOptions, NoInfer } from "@apollo/client/react";
4
- import type { QueryRef } from "@apollo/client/react/internal";
5
- import type { DeepPartial } from "@apollo/client/utilities";
3
+ import type { FetchMoreFunction, QueryRef, RefetchFunction } from "@apollo/client/react/internal";
4
+ import type { DeepPartial, NoInfer } from "@apollo/client/utilities";
6
5
  import type { SkipToken } from "./constants.js";
7
- import type { FetchMoreFunction, RefetchFunction } from "./useSuspenseQuery.js";
8
- export type UseBackgroundQueryResult<TData = unknown, TVariables extends OperationVariables = OperationVariables> = {
9
- /**
10
- * A function that enables you to execute a [subscription](https://www.apollographql.com/docs/react/data/subscriptions/), usually to subscribe to specific fields that were included in the query.
11
- *
12
- * This function returns _another_ function that you can call to terminate the subscription.
13
- */
14
- subscribeToMore: SubscribeToMoreFunction<TData, TVariables>;
15
- /**
16
- * A function that helps you fetch the next set of results for a [paginated list field](https://www.apollographql.com/docs/react/pagination/core-api/).
17
- */
18
- fetchMore: FetchMoreFunction<TData, TVariables>;
19
- /**
20
- * Update the variables of this observable query, and fetch the new results. This method should be preferred over `setVariables` in most use cases.
21
- *
22
- * @param variables - The new set of variables. If there are missing variables, the previous values of those variables will be used.
23
- */
24
- refetch: RefetchFunction<TData, TVariables>;
25
- };
26
- type BackgroundQueryHookOptionsNoInfer<TData, TVariables extends OperationVariables> = BackgroundQueryHookOptions<NoInfer<TData>, NoInfer<TVariables>>;
27
- export declare function useBackgroundQuery<TData, TVariables extends OperationVariables, TOptions extends Omit<BackgroundQueryHookOptions<TData>, "variables">>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & TOptions): [
6
+ export declare namespace useBackgroundQuery {
7
+ type FetchPolicy = Extract<WatchQueryFetchPolicy, "cache-first" | "network-only" | "no-cache" | "cache-and-network">;
8
+ interface Options<TVariables extends OperationVariables = OperationVariables> {
9
+ /**
10
+ * The instance of `ApolloClient` to use to execute the query.
11
+ *
12
+ * By default, the instance that's passed down via context is used, but you can provide a different instance here.
13
+ *
14
+ * @docGroup
15
+ *
16
+ * 1. Operation options
17
+ */
18
+ client?: ApolloClient;
19
+ /**
20
+ * Specifies whether a `NetworkStatus.refetch` operation should merge incoming field data with existing data, or overwrite the existing data. Overwriting is probably preferable, but merging is currently the default behavior, for backwards compatibility with Apollo Client 3.x.
21
+ *
22
+ * @docGroup
23
+ *
24
+ * 3. Caching options
25
+ */
26
+ refetchWritePolicy?: RefetchWritePolicy;
27
+ /**
28
+ * An object containing all of the GraphQL variables your query requires to execute.
29
+ *
30
+ * Each key in the object corresponds to a variable name, and that key's value corresponds to the variable value.
31
+ *
32
+ * @docGroup
33
+ *
34
+ * 1. Operation options
35
+ */
36
+ variables?: TVariables;
37
+ /**
38
+ * Specifies how the query handles a response that returns both GraphQL errors and partial results.
39
+ *
40
+ * For details, see [GraphQL error policies](https://www.apollographql.com/docs/react/data/error-handling/#graphql-error-policies).
41
+ *
42
+ * The default value is `none`, meaning that the query result includes error details but not partial results.
43
+ *
44
+ * @docGroup
45
+ *
46
+ * 1. Operation options
47
+ */
48
+ errorPolicy?: ErrorPolicy;
49
+ /**
50
+ * If you're using [Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/), this object is the initial value of the `context` object that's passed along your link chain.
51
+ *
52
+ * @docGroup
53
+ *
54
+ * 2. Networking options
55
+ */
56
+ context?: DefaultContext;
57
+ /**
58
+ * If `true`, the query can return partial results from the cache if the cache doesn't contain results for all queried fields.
59
+ *
60
+ * The default value is `false`.
61
+ *
62
+ * @docGroup
63
+ *
64
+ * 3. Caching options
65
+ */
66
+ returnPartialData?: boolean;
67
+ /**
68
+ * Specifies how the query interacts with the Apollo Client cache during execution (for example, whether it checks the cache for results before sending a request to the server).
69
+ *
70
+ * For details, see [Setting a fetch policy](https://www.apollographql.com/docs/react/data/queries/#setting-a-fetch-policy).
71
+ *
72
+ * The default value is `cache-first`.
73
+ *
74
+ * @docGroup
75
+ *
76
+ * 3. Caching options
77
+ */
78
+ fetchPolicy?: FetchPolicy;
79
+ /**
80
+ * A unique identifier for the query. Each item in the array must be a stable identifier to prevent infinite fetches.
81
+ *
82
+ * This is useful when using the same query and variables combination in more than one component, otherwise the components may clobber each other. This can also be used to force the query to re-evaluate fresh.
83
+ *
84
+ * @docGroup
85
+ *
86
+ * 1. Operation options
87
+ */
88
+ queryKey?: string | number | any[];
89
+ /**
90
+ * If `true`, the query is not executed. The default value is `false`.
91
+ *
92
+ * @deprecated
93
+ *
94
+ * We recommend using `skipToken` in place of the `skip` option as it is more type-safe.
95
+ *
96
+ * This option is deprecated and only supported to ease the migration from useQuery. It will be removed in a future release.
97
+ *
98
+ * @docGroup
99
+ *
100
+ * 1. Operation options
101
+ *
102
+ *
103
+ * @example Recommended usage of `skipToken`:
104
+ * ```ts
105
+ * import { skipToken, useBackgroundQuery } from '@apollo/client';
106
+ *
107
+ * const [queryRef] = useBackgroundQuery(query, id ? { variables: { id } } : skipToken);
108
+ * ```
109
+ */
110
+ skip?: boolean;
111
+ }
112
+ type Result<TData = unknown, TVariables extends OperationVariables = OperationVariables> = {
113
+ /**
114
+ * A function that enables you to execute a [subscription](https://www.apollographql.com/docs/react/data/subscriptions/), usually to subscribe to specific fields that were included in the query.
115
+ *
116
+ * This function returns _another_ function that you can call to terminate the subscription.
117
+ */
118
+ subscribeToMore: SubscribeToMoreFunction<TData, TVariables>;
119
+ /**
120
+ * A function that helps you fetch the next set of results for a [paginated list field](https://www.apollographql.com/docs/react/pagination/core-api/).
121
+ */
122
+ fetchMore: FetchMoreFunction<TData, TVariables>;
123
+ /**
124
+ * Update the variables of this observable query, and fetch the new results. This method should be preferred over `setVariables` in most use cases.
125
+ *
126
+ * @param variables - The new set of variables. If there are missing variables, the previous values of those variables will be used.
127
+ */
128
+ refetch: RefetchFunction<TData, TVariables>;
129
+ };
130
+ }
131
+ export declare function useBackgroundQuery<TData, TVariables extends OperationVariables, TOptions extends Omit<useBackgroundQuery.Options, "variables">>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: useBackgroundQuery.Options<NoInfer<TVariables>> & TOptions): [
28
132
  (QueryRef<TOptions["errorPolicy"] extends "ignore" | "all" ? TOptions["returnPartialData"] extends true ? DeepPartial<TData> | undefined : TData | undefined : TOptions["returnPartialData"] extends true ? DeepPartial<TData> : TData, TVariables> | (TOptions["skip"] extends boolean ? undefined : never)),
29
- UseBackgroundQueryResult<TData, TVariables>
133
+ useBackgroundQuery.Result<TData, TVariables>
30
134
  ];
31
- export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & {
135
+ export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
32
136
  returnPartialData: true;
33
137
  errorPolicy: "ignore" | "all";
34
138
  }): [
35
139
  QueryRef<DeepPartial<TData> | undefined, TVariables>,
36
- UseBackgroundQueryResult<TData, TVariables>
140
+ useBackgroundQuery.Result<TData, TVariables>
37
141
  ];
38
- export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & {
142
+ export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
39
143
  errorPolicy: "ignore" | "all";
40
144
  }): [
41
145
  QueryRef<TData | undefined, TVariables>,
42
- UseBackgroundQueryResult<TData, TVariables>
146
+ useBackgroundQuery.Result<TData, TVariables>
43
147
  ];
44
- export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & {
148
+ export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
45
149
  skip: boolean;
46
150
  returnPartialData: true;
47
151
  }): [
48
152
  QueryRef<DeepPartial<TData>, TVariables> | undefined,
49
- UseBackgroundQueryResult<TData, TVariables>
153
+ useBackgroundQuery.Result<TData, TVariables>
50
154
  ];
51
- export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & {
155
+ export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
52
156
  returnPartialData: true;
53
157
  }): [
54
158
  QueryRef<DeepPartial<TData>, TVariables>,
55
- UseBackgroundQueryResult<TData, TVariables>
159
+ useBackgroundQuery.Result<TData, TVariables>
56
160
  ];
57
- export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: BackgroundQueryHookOptionsNoInfer<TData, TVariables> & {
161
+ export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: useBackgroundQuery.Options<NoInfer<TVariables>> & {
58
162
  skip: boolean;
59
163
  }): [
60
164
  QueryRef<TData, TVariables> | undefined,
61
- UseBackgroundQueryResult<TData, TVariables>
165
+ useBackgroundQuery.Result<TData, TVariables>
62
166
  ];
63
- export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: BackgroundQueryHookOptionsNoInfer<TData, TVariables>): [QueryRef<TData, TVariables>, UseBackgroundQueryResult<TData, TVariables>];
64
- export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SkipToken): [undefined, UseBackgroundQueryResult<TData, TVariables>];
65
- export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SkipToken | (BackgroundQueryHookOptionsNoInfer<TData, TVariables> & {
167
+ export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: useBackgroundQuery.Options<NoInfer<TVariables>>): [QueryRef<TData, TVariables>, useBackgroundQuery.Result<TData, TVariables>];
168
+ export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SkipToken): [undefined, useBackgroundQuery.Result<TData, TVariables>];
169
+ export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options: SkipToken | (useBackgroundQuery.Options<NoInfer<TVariables>> & {
66
170
  returnPartialData: true;
67
171
  })): [
68
172
  QueryRef<DeepPartial<TData>, TVariables> | undefined,
69
- UseBackgroundQueryResult<TData, TVariables>
173
+ useBackgroundQuery.Result<TData, TVariables>
70
174
  ];
71
- export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: SkipToken | BackgroundQueryHookOptionsNoInfer<TData, TVariables>): [
175
+ export declare function useBackgroundQuery<TData = unknown, TVariables extends OperationVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: SkipToken | useBackgroundQuery.Options<NoInfer<TVariables>>): [
72
176
  QueryRef<TData, TVariables> | undefined,
73
- UseBackgroundQueryResult<TData, TVariables>
177
+ useBackgroundQuery.Result<TData, TVariables>
74
178
  ];
75
- export {};
76
179
  //# sourceMappingURL=useBackgroundQuery.d.ts.map