@apollo/client 4.2.0-alpha.1 → 4.2.0-alpha.3

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 (131) hide show
  1. package/CHANGELOG.md +209 -0
  2. package/__cjs/core/ApolloClient.cjs +25 -12
  3. package/__cjs/core/ApolloClient.cjs.map +1 -1
  4. package/__cjs/core/ApolloClient.d.cts +305 -146
  5. package/__cjs/core/QueryManager.cjs.map +1 -1
  6. package/__cjs/core/defaultOptions.cjs +3 -0
  7. package/__cjs/core/defaultOptions.cjs.map +1 -0
  8. package/__cjs/core/defaultOptions.d.cts +90 -0
  9. package/__cjs/core/index.cjs.map +1 -1
  10. package/__cjs/core/index.d.cts +2 -1
  11. package/__cjs/link/ws/index.cjs +9 -1
  12. package/__cjs/link/ws/index.cjs.map +1 -1
  13. package/__cjs/link/ws/index.d.cts +1 -1
  14. package/__cjs/react/hooks/useBackgroundQuery.cjs +3 -3
  15. package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
  16. package/__cjs/react/hooks/useBackgroundQuery.d.cts +1598 -765
  17. package/__cjs/react/hooks/useLazyQuery.cjs +3 -5
  18. package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
  19. package/__cjs/react/hooks/useLazyQuery.d.cts +369 -115
  20. package/__cjs/react/hooks/useLoadableQuery.cjs +8 -4
  21. package/__cjs/react/hooks/useLoadableQuery.cjs.map +1 -1
  22. package/__cjs/react/hooks/useLoadableQuery.d.cts +507 -192
  23. package/__cjs/react/hooks/useMutation.cjs +5 -48
  24. package/__cjs/react/hooks/useMutation.cjs.map +1 -1
  25. package/__cjs/react/hooks/useMutation.d.cts +239 -130
  26. package/__cjs/react/hooks/useQuery.cjs +5 -5
  27. package/__cjs/react/hooks/useQuery.cjs.map +1 -1
  28. package/__cjs/react/hooks/useQuery.d.cts +636 -276
  29. package/__cjs/react/hooks/useSubscription.cjs +1 -1
  30. package/__cjs/react/hooks/useSubscription.cjs.map +1 -1
  31. package/__cjs/react/hooks/useSubscription.d.cts +2 -2
  32. package/__cjs/react/hooks/useSuspenseQuery.cjs +3 -3
  33. package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
  34. package/__cjs/react/hooks/useSuspenseQuery.d.cts +799 -399
  35. package/__cjs/react/internal/cache/getSuspenseCache.cjs.map +1 -1
  36. package/__cjs/react/internal/cache/getSuspenseCache.d.cts +7 -0
  37. package/__cjs/utilities/internal/LazyType.cjs +3 -0
  38. package/__cjs/utilities/internal/LazyType.cjs.map +1 -0
  39. package/__cjs/utilities/internal/LazyType.d.cts +10 -0
  40. package/__cjs/utilities/internal/index.cjs.map +1 -1
  41. package/__cjs/utilities/internal/index.d.cts +3 -0
  42. package/__cjs/utilities/internal/types/OptionWithFallback.cjs +3 -0
  43. package/__cjs/utilities/internal/types/OptionWithFallback.cjs.map +1 -0
  44. package/__cjs/utilities/internal/types/OptionWithFallback.d.cts +5 -0
  45. package/__cjs/utilities/internal/types/SignatureStyle.cjs +3 -0
  46. package/__cjs/utilities/internal/types/SignatureStyle.cjs.map +1 -0
  47. package/__cjs/utilities/internal/types/SignatureStyle.d.cts +24 -0
  48. package/__cjs/version.cjs +1 -1
  49. package/core/ApolloClient.d.ts +305 -146
  50. package/core/ApolloClient.js +25 -12
  51. package/core/ApolloClient.js.map +1 -1
  52. package/core/QueryManager.js.map +1 -1
  53. package/core/defaultOptions.d.ts +90 -0
  54. package/core/defaultOptions.js +2 -0
  55. package/core/defaultOptions.js.map +1 -0
  56. package/core/index.d.ts +2 -1
  57. package/core/index.js.map +1 -1
  58. package/link/ws/index.d.ts +1 -1
  59. package/link/ws/index.js +9 -1
  60. package/link/ws/index.js.map +1 -1
  61. package/package.json +3 -7
  62. package/react/hooks/useBackgroundQuery.d.ts +1598 -765
  63. package/react/hooks/useBackgroundQuery.js +2 -2
  64. package/react/hooks/useBackgroundQuery.js.map +1 -1
  65. package/react/hooks/useLazyQuery.d.ts +369 -115
  66. package/react/hooks/useLazyQuery.js +2 -4
  67. package/react/hooks/useLazyQuery.js.map +1 -1
  68. package/react/hooks/useLoadableQuery.d.ts +507 -192
  69. package/react/hooks/useLoadableQuery.js +7 -3
  70. package/react/hooks/useLoadableQuery.js.map +1 -1
  71. package/react/hooks/useMutation.d.ts +239 -130
  72. package/react/hooks/useMutation.js +5 -48
  73. package/react/hooks/useMutation.js.map +1 -1
  74. package/react/hooks/useQuery.d.ts +636 -276
  75. package/react/hooks/useQuery.js +2 -2
  76. package/react/hooks/useQuery.js.map +1 -1
  77. package/react/hooks/useSubscription.d.ts +2 -2
  78. package/react/hooks/useSubscription.js +1 -1
  79. package/react/hooks/useSubscription.js.map +1 -1
  80. package/react/hooks/useSuspenseQuery.d.ts +799 -399
  81. package/react/hooks/useSuspenseQuery.js +2 -2
  82. package/react/hooks/useSuspenseQuery.js.map +1 -1
  83. package/react/hooks-compiled/useBackgroundQuery.d.ts +1598 -765
  84. package/react/hooks-compiled/useBackgroundQuery.js +2 -2
  85. package/react/hooks-compiled/useBackgroundQuery.js.map +1 -1
  86. package/react/hooks-compiled/useLazyQuery.d.ts +369 -115
  87. package/react/hooks-compiled/useLazyQuery.js +2 -4
  88. package/react/hooks-compiled/useLazyQuery.js.map +1 -1
  89. package/react/hooks-compiled/useLoadableQuery.d.ts +507 -192
  90. package/react/hooks-compiled/useLoadableQuery.js +2 -2
  91. package/react/hooks-compiled/useLoadableQuery.js.map +1 -1
  92. package/react/hooks-compiled/useMutation.d.ts +239 -130
  93. package/react/hooks-compiled/useMutation.js +4 -47
  94. package/react/hooks-compiled/useMutation.js.map +1 -1
  95. package/react/hooks-compiled/useQuery.d.ts +636 -276
  96. package/react/hooks-compiled/useQuery.js +2 -2
  97. package/react/hooks-compiled/useQuery.js.map +1 -1
  98. package/react/hooks-compiled/useSubscription.d.ts +2 -2
  99. package/react/hooks-compiled/useSubscription.js +1 -1
  100. package/react/hooks-compiled/useSubscription.js.map +1 -1
  101. package/react/hooks-compiled/useSuspenseQuery.d.ts +799 -399
  102. package/react/hooks-compiled/useSuspenseQuery.js +2 -2
  103. package/react/hooks-compiled/useSuspenseQuery.js.map +1 -1
  104. package/react/internal/cache/getSuspenseCache.d.ts +7 -0
  105. package/react/internal/cache/getSuspenseCache.js.map +1 -1
  106. package/skills/apollo-client/SKILL.md +168 -0
  107. package/skills/apollo-client/references/caching.md +560 -0
  108. package/skills/apollo-client/references/error-handling.md +350 -0
  109. package/skills/apollo-client/references/fragments.md +804 -0
  110. package/skills/apollo-client/references/integration-client.md +336 -0
  111. package/skills/apollo-client/references/integration-nextjs.md +325 -0
  112. package/skills/apollo-client/references/integration-react-router.md +256 -0
  113. package/skills/apollo-client/references/integration-tanstack-start.md +378 -0
  114. package/skills/apollo-client/references/mutations.md +549 -0
  115. package/skills/apollo-client/references/queries.md +416 -0
  116. package/skills/apollo-client/references/state-management.md +428 -0
  117. package/skills/apollo-client/references/suspense-hooks.md +773 -0
  118. package/skills/apollo-client/references/troubleshooting.md +487 -0
  119. package/skills/apollo-client/references/typescript-codegen.md +133 -0
  120. package/utilities/internal/LazyType.d.ts +10 -0
  121. package/utilities/internal/LazyType.js +2 -0
  122. package/utilities/internal/LazyType.js.map +1 -0
  123. package/utilities/internal/index.d.ts +3 -0
  124. package/utilities/internal/index.js.map +1 -1
  125. package/utilities/internal/types/OptionWithFallback.d.ts +5 -0
  126. package/utilities/internal/types/OptionWithFallback.js +2 -0
  127. package/utilities/internal/types/OptionWithFallback.js.map +1 -0
  128. package/utilities/internal/types/SignatureStyle.d.ts +24 -0
  129. package/utilities/internal/types/SignatureStyle.js +2 -0
  130. package/utilities/internal/types/SignatureStyle.js.map +1 -0
  131. package/version.js +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OptionWithFallback.js","sourceRoot":"","sources":["../../../../src/utilities/internal/types/OptionWithFallback.ts"],"names":[],"mappings":"","sourcesContent":["import type { RemoveIndexSignature } from \"./RemoveIndexSignature.js\";\n\ntype ReplaceUndefinedWithDefault<Value, Default> =\n Value extends any ?\n Value extends undefined ?\n Default\n : Value\n : never;\n\nexport type OptionWithFallback<\n Options,\n DefaultOptions,\n Key extends keyof DefaultOptions,\n> = Key extends keyof RemoveIndexSignature<Options> ?\n ReplaceUndefinedWithDefault<Options[Key], DefaultOptions[Key]>\n: DefaultOptions[Key];\n"]}
@@ -0,0 +1,24 @@
1
+ import type { ApolloClient, TypeOverrides } from "@apollo/client";
2
+ /**
3
+ * Signature style used for `ApolloClient` methods and hooks.
4
+ * Classic signatures are method signatures in place until 4.1.
5
+ * Modern signatures are the method signatures introduced in 4.1,
6
+ * which are more accurate and take global `defaultOptions` into account.
7
+ * Modern signatures require type inference and don't allow manually specified
8
+ * generic arguments. Users need to opt into them, either by explicitly declaring
9
+ * their signature style or by using `defaultOptions`.
10
+ */
11
+ export type SignatureStyle = TypeOverrides extends ({
12
+ signatureStyle: infer S extends "modern" | "classic";
13
+ }) ? S : ApolloClient.Options extends {
14
+ defaultOptions: {};
15
+ } ? "modern" : "classic";
16
+ /**
17
+ * A type to disable "classic" signatures when "modern" signatures are in use.
18
+ * Modern signatures are always active, as they are more complete than classic
19
+ * signatures, but they are defined after the classic signatures, so while
20
+ * classic signatures are active, TypeScript will not reach the modern signatures
21
+ * as long as a classic signature can be satisfied.
22
+ */
23
+ export type ClassicSignature = SignatureStyle extends "classic" ? unknown : never;
24
+ //# sourceMappingURL=SignatureStyle.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=SignatureStyle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SignatureStyle.js","sourceRoot":"","sources":["../../../../src/utilities/internal/types/SignatureStyle.ts"],"names":[],"mappings":"","sourcesContent":["import type { ApolloClient, TypeOverrides } from \"@apollo/client\";\n\n/**\n * Signature style used for `ApolloClient` methods and hooks.\n * Classic signatures are method signatures in place until 4.1.\n * Modern signatures are the method signatures introduced in 4.1,\n * which are more accurate and take global `defaultOptions` into account.\n * Modern signatures require type inference and don't allow manually specified\n * generic arguments. Users need to opt into them, either by explicitly declaring\n * their signature style or by using `defaultOptions`.\n */\nexport type SignatureStyle =\n TypeOverrides extends (\n {\n // explicit userland declaration of signature style\n signatureStyle: infer S extends \"modern\" | \"classic\";\n }\n ) ?\n S\n : // if any non-optional `DeclareDefaultOptions` are present,\n // we assume the user is using the \"modern\" signature style\n ApolloClient.Options extends { defaultOptions: {} } ? \"modern\"\n : \"classic\";\n\n/**\n * A type to disable \"classic\" signatures when \"modern\" signatures are in use.\n * Modern signatures are always active, as they are more complete than classic\n * signatures, but they are defined after the classic signatures, so while\n * classic signatures are active, TypeScript will not reach the modern signatures\n * as long as a classic signature can be satisfied.\n */\nexport type ClassicSignature =\n SignatureStyle extends \"classic\" ? unknown : never;\n"]}
package/version.js CHANGED
@@ -1,3 +1,3 @@
1
- export const version = "4.2.0-alpha.1";
1
+ export const version = "4.2.0-alpha.3";
2
2
  export const build = "esm";
3
3
  //# sourceMappingURL=version.js.map