@apollo/client 4.1.0-alpha.3 → 4.1.0-alpha.4

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 (191) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/__cjs/cache/core/types/common.cjs.map +1 -1
  3. package/__cjs/cache/core/types/common.d.cts +1 -1
  4. package/__cjs/cache/inmemory/fragmentRegistry.cjs +1 -1
  5. package/__cjs/cache/inmemory/fragmentRegistry.cjs.map +1 -1
  6. package/__cjs/core/ApolloClient.d.cts +7 -3
  7. package/__cjs/core/ObservableQuery.cjs +8 -4
  8. package/__cjs/core/ObservableQuery.cjs.map +1 -1
  9. package/__cjs/core/ObservableQuery.d.cts +2 -2
  10. package/__cjs/core/QueryManager.cjs +1 -1
  11. package/__cjs/core/QueryManager.cjs.map +1 -1
  12. package/__cjs/dev/setErrorMessageHandler.cjs.map +1 -1
  13. package/__cjs/dev/setErrorMessageHandler.d.cts +1 -1
  14. package/__cjs/link/schema/index.cjs +1 -1
  15. package/__cjs/link/schema/index.cjs.map +1 -1
  16. package/__cjs/link/schema/index.d.cts +1 -1
  17. package/__cjs/link/subscriptions/index.cjs +2 -1
  18. package/__cjs/link/subscriptions/index.cjs.map +1 -1
  19. package/__cjs/masking/maskDefinition.cjs +1 -1
  20. package/__cjs/masking/maskDefinition.cjs.map +1 -1
  21. package/__cjs/masking/types.d.cts +2 -1
  22. package/__cjs/react/hooks/internal/index.cjs +3 -1
  23. package/__cjs/react/hooks/internal/index.cjs.map +1 -1
  24. package/__cjs/react/hooks/internal/index.d.cts +1 -0
  25. package/__cjs/react/hooks/internal/useDeepMemo.cjs +2 -0
  26. package/__cjs/react/hooks/internal/useDeepMemo.cjs.map +1 -1
  27. package/__cjs/react/hooks/internal/useRenderGuard.cjs +1 -1
  28. package/__cjs/react/hooks/internal/useRenderGuard.cjs.map +1 -1
  29. package/__cjs/react/hooks/internal/useSuspenseHookCacheKey.cjs +28 -0
  30. package/__cjs/react/hooks/internal/useSuspenseHookCacheKey.cjs.map +1 -0
  31. package/__cjs/react/hooks/internal/useSuspenseHookCacheKey.d.cts +11 -0
  32. package/__cjs/react/hooks/useBackgroundQuery.cjs +3 -11
  33. package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
  34. package/__cjs/react/hooks/useFragment.cjs +1 -3
  35. package/__cjs/react/hooks/useFragment.cjs.map +1 -1
  36. package/__cjs/react/hooks/useLazyQuery.cjs +2 -0
  37. package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
  38. package/__cjs/react/hooks/useLazyQuery.d.cts +1 -1
  39. package/__cjs/react/hooks/useMutation.d.cts +3 -1
  40. package/__cjs/react/hooks/useQuery.cjs +1 -4
  41. package/__cjs/react/hooks/useQuery.cjs.map +1 -1
  42. package/__cjs/react/hooks/useQuery.d.cts +1 -1
  43. package/__cjs/react/hooks/useQueryRefHandlers.cjs +1 -3
  44. package/__cjs/react/hooks/useQueryRefHandlers.cjs.map +1 -1
  45. package/__cjs/react/hooks/useReactiveVar.cjs +2 -1
  46. package/__cjs/react/hooks/useReactiveVar.cjs.map +1 -1
  47. package/__cjs/react/hooks/useReactiveVar.d.cts +2 -1
  48. package/__cjs/react/hooks/useReadQuery.cjs +1 -3
  49. package/__cjs/react/hooks/useReadQuery.cjs.map +1 -1
  50. package/__cjs/react/hooks/useReadQuery.d.cts +1 -1
  51. package/__cjs/react/hooks/useSubscription.cjs +1 -1
  52. package/__cjs/react/hooks/useSubscription.cjs.map +1 -1
  53. package/__cjs/react/hooks/useSuspenseFragment.cjs +3 -4
  54. package/__cjs/react/hooks/useSuspenseFragment.cjs.map +1 -1
  55. package/__cjs/react/hooks/useSuspenseQuery.cjs +6 -12
  56. package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
  57. package/__cjs/react/hooks/useSuspenseQuery.d.cts +1 -1
  58. package/__cjs/react/hooks/useSyncExternalStore.cjs +1 -1
  59. package/__cjs/react/hooks/useSyncExternalStore.cjs.map +1 -1
  60. package/__cjs/react/internal/cache/QueryReference.cjs +1 -1
  61. package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
  62. package/__cjs/react/internal/cache/QueryReference.d.cts +4 -0
  63. package/__cjs/react/ssr/useSSRQuery.cjs +1 -0
  64. package/__cjs/react/ssr/useSSRQuery.cjs.map +1 -1
  65. package/__cjs/react/types/types.documentation.d.cts +4 -16
  66. package/__cjs/testing/core/mocking/mockLink.cjs +2 -2
  67. package/__cjs/testing/core/mocking/mockLink.cjs.map +1 -1
  68. package/__cjs/testing/core/mocking/mockLink.d.cts +3 -1
  69. package/__cjs/utilities/internal/getMemoryInternals.cjs.map +1 -1
  70. package/__cjs/utilities/internal/types/DocumentationTypes.d.cts +1 -1
  71. package/__cjs/version.cjs +1 -1
  72. package/cache/core/types/common.d.ts +1 -1
  73. package/cache/core/types/common.js.map +1 -1
  74. package/cache/inmemory/fragmentRegistry.js +1 -1
  75. package/cache/inmemory/fragmentRegistry.js.map +1 -1
  76. package/core/ApolloClient.d.ts +7 -3
  77. package/core/ObservableQuery.d.ts +2 -2
  78. package/core/ObservableQuery.js +8 -4
  79. package/core/ObservableQuery.js.map +1 -1
  80. package/core/QueryManager.js +1 -1
  81. package/core/QueryManager.js.map +1 -1
  82. package/dev/setErrorMessageHandler.d.ts +1 -1
  83. package/dev/setErrorMessageHandler.js.map +1 -1
  84. package/link/schema/index.d.ts +1 -1
  85. package/link/schema/index.js +1 -1
  86. package/link/schema/index.js.map +1 -1
  87. package/link/subscriptions/index.js +2 -1
  88. package/link/subscriptions/index.js.map +1 -1
  89. package/masking/internal/types.js.map +1 -1
  90. package/masking/maskDefinition.js +1 -1
  91. package/masking/maskDefinition.js.map +1 -1
  92. package/masking/types.d.ts +2 -1
  93. package/masking/types.js.map +1 -1
  94. package/package.json +1 -1
  95. package/react/hooks/internal/index.d.ts +1 -0
  96. package/react/hooks/internal/index.js +1 -0
  97. package/react/hooks/internal/index.js.map +1 -1
  98. package/react/hooks/internal/useDeepMemo.js +2 -0
  99. package/react/hooks/internal/useDeepMemo.js.map +1 -1
  100. package/react/hooks/internal/useRenderGuard.js +1 -1
  101. package/react/hooks/internal/useRenderGuard.js.map +1 -1
  102. package/react/hooks/internal/useSuspenseHookCacheKey.d.ts +11 -0
  103. package/react/hooks/internal/useSuspenseHookCacheKey.js +24 -0
  104. package/react/hooks/internal/useSuspenseHookCacheKey.js.map +1 -0
  105. package/react/hooks/useBackgroundQuery.js +4 -12
  106. package/react/hooks/useBackgroundQuery.js.map +1 -1
  107. package/react/hooks/useFragment.js +1 -3
  108. package/react/hooks/useFragment.js.map +1 -1
  109. package/react/hooks/useLazyQuery.d.ts +1 -1
  110. package/react/hooks/useLazyQuery.js +2 -0
  111. package/react/hooks/useLazyQuery.js.map +1 -1
  112. package/react/hooks/useMutation.d.ts +3 -1
  113. package/react/hooks/useQuery.d.ts +1 -1
  114. package/react/hooks/useQuery.js +1 -4
  115. package/react/hooks/useQuery.js.map +1 -1
  116. package/react/hooks/useQueryRefHandlers.js +1 -3
  117. package/react/hooks/useQueryRefHandlers.js.map +1 -1
  118. package/react/hooks/useReactiveVar.d.ts +2 -1
  119. package/react/hooks/useReactiveVar.js +2 -1
  120. package/react/hooks/useReactiveVar.js.map +1 -1
  121. package/react/hooks/useReadQuery.d.ts +1 -1
  122. package/react/hooks/useReadQuery.js +1 -3
  123. package/react/hooks/useReadQuery.js.map +1 -1
  124. package/react/hooks/useSubscription.js +1 -1
  125. package/react/hooks/useSubscription.js.map +1 -1
  126. package/react/hooks/useSuspenseFragment.js +3 -4
  127. package/react/hooks/useSuspenseFragment.js.map +1 -1
  128. package/react/hooks/useSuspenseQuery.d.ts +1 -1
  129. package/react/hooks/useSuspenseQuery.js +7 -13
  130. package/react/hooks/useSuspenseQuery.js.map +1 -1
  131. package/react/hooks/useSyncExternalStore.js +1 -1
  132. package/react/hooks/useSyncExternalStore.js.map +1 -1
  133. package/react/hooks-compiled/internal/index.d.ts +1 -0
  134. package/react/hooks-compiled/internal/index.js +1 -0
  135. package/react/hooks-compiled/internal/index.js.map +1 -1
  136. package/react/hooks-compiled/internal/useDeepMemo.js +2 -0
  137. package/react/hooks-compiled/internal/useDeepMemo.js.map +1 -1
  138. package/react/hooks-compiled/internal/useRenderGuard.js +1 -1
  139. package/react/hooks-compiled/internal/useRenderGuard.js.map +1 -1
  140. package/react/hooks-compiled/internal/useSuspenseHookCacheKey.d.ts +11 -0
  141. package/react/hooks-compiled/internal/useSuspenseHookCacheKey.js +71 -0
  142. package/react/hooks-compiled/internal/useSuspenseHookCacheKey.js.map +1 -0
  143. package/react/hooks-compiled/useBackgroundQuery.js +6 -14
  144. package/react/hooks-compiled/useBackgroundQuery.js.map +1 -1
  145. package/react/hooks-compiled/useFragment.js +14 -18
  146. package/react/hooks-compiled/useFragment.js.map +1 -1
  147. package/react/hooks-compiled/useLazyQuery.d.ts +1 -1
  148. package/react/hooks-compiled/useLazyQuery.js +2 -0
  149. package/react/hooks-compiled/useLazyQuery.js.map +1 -1
  150. package/react/hooks-compiled/useLoadableQuery.js +69 -75
  151. package/react/hooks-compiled/useMutation.d.ts +3 -1
  152. package/react/hooks-compiled/useMutation.js +0 -12
  153. package/react/hooks-compiled/useMutation.js.map +1 -1
  154. package/react/hooks-compiled/useQuery.d.ts +1 -1
  155. package/react/hooks-compiled/useQuery.js +44 -56
  156. package/react/hooks-compiled/useQuery.js.map +1 -1
  157. package/react/hooks-compiled/useQueryRefHandlers.js +1 -5
  158. package/react/hooks-compiled/useQueryRefHandlers.js.map +1 -1
  159. package/react/hooks-compiled/useReactiveVar.d.ts +2 -1
  160. package/react/hooks-compiled/useReactiveVar.js +2 -1
  161. package/react/hooks-compiled/useReactiveVar.js.map +1 -1
  162. package/react/hooks-compiled/useReadQuery.d.ts +1 -1
  163. package/react/hooks-compiled/useReadQuery.js +77 -14
  164. package/react/hooks-compiled/useReadQuery.js.map +1 -1
  165. package/react/hooks-compiled/useSubscription.js +237 -93
  166. package/react/hooks-compiled/useSubscription.js.map +1 -1
  167. package/react/hooks-compiled/useSuspenseFragment.js +3 -4
  168. package/react/hooks-compiled/useSuspenseFragment.js.map +1 -1
  169. package/react/hooks-compiled/useSuspenseQuery.d.ts +1 -1
  170. package/react/hooks-compiled/useSuspenseQuery.js +9 -19
  171. package/react/hooks-compiled/useSuspenseQuery.js.map +1 -1
  172. package/react/hooks-compiled/useSyncExternalStore.js +1 -1
  173. package/react/hooks-compiled/useSyncExternalStore.js.map +1 -1
  174. package/react/index.compiled.d.ts +1 -1
  175. package/react/index.compiled.js +1 -1
  176. package/react/index.compiled.js.map +1 -1
  177. package/react/internal/cache/QueryReference.d.ts +4 -0
  178. package/react/internal/cache/QueryReference.js +1 -1
  179. package/react/internal/cache/QueryReference.js.map +1 -1
  180. package/react/ssr/useSSRQuery.js +1 -0
  181. package/react/ssr/useSSRQuery.js.map +1 -1
  182. package/react/types/types.documentation.d.ts +4 -16
  183. package/react/types/types.documentation.js.map +1 -1
  184. package/testing/core/mocking/mockLink.d.ts +3 -1
  185. package/testing/core/mocking/mockLink.js +2 -2
  186. package/testing/core/mocking/mockLink.js.map +1 -1
  187. package/utilities/internal/getMemoryInternals.js.map +1 -1
  188. package/utilities/internal/globals/global.js +2 -2
  189. package/utilities/internal/globals/global.js.map +1 -1
  190. package/utilities/internal/types/DocumentationTypes.d.ts +1 -1
  191. package/version.js +1 -1
@@ -16,7 +16,7 @@ export type ErrorMessageHandler = {
16
16
  *
17
17
  * ⚠️ Note that arguments will only be passed in for error messages.
18
18
  * For normal log messages, you will get an empty array here and they will directly
19
- * be passed to `console.log` instead, to have the string subsitution done by the
19
+ * be passed to `console.log` instead, to have the string substitution done by the
20
20
  * engine, as that allows for nicer (and in the case of a browser, interactive)
21
21
  * output.
22
22
  *
@@ -1 +1 @@
1
- {"version":3,"file":"setErrorMessageHandler.js","sourceRoot":"","sources":["../../src/dev/setErrorMessageHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAInE,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAgCxD;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAA4B;IACjE,MAAM,CAAC,yBAAyB,CAAC,GAAG,OAAsC,CAAC;AAC7E,CAAC","sourcesContent":["import { global } from \"@apollo/client/utilities/internal/globals\";\n\nimport type { ErrorCodes } from \"../invariantErrorCodes.js\";\n\nimport { ApolloErrorMessageHandler } from \"./symbol.js\";\n\n/**\n * The error message handler is a function that is called when a message is\n * logged or an error is thrown to determine the contents of the error message\n * to be logged or thrown.\n */\nexport type ErrorMessageHandler = {\n /**\n * @param message - Usually the error message number (as defined in\n * `@apollo/client/invariantErrorCodes.js`).\n * In some edge cases, this can already be a string, that can be passed through\n * as an error message.\n *\n * @param args - The placeholders that can be passed into the error message (pre-stringified).\n * These relate with the `%s` and `%d` [substitution strings](https://developer.mozilla.org/en-US/docs/Web/API/console#using_string_substitutions)\n * in the error message defined in `@apollo/client/invariantErrorCodes.js`.\n *\n * ⚠️ Note that arguments will only be passed in for error messages.\n * For normal log messages, you will get an empty array here and they will directly\n * be passed to `console.log` instead, to have the string subsitution done by the\n * engine, as that allows for nicer (and in the case of a browser, interactive)\n * output.\n *\n * @returns The error message to be logged or thrown. If it returns `undefined`,\n * the mechanism will fall back to the default:\n * A link to https://go.apollo.dev/c/err with Apollo Client version,\n * the error message number, and the error message arguments encoded into\n * the URL hash.\n */ (message: string | number, args: string[]): string | undefined;\n};\n\n/**\n * Overrides the global \"Error Message Handler\" with a custom implementation.\n */\nexport function setErrorMessageHandler(handler: ErrorMessageHandler) {\n global[ApolloErrorMessageHandler] = handler as typeof handler & ErrorCodes;\n}\n"]}
1
+ {"version":3,"file":"setErrorMessageHandler.js","sourceRoot":"","sources":["../../src/dev/setErrorMessageHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAInE,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAgCxD;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAA4B;IACjE,MAAM,CAAC,yBAAyB,CAAC,GAAG,OAAsC,CAAC;AAC7E,CAAC","sourcesContent":["import { global } from \"@apollo/client/utilities/internal/globals\";\n\nimport type { ErrorCodes } from \"../invariantErrorCodes.js\";\n\nimport { ApolloErrorMessageHandler } from \"./symbol.js\";\n\n/**\n * The error message handler is a function that is called when a message is\n * logged or an error is thrown to determine the contents of the error message\n * to be logged or thrown.\n */\nexport type ErrorMessageHandler = {\n /**\n * @param message - Usually the error message number (as defined in\n * `@apollo/client/invariantErrorCodes.js`).\n * In some edge cases, this can already be a string, that can be passed through\n * as an error message.\n *\n * @param args - The placeholders that can be passed into the error message (pre-stringified).\n * These relate with the `%s` and `%d` [substitution strings](https://developer.mozilla.org/en-US/docs/Web/API/console#using_string_substitutions)\n * in the error message defined in `@apollo/client/invariantErrorCodes.js`.\n *\n * ⚠️ Note that arguments will only be passed in for error messages.\n * For normal log messages, you will get an empty array here and they will directly\n * be passed to `console.log` instead, to have the string substitution done by the\n * engine, as that allows for nicer (and in the case of a browser, interactive)\n * output.\n *\n * @returns The error message to be logged or thrown. If it returns `undefined`,\n * the mechanism will fall back to the default:\n * A link to https://go.apollo.dev/c/err with Apollo Client version,\n * the error message number, and the error message arguments encoded into\n * the URL hash.\n */ (message: string | number, args: string[]): string | undefined;\n};\n\n/**\n * Overrides the global \"Error Message Handler\" with a custom implementation.\n */\nexport function setErrorMessageHandler(handler: ErrorMessageHandler) {\n global[ApolloErrorMessageHandler] = handler as typeof handler & ErrorCodes;\n}\n"]}
@@ -129,7 +129,7 @@ export declare namespace SchemaLink {
129
129
  /**
130
130
  * `SchemaLink` is a terminating link that executes GraphQL operations against
131
131
  * a local GraphQL schema instead of making network requests. This is commonly
132
- * used for server-side rendering (SSR) and mocking dataa.
132
+ * used for server-side rendering (SSR) and mocking data.
133
133
  *
134
134
  * > [!NOTE]
135
135
  * > While `SchemaLink` can provide GraphQL results on the client, the GraphQL
@@ -4,7 +4,7 @@ import { ApolloLink } from "@apollo/client/link";
4
4
  /**
5
5
  * `SchemaLink` is a terminating link that executes GraphQL operations against
6
6
  * a local GraphQL schema instead of making network requests. This is commonly
7
- * used for server-side rendering (SSR) and mocking dataa.
7
+ * used for server-side rendering (SSR) and mocking data.
8
8
  *
9
9
  * > [!NOTE]
10
10
  * > While `SchemaLink` can provide GraphQL results on the client, the GraphQL
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/schema/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AA+GjD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,OAAO,UAAW,SAAQ,UAAU;IACjC,MAAM,CAA+B;IACrC,SAAS,CAAkC;IAC3C,OAAO,CAAgC;IACvC,QAAQ,CAAU;IAEzB,YAAY,OAA2B;QACrC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;IACrC,CAAC;IAEM,OAAO,CACZ,SAA+B;QAE/B,OAAO,IAAI,UAAU,CAAoB,CAAC,QAAQ,EAAE,EAAE;YACpD,IAAI,OAAO,CAA6B,CAAC,OAAO,EAAE,EAAE,CAClD,OAAO,CACL,OAAO,IAAI,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC;gBAClC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;gBACzB,CAAC,CAAC,IAAI,CAAC,OAAO,CACf,CACF;iBACE,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;gBAChB,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;oBAClB,MAAM,gBAAgB,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;oBAChE,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;wBAChC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC;oBACtC,CAAC;gBACH,CAAC;gBAED,OAAO,OAAO,CAAC;oBACb,MAAM,EAAE,IAAI,CAAC,MAAM;oBACnB,QAAQ,EAAE,SAAS,CAAC,KAAK;oBACzB,SAAS,EAAE,IAAI,CAAC,SAAS;oBACzB,YAAY,EAAE,OAAO;oBACrB,cAAc,EAAE,SAAS,CAAC,SAAS;oBACnC,aAAa,EAAE,SAAS,CAAC,aAAa;iBACvC,CAAC,CAAC;YACL,CAAC,CAAC;iBACD,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;gBACb,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;oBACrB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBACpB,QAAQ,CAAC,QAAQ,EAAE,CAAC;gBACtB,CAAC;YACH,CAAC,CAAC;iBACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;gBACf,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;oBACrB,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBACxB,CAAC;YACH,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import type { GraphQLSchema } from \"graphql\";\nimport { execute, validate } from \"graphql\";\nimport { Observable } from \"rxjs\";\n\nimport { ApolloLink } from \"@apollo/client/link\";\n\nexport declare namespace SchemaLink {\n export namespace SchemaLinkDocumentationTypes {\n /**\n * A function that returns the resolver context for a given operation.\n *\n * This function is called for each operation and allows you to create\n * operation-specific context. This is useful when you need to include\n * information from the operation (like headers, variables, etc.) in the\n * resolver context.\n *\n * @param operation - The Apollo Link operation\n * @returns The resolver context object or a promise that resolves to the context\n *\n * @example\n *\n * ```ts\n * const link = new SchemaLink({\n * schema,\n * context: (operation) => {\n * return {\n * userId: operation.getContext().userId,\n * dataSources: {\n * userAPI: new UserAPI(),\n * },\n * };\n * },\n * });\n * ```\n */\n export function ResolverContextFunction(\n operation: ApolloLink.Operation\n ): SchemaLink.ResolverContext | PromiseLike<SchemaLink.ResolverContext>;\n }\n /**\n * The resolver context object passed to GraphQL resolvers.\n *\n * This context object is passed as the third parameter to GraphQL resolvers\n * and typically contains data-fetching connectors, authentication information,\n * and other request-specific data.\n */\n export type ResolverContext = Record<string, any>;\n\n /** {@inheritDoc @apollo/client/link/schema!SchemaLink.SchemaLinkDocumentationTypes.ResolverContextFunction:function(1)} */\n export type ResolverContextFunction = (\n operation: ApolloLink.Operation\n ) => SchemaLink.ResolverContext | PromiseLike<SchemaLink.ResolverContext>;\n\n /**\n * Options for configuring the `SchemaLink`.\n */\n export interface Options {\n /**\n * An executable GraphQL schema to use for operation execution.\n *\n * @remarks\n *\n * This should be a complete, executable GraphQL schema created using\n * tools like `makeExecutableSchema` from `@graphql-tools/schema` or\n * `buildSchema` from `graphql`.\n *\n * @example\n *\n * ```ts\n * import { makeExecutableSchema } from \"@graphql-tools/schema\";\n *\n * const schema = makeExecutableSchema({\n * typeDefs,\n * resolvers,\n * });\n *\n * const link = new SchemaLink({ schema });\n * ```\n */\n schema: GraphQLSchema;\n\n /**\n * The root value passed to root-level resolvers. It's typically not used in\n * most schemas but can be useful for certain advanced patterns.\n */\n rootValue?: any;\n\n /**\n * Context object or function that returns the context object to provide to\n * resolvers. The context is passed as the third parameter to all GraphQL\n * resolvers.\n *\n * - If a static object is provided, the same context will be used for all\n * operations\n * - If a function is provided, the function is called for each operation to\n * generate operation-specific context\n */\n context?: SchemaLink.ResolverContext | SchemaLink.ResolverContextFunction;\n\n /**\n * Whether to validate incoming queries against the schema before execution.\n *\n * When enabled, queries will be validated against the schema before execution,\n * and validation errors will be returned in the result's `errors` array,\n * just like a remote GraphQL server would.\n *\n * This is useful for testing and development to catch query errors early,\n * but may add overhead in production environments.\n *\n * @defaultValue false\n */\n validate?: boolean;\n }\n}\n\n/**\n * `SchemaLink` is a terminating link that executes GraphQL operations against\n * a local GraphQL schema instead of making network requests. This is commonly\n * used for server-side rendering (SSR) and mocking dataa.\n *\n * > [!NOTE]\n * > While `SchemaLink` can provide GraphQL results on the client, the GraphQL\n * > execution layer is [quite large](https://bundlephobia.com/result?p=graphql) for practical client-side use.\n * > For client-side state management, consider Apollo Client's [local state management](https://apollographql.com/docs/react/local-state/local-state-management/)\n * > functionality instead, which integrates with the Apollo Client cache.\n *\n * @example\n *\n * ```ts\n * import { SchemaLink } from \"@apollo/client/link/schema\";\n * import schema from \"./path/to/your/schema\";\n *\n * const link = new SchemaLink({ schema });\n * ```\n */\nexport class SchemaLink extends ApolloLink {\n public schema: SchemaLink.Options[\"schema\"];\n public rootValue: SchemaLink.Options[\"rootValue\"];\n public context: SchemaLink.Options[\"context\"];\n public validate: boolean;\n\n constructor(options: SchemaLink.Options) {\n super();\n this.schema = options.schema;\n this.rootValue = options.rootValue;\n this.context = options.context;\n this.validate = !!options.validate;\n }\n\n public request(\n operation: ApolloLink.Operation\n ): Observable<ApolloLink.Result> {\n return new Observable<ApolloLink.Result>((observer) => {\n new Promise<SchemaLink.ResolverContext>((resolve) =>\n resolve(\n typeof this.context === \"function\" ?\n this.context(operation)\n : this.context\n )\n )\n .then((context) => {\n if (this.validate) {\n const validationErrors = validate(this.schema, operation.query);\n if (validationErrors.length > 0) {\n return { errors: validationErrors };\n }\n }\n\n return execute({\n schema: this.schema,\n document: operation.query,\n rootValue: this.rootValue,\n contextValue: context,\n variableValues: operation.variables,\n operationName: operation.operationName,\n });\n })\n .then((data) => {\n if (!observer.closed) {\n observer.next(data);\n observer.complete();\n }\n })\n .catch((error) => {\n if (!observer.closed) {\n observer.error(error);\n }\n });\n });\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/schema/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AA+GjD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,OAAO,UAAW,SAAQ,UAAU;IACjC,MAAM,CAA+B;IACrC,SAAS,CAAkC;IAC3C,OAAO,CAAgC;IACvC,QAAQ,CAAU;IAEzB,YAAY,OAA2B;QACrC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;IACrC,CAAC;IAEM,OAAO,CACZ,SAA+B;QAE/B,OAAO,IAAI,UAAU,CAAoB,CAAC,QAAQ,EAAE,EAAE;YACpD,IAAI,OAAO,CAA6B,CAAC,OAAO,EAAE,EAAE,CAClD,OAAO,CACL,OAAO,IAAI,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC;gBAClC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;gBACzB,CAAC,CAAC,IAAI,CAAC,OAAO,CACf,CACF;iBACE,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;gBAChB,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;oBAClB,MAAM,gBAAgB,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;oBAChE,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;wBAChC,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC;oBACtC,CAAC;gBACH,CAAC;gBAED,OAAO,OAAO,CAAC;oBACb,MAAM,EAAE,IAAI,CAAC,MAAM;oBACnB,QAAQ,EAAE,SAAS,CAAC,KAAK;oBACzB,SAAS,EAAE,IAAI,CAAC,SAAS;oBACzB,YAAY,EAAE,OAAO;oBACrB,cAAc,EAAE,SAAS,CAAC,SAAS;oBACnC,aAAa,EAAE,SAAS,CAAC,aAAa;iBACvC,CAAC,CAAC;YACL,CAAC,CAAC;iBACD,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;gBACb,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;oBACrB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBACpB,QAAQ,CAAC,QAAQ,EAAE,CAAC;gBACtB,CAAC;YACH,CAAC,CAAC;iBACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;gBACf,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;oBACrB,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBACxB,CAAC;YACH,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import type { GraphQLSchema } from \"graphql\";\nimport { execute, validate } from \"graphql\";\nimport { Observable } from \"rxjs\";\n\nimport { ApolloLink } from \"@apollo/client/link\";\n\nexport declare namespace SchemaLink {\n export namespace SchemaLinkDocumentationTypes {\n /**\n * A function that returns the resolver context for a given operation.\n *\n * This function is called for each operation and allows you to create\n * operation-specific context. This is useful when you need to include\n * information from the operation (like headers, variables, etc.) in the\n * resolver context.\n *\n * @param operation - The Apollo Link operation\n * @returns The resolver context object or a promise that resolves to the context\n *\n * @example\n *\n * ```ts\n * const link = new SchemaLink({\n * schema,\n * context: (operation) => {\n * return {\n * userId: operation.getContext().userId,\n * dataSources: {\n * userAPI: new UserAPI(),\n * },\n * };\n * },\n * });\n * ```\n */\n export function ResolverContextFunction(\n operation: ApolloLink.Operation\n ): SchemaLink.ResolverContext | PromiseLike<SchemaLink.ResolverContext>;\n }\n /**\n * The resolver context object passed to GraphQL resolvers.\n *\n * This context object is passed as the third parameter to GraphQL resolvers\n * and typically contains data-fetching connectors, authentication information,\n * and other request-specific data.\n */\n export type ResolverContext = Record<string, any>;\n\n /** {@inheritDoc @apollo/client/link/schema!SchemaLink.SchemaLinkDocumentationTypes.ResolverContextFunction:function(1)} */\n export type ResolverContextFunction = (\n operation: ApolloLink.Operation\n ) => SchemaLink.ResolverContext | PromiseLike<SchemaLink.ResolverContext>;\n\n /**\n * Options for configuring the `SchemaLink`.\n */\n export interface Options {\n /**\n * An executable GraphQL schema to use for operation execution.\n *\n * @remarks\n *\n * This should be a complete, executable GraphQL schema created using\n * tools like `makeExecutableSchema` from `@graphql-tools/schema` or\n * `buildSchema` from `graphql`.\n *\n * @example\n *\n * ```ts\n * import { makeExecutableSchema } from \"@graphql-tools/schema\";\n *\n * const schema = makeExecutableSchema({\n * typeDefs,\n * resolvers,\n * });\n *\n * const link = new SchemaLink({ schema });\n * ```\n */\n schema: GraphQLSchema;\n\n /**\n * The root value passed to root-level resolvers. It's typically not used in\n * most schemas but can be useful for certain advanced patterns.\n */\n rootValue?: any;\n\n /**\n * Context object or function that returns the context object to provide to\n * resolvers. The context is passed as the third parameter to all GraphQL\n * resolvers.\n *\n * - If a static object is provided, the same context will be used for all\n * operations\n * - If a function is provided, the function is called for each operation to\n * generate operation-specific context\n */\n context?: SchemaLink.ResolverContext | SchemaLink.ResolverContextFunction;\n\n /**\n * Whether to validate incoming queries against the schema before execution.\n *\n * When enabled, queries will be validated against the schema before execution,\n * and validation errors will be returned in the result's `errors` array,\n * just like a remote GraphQL server would.\n *\n * This is useful for testing and development to catch query errors early,\n * but may add overhead in production environments.\n *\n * @defaultValue false\n */\n validate?: boolean;\n }\n}\n\n/**\n * `SchemaLink` is a terminating link that executes GraphQL operations against\n * a local GraphQL schema instead of making network requests. This is commonly\n * used for server-side rendering (SSR) and mocking data.\n *\n * > [!NOTE]\n * > While `SchemaLink` can provide GraphQL results on the client, the GraphQL\n * > execution layer is [quite large](https://bundlephobia.com/result?p=graphql) for practical client-side use.\n * > For client-side state management, consider Apollo Client's [local state management](https://apollographql.com/docs/react/local-state/local-state-management/)\n * > functionality instead, which integrates with the Apollo Client cache.\n *\n * @example\n *\n * ```ts\n * import { SchemaLink } from \"@apollo/client/link/schema\";\n * import schema from \"./path/to/your/schema\";\n *\n * const link = new SchemaLink({ schema });\n * ```\n */\nexport class SchemaLink extends ApolloLink {\n public schema: SchemaLink.Options[\"schema\"];\n public rootValue: SchemaLink.Options[\"rootValue\"];\n public context: SchemaLink.Options[\"context\"];\n public validate: boolean;\n\n constructor(options: SchemaLink.Options) {\n super();\n this.schema = options.schema;\n this.rootValue = options.rootValue;\n this.context = options.context;\n this.validate = !!options.validate;\n }\n\n public request(\n operation: ApolloLink.Operation\n ): Observable<ApolloLink.Result> {\n return new Observable<ApolloLink.Result>((observer) => {\n new Promise<SchemaLink.ResolverContext>((resolve) =>\n resolve(\n typeof this.context === \"function\" ?\n this.context(operation)\n : this.context\n )\n )\n .then((context) => {\n if (this.validate) {\n const validationErrors = validate(this.schema, operation.query);\n if (validationErrors.length > 0) {\n return { errors: validationErrors };\n }\n }\n\n return execute({\n schema: this.schema,\n document: operation.query,\n rootValue: this.rootValue,\n contextValue: context,\n variableValues: operation.variables,\n operationName: operation.operationName,\n });\n })\n .then((data) => {\n if (!observer.closed) {\n observer.next(data);\n observer.complete();\n }\n })\n .catch((error) => {\n if (!observer.closed) {\n observer.error(error);\n }\n });\n });\n }\n}\n"]}
@@ -71,7 +71,8 @@ export class GraphQLWsLink extends ApolloLink {
71
71
  }
72
72
  request(operation) {
73
73
  return new Observable((observer) => {
74
- return this.client.subscribe({ ...operation, query: print(operation.query) }, {
74
+ const { query, variables, operationName, extensions } = operation;
75
+ return this.client.subscribe({ variables, operationName, extensions, query: print(query) }, {
75
76
  next: observer.next.bind(observer),
76
77
  complete: observer.complete.bind(observer),
77
78
  error: (err) => {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/subscriptions/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,0CAA0C;AAC1C,EAAE;AACF,+EAA+E;AAC/E,0CAA0C;AAC1C,EAAE;AACF,2CAA2C;AAC3C,EAAE;AACF,wBAAwB;AACxB,EAAE;AACF,yCAAyC;AACzC,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,+EAA+E;AAC/E,4EAA4E;AAC5E,wEAAwE;AACxE,2DAA2D;AAC3D,EAAE;AACF,6EAA6E;AAC7E,sDAAsD;AACtD,EAAE;AACF,6EAA6E;AAC7E,2EAA2E;AAC3E,8EAA8E;AAC9E,yEAAyE;AACzE,gFAAgF;AAChF,4EAA4E;AAC5E,gBAAgB;AAIhB,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEpE,yEAAyE;AACzE,SAAS,gBAAgB,CAAC,GAAY;IACpC,OAAO,eAAe,CAAC,GAAG,CAAC,IAAI,MAAM,IAAI,GAAG,IAAI,QAAQ,IAAI,GAAG,CAAC;AAClE,CAAC;AAED,yEAAyE;AACzE,SAAS,gBAAgB,CAAC,GAAY;IACpC,OAAO,eAAe,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,MAAM,EAAE,UAAU,KAAK,SAAS,CAAC,MAAM,CAAC;AAC7E,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAO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,CAAC;gBACD,+FAA+F;aAChD,CAClD,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["// This file is adapted from the graphql-ws npm package:\n// https://github.com/enisdenjo/graphql-ws\n//\n// Most of the file comes from that package's README; some other parts (such as\n// isLikeCloseEvent) come from its source.\n//\n// Here's the license of the original code:\n//\n// The MIT License (MIT)\n//\n// Copyright (c) 2020-2021 Denis Badurina\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport type { FormattedExecutionResult } from \"graphql\";\nimport type { Client, Sink } from \"graphql-ws\";\nimport { Observable } from \"rxjs\";\n\nimport { CombinedGraphQLErrors } from \"@apollo/client/errors\";\nimport { ApolloLink } from \"@apollo/client/link\";\nimport { print } from \"@apollo/client/utilities\";\nimport { isNonNullObject } from \"@apollo/client/utilities/internal\";\n\n// https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/close_event\nfunction isLikeCloseEvent(val: unknown): val is CloseEvent {\n return isNonNullObject(val) && \"code\" in val && \"reason\" in val;\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/error_event\nfunction isLikeErrorEvent(err: unknown): err is Event {\n return isNonNullObject(err) && err.target?.readyState === WebSocket.CLOSED;\n}\n\n/**\n * The `GraphQLWsLink` is a terminating link sends GraphQL operations over a\n * WebSocket connection using the [`graphql-ws`](https://www.npmjs.com/package/graphql-ws) library. It's used most\n * commonly with GraphQL [subscriptions](https://apollographql.com/docs/react/data/subscriptions/),\n *\n * > [!NOTE]\n * > This link works with the `graphql-ws` library. If your server uses\n * > the deprecated `subscriptions-transport-ws` library, use the deprecated\n * > [`WebSocketLink`](https://apollographql.com/docs/react/api/link/apollo-link-ws) link instead.\n *\n * @example\n *\n * ```ts\n * import { GraphQLWsLink } from \"@apollo/client/link/subscriptions\";\n * import { createClient } from \"graphql-ws\";\n *\n * const link = new GraphQLWsLink(\n * createClient({\n * url: \"ws://localhost:3000/subscriptions\",\n * })\n * );\n * ```\n */\nexport class GraphQLWsLink extends ApolloLink {\n constructor(public readonly client: Client) {\n super();\n }\n\n public request(\n operation: ApolloLink.Operation\n ): Observable<ApolloLink.Result> {\n return new Observable((observer) => {\n return this.client.subscribe<ApolloLink.Result>(\n { ...operation, query: print(operation.query) },\n {\n next: observer.next.bind(observer),\n complete: observer.complete.bind(observer),\n error: (err) => {\n if (err instanceof Error) {\n return observer.error(err);\n }\n const likeClose = isLikeCloseEvent(err);\n if (likeClose || isLikeErrorEvent(err)) {\n return observer.error(\n // reason will be available on clean closes\n new Error(\n `Socket closed${likeClose ? ` with event ${err.code}` : \"\"}${\n likeClose ? ` ${err.reason}` : \"\"\n }`\n )\n );\n }\n\n return observer.error(\n new CombinedGraphQLErrors({\n errors: Array.isArray(err) ? err : [err],\n })\n );\n },\n // casting around a wrong type in graphql-ws, which incorrectly expects `Sink<ExecutionResult>`\n } satisfies Sink<FormattedExecutionResult> as any\n );\n });\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/subscriptions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This file is adapted from the graphql-ws npm package:\n// https://github.com/enisdenjo/graphql-ws\n//\n// Most of the file comes from that package's README; some other parts (such as\n// isLikeCloseEvent) come from its source.\n//\n// Here's the license of the original code:\n//\n// The MIT License (MIT)\n//\n// Copyright (c) 2020-2021 Denis Badurina\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport type { FormattedExecutionResult } from \"graphql\";\nimport type { Client, Sink } from \"graphql-ws\";\nimport { Observable } from \"rxjs\";\n\nimport { CombinedGraphQLErrors } from \"@apollo/client/errors\";\nimport { ApolloLink } from \"@apollo/client/link\";\nimport { print } from \"@apollo/client/utilities\";\nimport { isNonNullObject } from \"@apollo/client/utilities/internal\";\n\n// https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/close_event\nfunction isLikeCloseEvent(val: unknown): val is CloseEvent {\n return isNonNullObject(val) && \"code\" in val && \"reason\" in val;\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/error_event\nfunction isLikeErrorEvent(err: unknown): err is Event {\n return isNonNullObject(err) && err.target?.readyState === WebSocket.CLOSED;\n}\n\n/**\n * The `GraphQLWsLink` is a terminating link sends GraphQL operations over a\n * WebSocket connection using the [`graphql-ws`](https://www.npmjs.com/package/graphql-ws) library. It's used most\n * commonly with GraphQL [subscriptions](https://apollographql.com/docs/react/data/subscriptions/),\n *\n * > [!NOTE]\n * > This link works with the `graphql-ws` library. If your server uses\n * > the deprecated `subscriptions-transport-ws` library, use the deprecated\n * > [`WebSocketLink`](https://apollographql.com/docs/react/api/link/apollo-link-ws) link instead.\n *\n * @example\n *\n * ```ts\n * import { GraphQLWsLink } from \"@apollo/client/link/subscriptions\";\n * import { createClient } from \"graphql-ws\";\n *\n * const link = new GraphQLWsLink(\n * createClient({\n * url: \"ws://localhost:3000/subscriptions\",\n * })\n * );\n * ```\n */\nexport class GraphQLWsLink extends ApolloLink {\n constructor(public readonly client: Client) {\n super();\n }\n\n public request(\n operation: ApolloLink.Operation\n ): Observable<ApolloLink.Result> {\n return new Observable((observer) => {\n const { query, variables, operationName, extensions } = operation;\n return this.client.subscribe<ApolloLink.Result>(\n { variables, operationName, extensions, query: print(query) },\n {\n next: observer.next.bind(observer),\n complete: observer.complete.bind(observer),\n error: (err) => {\n if (err instanceof Error) {\n return observer.error(err);\n }\n const likeClose = isLikeCloseEvent(err);\n if (likeClose || isLikeErrorEvent(err)) {\n return observer.error(\n // reason will be available on clean closes\n new Error(\n `Socket closed${likeClose ? ` with event ${err.code}` : \"\"}${\n likeClose ? ` ${err.reason}` : \"\"\n }`\n )\n );\n }\n\n return observer.error(\n new CombinedGraphQLErrors({\n errors: Array.isArray(err) ? err : [err],\n })\n );\n },\n // casting around a wrong type in graphql-ws, which incorrectly expects `Sink<ExecutionResult>`\n } satisfies Sink<FormattedExecutionResult> as any\n );\n });\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/masking/internal/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n IsAny,\n Prettify,\n Primitive,\n RemoveIndexSignature,\n} from \"@apollo/client/utilities/internal\";\n\nexport type UnwrapFragmentRefs<TData> =\n true extends IsAny<TData> ? TData\n : TData extends any ?\n // Ensure tagged/branded types are left alone (i.e. type UUID = string & { ... })\n TData extends Primitive ? TData\n : // Leave TData alone if it is Record<string, any> and not a specific shape\n string extends keyof TData ? TData\n : // short-circuit on empty object\n keyof TData extends never ? TData\n : TData extends { \" $fragmentRefs\"?: infer FragmentRefs } ?\n UnwrapFragmentRefs<\n CombineIntersection<\n | Omit<TData, \" $fragmentRefs\">\n | RemoveFragmentName<\n NonNullable<\n NonNullable<FragmentRefs>[keyof NonNullable<FragmentRefs>]\n >\n >\n >\n >\n : TData extends object ?\n {\n [K in keyof TData]: UnwrapFragmentRefs<TData[K]>;\n }\n : TData\n : never;\n\n/**\n * ```ts\n * CombineIntersection<\n * | { foo: string }\n * | { __typename: \"A\"; a: string }\n * | { __typename: \"B\"; b1: number }\n * | { __typename: \"B\"; b2: string }\n * > =>\n * | { foo: string }\n * | CombineByTypeName<\n * | { __typename: \"A\"; a: string }\n * | { __typename: \"B\"; b1: number }\n * | { __typename: \"B\"; b2: string }\n * >\n * ```\n */\ntype CombineIntersection<T> =\n | Exclude<T, { __typename?: string }>\n | CombineByTypeName<Extract<T, { __typename?: string }>>;\n/**\n * ```ts\n * CombineByTypeName<\n * | { __typename: \"A\"; a: string }\n * | { __typename: \"B\"; b1: number }\n * | { __typename: \"B\"; b2: string }\n * > =>\n * | CombineWithArrays<\n * | { __typename: \"A\"; a: string }\n * >\n * | CombineWithArrays<\n * | { __typename: \"B\"; b1: number }\n * | { __typename: \"B\"; b2: number }\n * >\n * ```\n */\ntype CombineByTypeName<T extends { __typename?: string }> = {\n [TypeName in NonNullable<T[\"__typename\"]>]: Prettify<\n MergeUnions<ExtractByMatchingTypeNames<T, TypeName>>\n >;\n}[NonNullable<T[\"__typename\"]>];\n\n/**\n * ```ts\n * CombineByTypeName<\n * | {\n * __typename: \"Person\" | \"Animatronic\" | \"CartoonCharacter\";\n * id: number;\n * name: string;\n * }\n * | {\n * __typename: \"Person\";\n * birthdate: string;\n * }\n * | {\n * __typename: \"Animatronic\";\n * manufacturer: string;\n * warrantyEndDate: string;\n * }\n * | {\n * __typename: \"CartoonCharacter\";\n * animator: string;\n * voiceActor: string;\n * }\n * >\n * =>\n * {\n * id: number;\n * name: string;\n * __typename: \"Person\";\n * birthdate: string;\n * } | {\n * id: number;\n * name: string;\n * __typename: \"Animatronic\";\n * manufacturer: string;\n * warrantyEndDate: string;\n * } | {\n * id: number;\n * name: string;\n * __typename: \"CartoonCharacter\";\n * animator: string;\n * voiceActor: string;\n * }\n * ```\n */\ntype ExtractByMatchingTypeNames<\n Union extends { __typename?: string },\n TypeName extends string,\n> = Union extends any ?\n TypeName extends NonNullable<Union[\"__typename\"]> ?\n Omit<Union, \"__typename\"> & {\n // preserve `?`, which `& { __typename: TypeName }` would not do\n [K in keyof Union as K extends \"__typename\" ? K : never]: TypeName;\n }\n : never\n: never;\n\ntype MergeUnions<TUnion> = MergeUnionsAcc<\n TUnion,\n takeOneFromUnion<TUnion>,\n never\n>;\n\ntype DistributedRequiredExclude<T, U> =\n T extends any ?\n Required<T> extends Required<U> ?\n Required<U> extends Required<T> ?\n never\n : T\n : T\n : T;\n\ntype MergeUnionsAcc<TUnion, Curr, Merged> =\n [Curr] extends [never] ? Merged\n : MergeUnionsAcc<\n DistributedRequiredExclude<TUnion, Curr>,\n takeOneFromUnion<DistributedRequiredExclude<TUnion, Curr>>,\n [Merged] extends [never] ? Curr : MergeObjects<Curr, Merged>\n >;\ntype unionToIntersection<T> =\n (T extends unknown ? (x: T) => unknown : never) extends (\n (x: infer U) => unknown\n ) ?\n U\n : never;\n\ntype takeOneFromUnion<T> =\n unionToIntersection<T extends T ? (x: T) => 0 : never> extends (\n (x: infer U) => 0\n ) ?\n U\n : never;\n\ntype MergeObjects<T, U> = Prettify<\n {\n [k in keyof T]: k extends keyof U ?\n [NonNullable<T[k]>, NonNullable<U[k]>] extends (\n [infer TK extends object, infer UK extends object]\n ) ?\n TK extends unknown[] ?\n UK extends unknown[] ?\n | CombineIntersection<TK[number] | UK[number]>[]\n | Extract<T[k] | U[k], undefined | null>\n : T[k]\n : CombineIntersection<TK | UK> | Extract<T[k] | U[k], undefined | null>\n : T[k]\n : T[k];\n } & Pick<U, Exclude<keyof U, keyof T>>\n>;\n\n// force distrubution when T is a union with | undefined\nexport type RemoveFragmentName<T> =\n T extends any ? Omit<T, \" $fragmentName\"> : T;\n\ntype Exact<in out T> = (x: T) => T;\nexport type ContainsFragmentsRefs<TData, Seen = never> = true extends (\n IsAny<TData>\n) ?\n false\n: TData extends object ?\n Exact<TData> extends Seen ? false\n : \" $fragmentRefs\" extends keyof RemoveIndexSignature<TData> ? true\n : ContainsFragmentsRefs<TData[keyof TData], Seen | Exact<TData>>\n: false;\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/masking/internal/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n IsAny,\n Prettify,\n Primitive,\n RemoveIndexSignature,\n} from \"@apollo/client/utilities/internal\";\n\nexport type UnwrapFragmentRefs<TData> =\n true extends IsAny<TData> ? TData\n : TData extends any ?\n // Ensure tagged/branded types are left alone (i.e. type UUID = string & { ... })\n TData extends Primitive ? TData\n : // Leave TData alone if it is Record<string, any> and not a specific shape\n string extends keyof TData ? TData\n : // short-circuit on empty object\n keyof TData extends never ? TData\n : TData extends { \" $fragmentRefs\"?: infer FragmentRefs } ?\n UnwrapFragmentRefs<\n CombineIntersection<\n | Omit<TData, \" $fragmentRefs\">\n | RemoveFragmentName<\n NonNullable<\n NonNullable<FragmentRefs>[keyof NonNullable<FragmentRefs>]\n >\n >\n >\n >\n : TData extends object ?\n {\n [K in keyof TData]: UnwrapFragmentRefs<TData[K]>;\n }\n : TData\n : never;\n\n/**\n * ```ts\n * CombineIntersection<\n * | { foo: string }\n * | { __typename: \"A\"; a: string }\n * | { __typename: \"B\"; b1: number }\n * | { __typename: \"B\"; b2: string }\n * > =>\n * | { foo: string }\n * | CombineByTypeName<\n * | { __typename: \"A\"; a: string }\n * | { __typename: \"B\"; b1: number }\n * | { __typename: \"B\"; b2: string }\n * >\n * ```\n */\ntype CombineIntersection<T> =\n | Exclude<T, { __typename?: string }>\n | CombineByTypeName<Extract<T, { __typename?: string }>>;\n/**\n * ```ts\n * CombineByTypeName<\n * | { __typename: \"A\"; a: string }\n * | { __typename: \"B\"; b1: number }\n * | { __typename: \"B\"; b2: string }\n * > =>\n * | CombineWithArrays<\n * | { __typename: \"A\"; a: string }\n * >\n * | CombineWithArrays<\n * | { __typename: \"B\"; b1: number }\n * | { __typename: \"B\"; b2: number }\n * >\n * ```\n */\ntype CombineByTypeName<T extends { __typename?: string }> = {\n [TypeName in NonNullable<T[\"__typename\"]>]: Prettify<\n MergeUnions<ExtractByMatchingTypeNames<T, TypeName>>\n >;\n}[NonNullable<T[\"__typename\"]>];\n\n/**\n * ```ts\n * CombineByTypeName<\n * | {\n * __typename: \"Person\" | \"Animatronic\" | \"CartoonCharacter\";\n * id: number;\n * name: string;\n * }\n * | {\n * __typename: \"Person\";\n * birthdate: string;\n * }\n * | {\n * __typename: \"Animatronic\";\n * manufacturer: string;\n * warrantyEndDate: string;\n * }\n * | {\n * __typename: \"CartoonCharacter\";\n * animator: string;\n * voiceActor: string;\n * }\n * >\n * =>\n * {\n * id: number;\n * name: string;\n * __typename: \"Person\";\n * birthdate: string;\n * } | {\n * id: number;\n * name: string;\n * __typename: \"Animatronic\";\n * manufacturer: string;\n * warrantyEndDate: string;\n * } | {\n * id: number;\n * name: string;\n * __typename: \"CartoonCharacter\";\n * animator: string;\n * voiceActor: string;\n * }\n * ```\n */\ntype ExtractByMatchingTypeNames<\n Union extends { __typename?: string },\n TypeName extends string,\n> = Union extends any ?\n TypeName extends NonNullable<Union[\"__typename\"]> ?\n Omit<Union, \"__typename\"> & {\n // preserve `?`, which `& { __typename: TypeName }` would not do\n [K in keyof Union as K extends \"__typename\" ? K : never]: TypeName;\n }\n : never\n: never;\n\ntype MergeUnions<TUnion> = MergeUnionsAcc<\n TUnion,\n takeOneFromUnion<TUnion>,\n never\n>;\n\ntype DistributedRequiredExclude<T, U> =\n T extends any ?\n Required<T> extends Required<U> ?\n Required<U> extends Required<T> ?\n never\n : T\n : T\n : T;\n\ntype MergeUnionsAcc<TUnion, Curr, Merged> =\n [Curr] extends [never] ? Merged\n : MergeUnionsAcc<\n DistributedRequiredExclude<TUnion, Curr>,\n takeOneFromUnion<DistributedRequiredExclude<TUnion, Curr>>,\n [Merged] extends [never] ? Curr : MergeObjects<Curr, Merged>\n >;\ntype unionToIntersection<T> =\n (T extends unknown ? (x: T) => unknown : never) extends (\n (x: infer U) => unknown\n ) ?\n U\n : never;\n\ntype takeOneFromUnion<T> =\n unionToIntersection<T extends T ? (x: T) => 0 : never> extends (\n (x: infer U) => 0\n ) ?\n U\n : never;\n\ntype MergeObjects<T, U> = Prettify<\n {\n [k in keyof T]: k extends keyof U ?\n [NonNullable<T[k]>, NonNullable<U[k]>] extends (\n [infer TK extends object, infer UK extends object]\n ) ?\n TK extends unknown[] ?\n UK extends unknown[] ?\n | CombineIntersection<TK[number] | UK[number]>[]\n | Extract<T[k] | U[k], undefined | null>\n : T[k]\n : CombineIntersection<TK | UK> | Extract<T[k] | U[k], undefined | null>\n : T[k]\n : T[k];\n } & Pick<U, Exclude<keyof U, keyof T>>\n>;\n\n// force distribution when T is a union with | undefined\nexport type RemoveFragmentName<T> =\n T extends any ? Omit<T, \" $fragmentName\"> : T;\n\ntype Exact<in out T> = (x: T) => T;\nexport type ContainsFragmentsRefs<TData, Seen = never> = true extends (\n IsAny<TData>\n) ?\n false\n: TData extends object ?\n Exact<TData> extends Seen ? false\n : \" $fragmentRefs\" extends keyof RemoveIndexSignature<TData> ? true\n : ContainsFragmentsRefs<TData[keyof TData], Seen | Exact<TData>>\n: false;\n"]}
@@ -39,7 +39,7 @@ function maskSelectionSet(data, selectionSet, context, migration, path) {
39
39
  }
40
40
  for (const selection of selectionSet.selections) {
41
41
  let value;
42
- // we later want to add acessor warnings to the final result
42
+ // we later want to add accessor warnings to the final result
43
43
  // so we need a new object to add the accessor warning to
44
44
  if (migration) {
45
45
  knownChanged.add(memo);
@@ -1 +1 @@
1
- {"version":3,"file":"maskDefinition.js","sources":["../../src/masking/maskDefinition.ts"],"sourcesContent":["import type { FragmentDefinitionNode, SelectionSetNode } from \"graphql\";\nimport { Kind } from \"graphql\";\n\nimport type { ApolloCache } from \"@apollo/client/cache\";\nimport { __DEV__ } from \"@apollo/client/utilities/environment\";\nimport type { FragmentMap } from \"@apollo/client/utilities/internal\";\nimport {\n maybeDeepFreeze,\n resultKeyNameFromField,\n} from \"@apollo/client/utilities/internal\";\nimport { invariant } from \"@apollo/client/utilities/invariant\";\n\nimport { disableWarningsSlot, getFragmentMaskMode } from \"./utils.js\";\n\ninterface MaskingContext {\n operationType: \"query\" | \"mutation\" | \"subscription\" | \"fragment\";\n operationName: string | undefined;\n fragmentMap: FragmentMap;\n cache: ApolloCache;\n mutableTargets: WeakMap<any, any>;\n knownChanged: WeakSet<any>;\n}\n\nexport function maskDefinition(\n data: Record<string, any>,\n selectionSet: SelectionSetNode,\n context: MaskingContext\n) {\n return disableWarningsSlot.withValue(true, () => {\n const masked = maskSelectionSet(data, selectionSet, context, false);\n\n if (Object.isFrozen(data)) {\n maybeDeepFreeze(masked);\n }\n return masked;\n });\n}\n\nfunction getMutableTarget(\n data: Record<string, any>,\n mutableTargets: WeakMap<any, any>\n): typeof data {\n if (mutableTargets.has(data)) {\n return mutableTargets.get(data);\n }\n\n const mutableTarget = Array.isArray(data) ? [] : {};\n mutableTargets.set(data, mutableTarget);\n return mutableTarget;\n}\n\nfunction maskSelectionSet(\n data: any,\n selectionSet: SelectionSetNode,\n context: MaskingContext,\n migration: boolean,\n path?: string | undefined\n): typeof data {\n const { knownChanged } = context;\n const memo = getMutableTarget(data, context.mutableTargets);\n\n if (Array.isArray(data)) {\n for (const [index, item] of Array.from(data.entries())) {\n if (item === null) {\n memo[index] = null;\n continue;\n }\n\n const masked = maskSelectionSet(\n item,\n selectionSet,\n context,\n migration,\n __DEV__ ? `${path || \"\"}[${index}]` : void 0\n );\n if (knownChanged.has(masked)) {\n knownChanged.add(memo);\n }\n\n memo[index] = masked;\n }\n\n return knownChanged.has(memo) ? memo : data;\n }\n\n for (const selection of selectionSet.selections) {\n let value: any;\n\n // we later want to add acessor warnings to the final result\n // so we need a new object to add the accessor warning to\n if (migration) {\n knownChanged.add(memo);\n }\n\n if (selection.kind === Kind.FIELD) {\n const keyName = resultKeyNameFromField(selection);\n const childSelectionSet = selection.selectionSet;\n\n value = memo[keyName] || data[keyName];\n\n if (value === void 0) {\n continue;\n }\n\n if (childSelectionSet && value !== null) {\n const masked = maskSelectionSet(\n data[keyName],\n childSelectionSet,\n context,\n migration,\n __DEV__ ? `${path || \"\"}.${keyName}` : void 0\n );\n\n if (knownChanged.has(masked)) {\n value = masked;\n }\n }\n\n if (!__DEV__) {\n memo[keyName] = value;\n }\n if (__DEV__) {\n if (\n migration &&\n keyName !== \"__typename\" &&\n // either the field is not present in the memo object\n // or it has a `get` descriptor, not a `value` descriptor\n // => it is a warning accessor and we can overwrite it\n // with another accessor\n !Object.getOwnPropertyDescriptor(memo, keyName)?.value\n ) {\n Object.defineProperty(\n memo,\n keyName,\n getAccessorWarningDescriptor(\n keyName,\n value,\n path || \"\",\n context.operationName,\n context.operationType\n )\n );\n } else {\n delete memo[keyName];\n memo[keyName] = value;\n }\n }\n }\n\n if (\n selection.kind === Kind.INLINE_FRAGMENT &&\n (!selection.typeCondition ||\n context.cache.fragmentMatches(selection, data.__typename))\n ) {\n value = maskSelectionSet(\n data,\n selection.selectionSet,\n context,\n migration,\n path\n );\n }\n\n if (selection.kind === Kind.FRAGMENT_SPREAD) {\n const fragmentName = selection.name.value;\n const fragment: FragmentDefinitionNode | null =\n context.fragmentMap[fragmentName] ||\n (context.fragmentMap[fragmentName] =\n context.cache.lookupFragment(fragmentName)!);\n invariant(\n fragment,\n \"Could not find fragment with name '%s'.\",\n fragmentName\n );\n\n const mode = getFragmentMaskMode(selection);\n\n if (mode !== \"mask\") {\n value = maskSelectionSet(\n data,\n fragment.selectionSet,\n context,\n mode === \"migrate\",\n path\n );\n }\n }\n\n if (knownChanged.has(value)) {\n knownChanged.add(memo);\n }\n }\n\n if (\"__typename\" in data && !(\"__typename\" in memo)) {\n memo.__typename = data.__typename;\n }\n\n // This check prevents cases where masked fields may accidentally be\n // returned as part of this object when the fragment also selects\n // additional fields from the same child selection.\n if (Object.keys(memo).length !== Object.keys(data).length) {\n knownChanged.add(memo);\n }\n\n return knownChanged.has(memo) ? memo : data;\n}\n\nfunction getAccessorWarningDescriptor(\n fieldName: string,\n value: any,\n path: string,\n operationName: string | undefined,\n operationType: string\n): PropertyDescriptor {\n let getValue = () => {\n if (disableWarningsSlot.getValue()) {\n return value;\n }\n\n invariant.warn(\n \"Accessing unmasked field on %s at path '%s'. This field will not be available when masking is enabled. Please read the field from the fragment instead.\",\n operationName ?\n `${operationType} '${operationName}'`\n : `anonymous ${operationType}`,\n `${path}.${fieldName}`.replace(/^\\./, \"\")\n );\n\n getValue = () => value;\n\n return value;\n };\n\n return {\n get() {\n return getValue();\n },\n set(newValue) {\n getValue = () => newValue;\n },\n enumerable: true,\n configurable: true,\n };\n}\n"],"names":[],"mappings":"AACA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAqB,CAArB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA8B;AAG9B,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAwB,CAAxB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,C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oB;QAChB,CAAJ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgB,EAAE,CAAlB,CAAA,CAAA,CAAsB;IACtB,CAAG;AACH;"}
1
+ {"version":3,"file":"maskDefinition.js","sources":["../../src/masking/maskDefinition.ts"],"sourcesContent":["import type { FragmentDefinitionNode, SelectionSetNode } from \"graphql\";\nimport { Kind } from \"graphql\";\n\nimport type { ApolloCache } from \"@apollo/client/cache\";\nimport { __DEV__ } from \"@apollo/client/utilities/environment\";\nimport type { FragmentMap } from \"@apollo/client/utilities/internal\";\nimport {\n maybeDeepFreeze,\n resultKeyNameFromField,\n} from \"@apollo/client/utilities/internal\";\nimport { invariant } from \"@apollo/client/utilities/invariant\";\n\nimport { disableWarningsSlot, getFragmentMaskMode } from \"./utils.js\";\n\ninterface MaskingContext {\n operationType: \"query\" | \"mutation\" | \"subscription\" | \"fragment\";\n operationName: string | undefined;\n fragmentMap: FragmentMap;\n cache: ApolloCache;\n mutableTargets: WeakMap<any, any>;\n knownChanged: WeakSet<any>;\n}\n\nexport function maskDefinition(\n data: Record<string, any>,\n selectionSet: SelectionSetNode,\n context: MaskingContext\n) {\n return disableWarningsSlot.withValue(true, () => {\n const masked = maskSelectionSet(data, selectionSet, context, false);\n\n if (Object.isFrozen(data)) {\n maybeDeepFreeze(masked);\n }\n return masked;\n });\n}\n\nfunction getMutableTarget(\n data: Record<string, any>,\n mutableTargets: WeakMap<any, any>\n): typeof data {\n if (mutableTargets.has(data)) {\n return mutableTargets.get(data);\n }\n\n const mutableTarget = Array.isArray(data) ? [] : {};\n mutableTargets.set(data, mutableTarget);\n return mutableTarget;\n}\n\nfunction maskSelectionSet(\n data: any,\n selectionSet: SelectionSetNode,\n context: MaskingContext,\n migration: boolean,\n path?: string | undefined\n): typeof data {\n const { knownChanged } = context;\n const memo = getMutableTarget(data, context.mutableTargets);\n\n if (Array.isArray(data)) {\n for (const [index, item] of Array.from(data.entries())) {\n if (item === null) {\n memo[index] = null;\n continue;\n }\n\n const masked = maskSelectionSet(\n item,\n selectionSet,\n context,\n migration,\n __DEV__ ? `${path || \"\"}[${index}]` : void 0\n );\n if (knownChanged.has(masked)) {\n knownChanged.add(memo);\n }\n\n memo[index] = masked;\n }\n\n return knownChanged.has(memo) ? memo : data;\n }\n\n for (const selection of selectionSet.selections) {\n let value: any;\n\n // we later want to add accessor warnings to the final result\n // so we need a new object to add the accessor warning to\n if (migration) {\n knownChanged.add(memo);\n }\n\n if (selection.kind === Kind.FIELD) {\n const keyName = resultKeyNameFromField(selection);\n const childSelectionSet = selection.selectionSet;\n\n value = memo[keyName] || data[keyName];\n\n if (value === void 0) {\n continue;\n }\n\n if (childSelectionSet && value !== null) {\n const masked = maskSelectionSet(\n data[keyName],\n childSelectionSet,\n context,\n migration,\n __DEV__ ? `${path || \"\"}.${keyName}` : void 0\n );\n\n if (knownChanged.has(masked)) {\n value = masked;\n }\n }\n\n if (!__DEV__) {\n memo[keyName] = value;\n }\n if (__DEV__) {\n if (\n migration &&\n keyName !== \"__typename\" &&\n // either the field is not present in the memo object\n // or it has a `get` descriptor, not a `value` descriptor\n // => it is a warning accessor and we can overwrite it\n // with another accessor\n !Object.getOwnPropertyDescriptor(memo, keyName)?.value\n ) {\n Object.defineProperty(\n memo,\n keyName,\n getAccessorWarningDescriptor(\n keyName,\n value,\n path || \"\",\n context.operationName,\n context.operationType\n )\n );\n } else {\n delete memo[keyName];\n memo[keyName] = value;\n }\n }\n }\n\n if (\n selection.kind === Kind.INLINE_FRAGMENT &&\n (!selection.typeCondition ||\n context.cache.fragmentMatches(selection, data.__typename))\n ) {\n value = maskSelectionSet(\n data,\n selection.selectionSet,\n context,\n migration,\n path\n );\n }\n\n if (selection.kind === Kind.FRAGMENT_SPREAD) {\n const fragmentName = selection.name.value;\n const fragment: FragmentDefinitionNode | null =\n context.fragmentMap[fragmentName] ||\n (context.fragmentMap[fragmentName] =\n context.cache.lookupFragment(fragmentName)!);\n invariant(\n fragment,\n \"Could not find fragment with name '%s'.\",\n fragmentName\n );\n\n const mode = getFragmentMaskMode(selection);\n\n if (mode !== \"mask\") {\n value = maskSelectionSet(\n data,\n fragment.selectionSet,\n context,\n mode === \"migrate\",\n path\n );\n }\n }\n\n if (knownChanged.has(value)) {\n knownChanged.add(memo);\n }\n }\n\n if (\"__typename\" in data && !(\"__typename\" in memo)) {\n memo.__typename = data.__typename;\n }\n\n // This check prevents cases where masked fields may accidentally be\n // returned as part of this object when the fragment also selects\n // additional fields from the same child selection.\n if (Object.keys(memo).length !== Object.keys(data).length) {\n knownChanged.add(memo);\n }\n\n return knownChanged.has(memo) ? memo : data;\n}\n\nfunction getAccessorWarningDescriptor(\n fieldName: string,\n value: any,\n path: string,\n operationName: string | undefined,\n operationType: string\n): PropertyDescriptor {\n let getValue = () => {\n if (disableWarningsSlot.getValue()) {\n return value;\n }\n\n invariant.warn(\n \"Accessing unmasked field on %s at path '%s'. This field will not be available when masking is enabled. Please read the field from the fragment instead.\",\n operationName ?\n `${operationType} '${operationName}'`\n : `anonymous ${operationType}`,\n `${path}.${fieldName}`.replace(/^\\./, \"\")\n );\n\n getValue = () => value;\n\n return value;\n };\n\n return {\n get() {\n return getValue();\n },\n set(newValue) {\n getValue = () => newValue;\n },\n enumerable: true,\n configurable: true,\n };\n}\n"],"names":[],"mappings":"AACA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAqB,CAArB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA8B;AAG9B,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAwB,CAAxB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA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,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgB,EAAE,CAAlB,CAAA,CAAA,CAAsB;IACtB,CAAG;AACH;"}
@@ -1,10 +1,11 @@
1
+ import type { DocumentTypeDecoration } from "@graphql-typed-document-node/core";
1
2
  import type { TypeOverrides } from "@apollo/client";
2
3
  import type { ApplyHKTImplementationWithDefault } from "@apollo/client/utilities/internal";
3
4
  import type { PreserveTypes } from "./PreserveTypes.js";
4
5
  /**
5
6
  * Type used with [fragments](https://apollographql.com/docs/react/data/fragments#using-with-fragments) to ensure parent objects contain the fragment spread from the type.
6
7
  */
7
- export type FragmentType<TFragmentData> = ApplyHKTImplementationWithDefault<TypeOverrides, "FragmentType", PreserveTypes.TypeOverrides, TFragmentData>;
8
+ export type FragmentType<TFragmentDataOrTypedDocumentNode> = ApplyHKTImplementationWithDefault<TypeOverrides, "FragmentType", PreserveTypes.TypeOverrides, TFragmentDataOrTypedDocumentNode extends (DocumentTypeDecoration<infer TFragmentData, any>) ? TFragmentData : TFragmentDataOrTypedDocumentNode>;
8
9
  /** Unwraps `TData` into its unmasked type. */
9
10
  export type Unmasked<TData> = ApplyHKTImplementationWithDefault<TypeOverrides, "Unmasked", PreserveTypes.TypeOverrides, TData>;
10
11
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/masking/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { TypeOverrides } from \"@apollo/client\";\nimport type { ApplyHKTImplementationWithDefault } from \"@apollo/client/utilities/internal\";\n\nimport type { PreserveTypes } from \"./PreserveTypes.js\";\n\n/**\n * Type used with [fragments](https://apollographql.com/docs/react/data/fragments#using-with-fragments) to ensure parent objects contain the fragment spread from the type.\n */\nexport type FragmentType<TFragmentData> = ApplyHKTImplementationWithDefault<\n TypeOverrides,\n \"FragmentType\",\n PreserveTypes.TypeOverrides,\n TFragmentData\n>;\n\n/** Unwraps `TData` into its unmasked type. */\nexport type Unmasked<TData> = ApplyHKTImplementationWithDefault<\n TypeOverrides,\n \"Unmasked\",\n PreserveTypes.TypeOverrides,\n TData\n>;\n\n/**\n * Returns TData as either masked or unmasked depending on whether masking is\n * enabled.\n */\nexport type MaybeMasked<TData> = ApplyHKTImplementationWithDefault<\n TypeOverrides,\n \"MaybeMasked\",\n PreserveTypes.TypeOverrides,\n TData\n>;\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/masking/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { DocumentTypeDecoration } from \"@graphql-typed-document-node/core\";\n\nimport type { TypeOverrides } from \"@apollo/client\";\nimport type { ApplyHKTImplementationWithDefault } from \"@apollo/client/utilities/internal\";\n\nimport type { PreserveTypes } from \"./PreserveTypes.js\";\n\n/**\n * Type used with [fragments](https://apollographql.com/docs/react/data/fragments#using-with-fragments) to ensure parent objects contain the fragment spread from the type.\n */\nexport type FragmentType<TFragmentDataOrTypedDocumentNode> =\n ApplyHKTImplementationWithDefault<\n TypeOverrides,\n \"FragmentType\",\n PreserveTypes.TypeOverrides,\n TFragmentDataOrTypedDocumentNode extends (\n DocumentTypeDecoration<infer TFragmentData, any>\n ) ?\n TFragmentData\n : TFragmentDataOrTypedDocumentNode\n >;\n\n/** Unwraps `TData` into its unmasked type. */\nexport type Unmasked<TData> = ApplyHKTImplementationWithDefault<\n TypeOverrides,\n \"Unmasked\",\n PreserveTypes.TypeOverrides,\n TData\n>;\n\n/**\n * Returns TData as either masked or unmasked depending on whether masking is\n * enabled.\n */\nexport type MaybeMasked<TData> = ApplyHKTImplementationWithDefault<\n TypeOverrides,\n \"MaybeMasked\",\n PreserveTypes.TypeOverrides,\n TData\n>;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apollo/client",
3
- "version": "4.1.0-alpha.3",
3
+ "version": "4.1.0-alpha.4",
4
4
  "description": "A fully-featured caching GraphQL client.",
5
5
  "private": false,
6
6
  "keywords": [
@@ -1,5 +1,6 @@
1
1
  export { useDeepMemo } from "./useDeepMemo.js";
2
2
  export { useRenderGuard } from "./useRenderGuard.js";
3
+ export { useSuspenseHookCacheKey } from "./useSuspenseHookCacheKey.js";
3
4
  export { __use } from "./__use.js";
4
5
  export { wrapHook } from "./wrapHook.js";
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,7 @@
1
1
  // These hooks are used internally and are not exported publicly by the library
2
2
  export { useDeepMemo } from "./useDeepMemo.js";
3
3
  export { useRenderGuard } from "./useRenderGuard.js";
4
+ export { useSuspenseHookCacheKey } from "./useSuspenseHookCacheKey.js";
4
5
  export { __use } from "./__use.js";
5
6
  export { wrapHook } from "./wrapHook.js";
6
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/react/hooks/internal/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC","sourcesContent":["// These hooks are used internally and are not exported publicly by the library\nexport { useDeepMemo } from \"./useDeepMemo.js\";\nexport { useRenderGuard } from \"./useRenderGuard.js\";\nexport { __use } from \"./__use.js\";\nexport { wrapHook } from \"./wrapHook.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/react/hooks/internal/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC","sourcesContent":["// These hooks are used internally and are not exported publicly by the library\nexport { useDeepMemo } from \"./useDeepMemo.js\";\nexport { useRenderGuard } from \"./useRenderGuard.js\";\nexport { useSuspenseHookCacheKey } from \"./useSuspenseHookCacheKey.js\";\nexport { __use } from \"./__use.js\";\nexport { wrapHook } from \"./wrapHook.js\";\n"]}
@@ -2,9 +2,11 @@ import { equal } from "@wry/equality";
2
2
  import * as React from "react";
3
3
  export function useDeepMemo(memoFn, deps) {
4
4
  const ref = React.useRef(void 0);
5
+ // eslint-disable-next-line react-hooks/refs
5
6
  if (!ref.current || !equal(ref.current.deps, deps)) {
6
7
  ref.current = { value: memoFn(), deps };
7
8
  }
9
+ // eslint-disable-next-line react-hooks/refs
8
10
  return ref.current.value;
9
11
  }
10
12
  //# sourceMappingURL=useDeepMemo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDeepMemo.js","sourceRoot":"","sources":["../../../../src/react/hooks/internal/useDeepMemo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,UAAU,WAAW,CACzB,MAAoB,EACpB,IAAoB;IAEpB,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAA0C,KAAK,CAAC,CAAC,CAAC;IAC1E,IAAI,CAAC,GAAG,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;QACnD,GAAG,CAAC,OAAO,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC;IAC1C,CAAC;IACD,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC;AAC3B,CAAC","sourcesContent":["import { equal } from \"@wry/equality\";\nimport type { DependencyList } from \"react\";\nimport * as React from \"react\";\n\nexport function useDeepMemo<TValue>(\n memoFn: () => TValue,\n deps: DependencyList\n) {\n const ref = React.useRef<{ deps: DependencyList; value: TValue }>(void 0);\n if (!ref.current || !equal(ref.current.deps, deps)) {\n ref.current = { value: memoFn(), deps };\n }\n return ref.current.value;\n}\n"]}
1
+ {"version":3,"file":"useDeepMemo.js","sourceRoot":"","sources":["../../../../src/react/hooks/internal/useDeepMemo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,UAAU,WAAW,CACzB,MAAoB,EACpB,IAAoB;IAEpB,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAA0C,KAAK,CAAC,CAAC,CAAC;IAC1E,4CAA4C;IAC5C,IAAI,CAAC,GAAG,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;QACnD,GAAG,CAAC,OAAO,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC;IAC1C,CAAC;IACD,4CAA4C;IAC5C,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC;AAC3B,CAAC","sourcesContent":["import { equal } from \"@wry/equality\";\nimport type { DependencyList } from \"react\";\nimport * as React from \"react\";\n\nexport function useDeepMemo<TValue>(\n memoFn: () => TValue,\n deps: DependencyList\n) {\n const ref = React.useRef<{ deps: DependencyList; value: TValue }>(void 0);\n // eslint-disable-next-line react-hooks/refs\n if (!ref.current || !equal(ref.current.deps, deps)) {\n ref.current = { value: memoFn(), deps };\n }\n // eslint-disable-next-line react-hooks/refs\n return ref.current.value;\n}\n"]}
@@ -3,7 +3,7 @@ let Ctx;
3
3
  function noop() { }
4
4
  export function useRenderGuard() {
5
5
  if (!Ctx) {
6
- // we want the intialization to be lazy because `createContext` would error on import in a RSC
6
+ // we want the initialization to be lazy because `createContext` would error on import in a RSC
7
7
  Ctx = React.createContext(null);
8
8
  }
9
9
  return React.useCallback(
@@ -1 +1 @@
1
- {"version":3,"file":"useRenderGuard.js","sourceRoot":"","sources":["../../../../src/react/hooks/internal/useRenderGuard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,IAAI,GAAwB,CAAC;AAE7B,SAAS,IAAI,KAAI,CAAC;AAClB,MAAM,UAAU,cAAc;IAC5B,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,8FAA8F;QAC9F,GAAG,GAAG,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,KAAK,CAAC,WAAW;IACtB;;OAEG,CAAC,GAAG,EAAE;QACP,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC;QAC3B,IAAI,CAAC;YACH,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;YAErB;;;;;;;;;;;;;;eAcG;YACH,KAAK,CAAC,YAAY,CAAC,+BAA+B,CAAC,CAAC,GAAG,CAAC,CAAC;YACzD,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,KAAK,CAAC;QACf,CAAC;gBAAS,CAAC;YACT,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;QACvB,CAAC;IACH,CAAC,EACD,EAAE,CACH,CAAC;AACJ,CAAC","sourcesContent":["import * as React from \"react\";\n\nlet Ctx: React.Context<null>;\n\nfunction noop() {}\nexport function useRenderGuard() {\n if (!Ctx) {\n // we want the intialization to be lazy because `createContext` would error on import in a RSC\n Ctx = React.createContext(null);\n }\n\n return React.useCallback(\n /**\n * @returns true if the hook was called during render\n */ () => {\n const orig = console.error;\n try {\n console.error = noop;\n\n /**\n * `useContext` can be called conditionally during render, so this is safe.\n * (Also, during render we would want to throw as a reaction to this anyways, so it\n * wouldn't even matter if we got the order of hooks mixed up...)\n *\n * They cannot however be called outside of Render, and that's what we're testing here.\n *\n * Different versions of React have different behaviour on an invalid hook call:\n *\n * React 16.8 - 17: throws an error\n * https://github.com/facebook/react/blob/2b93d686e359c7afa299e2ec5cf63160a32a1155/packages/react/src/ReactHooks.js#L18-L26\n *\n * React 18 & 19: `console.error` in development, then `resolveDispatcher` returns `null` and a member access on `null` throws.\n * https://github.com/facebook/react/blob/58e8304483ebfadd02a295339b5e9a989ac98c6e/packages/react/src/ReactHooks.js#L28-L35\n */\n React[\"useContext\" /* hide this from the linter */](Ctx);\n return true;\n } catch (e) {\n return false;\n } finally {\n console.error = orig;\n }\n },\n []\n );\n}\n"]}
1
+ {"version":3,"file":"useRenderGuard.js","sourceRoot":"","sources":["../../../../src/react/hooks/internal/useRenderGuard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,IAAI,GAAwB,CAAC;AAE7B,SAAS,IAAI,KAAI,CAAC;AAClB,MAAM,UAAU,cAAc;IAC5B,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,+FAA+F;QAC/F,GAAG,GAAG,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,KAAK,CAAC,WAAW;IACtB;;OAEG,CAAC,GAAG,EAAE;QACP,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC;QAC3B,IAAI,CAAC;YACH,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;YAErB;;;;;;;;;;;;;;eAcG;YACH,KAAK,CAAC,YAAY,CAAC,+BAA+B,CAAC,CAAC,GAAG,CAAC,CAAC;YACzD,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,KAAK,CAAC;QACf,CAAC;gBAAS,CAAC;YACT,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;QACvB,CAAC;IACH,CAAC,EACD,EAAE,CACH,CAAC;AACJ,CAAC","sourcesContent":["import * as React from \"react\";\n\nlet Ctx: React.Context<null>;\n\nfunction noop() {}\nexport function useRenderGuard() {\n if (!Ctx) {\n // we want the initialization to be lazy because `createContext` would error on import in a RSC\n Ctx = React.createContext(null);\n }\n\n return React.useCallback(\n /**\n * @returns true if the hook was called during render\n */ () => {\n const orig = console.error;\n try {\n console.error = noop;\n\n /**\n * `useContext` can be called conditionally during render, so this is safe.\n * (Also, during render we would want to throw as a reaction to this anyways, so it\n * wouldn't even matter if we got the order of hooks mixed up...)\n *\n * They cannot however be called outside of Render, and that's what we're testing here.\n *\n * Different versions of React have different behaviour on an invalid hook call:\n *\n * React 16.8 - 17: throws an error\n * https://github.com/facebook/react/blob/2b93d686e359c7afa299e2ec5cf63160a32a1155/packages/react/src/ReactHooks.js#L18-L26\n *\n * React 18 & 19: `console.error` in development, then `resolveDispatcher` returns `null` and a member access on `null` throws.\n * https://github.com/facebook/react/blob/58e8304483ebfadd02a295339b5e9a989ac98c6e/packages/react/src/ReactHooks.js#L28-L35\n */\n React[\"useContext\" /* hide this from the linter */](Ctx);\n return true;\n } catch (e) {\n return false;\n } finally {\n console.error = orig;\n }\n },\n []\n );\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import type { DocumentNode } from "graphql";
2
+ import type { OperationVariables } from "@apollo/client";
3
+ import type { SkipToken } from "../constants.js";
4
+ export declare namespace useSuspenseHookCacheKey {
5
+ interface Options {
6
+ variables?: OperationVariables;
7
+ queryKey?: string | number | any[];
8
+ }
9
+ }
10
+ export declare function useSuspenseHookCacheKey(query: DocumentNode, options: (SkipToken & Partial<useSuspenseHookCacheKey.Options>) | useSuspenseHookCacheKey.Options): [DocumentNode, string, ...any[]];
11
+ //# sourceMappingURL=useSuspenseHookCacheKey.d.ts.map
@@ -0,0 +1,24 @@
1
+ import * as React from "react";
2
+ import { canonicalStringify } from "@apollo/client/utilities";
3
+ import { skipToken } from "../constants.js";
4
+ export function useSuspenseHookCacheKey(query, options) {
5
+ const { queryKey = [], variables } = options;
6
+ const canonicalVariables = canonicalStringify(variables);
7
+ // This state value let's us maintain the variables used for the cache key
8
+ // when `skipToken` is used to skip a query after its been executed.
9
+ // Since options aren't provided when using `skipToken`, `variables` would
10
+ // otherwise disappear which means we'd return a new cache key without a
11
+ // variables value which creates a new `ObservableQuery` instance. This was
12
+ // particularly problematic when `refetchQueries` was used because it meant
13
+ // refetching against an `ObservableQuery` instance that had no variables.
14
+ let [cacheKeyVariables, setCacheKeyVariables] = React.useState(canonicalVariables);
15
+ if (options !== skipToken && cacheKeyVariables !== canonicalVariables) {
16
+ setCacheKeyVariables((cacheKeyVariables = canonicalVariables));
17
+ }
18
+ return [
19
+ query,
20
+ cacheKeyVariables,
21
+ ...[].concat(queryKey),
22
+ ];
23
+ }
24
+ //# sourceMappingURL=useSuspenseHookCacheKey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSuspenseHookCacheKey.js","sourceRoot":"","sources":["../../../../src/react/hooks/internal/useSuspenseHookCacheKey.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAG9D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAS5C,MAAM,UAAU,uBAAuB,CACrC,KAAmB,EACnB,OAEmC;IAEnC,MAAM,EAAE,QAAQ,GAAG,EAAE,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAC7C,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAEzD,0EAA0E;IAC1E,oEAAoE;IACpE,0EAA0E;IAC1E,wEAAwE;IACxE,2EAA2E;IAC3E,2EAA2E;IAC3E,0EAA0E;IAC1E,IAAI,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAC3C,KAAK,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;IAErC,IAAI,OAAO,KAAK,SAAS,IAAI,iBAAiB,KAAK,kBAAkB,EAAE,CAAC;QACtE,oBAAoB,CAAC,CAAC,iBAAiB,GAAG,kBAAkB,CAAC,CAAC,CAAC;IACjE,CAAC;IAED,OAAO;QACL,KAAK;QACL,iBAAiB;QACjB,GAAI,EAAY,CAAC,MAAM,CAAC,QAAQ,CAAC;KACf,CAAC;AACvB,CAAC","sourcesContent":["import type { DocumentNode } from \"graphql\";\nimport * as React from \"react\";\n\nimport type { OperationVariables } from \"@apollo/client\";\nimport type { CacheKey } from \"@apollo/client/react/internal\";\nimport { canonicalStringify } from \"@apollo/client/utilities\";\n\nimport type { SkipToken } from \"../constants.js\";\nimport { skipToken } from \"../constants.js\";\n\nexport declare namespace useSuspenseHookCacheKey {\n export interface Options {\n variables?: OperationVariables;\n queryKey?: string | number | any[];\n }\n}\n\nexport function useSuspenseHookCacheKey(\n query: DocumentNode,\n options:\n | (SkipToken & Partial<useSuspenseHookCacheKey.Options>)\n | useSuspenseHookCacheKey.Options\n) {\n const { queryKey = [], variables } = options;\n const canonicalVariables = canonicalStringify(variables);\n\n // This state value let's us maintain the variables used for the cache key\n // when `skipToken` is used to skip a query after its been executed.\n // Since options aren't provided when using `skipToken`, `variables` would\n // otherwise disappear which means we'd return a new cache key without a\n // variables value which creates a new `ObservableQuery` instance. This was\n // particularly problematic when `refetchQueries` was used because it meant\n // refetching against an `ObservableQuery` instance that had no variables.\n let [cacheKeyVariables, setCacheKeyVariables] =\n React.useState(canonicalVariables);\n\n if (options !== skipToken && cacheKeyVariables !== canonicalVariables) {\n setCacheKeyVariables((cacheKeyVariables = canonicalVariables));\n }\n\n return [\n query,\n cacheKeyVariables,\n ...([] as any[]).concat(queryKey),\n ] satisfies CacheKey;\n}\n"]}
@@ -1,21 +1,18 @@
1
1
  import * as React from "react";
2
- import { canonicalStringify } from "@apollo/client/cache";
3
2
  import { getSuspenseCache, unwrapQueryRef, updateWrappedQueryRef, wrapQueryRef, } from "@apollo/client/react/internal";
4
- import { wrapHook } from "./internal/index.js";
3
+ import { useSuspenseHookCacheKey, wrapHook } from "./internal/index.js";
5
4
  import { useApolloClient } from "./useApolloClient.js";
6
5
  import { useWatchQueryOptions } from "./useSuspenseQuery.js";
7
6
  export function useBackgroundQuery(query, options) {
8
7
  "use no memo";
9
- return wrapHook("useBackgroundQuery",
10
- // eslint-disable-next-line react-compiler/react-compiler
11
- useBackgroundQuery_, useApolloClient(typeof options === "object" ? options.client : undefined))(query, options ?? {});
8
+ return wrapHook("useBackgroundQuery", useBackgroundQuery_, useApolloClient(typeof options === "object" ? options.client : undefined))(query, options ?? {});
12
9
  }
13
10
  function useBackgroundQuery_(query, options) {
14
11
  const client = useApolloClient(options.client);
15
12
  const suspenseCache = getSuspenseCache(client);
16
13
  const watchQueryOptions = useWatchQueryOptions({ client, query, options });
17
- const { fetchPolicy, variables } = watchQueryOptions;
18
- const { queryKey = [] } = options;
14
+ const { fetchPolicy } = watchQueryOptions;
15
+ const cacheKey = useSuspenseHookCacheKey(query, options);
19
16
  // This ref tracks the first time query execution is enabled to determine
20
17
  // whether to return a query ref or `undefined`. When initialized
21
18
  // in a skipped state (either via `skip: true` or `skipToken`) we return
@@ -24,11 +21,6 @@ function useBackgroundQuery_(query, options) {
24
21
  // skipped again later.
25
22
  const didFetchResult = React.useRef(fetchPolicy !== "standby");
26
23
  didFetchResult.current ||= fetchPolicy !== "standby";
27
- const cacheKey = [
28
- query,
29
- canonicalStringify(variables),
30
- ...[].concat(queryKey),
31
- ];
32
24
  const queryRef = suspenseCache.getQueryRef(cacheKey, () => client.watchQuery(watchQueryOptions));
33
25
  const [wrappedQueryRef, setWrappedQueryRef] = React.useState(wrapQueryRef(queryRef));
34
26
  if (unwrapQueryRef(wrappedQueryRef) !== queryRef) {