@apollo/client 4.0.0-rc.9 → 4.0.0

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 (173) hide show
  1. package/CHANGELOG.md +2476 -0
  2. package/README.md +6 -2
  3. package/__cjs/cache/inmemory/inMemoryCache.cjs +2 -2
  4. package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
  5. package/__cjs/cache/inmemory/policies.cjs +18 -12
  6. package/__cjs/cache/inmemory/policies.cjs.map +1 -1
  7. package/__cjs/core/ObservableQuery.d.cts +1 -1
  8. package/__cjs/core/index.cjs.map +1 -1
  9. package/__cjs/core/index.d.cts +1 -1
  10. package/__cjs/incremental/handlers/defer20220824.cjs.map +1 -1
  11. package/__cjs/incremental/handlers/defer20220824.d.cts +9 -6
  12. package/__cjs/incremental/handlers/notImplemented.cjs.map +1 -1
  13. package/__cjs/incremental/handlers/notImplemented.d.cts +11 -0
  14. package/__cjs/link/core/ApolloLink.cjs.map +1 -1
  15. package/__cjs/link/core/ApolloLink.d.cts +5 -2
  16. package/__cjs/link/core/types.d.cts +0 -4
  17. package/__cjs/link/index.cjs.map +1 -1
  18. package/__cjs/link/index.d.cts +2 -1
  19. package/__cjs/link/remove-typename/removeTypenameFromVariables.cjs +2 -2
  20. package/__cjs/link/remove-typename/removeTypenameFromVariables.cjs.map +1 -1
  21. package/__cjs/link/remove-typename/removeTypenameFromVariables.d.cts +2 -2
  22. package/__cjs/local-state/LocalState.cjs.map +1 -1
  23. package/__cjs/masking/GraphQLCodegenDataMasking.d.cts +10 -42
  24. package/__cjs/masking/PreserveTypes.cjs +3 -0
  25. package/__cjs/masking/PreserveTypes.cjs.map +1 -0
  26. package/__cjs/masking/PreserveTypes.d.cts +26 -0
  27. package/__cjs/masking/index.cjs.map +1 -1
  28. package/__cjs/masking/index.d.cts +1 -1
  29. package/__cjs/masking/internal/types.d.cts +0 -1
  30. package/__cjs/masking/types.d.cts +6 -23
  31. package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
  32. package/__cjs/react/hooks/useBackgroundQuery.d.cts +2 -1
  33. package/__cjs/react/hooks/useLazyQuery.d.cts +1 -1
  34. package/__cjs/react/hooks/useLoadableQuery.cjs.map +1 -1
  35. package/__cjs/react/hooks/useLoadableQuery.d.cts +2 -1
  36. package/__cjs/react/hooks/useQuery.d.cts +1 -1
  37. package/__cjs/react/hooks/useQueryRefHandlers.cjs.map +1 -1
  38. package/__cjs/react/hooks/useQueryRefHandlers.d.cts +2 -1
  39. package/__cjs/react/hooks/useReadQuery.cjs.map +1 -1
  40. package/__cjs/react/hooks/useReadQuery.d.cts +1 -1
  41. package/__cjs/react/query-preloader/createQueryPreloader.cjs.map +1 -1
  42. package/__cjs/react/query-preloader/createQueryPreloader.d.cts +1 -1
  43. package/__cjs/react/types/deprecated.d.cts +1 -1
  44. package/__cjs/react/types/types.documentation.d.cts +1 -1
  45. package/__cjs/testing/core/mocking/mockSubscriptionLink.d.cts +1 -1
  46. package/__cjs/testing/react/MockedProvider.cjs.map +1 -1
  47. package/__cjs/testing/react/MockedProvider.d.cts +5 -0
  48. package/__cjs/utilities/common/stripTypename.cjs +11 -0
  49. package/__cjs/utilities/common/stripTypename.cjs.map +1 -1
  50. package/__cjs/utilities/common/stripTypename.d.cts +11 -0
  51. package/__cjs/utilities/graphql/DocumentTransform.cjs +84 -1
  52. package/__cjs/utilities/graphql/DocumentTransform.cjs.map +1 -1
  53. package/__cjs/utilities/graphql/DocumentTransform.d.cts +94 -5
  54. package/__cjs/utilities/graphql/isFormattedExecutionResult.cjs +27 -0
  55. package/__cjs/utilities/graphql/isFormattedExecutionResult.cjs.map +1 -1
  56. package/__cjs/utilities/graphql/isFormattedExecutionResult.d.cts +27 -0
  57. package/__cjs/utilities/graphql/operations.cjs +54 -3
  58. package/__cjs/utilities/graphql/operations.cjs.map +1 -1
  59. package/__cjs/utilities/graphql/operations.d.cts +54 -3
  60. package/__cjs/utilities/graphql/storeUtils.cjs +9 -0
  61. package/__cjs/utilities/graphql/storeUtils.cjs.map +1 -1
  62. package/__cjs/utilities/graphql/storeUtils.d.cts +9 -0
  63. package/__cjs/utilities/graphql/transform.cjs +12 -1
  64. package/__cjs/utilities/graphql/transform.cjs.map +1 -1
  65. package/__cjs/utilities/graphql/transform.d.cts +12 -1
  66. package/__cjs/utilities/internal/canonicalStringify.cjs +30 -7
  67. package/__cjs/utilities/internal/canonicalStringify.cjs.map +1 -1
  68. package/__cjs/utilities/internal/canonicalStringify.d.cts +30 -7
  69. package/__cjs/utilities/internal/getMainDefinition.cjs +36 -8
  70. package/__cjs/utilities/internal/getMainDefinition.cjs.map +1 -1
  71. package/__cjs/utilities/internal/getMainDefinition.d.cts +36 -8
  72. package/__cjs/utilities/internal/types/DocumentationTypes.d.cts +1 -1
  73. package/__cjs/v4-migration.cjs +9 -0
  74. package/__cjs/v4-migration.cjs.map +1 -0
  75. package/__cjs/v4-migration.d.cts +826 -0
  76. package/__cjs/version.cjs +1 -1
  77. package/__cjs/version.cjs.map +1 -1
  78. package/cache/inmemory/inMemoryCache.js +2 -2
  79. package/cache/inmemory/inMemoryCache.js.map +1 -1
  80. package/cache/inmemory/policies.js +18 -12
  81. package/cache/inmemory/policies.js.map +1 -1
  82. package/core/ObservableQuery.d.ts +1 -1
  83. package/core/index.d.ts +1 -1
  84. package/core/index.js.map +1 -1
  85. package/incremental/handlers/defer20220824.d.ts +9 -6
  86. package/incremental/handlers/defer20220824.js.map +1 -1
  87. package/incremental/handlers/notImplemented.d.ts +11 -0
  88. package/incremental/handlers/notImplemented.js.map +1 -1
  89. package/legacyEntryPoints/v4-migration/index.d.ts +1 -0
  90. package/legacyEntryPoints/v4-migration/index.js +1 -0
  91. package/legacyEntryPoints/v4-migration/v4-migration.cjs +1 -0
  92. package/legacyEntryPoints/v4-migration/v4-migration.d.cts +1 -0
  93. package/link/core/ApolloLink.d.ts +5 -2
  94. package/link/core/ApolloLink.js.map +1 -1
  95. package/link/core/types.d.ts +0 -4
  96. package/link/core/types.js.map +1 -1
  97. package/link/index.d.ts +2 -1
  98. package/link/index.js.map +1 -1
  99. package/link/remove-typename/removeTypenameFromVariables.d.ts +2 -2
  100. package/link/remove-typename/removeTypenameFromVariables.js +2 -2
  101. package/link/remove-typename/removeTypenameFromVariables.js.map +1 -1
  102. package/local-state/LocalState.js.map +1 -1
  103. package/masking/GraphQLCodegenDataMasking.d.ts +10 -42
  104. package/masking/GraphQLCodegenDataMasking.js.map +1 -1
  105. package/masking/PreserveTypes.d.ts +26 -0
  106. package/masking/PreserveTypes.js +2 -0
  107. package/masking/PreserveTypes.js.map +1 -0
  108. package/masking/index.d.ts +1 -1
  109. package/masking/index.js.map +1 -1
  110. package/masking/internal/types.d.ts +0 -1
  111. package/masking/internal/types.js.map +1 -1
  112. package/masking/types.d.ts +6 -23
  113. package/masking/types.js.map +1 -1
  114. package/package.json +8 -2
  115. package/react/hooks/useBackgroundQuery.d.ts +2 -1
  116. package/react/hooks/useBackgroundQuery.js.map +1 -1
  117. package/react/hooks/useLazyQuery.d.ts +1 -1
  118. package/react/hooks/useLoadableQuery.d.ts +2 -1
  119. package/react/hooks/useLoadableQuery.js.map +1 -1
  120. package/react/hooks/useQuery.d.ts +1 -1
  121. package/react/hooks/useQueryRefHandlers.d.ts +2 -1
  122. package/react/hooks/useQueryRefHandlers.js.map +1 -1
  123. package/react/hooks/useReadQuery.d.ts +1 -1
  124. package/react/hooks/useReadQuery.js.map +1 -1
  125. package/react/hooks-compiled/useBackgroundQuery.d.ts +2 -1
  126. package/react/hooks-compiled/useBackgroundQuery.js.map +1 -1
  127. package/react/hooks-compiled/useLazyQuery.d.ts +1 -1
  128. package/react/hooks-compiled/useLoadableQuery.d.ts +2 -1
  129. package/react/hooks-compiled/useLoadableQuery.js.map +1 -1
  130. package/react/hooks-compiled/useQuery.d.ts +1 -1
  131. package/react/hooks-compiled/useQueryRefHandlers.d.ts +2 -1
  132. package/react/hooks-compiled/useQueryRefHandlers.js.map +1 -1
  133. package/react/hooks-compiled/useReadQuery.d.ts +1 -1
  134. package/react/hooks-compiled/useReadQuery.js.map +1 -1
  135. package/react/query-preloader/createQueryPreloader.d.ts +1 -1
  136. package/react/query-preloader/createQueryPreloader.js.map +1 -1
  137. package/react/types/deprecated.d.ts +1 -1
  138. package/react/types/deprecated.js.map +1 -1
  139. package/react/types/types.documentation.d.ts +1 -1
  140. package/react/types/types.documentation.js.map +1 -1
  141. package/testing/core/mocking/mockSubscriptionLink.d.ts +1 -1
  142. package/testing/react/MockedProvider.d.ts +5 -0
  143. package/testing/react/MockedProvider.js.map +1 -1
  144. package/utilities/common/stripTypename.d.ts +11 -0
  145. package/utilities/common/stripTypename.js +11 -0
  146. package/utilities/common/stripTypename.js.map +1 -1
  147. package/utilities/graphql/DocumentTransform.d.ts +94 -5
  148. package/utilities/graphql/DocumentTransform.js +84 -1
  149. package/utilities/graphql/DocumentTransform.js.map +1 -1
  150. package/utilities/graphql/isFormattedExecutionResult.d.ts +27 -0
  151. package/utilities/graphql/isFormattedExecutionResult.js +27 -0
  152. package/utilities/graphql/isFormattedExecutionResult.js.map +1 -1
  153. package/utilities/graphql/operations.d.ts +54 -3
  154. package/utilities/graphql/operations.js +54 -3
  155. package/utilities/graphql/operations.js.map +1 -1
  156. package/utilities/graphql/storeUtils.d.ts +9 -0
  157. package/utilities/graphql/storeUtils.js +9 -0
  158. package/utilities/graphql/storeUtils.js.map +1 -1
  159. package/utilities/graphql/transform.d.ts +12 -1
  160. package/utilities/graphql/transform.js +12 -1
  161. package/utilities/graphql/transform.js.map +1 -1
  162. package/utilities/internal/canonicalStringify.d.ts +30 -7
  163. package/utilities/internal/canonicalStringify.js +30 -7
  164. package/utilities/internal/canonicalStringify.js.map +1 -1
  165. package/utilities/internal/getMainDefinition.d.ts +37 -9
  166. package/utilities/internal/getMainDefinition.js +36 -8
  167. package/utilities/internal/getMainDefinition.js.map +1 -1
  168. package/utilities/internal/types/DocumentationTypes.d.ts +1 -1
  169. package/v4-migration.d.ts +826 -0
  170. package/v4-migration.js +8 -0
  171. package/v4-migration.js.map +1 -0
  172. package/version.js +1 -1
  173. package/version.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"types.documentation.js","sourceRoot":"","sources":["../../../src/react/types/types.documentation.ts"],"names":[],"mappings":"","sourcesContent":["export interface QueryOptionsDocumentation {\n /**\n * A GraphQL query string parsed into an AST with the gql template literal.\n *\n * @docGroup 1. Operation options\n */\n query: unknown;\n\n /**\n * An object containing all of the GraphQL variables your query requires to execute.\n *\n * Each key in the object corresponds to a variable name, and that key's value corresponds to the variable value.\n *\n * @docGroup 1. Operation options\n */\n variables: unknown;\n\n /**\n * Specifies how the query handles a response that returns both GraphQL errors and partial results.\n *\n * For details, see [GraphQL error policies](https://www.apollographql.com/docs/react/data/error-handling/#graphql-error-policies).\n *\n * The default value is `none`, meaning that the query result includes error details but not partial results.\n *\n * @docGroup 1. Operation options\n */\n errorPolicy: unknown;\n\n /**\n * If you're using [Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/), this object is the initial value of the `context` object that's passed along your link chain.\n *\n * @docGroup 2. Networking options\n */\n context: unknown;\n\n /**\n * Specifies how the query interacts with the Apollo Client cache during execution (for example, whether it checks the cache for results before sending a request to the server).\n *\n * For details, see [Setting a fetch policy](https://www.apollographql.com/docs/react/data/queries/#setting-a-fetch-policy).\n *\n * The default value is `cache-first`.\n *\n * @docGroup 3. Caching options\n */\n fetchPolicy: unknown;\n\n /**\n * Specifies the `FetchPolicy` to be used after this query has completed.\n *\n * @docGroup 3. Caching options\n */\n nextFetchPolicy: unknown;\n\n /**\n * Defaults to the initial value of options.fetchPolicy, but can be explicitly\n * configured to specify the WatchQueryFetchPolicy to revert back to whenever\n * variables change (unless nextFetchPolicy intervenes).\n *\n * @docGroup 3. Caching options\n */\n initialFetchPolicy: unknown;\n\n /**\n * Specifies the interval (in milliseconds) at which the query polls for updated results.\n *\n * The default value is `0` (no polling).\n *\n * @docGroup 2. Networking options\n */\n pollInterval: unknown;\n\n /**\n * If `true`, the in-progress query's associated component re-renders whenever the network status changes or a network error occurs.\n *\n * The default value is `true`.\n *\n * @docGroup 2. Networking options\n */\n notifyOnNetworkStatusChange: unknown;\n\n /**\n * If `true`, the query can return partial results from the cache if the cache doesn't contain results for all queried fields.\n *\n * The default value is `false`.\n *\n * @docGroup 3. Caching options\n */\n returnPartialData: unknown;\n\n /**\n * Specifies whether a `NetworkStatus.refetch` operation should merge\n * incoming field data with existing data, or overwrite the existing data.\n * Overwriting is probably preferable, but merging is currently the default\n * behavior, for backwards compatibility with Apollo Client 3.x.\n *\n * @docGroup 3. Caching options\n */\n refetchWritePolicy: unknown;\n\n /**\n * Watched queries must opt into overwriting existing data on refetch, by passing refetchWritePolicy: \"overwrite\" in their WatchQueryOptions.\n *\n * The default value is \"overwrite\".\n *\n * @docGroup 3. Caching options\n */\n refetchWritePolicy_suspense: unknown;\n\n /**\n * If true, the query is not executed.\n *\n * The default value is `false`.\n *\n * @docGroup 1. Operation options\n */\n skip: unknown;\n\n /**\n * If `true`, the query is not executed. The default value is `false`.\n *\n * @deprecated We recommend using `skipToken` in place of the `skip` option as\n * it is more type-safe.\n *\n * This option is deprecated and only supported to ease the migration from `useQuery`. It will be removed in a future release.\n * Please use [`skipToken`](https://www.apollographql.com/docs/react/api/react/hooks#skiptoken) instead of the `skip` option as it is more type-safe.\n *\n * @docGroup 1. Operation options\n */\n skip_deprecated: unknown;\n\n /**\n * The instance of `ApolloClient` to use to execute the query.\n *\n * By default, the instance that's passed down via context is used, but you\n * can provide a different instance here.\n *\n * @docGroup 1. Operation options\n */\n client: unknown;\n\n /**\n * A unique identifier for the query. Each item in the array must be a stable\n * identifier to prevent infinite fetches.\n *\n * This is useful when using the same query and variables combination in more\n * than one component, otherwise the components may clobber each other. This\n * can also be used to force the query to re-evaluate fresh.\n *\n * @docGroup 1. Operation options\n */\n queryKey: unknown;\n\n /**\n * Pass `false` to skip executing the query during [server-side rendering](https://www.apollographql.com/docs/react/performance/server-side-rendering/).\n *\n * @docGroup 2. Networking options\n */\n ssr: unknown;\n\n /**\n * A callback function that's called whenever a refetch attempt occurs\n * while polling. If the function returns `true`, the refetch is\n * skipped and not reattempted until the next poll interval.\n *\n * @docGroup 2. Networking options\n */\n skipPollAttempt: unknown;\n}\n\nexport interface QueryResultDocumentation {\n /**\n * The instance of Apollo Client that executed the query.\n * Can be useful for manually executing followup queries or writing data to the cache.\n *\n * @docGroup 2. Network info\n */\n client: unknown;\n /**\n * A reference to the internal `ObservableQuery` used by the hook.\n */\n observable: unknown;\n /**\n * An object containing the result of your GraphQL query after it completes.\n *\n * This value might be `undefined` if a query results in one or more errors (depending on the query's `errorPolicy`).\n *\n * @docGroup 1. Operation data\n */\n data: unknown;\n /**\n * An object containing the result from the most recent _previous_ execution of this query.\n *\n * This value is `undefined` if this is the query's first execution.\n *\n * @docGroup 1. Operation data\n */\n previousData: unknown;\n /**\n * A single ErrorLike object describing the error that occured during the latest\n * query execution.\n *\n * For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).\n *\n * @docGroup 1. Operation data\n */\n error: unknown;\n /**\n * If `true`, the query is still in flight and results have not yet been returned.\n *\n * @docGroup 2. Network info\n */\n loading: unknown;\n /**\n * A number indicating the current network state of the query's associated request. [See possible values.](https://github.com/apollographql/apollo-client/blob/d96f4578f89b933c281bb775a39503f6cdb59ee8/src/core/networkStatus.ts#L4)\n *\n * Used in conjunction with the [`notifyOnNetworkStatusChange`](#notifyonnetworkstatuschange) option.\n *\n * @docGroup 2. Network info\n */\n networkStatus: unknown;\n /**\n * An object containing the variables that were provided for the query.\n *\n * @docGroup 1. Operation data\n */\n variables: unknown;\n\n /**\n * A function that enables you to re-execute the query, optionally passing in new `variables`.\n *\n * To guarantee that the refetch performs a network request, its `fetchPolicy` is set to `network-only` (unless the original query's `fetchPolicy` is `no-cache` or `cache-and-network`, which also guarantee a network request).\n *\n * See also [Refetching](https://www.apollographql.com/docs/react/data/queries/#refetching).\n *\n * Returns a `ResultPromise` with an additional `.retain()` method. Calling\n * `.retain()` keeps the network operation running even if the `ObservableQuery`\n * no longer requires the result.\n *\n * @docGroup 3. Helper functions\n */\n refetch: unknown;\n /**\n * {@inheritDoc @apollo/client!ObservableQuery#fetchMore:member(1)}\n *\n * @docGroup 3. Helper functions\n */\n fetchMore: unknown;\n /**\n * {@inheritDoc @apollo/client!ObservableQuery#startPolling:member(1)}\n *\n * @docGroup 3. Helper functions\n */\n startPolling: unknown;\n /**\n * {@inheritDoc @apollo/client!ObservableQuery#stopPolling:member(1)}\n *\n * @docGroup 3. Helper functions\n */\n stopPolling: unknown;\n /**\n * {@inheritDoc @apollo/client!ObservableQuery#subscribeToMore:member(1)}\n *\n * @docGroup 3. Helper functions\n */\n subscribeToMore: unknown;\n /**\n * {@inheritDoc @apollo/client!ObservableQuery#updateQuery:member(1)}\n *\n * @docGroup 3. Helper functions\n */\n updateQuery: unknown;\n\n /**\n * Describes the completeness of `data`.\n *\n * - `empty`: No data could be fulfilled from the cache or the result is\n * incomplete. `data` is `undefined`.\n * - `partial`: Some data could be fulfilled from the cache but `data` is\n * incomplete. This is only possible when `returnPartialData` is `true`.\n * - `streaming`: `data` is incomplete as a result of a deferred query and\n * the result is still streaming in.\n * - `complete`: `data` is a fully satisfied query result fulfilled\n * either from the cache or network.\n *\n * @docGroup 1. Operation data\n */\n dataState: unknown;\n\n /**\n * Describes whether `data` is a complete or partial result. This flag is only\n * set when `returnPartialData` is `true` in query options.\n *\n * @deprecated This field will be removed in a future version of Apollo Client.\n * @docGroup 1. Operation data\n */\n partial: boolean;\n}\n\nexport interface MutationOptionsDocumentation {\n /**\n * A GraphQL document, often created with `gql` from the `graphql-tag`\n * package, that contains a single mutation inside of it.\n *\n * @docGroup 1. Operation options\n */\n mutation: unknown;\n\n /**\n * Provide `no-cache` if the mutation's result should _not_ be written to the Apollo Client cache.\n *\n * The default value is `network-only` (which means the result _is_ written to the cache).\n *\n * Unlike queries, mutations _do not_ support [fetch policies](https://www.apollographql.com/docs/react/data/queries/#setting-a-fetch-policy) besides `network-only` and `no-cache`.\n *\n * @docGroup 3. Caching options\n */\n fetchPolicy: unknown;\n\n /**\n * To avoid retaining sensitive information from mutation root field\n * arguments, Apollo Client v3.4+ automatically clears any `ROOT_MUTATION`\n * fields from the cache after each mutation finishes. If you need this\n * information to remain in the cache, you can prevent the removal by passing\n * `keepRootFields: true` to the mutation. `ROOT_MUTATION` result data are\n * also passed to the mutation `update` function, so we recommend obtaining\n * the results that way, rather than using this option, if possible.\n */\n keepRootFields: unknown;\n\n /**\n * By providing either an object or a callback function that, when invoked after\n * a mutation, allows you to return optimistic data and optionally skip updates\n * via the `IGNORE` sentinel object, Apollo Client caches this temporary\n * (and potentially incorrect) response until the mutation completes, enabling\n * more responsive UI updates.\n *\n * For more information, see [Optimistic mutation results](https://www.apollographql.com/docs/react/performance/optimistic-ui/).\n *\n * @docGroup 3. Caching options\n */\n optimisticResponse: unknown;\n\n /**\n * A `MutationQueryReducersMap`, which is map from query names to\n * mutation query reducers. Briefly, this map defines how to incorporate the\n * results of the mutation into the results of queries that are currently\n * being watched by your application.\n */\n updateQueries: unknown;\n\n /**\n * An array (or a function that _returns_ an array) that specifies which queries you want to refetch after the mutation occurs.\n *\n * Each array value can be either:\n *\n * - An object containing the `query` to execute, along with any `variables`\n *\n * - A string indicating the operation name of the query to refetch\n *\n * @docGroup 1. Operation options\n */\n refetchQueries: unknown;\n\n /**\n * If `true`, makes sure all queries included in `refetchQueries` are completed before the mutation is considered complete.\n *\n * The default value is `false` (queries are refetched asynchronously).\n *\n * @docGroup 1. Operation options\n */\n awaitRefetchQueries: unknown;\n\n /**\n * A function used to update the Apollo Client cache after the mutation completes.\n *\n * For more information, see [Updating the cache after a mutation](https://www.apollographql.com/docs/react/data/mutations#updating-the-cache-after-a-mutation).\n *\n * @docGroup 3. Caching options\n */\n update: unknown;\n\n /**\n * Optional callback for intercepting queries whose cache data has been updated by the mutation, as well as any queries specified in the `refetchQueries: [...]` list passed to `client.mutate`.\n *\n * Returning a `Promise` from `onQueryUpdated` will cause the final mutation `Promise` to await the returned `Promise`. Returning `false` causes the query to be ignored.\n *\n * @docGroup 1. Operation options\n */\n onQueryUpdated: unknown;\n\n /**\n * Specifies how the mutation handles a response that returns both GraphQL errors and partial results.\n *\n * For details, see [GraphQL error policies](https://www.apollographql.com/docs/react/data/error-handling/#graphql-error-policies).\n *\n * The default value is `none`, meaning that the mutation result includes error details but _not_ partial results.\n *\n * @docGroup 1. Operation options\n */\n errorPolicy: unknown;\n\n /**\n * An object containing all of the GraphQL variables your mutation requires to execute.\n *\n * Each key in the object corresponds to a variable name, and that key's value corresponds to the variable value.\n *\n * @docGroup 1. Operation options\n */\n variables: unknown;\n\n /**\n * If you're using [Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/), this object is the initial value of the `context` object that's passed along your link chain.\n *\n * @docGroup 2. Networking options\n */\n context: unknown;\n\n /**\n * The instance of `ApolloClient` to use to execute the mutation.\n *\n * By default, the instance that's passed down via context is used, but you can provide a different instance here.\n *\n * @docGroup 2. Networking options\n */\n client: unknown;\n /**\n * If `true`, the in-progress mutation's associated component re-renders whenever the network status changes or a network error occurs.\n *\n * The default value is `true`.\n *\n * @docGroup 2. Networking options\n */\n notifyOnNetworkStatusChange: unknown;\n /**\n * A callback function that's called when your mutation successfully completes with zero errors (or if `errorPolicy` is `ignore` and partial data is returned).\n *\n * This function is passed the mutation's result `data` and any options passed to the mutation.\n *\n * @docGroup 1. Operation options\n */\n onCompleted: unknown;\n /**\n * A callback function that's called when the mutation encounters one or more errors (unless `errorPolicy` is `ignore`).\n *\n * This function is passed an [`ApolloError`](https://github.com/apollographql/apollo-client/blob/d96f4578f89b933c281bb775a39503f6cdb59ee8/src/errors/index.ts#L36-L39) object that contains either a `networkError` object or a `graphQLErrors` array, depending on the error(s) that occurred, as well as any options passed the mutation.\n *\n * @docGroup 1. Operation options\n */\n onError: unknown;\n /**\n * If `true`:\n *\n * - The initial state update (setting loading to true) is skipped\n * - The success state update (setting data and setting loading to false) is skipped\n * - Error updates will still occur\n *\n * The default value is `false`.\n *\n * This option is useful when you want to execute a mutation but don't need to track its progress or result in the UI, potentially improving performance by reducing re-renders.\n *\n * @docGroup 1. Operation options\n */\n ignoreResults: unknown;\n}\n\nexport interface MutationResultDocumentation {\n /**\n * The data returned from your mutation. Can be `undefined` if `ignoreResults` is `true`.\n */\n data: unknown;\n /**\n * If the mutation produces one or more errors, this object contains either an array of `graphQLErrors` or a single `networkError`. Otherwise, this value is `undefined`.\n *\n * For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).\n */\n error: unknown;\n /**\n * If `true`, the mutation is currently in flight.\n */\n loading: unknown;\n /**\n * If `true`, the mutation's mutate function has been called.\n */\n called: unknown;\n /**\n * The instance of Apollo Client that executed the mutation.\n *\n * Can be useful for manually executing followup operations or writing data to the cache.\n */\n client: unknown;\n /**\n * A function that you can call to reset the mutation's result to its initial, uncalled state.\n */\n reset: unknown;\n /**\n * Custom extensions returned from the GraphQL server\n */\n extensions: unknown;\n}\n\nexport interface SubscriptionOptionsDocumentation {\n /**\n * A GraphQL document, often created with `gql` from the `graphql-tag`\n * package, that contains a single subscription inside of it.\n */\n query: unknown;\n /**\n * An object containing all of the variables your subscription needs to execute\n */\n variables: unknown;\n\n /**\n * Specifies the `ErrorPolicy` to be used for this operation\n */\n errorPolicy: unknown;\n\n /**\n * How you want your component to interact with the Apollo cache. For details, see [Setting a fetch policy](https://www.apollographql.com/docs/react/data/queries/#setting-a-fetch-policy).\n */\n fetchPolicy: unknown;\n\n /**\n * Determines if your subscription should be unsubscribed and subscribed again when an input to the hook (such as `subscription` or `variables`) changes.\n */\n shouldResubscribe: unknown;\n\n /**\n * If `true`, the hook will not cause the component to rerender. This is useful when you want to control the rendering of your component yourself with logic in the `onData` and `onError` callbacks.\n *\n * Changing this to `true` when the hook already has `data` will reset the `data` to `undefined`.\n */\n ignoreResults: unknown;\n /**\n * An `ApolloClient` instance. By default `useSubscription` / `Subscription` uses the client passed down via context, but a different client can be passed in.\n */\n client: unknown;\n\n /**\n * Determines if the current subscription should be skipped. Useful if, for example, variables depend on previous queries and are not ready yet.\n */\n skip: unknown;\n\n /**\n * Shared context between your component and your network interface (Apollo Link).\n */\n context: unknown;\n\n /**\n * Shared context between your component and your network interface (Apollo Link).\n */\n extensions: unknown;\n\n /**\n * Allows the registration of a callback function that will be triggered each time the `useSubscription` Hook / `Subscription` component completes the subscription.\n */\n onComplete: unknown;\n\n /**\n * Allows the registration of a callback function that will be triggered each time the `useSubscription` Hook / `Subscription` component receives data. The callback `options` object param consists of the current Apollo Client instance in `client`, and the received subscription data in `data`.\n */\n onData: unknown;\n\n /**\n * Allows the registration of a callback function that will be triggered each time the `useSubscription` Hook / `Subscription` component receives an error.\n */\n onError: unknown;\n}\n\nexport interface SubscriptionResultDocumentation {\n /**\n * A boolean that indicates whether any initial data has been returned\n */\n loading: unknown;\n /**\n * An object containing the result of your GraphQL subscription. Defaults to an empty object.\n */\n data: unknown;\n /**\n * A runtime error with `graphQLErrors` and `networkError` properties\n */\n error: unknown;\n}\n"]}
1
+ {"version":3,"file":"types.documentation.js","sourceRoot":"","sources":["../../../src/react/types/types.documentation.ts"],"names":[],"mappings":"","sourcesContent":["export interface QueryOptionsDocumentation {\n /**\n * A GraphQL query string parsed into an AST with the gql template literal.\n *\n * @docGroup 1. Operation options\n */\n query: unknown;\n\n /**\n * An object containing all of the GraphQL variables your query requires to execute.\n *\n * Each key in the object corresponds to a variable name, and that key's value corresponds to the variable value.\n *\n * @docGroup 1. Operation options\n */\n variables: unknown;\n\n /**\n * Specifies how the query handles a response that returns both GraphQL errors and partial results.\n *\n * For details, see [GraphQL error policies](https://www.apollographql.com/docs/react/data/error-handling/#graphql-error-policies).\n *\n * The default value is `none`, meaning that the query result includes error details but not partial results.\n *\n * @docGroup 1. Operation options\n */\n errorPolicy: unknown;\n\n /**\n * If you're using [Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/), this object is the initial value of the `context` object that's passed along your link chain.\n *\n * @docGroup 2. Networking options\n */\n context: unknown;\n\n /**\n * Specifies how the query interacts with the Apollo Client cache during execution (for example, whether it checks the cache for results before sending a request to the server).\n *\n * For details, see [Setting a fetch policy](https://www.apollographql.com/docs/react/data/queries/#setting-a-fetch-policy).\n *\n * The default value is `cache-first`.\n *\n * @docGroup 3. Caching options\n */\n fetchPolicy: unknown;\n\n /**\n * Specifies the `FetchPolicy` to be used after this query has completed.\n *\n * @docGroup 3. Caching options\n */\n nextFetchPolicy: unknown;\n\n /**\n * Defaults to the initial value of options.fetchPolicy, but can be explicitly\n * configured to specify the WatchQueryFetchPolicy to revert back to whenever\n * variables change (unless nextFetchPolicy intervenes).\n *\n * @docGroup 3. Caching options\n */\n initialFetchPolicy: unknown;\n\n /**\n * Specifies the interval (in milliseconds) at which the query polls for updated results.\n *\n * The default value is `0` (no polling).\n *\n * @docGroup 2. Networking options\n */\n pollInterval: unknown;\n\n /**\n * If `true`, the in-progress query's associated component re-renders whenever the network status changes or a network error occurs.\n *\n * The default value is `true`.\n *\n * @docGroup 2. Networking options\n */\n notifyOnNetworkStatusChange: unknown;\n\n /**\n * If `true`, the query can return partial results from the cache if the cache doesn't contain results for all queried fields.\n *\n * The default value is `false`.\n *\n * @docGroup 3. Caching options\n */\n returnPartialData: unknown;\n\n /**\n * Specifies whether a `NetworkStatus.refetch` operation should merge\n * incoming field data with existing data, or overwrite the existing data.\n * Overwriting is probably preferable, but merging is currently the default\n * behavior, for backwards compatibility with Apollo Client 3.x.\n *\n * @docGroup 3. Caching options\n */\n refetchWritePolicy: unknown;\n\n /**\n * Watched queries must opt into overwriting existing data on refetch, by passing refetchWritePolicy: \"overwrite\" in their WatchQueryOptions.\n *\n * The default value is \"overwrite\".\n *\n * @docGroup 3. Caching options\n */\n refetchWritePolicy_suspense: unknown;\n\n /**\n * If true, the query is not executed.\n *\n * The default value is `false`.\n *\n * @docGroup 1. Operation options\n */\n skip: unknown;\n\n /**\n * If `true`, the query is not executed. The default value is `false`.\n *\n * @deprecated We recommend using `skipToken` in place of the `skip` option as\n * it is more type-safe.\n *\n * This option is deprecated and only supported to ease the migration from `useQuery`. It will be removed in a future release.\n * Please use [`skipToken`](https://www.apollographql.com/docs/react/api/react/hooks#skiptoken) instead of the `skip` option as it is more type-safe.\n *\n * @docGroup 1. Operation options\n */\n skip_deprecated: unknown;\n\n /**\n * The instance of `ApolloClient` to use to execute the query.\n *\n * By default, the instance that's passed down via context is used, but you\n * can provide a different instance here.\n *\n * @docGroup 1. Operation options\n */\n client: unknown;\n\n /**\n * A unique identifier for the query. Each item in the array must be a stable\n * identifier to prevent infinite fetches.\n *\n * This is useful when using the same query and variables combination in more\n * than one component, otherwise the components may clobber each other. This\n * can also be used to force the query to re-evaluate fresh.\n *\n * @docGroup 1. Operation options\n */\n queryKey: unknown;\n\n /**\n * Pass `false` to skip executing the query during [server-side rendering](https://www.apollographql.com/docs/react/performance/server-side-rendering/).\n *\n * @docGroup 2. Networking options\n */\n ssr: unknown;\n\n /**\n * A callback function that's called whenever a refetch attempt occurs\n * while polling. If the function returns `true`, the refetch is\n * skipped and not reattempted until the next poll interval.\n *\n * @docGroup 2. Networking options\n */\n skipPollAttempt: unknown;\n}\n\nexport interface QueryResultDocumentation {\n /**\n * The instance of Apollo Client that executed the query.\n * Can be useful for manually executing followup queries or writing data to the cache.\n *\n * @docGroup 2. Network info\n */\n client: unknown;\n /**\n * A reference to the internal `ObservableQuery` used by the hook.\n */\n observable: unknown;\n /**\n * An object containing the result of your GraphQL query after it completes.\n *\n * This value might be `undefined` if a query results in one or more errors (depending on the query's `errorPolicy`).\n *\n * @docGroup 1. Operation data\n */\n data: unknown;\n /**\n * An object containing the result from the most recent _previous_ execution of this query.\n *\n * This value is `undefined` if this is the query's first execution.\n *\n * @docGroup 1. Operation data\n */\n previousData: unknown;\n /**\n * A single ErrorLike object describing the error that occured during the latest\n * query execution.\n *\n * For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).\n *\n * @docGroup 1. Operation data\n */\n error: unknown;\n /**\n * If `true`, the query is still in flight.\n *\n * @docGroup 2. Network info\n */\n loading: unknown;\n /**\n * A number indicating the current network state of the query's associated request. [See possible values.](https://github.com/apollographql/apollo-client/blob/d96f4578f89b933c281bb775a39503f6cdb59ee8/src/core/networkStatus.ts#L4)\n *\n * Used in conjunction with the [`notifyOnNetworkStatusChange`](#notifyonnetworkstatuschange) option.\n *\n * @docGroup 2. Network info\n */\n networkStatus: unknown;\n /**\n * An object containing the variables that were provided for the query.\n *\n * @docGroup 1. Operation data\n */\n variables: unknown;\n\n /**\n * A function that enables you to re-execute the query, optionally passing in new `variables`.\n *\n * To guarantee that the refetch performs a network request, its `fetchPolicy` is set to `network-only` (unless the original query's `fetchPolicy` is `no-cache` or `cache-and-network`, which also guarantee a network request).\n *\n * See also [Refetching](https://www.apollographql.com/docs/react/data/queries/#refetching).\n *\n * Returns a `ResultPromise` with an additional `.retain()` method. Calling\n * `.retain()` keeps the network operation running even if the `ObservableQuery`\n * no longer requires the result.\n *\n * @docGroup 3. Helper functions\n */\n refetch: unknown;\n /**\n * {@inheritDoc @apollo/client!ObservableQuery#fetchMore:member(1)}\n *\n * @docGroup 3. Helper functions\n */\n fetchMore: unknown;\n /**\n * {@inheritDoc @apollo/client!ObservableQuery#startPolling:member(1)}\n *\n * @docGroup 3. Helper functions\n */\n startPolling: unknown;\n /**\n * {@inheritDoc @apollo/client!ObservableQuery#stopPolling:member(1)}\n *\n * @docGroup 3. Helper functions\n */\n stopPolling: unknown;\n /**\n * {@inheritDoc @apollo/client!ObservableQuery#subscribeToMore:member(1)}\n *\n * @docGroup 3. Helper functions\n */\n subscribeToMore: unknown;\n /**\n * {@inheritDoc @apollo/client!ObservableQuery#updateQuery:member(1)}\n *\n * @docGroup 3. Helper functions\n */\n updateQuery: unknown;\n\n /**\n * Describes the completeness of `data`.\n *\n * - `empty`: No data could be fulfilled from the cache or the result is\n * incomplete. `data` is `undefined`.\n * - `partial`: Some data could be fulfilled from the cache but `data` is\n * incomplete. This is only possible when `returnPartialData` is `true`.\n * - `streaming`: `data` is incomplete as a result of a deferred query and\n * the result is still streaming in.\n * - `complete`: `data` is a fully satisfied query result fulfilled\n * either from the cache or network.\n *\n * @docGroup 1. Operation data\n */\n dataState: unknown;\n\n /**\n * Describes whether `data` is a complete or partial result. This flag is only\n * set when `returnPartialData` is `true` in query options.\n *\n * @deprecated This field will be removed in a future version of Apollo Client.\n * @docGroup 1. Operation data\n */\n partial: boolean;\n}\n\nexport interface MutationOptionsDocumentation {\n /**\n * A GraphQL document, often created with `gql` from the `graphql-tag`\n * package, that contains a single mutation inside of it.\n *\n * @docGroup 1. Operation options\n */\n mutation: unknown;\n\n /**\n * Provide `no-cache` if the mutation's result should _not_ be written to the Apollo Client cache.\n *\n * The default value is `network-only` (which means the result _is_ written to the cache).\n *\n * Unlike queries, mutations _do not_ support [fetch policies](https://www.apollographql.com/docs/react/data/queries/#setting-a-fetch-policy) besides `network-only` and `no-cache`.\n *\n * @docGroup 3. Caching options\n */\n fetchPolicy: unknown;\n\n /**\n * To avoid retaining sensitive information from mutation root field\n * arguments, Apollo Client v3.4+ automatically clears any `ROOT_MUTATION`\n * fields from the cache after each mutation finishes. If you need this\n * information to remain in the cache, you can prevent the removal by passing\n * `keepRootFields: true` to the mutation. `ROOT_MUTATION` result data are\n * also passed to the mutation `update` function, so we recommend obtaining\n * the results that way, rather than using this option, if possible.\n */\n keepRootFields: unknown;\n\n /**\n * By providing either an object or a callback function that, when invoked after\n * a mutation, allows you to return optimistic data and optionally skip updates\n * via the `IGNORE` sentinel object, Apollo Client caches this temporary\n * (and potentially incorrect) response until the mutation completes, enabling\n * more responsive UI updates.\n *\n * For more information, see [Optimistic mutation results](https://www.apollographql.com/docs/react/performance/optimistic-ui/).\n *\n * @docGroup 3. Caching options\n */\n optimisticResponse: unknown;\n\n /**\n * A `MutationQueryReducersMap`, which is map from query names to\n * mutation query reducers. Briefly, this map defines how to incorporate the\n * results of the mutation into the results of queries that are currently\n * being watched by your application.\n */\n updateQueries: unknown;\n\n /**\n * An array (or a function that _returns_ an array) that specifies which queries you want to refetch after the mutation occurs.\n *\n * Each array value can be either:\n *\n * - An object containing the `query` to execute, along with any `variables`\n *\n * - A string indicating the operation name of the query to refetch\n *\n * @docGroup 1. Operation options\n */\n refetchQueries: unknown;\n\n /**\n * If `true`, makes sure all queries included in `refetchQueries` are completed before the mutation is considered complete.\n *\n * The default value is `false` (queries are refetched asynchronously).\n *\n * @docGroup 1. Operation options\n */\n awaitRefetchQueries: unknown;\n\n /**\n * A function used to update the Apollo Client cache after the mutation completes.\n *\n * For more information, see [Updating the cache after a mutation](https://www.apollographql.com/docs/react/data/mutations#updating-the-cache-after-a-mutation).\n *\n * @docGroup 3. Caching options\n */\n update: unknown;\n\n /**\n * Optional callback for intercepting queries whose cache data has been updated by the mutation, as well as any queries specified in the `refetchQueries: [...]` list passed to `client.mutate`.\n *\n * Returning a `Promise` from `onQueryUpdated` will cause the final mutation `Promise` to await the returned `Promise`. Returning `false` causes the query to be ignored.\n *\n * @docGroup 1. Operation options\n */\n onQueryUpdated: unknown;\n\n /**\n * Specifies how the mutation handles a response that returns both GraphQL errors and partial results.\n *\n * For details, see [GraphQL error policies](https://www.apollographql.com/docs/react/data/error-handling/#graphql-error-policies).\n *\n * The default value is `none`, meaning that the mutation result includes error details but _not_ partial results.\n *\n * @docGroup 1. Operation options\n */\n errorPolicy: unknown;\n\n /**\n * An object containing all of the GraphQL variables your mutation requires to execute.\n *\n * Each key in the object corresponds to a variable name, and that key's value corresponds to the variable value.\n *\n * @docGroup 1. Operation options\n */\n variables: unknown;\n\n /**\n * If you're using [Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/), this object is the initial value of the `context` object that's passed along your link chain.\n *\n * @docGroup 2. Networking options\n */\n context: unknown;\n\n /**\n * The instance of `ApolloClient` to use to execute the mutation.\n *\n * By default, the instance that's passed down via context is used, but you can provide a different instance here.\n *\n * @docGroup 2. Networking options\n */\n client: unknown;\n /**\n * If `true`, the in-progress mutation's associated component re-renders whenever the network status changes or a network error occurs.\n *\n * The default value is `true`.\n *\n * @docGroup 2. Networking options\n */\n notifyOnNetworkStatusChange: unknown;\n /**\n * A callback function that's called when your mutation successfully completes with zero errors (or if `errorPolicy` is `ignore` and partial data is returned).\n *\n * This function is passed the mutation's result `data` and any options passed to the mutation.\n *\n * @docGroup 1. Operation options\n */\n onCompleted: unknown;\n /**\n * A callback function that's called when the mutation encounters one or more errors (unless `errorPolicy` is `ignore`).\n *\n * This function is passed an [`ApolloError`](https://github.com/apollographql/apollo-client/blob/d96f4578f89b933c281bb775a39503f6cdb59ee8/src/errors/index.ts#L36-L39) object that contains either a `networkError` object or a `graphQLErrors` array, depending on the error(s) that occurred, as well as any options passed the mutation.\n *\n * @docGroup 1. Operation options\n */\n onError: unknown;\n /**\n * If `true`:\n *\n * - The initial state update (setting loading to true) is skipped\n * - The success state update (setting data and setting loading to false) is skipped\n * - Error updates will still occur\n *\n * The default value is `false`.\n *\n * This option is useful when you want to execute a mutation but don't need to track its progress or result in the UI, potentially improving performance by reducing re-renders.\n *\n * @docGroup 1. Operation options\n */\n ignoreResults: unknown;\n}\n\nexport interface MutationResultDocumentation {\n /**\n * The data returned from your mutation. Can be `undefined` if `ignoreResults` is `true`.\n */\n data: unknown;\n /**\n * If the mutation produces one or more errors, this object contains either an array of `graphQLErrors` or a single `networkError`. Otherwise, this value is `undefined`.\n *\n * For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).\n */\n error: unknown;\n /**\n * If `true`, the mutation is currently in flight.\n */\n loading: unknown;\n /**\n * If `true`, the mutation's mutate function has been called.\n */\n called: unknown;\n /**\n * The instance of Apollo Client that executed the mutation.\n *\n * Can be useful for manually executing followup operations or writing data to the cache.\n */\n client: unknown;\n /**\n * A function that you can call to reset the mutation's result to its initial, uncalled state.\n */\n reset: unknown;\n /**\n * Custom extensions returned from the GraphQL server\n */\n extensions: unknown;\n}\n\nexport interface SubscriptionOptionsDocumentation {\n /**\n * A GraphQL document, often created with `gql` from the `graphql-tag`\n * package, that contains a single subscription inside of it.\n */\n query: unknown;\n /**\n * An object containing all of the variables your subscription needs to execute\n */\n variables: unknown;\n\n /**\n * Specifies the `ErrorPolicy` to be used for this operation\n */\n errorPolicy: unknown;\n\n /**\n * How you want your component to interact with the Apollo cache. For details, see [Setting a fetch policy](https://www.apollographql.com/docs/react/data/queries/#setting-a-fetch-policy).\n */\n fetchPolicy: unknown;\n\n /**\n * Determines if your subscription should be unsubscribed and subscribed again when an input to the hook (such as `subscription` or `variables`) changes.\n */\n shouldResubscribe: unknown;\n\n /**\n * If `true`, the hook will not cause the component to rerender. This is useful when you want to control the rendering of your component yourself with logic in the `onData` and `onError` callbacks.\n *\n * Changing this to `true` when the hook already has `data` will reset the `data` to `undefined`.\n */\n ignoreResults: unknown;\n /**\n * An `ApolloClient` instance. By default `useSubscription` / `Subscription` uses the client passed down via context, but a different client can be passed in.\n */\n client: unknown;\n\n /**\n * Determines if the current subscription should be skipped. Useful if, for example, variables depend on previous queries and are not ready yet.\n */\n skip: unknown;\n\n /**\n * Shared context between your component and your network interface (Apollo Link).\n */\n context: unknown;\n\n /**\n * Shared context between your component and your network interface (Apollo Link).\n */\n extensions: unknown;\n\n /**\n * Allows the registration of a callback function that will be triggered each time the `useSubscription` Hook / `Subscription` component completes the subscription.\n */\n onComplete: unknown;\n\n /**\n * Allows the registration of a callback function that will be triggered each time the `useSubscription` Hook / `Subscription` component receives data. The callback `options` object param consists of the current Apollo Client instance in `client`, and the received subscription data in `data`.\n */\n onData: unknown;\n\n /**\n * Allows the registration of a callback function that will be triggered each time the `useSubscription` Hook / `Subscription` component receives an error.\n */\n onError: unknown;\n}\n\nexport interface SubscriptionResultDocumentation {\n /**\n * A boolean that indicates whether any initial data has been returned\n */\n loading: unknown;\n /**\n * An object containing the result of your GraphQL subscription. Defaults to an empty object.\n */\n data: unknown;\n /**\n * A runtime error with `graphQLErrors` and `networkError` properties\n */\n error: unknown;\n}\n"]}
@@ -13,7 +13,7 @@ export declare class MockSubscriptionLink extends ApolloLink {
13
13
  operation?: ApolloLink.Operation;
14
14
  private observers;
15
15
  constructor();
16
- request(operation: ApolloLink.Operation): Observable<ApolloLink.Result<Record<string, any>, Record<string, any>>>;
16
+ request(operation: ApolloLink.Operation): Observable<import("graphql").FormattedExecutionResult<Record<string, any>, Record<string, any>>>;
17
17
  simulateResult(result: MockSubscriptionLink.Result, complete?: boolean): void;
18
18
  simulateComplete(): void;
19
19
  onSetup(listener: any): void;
@@ -14,6 +14,11 @@ export interface MockedProviderProps {
14
14
  link?: ApolloLink;
15
15
  showWarnings?: boolean;
16
16
  mockLinkDefaultOptions?: MockLink.DefaultOptions;
17
+ /**
18
+ * Configuration used by the [Apollo Client Devtools extension](https://www.apollographql.com/docs/react/development-testing/developer-tooling/#apollo-client-devtools) for this client.
19
+ *
20
+ * @since 3.14.0
21
+ */
17
22
  devtools?: ApolloClient.Options["devtools"];
18
23
  }
19
24
  interface MockedProviderState {
@@ -1 +1 @@
1
- {"version":3,"file":"MockedProvider.js","sourceRoot":"","sources":["../../../src/testing/react/MockedProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,aAAa,IAAI,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAG9D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAmBlD,MAAM,OAAO,cAAe,SAAQ,KAAK,CAAC,SAGzC;IACC,YAAY,KAA0B;QACpC,KAAK,CAAC,KAAK,CAAC,CAAC;QAEb,MAAM,EACJ,KAAK,EACL,cAAc,EACd,KAAK,EACL,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,sBAAsB,EACtB,QAAQ,GACT,GAAG,IAAI,CAAC,KAAK,CAAC;QACf,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC;YAC9B,KAAK,EAAE,KAAK,IAAI,IAAI,KAAK,EAAE;YAC3B,cAAc;YACd,IAAI,EACF,IAAI;gBACJ,IAAI,QAAQ,CAAC,KAAK,IAAI,EAAE,EAAE;oBACxB,YAAY;oBACZ,cAAc,EAAE,sBAAsB;iBACvC,CAAC;YACJ,UAAU;YACV,QAAQ;SACT,CAAC,CAAC;QAEH,IAAI,CAAC,KAAK,GAAG;YACX,MAAM;SACP,CAAC;IACJ,CAAC;IAEM,MAAM;QACX,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAC5C,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAE9B,OAAO,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;YACnC,oBAAC,cAAc,IAAC,MAAM,EAAE,MAAM,IAC3B,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,UAAU,EAAE,CAAC,CACtD;YACnB,CAAC,CAAC,IAAI,CAAC;IACX,CAAC;IAEM,oBAAoB;QACzB,oEAAoE;QACpE,mDAAmD;QACnD,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IAC3B,CAAC;CACF","sourcesContent":["import * as React from \"react\";\n\nimport { ApolloClient } from \"@apollo/client\";\nimport type { ApolloCache } from \"@apollo/client/cache\";\nimport { InMemoryCache as Cache } from \"@apollo/client/cache\";\nimport type { ApolloLink } from \"@apollo/client/link\";\nimport type { LocalState } from \"@apollo/client/local-state\";\nimport { ApolloProvider } from \"@apollo/client/react\";\nimport { MockLink } from \"@apollo/client/testing\";\n\nexport interface MockedProviderProps {\n mocks?: ReadonlyArray<MockLink.MockedResponse<any, any>>;\n defaultOptions?: ApolloClient.DefaultOptions;\n cache?: ApolloCache;\n localState?: LocalState;\n childProps?: object;\n children?: any;\n link?: ApolloLink;\n showWarnings?: boolean;\n mockLinkDefaultOptions?: MockLink.DefaultOptions;\n devtools?: ApolloClient.Options[\"devtools\"];\n}\n\ninterface MockedProviderState {\n client: ApolloClient;\n}\n\nexport class MockedProvider extends React.Component<\n MockedProviderProps,\n MockedProviderState\n> {\n constructor(props: MockedProviderProps) {\n super(props);\n\n const {\n mocks,\n defaultOptions,\n cache,\n localState,\n link,\n showWarnings,\n mockLinkDefaultOptions,\n devtools,\n } = this.props;\n const client = new ApolloClient({\n cache: cache || new Cache(),\n defaultOptions,\n link:\n link ||\n new MockLink(mocks || [], {\n showWarnings,\n defaultOptions: mockLinkDefaultOptions,\n }),\n localState,\n devtools,\n });\n\n this.state = {\n client,\n };\n }\n\n public render() {\n const { children, childProps } = this.props;\n const { client } = this.state;\n\n return React.isValidElement(children) ?\n <ApolloProvider client={client}>\n {React.cloneElement(React.Children.only(children), { ...childProps })}\n </ApolloProvider>\n : null;\n }\n\n public componentWillUnmount() {\n // Since this.state.client was created in the constructor, it's this\n // MockedProvider's responsibility to terminate it.\n this.state.client.stop();\n }\n}\n"]}
1
+ {"version":3,"file":"MockedProvider.js","sourceRoot":"","sources":["../../../src/testing/react/MockedProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,aAAa,IAAI,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAG9D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAwBlD,MAAM,OAAO,cAAe,SAAQ,KAAK,CAAC,SAGzC;IACC,YAAY,KAA0B;QACpC,KAAK,CAAC,KAAK,CAAC,CAAC;QAEb,MAAM,EACJ,KAAK,EACL,cAAc,EACd,KAAK,EACL,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,sBAAsB,EACtB,QAAQ,GACT,GAAG,IAAI,CAAC,KAAK,CAAC;QACf,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC;YAC9B,KAAK,EAAE,KAAK,IAAI,IAAI,KAAK,EAAE;YAC3B,cAAc;YACd,IAAI,EACF,IAAI;gBACJ,IAAI,QAAQ,CAAC,KAAK,IAAI,EAAE,EAAE;oBACxB,YAAY;oBACZ,cAAc,EAAE,sBAAsB;iBACvC,CAAC;YACJ,UAAU;YACV,QAAQ;SACT,CAAC,CAAC;QAEH,IAAI,CAAC,KAAK,GAAG;YACX,MAAM;SACP,CAAC;IACJ,CAAC;IAEM,MAAM;QACX,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAC5C,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAE9B,OAAO,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;YACnC,oBAAC,cAAc,IAAC,MAAM,EAAE,MAAM,IAC3B,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,UAAU,EAAE,CAAC,CACtD;YACnB,CAAC,CAAC,IAAI,CAAC;IACX,CAAC;IAEM,oBAAoB;QACzB,oEAAoE;QACpE,mDAAmD;QACnD,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IAC3B,CAAC;CACF","sourcesContent":["import * as React from \"react\";\n\nimport { ApolloClient } from \"@apollo/client\";\nimport type { ApolloCache } from \"@apollo/client/cache\";\nimport { InMemoryCache as Cache } from \"@apollo/client/cache\";\nimport type { ApolloLink } from \"@apollo/client/link\";\nimport type { LocalState } from \"@apollo/client/local-state\";\nimport { ApolloProvider } from \"@apollo/client/react\";\nimport { MockLink } from \"@apollo/client/testing\";\n\nexport interface MockedProviderProps {\n mocks?: ReadonlyArray<MockLink.MockedResponse<any, any>>;\n defaultOptions?: ApolloClient.DefaultOptions;\n cache?: ApolloCache;\n localState?: LocalState;\n childProps?: object;\n children?: any;\n link?: ApolloLink;\n showWarnings?: boolean;\n mockLinkDefaultOptions?: MockLink.DefaultOptions;\n /**\n * Configuration used by the [Apollo Client Devtools extension](https://www.apollographql.com/docs/react/development-testing/developer-tooling/#apollo-client-devtools) for this client.\n *\n * @since 3.14.0\n */\n devtools?: ApolloClient.Options[\"devtools\"];\n}\n\ninterface MockedProviderState {\n client: ApolloClient;\n}\n\nexport class MockedProvider extends React.Component<\n MockedProviderProps,\n MockedProviderState\n> {\n constructor(props: MockedProviderProps) {\n super(props);\n\n const {\n mocks,\n defaultOptions,\n cache,\n localState,\n link,\n showWarnings,\n mockLinkDefaultOptions,\n devtools,\n } = this.props;\n const client = new ApolloClient({\n cache: cache || new Cache(),\n defaultOptions,\n link:\n link ||\n new MockLink(mocks || [], {\n showWarnings,\n defaultOptions: mockLinkDefaultOptions,\n }),\n localState,\n devtools,\n });\n\n this.state = {\n client,\n };\n }\n\n public render() {\n const { children, childProps } = this.props;\n const { client } = this.state;\n\n return React.isValidElement(children) ?\n <ApolloProvider client={client}>\n {React.cloneElement(React.Children.only(children), { ...childProps })}\n </ApolloProvider>\n : null;\n }\n\n public componentWillUnmount() {\n // Since this.state.client was created in the constructor, it's this\n // MockedProvider's responsibility to terminate it.\n this.state.client.stop();\n }\n}\n"]}
@@ -3,6 +3,17 @@
3
3
  *
4
4
  * @param value - The object or array that should have `__typename` removed.
5
5
  * @returns The object with all `__typename` properties removed.
6
+ *
7
+ * @example
8
+ *
9
+ * ```ts
10
+ * stripTypename({
11
+ * __typename: "User",
12
+ * id: 1,
13
+ * profile: { __typename: "Profile", name: "John Doe" },
14
+ * });
15
+ * // => { id: 1, profile: { name: "John Doe"}}
16
+ * ```
6
17
  */
7
18
  export declare function stripTypename<T>(value: T): import("@apollo/client/utilities/internal").DeepOmit<T, "__typename">;
8
19
  //# sourceMappingURL=stripTypename.d.ts.map
@@ -4,6 +4,17 @@ import { omitDeep } from "@apollo/client/utilities/internal";
4
4
  *
5
5
  * @param value - The object or array that should have `__typename` removed.
6
6
  * @returns The object with all `__typename` properties removed.
7
+ *
8
+ * @example
9
+ *
10
+ * ```ts
11
+ * stripTypename({
12
+ * __typename: "User",
13
+ * id: 1,
14
+ * profile: { __typename: "Profile", name: "John Doe" },
15
+ * });
16
+ * // => { id: 1, profile: { name: "John Doe"}}
17
+ * ```
7
18
  */
8
19
  export function stripTypename(value) {
9
20
  return omitDeep(value, "__typename");
@@ -1 +1 @@
1
- {"version":3,"file":"stripTypename.js","sourceRoot":"","sources":["../../../src/utilities/common/stripTypename.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAI,KAAQ;IACvC,OAAO,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;AACvC,CAAC","sourcesContent":["import { omitDeep } from \"@apollo/client/utilities/internal\";\n\n/**\n * Deeply removes all `__typename` properties in the given object or array.\n *\n * @param value - The object or array that should have `__typename` removed.\n * @returns The object with all `__typename` properties removed.\n */\nexport function stripTypename<T>(value: T) {\n return omitDeep(value, \"__typename\");\n}\n"]}
1
+ {"version":3,"file":"stripTypename.js","sourceRoot":"","sources":["../../../src/utilities/common/stripTypename.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAE7D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,aAAa,CAAI,KAAQ;IACvC,OAAO,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;AACvC,CAAC","sourcesContent":["import { omitDeep } from \"@apollo/client/utilities/internal\";\n\n/**\n * Deeply removes all `__typename` properties in the given object or array.\n *\n * @param value - The object or array that should have `__typename` removed.\n * @returns The object with all `__typename` properties removed.\n *\n * @example\n *\n * ```ts\n * stripTypename({\n * __typename: \"User\",\n * id: 1,\n * profile: { __typename: \"Profile\", name: \"John Doe\" },\n * });\n * // => { id: 1, profile: { name: \"John Doe\"}}\n * ```\n */\nexport function stripTypename<T>(value: T) {\n return omitDeep(value, \"__typename\");\n}\n"]}
@@ -3,37 +3,126 @@ export type DocumentTransformCacheKey = ReadonlyArray<unknown>;
3
3
  type TransformFn = (document: DocumentNode) => DocumentNode;
4
4
  interface DocumentTransformOptions {
5
5
  /**
6
- * Determines whether to cache the transformed GraphQL document. Caching can speed up repeated calls to the document transform for the same input document. Set to `false` to completely disable caching for the document transform. When disabled, this option takes precedence over the [`getCacheKey`](#getcachekey) option.
6
+ * Determines whether to cache the transformed GraphQL document. Caching can
7
+ * speed up repeated calls to the document transform for the same input
8
+ * document. Set to `false` to completely disable caching for the document
9
+ * transform. When disabled, this option takes precedence over the [`getCacheKey`](#getcachekey)
10
+ * option.
7
11
  *
8
- * The default value is `true`.
12
+ * @defaultValue `true`
9
13
  */
10
14
  cache?: boolean;
11
15
  /**
12
16
  * Defines a custom cache key for a GraphQL document that will determine whether to re-run the document transform when given the same input GraphQL document. Returns an array that defines the cache key. Return `undefined` to disable caching for that GraphQL document.
13
17
  *
14
- * > **Note:** The items in the array may be any type, but also need to be referentially stable to guarantee a stable cache key.
18
+ * > [!NOTE]
19
+ * > The items in the array can be any type, but each item needs to be
20
+ * > referentially stable to guarantee a stable cache key.
15
21
  *
16
- * The default implementation of this function returns the `document` as the cache key.
22
+ * @defaultValue `(document) => [document]`
17
23
  */
18
24
  getCacheKey?: (document: DocumentNode) => DocumentTransformCacheKey | undefined;
19
25
  }
26
+ /**
27
+ * A class for transforming GraphQL documents. See the [Document transforms
28
+ * documentation](https://www.apollographql.com/docs/react/data/document-transforms) for more details on using them.
29
+ *
30
+ * @example
31
+ *
32
+ * ```ts
33
+ * import { DocumentTransform } from "@apollo/client/utilities";
34
+ * import { visit } from "graphql";
35
+ *
36
+ * const documentTransform = new DocumentTransform((doc) => {
37
+ * return visit(doc, {
38
+ * // ...
39
+ * });
40
+ * });
41
+ *
42
+ * const transformedDoc = documentTransform.transformDocument(myDocument);
43
+ * ```
44
+ */
20
45
  export declare class DocumentTransform {
21
46
  private readonly transform;
22
47
  private cached;
23
48
  private readonly resultCache;
24
49
  private getCacheKey;
50
+ /**
51
+ * Creates a DocumentTransform that returns the input document unchanged.
52
+ *
53
+ * @returns The input document
54
+ */
25
55
  static identity(): DocumentTransform;
56
+ /**
57
+ * Creates a DocumentTransform that conditionally applies one of two transforms.
58
+ *
59
+ * @param predicate - Function that determines which transform to apply
60
+ * @param left - Transform to apply when `predicate` returns `true`
61
+ * @param right - Transform to apply when `predicate` returns `false`. If not provided, it defaults to `DocumentTransform.identity()`.
62
+ * @returns A DocumentTransform that conditionally applies a document transform based on the predicate
63
+ *
64
+ * @example
65
+ *
66
+ * ```ts
67
+ * import { isQueryOperation } from "@apollo/client/utilities";
68
+ *
69
+ * const conditionalTransform = DocumentTransform.split(
70
+ * (document) => isQueryOperation(document),
71
+ * queryTransform,
72
+ * mutationTransform
73
+ * );
74
+ * ```
75
+ */
26
76
  static split(predicate: (document: DocumentNode) => boolean, left: DocumentTransform, right?: DocumentTransform): DocumentTransform & {
27
77
  left: DocumentTransform;
28
78
  right: DocumentTransform;
29
79
  };
30
80
  constructor(transform: TransformFn, options?: DocumentTransformOptions);
31
81
  /**
32
- * Resets the internal cache of this transform, if it has one.
82
+ * Resets the internal cache of this transform, if it is cached.
33
83
  */
34
84
  resetCache(): void;
35
85
  private performWork;
86
+ /**
87
+ * Transforms a GraphQL document using the configured transform function.
88
+ *
89
+ * @remarks
90
+ *
91
+ * Note that `transformDocument` caches the transformed document. Calling
92
+ * `transformDocument` again with the already-transformed document will
93
+ * immediately return it.
94
+ *
95
+ * @param document - The GraphQL document to transform
96
+ * @returns The transformed document
97
+ *
98
+ * @example
99
+ *
100
+ * ```ts
101
+ * const document = gql`
102
+ * # ...
103
+ * `;
104
+ *
105
+ * const documentTransform = new DocumentTransform(transformFn);
106
+ * const transformedDocument = documentTransform.transformDocument(document);
107
+ * ```
108
+ */
36
109
  transformDocument(document: DocumentNode): DocumentNode;
110
+ /**
111
+ * Combines this document transform with another document transform. The
112
+ * returned document transform first applies the current document transform,
113
+ * then applies the other document transform.
114
+ *
115
+ * @param otherTransform - The transform to apply after this one
116
+ * @returns A new DocumentTransform that applies both transforms in sequence
117
+ *
118
+ * @example
119
+ *
120
+ * ```ts
121
+ * const combinedTransform = addTypenameTransform.concat(
122
+ * removeDirectivesTransform
123
+ * );
124
+ * ```
125
+ */
37
126
  concat(otherTransform: DocumentTransform): DocumentTransform;
38
127
  /**
39
128
  * @internal
@@ -7,6 +7,25 @@ import { cacheSizes } from "../caching/sizes.js";
7
7
  function identity(document) {
8
8
  return document;
9
9
  }
10
+ /**
11
+ * A class for transforming GraphQL documents. See the [Document transforms
12
+ * documentation](https://www.apollographql.com/docs/react/data/document-transforms) for more details on using them.
13
+ *
14
+ * @example
15
+ *
16
+ * ```ts
17
+ * import { DocumentTransform } from "@apollo/client/utilities";
18
+ * import { visit } from "graphql";
19
+ *
20
+ * const documentTransform = new DocumentTransform((doc) => {
21
+ * return visit(doc, {
22
+ * // ...
23
+ * });
24
+ * });
25
+ *
26
+ * const transformedDoc = documentTransform.transformDocument(myDocument);
27
+ * ```
28
+ */
10
29
  export class DocumentTransform {
11
30
  transform;
12
31
  cached;
@@ -19,12 +38,37 @@ export class DocumentTransform {
19
38
  getCacheKey(document) {
20
39
  return [document];
21
40
  }
41
+ /**
42
+ * Creates a DocumentTransform that returns the input document unchanged.
43
+ *
44
+ * @returns The input document
45
+ */
22
46
  static identity() {
23
47
  // No need to cache this transform since it just returns the document
24
48
  // unchanged. This should save a bit of memory that would otherwise be
25
49
  // needed to populate the `documentCache` of this transform.
26
50
  return new DocumentTransform(identity, { cache: false });
27
51
  }
52
+ /**
53
+ * Creates a DocumentTransform that conditionally applies one of two transforms.
54
+ *
55
+ * @param predicate - Function that determines which transform to apply
56
+ * @param left - Transform to apply when `predicate` returns `true`
57
+ * @param right - Transform to apply when `predicate` returns `false`. If not provided, it defaults to `DocumentTransform.identity()`.
58
+ * @returns A DocumentTransform that conditionally applies a document transform based on the predicate
59
+ *
60
+ * @example
61
+ *
62
+ * ```ts
63
+ * import { isQueryOperation } from "@apollo/client/utilities";
64
+ *
65
+ * const conditionalTransform = DocumentTransform.split(
66
+ * (document) => isQueryOperation(document),
67
+ * queryTransform,
68
+ * mutationTransform
69
+ * );
70
+ * ```
71
+ */
28
72
  static split(predicate, left, right = DocumentTransform.identity()) {
29
73
  return Object.assign(new DocumentTransform((document) => {
30
74
  const documentTransform = predicate(document) ? left : right;
@@ -43,7 +87,7 @@ export class DocumentTransform {
43
87
  this.resetCache();
44
88
  }
45
89
  /**
46
- * Resets the internal cache of this transform, if it has one.
90
+ * Resets the internal cache of this transform, if it is cached.
47
91
  */
48
92
  resetCache() {
49
93
  if (this.cached) {
@@ -65,6 +109,29 @@ export class DocumentTransform {
65
109
  checkDocument(document);
66
110
  return this.transform(document);
67
111
  }
112
+ /**
113
+ * Transforms a GraphQL document using the configured transform function.
114
+ *
115
+ * @remarks
116
+ *
117
+ * Note that `transformDocument` caches the transformed document. Calling
118
+ * `transformDocument` again with the already-transformed document will
119
+ * immediately return it.
120
+ *
121
+ * @param document - The GraphQL document to transform
122
+ * @returns The transformed document
123
+ *
124
+ * @example
125
+ *
126
+ * ```ts
127
+ * const document = gql`
128
+ * # ...
129
+ * `;
130
+ *
131
+ * const documentTransform = new DocumentTransform(transformFn);
132
+ * const transformedDocument = documentTransform.transformDocument(document);
133
+ * ```
134
+ */
68
135
  transformDocument(document) {
69
136
  // If a user passes an already transformed result back to this function,
70
137
  // immediately return it.
@@ -75,6 +142,22 @@ export class DocumentTransform {
75
142
  this.resultCache.add(transformedDocument);
76
143
  return transformedDocument;
77
144
  }
145
+ /**
146
+ * Combines this document transform with another document transform. The
147
+ * returned document transform first applies the current document transform,
148
+ * then applies the other document transform.
149
+ *
150
+ * @param otherTransform - The transform to apply after this one
151
+ * @returns A new DocumentTransform that applies both transforms in sequence
152
+ *
153
+ * @example
154
+ *
155
+ * ```ts
156
+ * const combinedTransform = addTypenameTransform.concat(
157
+ * removeDirectivesTransform
158
+ * );
159
+ * ```
160
+ */
78
161
  concat(otherTransform) {
79
162
  return Object.assign(new DocumentTransform((document) => {
80
163
  return otherTransform.transformDocument(this.transformDocument(document));
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentTransform.js","sources":["../../../src/utilities/graphql/DocumentTransform.ts"],"sourcesContent":["import { WeakCache } from \"@wry/caches\";\nimport { Trie } from \"@wry/trie\";\nimport type { DocumentNode } from \"graphql\";\nimport { wrap } from \"optimism\";\n\nimport { checkDocument } from \"@apollo/client/utilities/internal\";\nimport { invariant } from \"@apollo/client/utilities/invariant\";\n\nimport { cacheSizes } from \"../caching/sizes.js\";\n\nexport type DocumentTransformCacheKey = ReadonlyArray<unknown>;\n\ntype TransformFn = (document: DocumentNode) => DocumentNode;\n\ninterface DocumentTransformOptions {\n /**\n * Determines whether to cache the transformed GraphQL document. Caching can speed up repeated calls to the document transform for the same input document. Set to `false` to completely disable caching for the document transform. When disabled, this option takes precedence over the [`getCacheKey`](#getcachekey) option.\n *\n * The default value is `true`.\n */\n cache?: boolean;\n /**\n * Defines a custom cache key for a GraphQL document that will determine whether to re-run the document transform when given the same input GraphQL document. Returns an array that defines the cache key. Return `undefined` to disable caching for that GraphQL document.\n *\n * > **Note:** The items in the array may be any type, but also need to be referentially stable to guarantee a stable cache key.\n *\n * The default implementation of this function returns the `document` as the cache key.\n */\n getCacheKey?: (\n document: DocumentNode\n ) => DocumentTransformCacheKey | undefined;\n}\n\nfunction identity(document: DocumentNode) {\n return document;\n}\n\nexport class DocumentTransform {\n private readonly transform: TransformFn;\n private cached: boolean;\n\n private readonly resultCache = new WeakSet<DocumentNode>();\n\n // This default implementation of getCacheKey can be overridden by providing\n // options.getCacheKey to the DocumentTransform constructor. In general, a\n // getCacheKey function may either return an array of keys (often including\n // the document) to be used as a cache key, or undefined to indicate the\n // transform for this document should not be cached.\n private getCacheKey(\n document: DocumentNode\n ): DocumentTransformCacheKey | undefined {\n return [document];\n }\n\n static identity() {\n // No need to cache this transform since it just returns the document\n // unchanged. This should save a bit of memory that would otherwise be\n // needed to populate the `documentCache` of this transform.\n return new DocumentTransform(identity, { cache: false });\n }\n\n static split(\n predicate: (document: DocumentNode) => boolean,\n left: DocumentTransform,\n right: DocumentTransform = DocumentTransform.identity()\n ) {\n return Object.assign(\n new DocumentTransform(\n (document) => {\n const documentTransform = predicate(document) ? left : right;\n\n return documentTransform.transformDocument(document);\n },\n // Reasonably assume both `left` and `right` transforms handle their own caching\n { cache: false }\n ),\n { left, right }\n );\n }\n\n constructor(transform: TransformFn, options: DocumentTransformOptions = {}) {\n this.transform = transform;\n\n if (options.getCacheKey) {\n // Override default `getCacheKey` function, which returns [document].\n this.getCacheKey = options.getCacheKey;\n }\n this.cached = options.cache !== false;\n\n this.resetCache();\n }\n\n /**\n * Resets the internal cache of this transform, if it has one.\n */\n resetCache() {\n if (this.cached) {\n const stableCacheKeys = new Trie<WeakKey>();\n this.performWork = wrap(\n DocumentTransform.prototype.performWork.bind(this),\n {\n makeCacheKey: (document) => {\n const cacheKeys = this.getCacheKey(document);\n if (cacheKeys) {\n invariant(\n Array.isArray(cacheKeys),\n \"`getCacheKey` must return an array or undefined\"\n );\n return stableCacheKeys.lookupArray(cacheKeys);\n }\n },\n max: cacheSizes[\"documentTransform.cache\"],\n cache: WeakCache<any, any>,\n }\n );\n }\n }\n\n private performWork(document: DocumentNode) {\n checkDocument(document);\n return this.transform(document);\n }\n\n transformDocument(document: DocumentNode) {\n // If a user passes an already transformed result back to this function,\n // immediately return it.\n if (this.resultCache.has(document)) {\n return document;\n }\n\n const transformedDocument = this.performWork(document);\n\n this.resultCache.add(transformedDocument);\n\n return transformedDocument;\n }\n\n concat(otherTransform: DocumentTransform): DocumentTransform {\n return Object.assign(\n new DocumentTransform(\n (document) => {\n return otherTransform.transformDocument(\n this.transformDocument(document)\n );\n },\n // Reasonably assume both transforms handle their own caching\n { cache: false }\n ),\n {\n left: this,\n right: otherTransform,\n }\n );\n }\n\n /**\n * @internal\n * Used to iterate through all transforms that are concatenations or `split` links.\n */\n readonly left?: DocumentTransform;\n /**\n * @internal\n * Used to iterate through all transforms that are concatenations or `split` links.\n */\n readonly right?: DocumentTransform;\n}\n"],"names":[],"mappings":"AAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAA0B,CAA1B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAuC;AACvC,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAqB,CAArB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgC;AAEhC,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAqB,CAArB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA+B;AAE/B,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAA8B,CAA9B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CA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,CAAA,CAAA,CAAA,CACkC,CAAC,CADnC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAC2C,CAAC,CACjC;QACH,CAAC;QACD,CAAR,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;QACQ,EAAE,CAAV,CAAA,CAAA,CAAA,CAAe,EAAE,CAAjB,CAAA,CAAA,CAAA,EAAA,CAAwB,CACjB,EACD;YACE,CAAR,CAAA,CAAA,CAAY,EAAE,CAAd,CAAA,CAAA,CAAkB;YACV,CAAR,CAAA,CAAA,CAAA,CAAa,EAAE,CAAf,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA6B;QAC7B,CAAO,CACF;IACH;;;;;;;IAMS,CAAX,CAAA,CAAA,CAAe;;;;;;;IAKJ,CAAX,CAAA,CAAA,CAAA,CAAgB;AAChB;"}
1
+ {"version":3,"file":"DocumentTransform.js","sources":["../../../src/utilities/graphql/DocumentTransform.ts"],"sourcesContent":["import { WeakCache } from \"@wry/caches\";\nimport { Trie } from \"@wry/trie\";\nimport type { DocumentNode } from \"graphql\";\nimport { wrap } from \"optimism\";\n\nimport { checkDocument } from \"@apollo/client/utilities/internal\";\nimport { invariant } from \"@apollo/client/utilities/invariant\";\n\nimport { cacheSizes } from \"../caching/sizes.js\";\n\nexport type DocumentTransformCacheKey = ReadonlyArray<unknown>;\n\ntype TransformFn = (document: DocumentNode) => DocumentNode;\n\ninterface DocumentTransformOptions {\n /**\n * Determines whether to cache the transformed GraphQL document. Caching can\n * speed up repeated calls to the document transform for the same input\n * document. Set to `false` to completely disable caching for the document\n * transform. When disabled, this option takes precedence over the [`getCacheKey`](#getcachekey)\n * option.\n *\n * @defaultValue `true`\n */\n cache?: boolean;\n /**\n * Defines a custom cache key for a GraphQL document that will determine whether to re-run the document transform when given the same input GraphQL document. Returns an array that defines the cache key. Return `undefined` to disable caching for that GraphQL document.\n *\n * > [!NOTE]\n * > The items in the array can be any type, but each item needs to be\n * > referentially stable to guarantee a stable cache key.\n *\n * @defaultValue `(document) => [document]`\n */\n getCacheKey?: (\n document: DocumentNode\n ) => DocumentTransformCacheKey | undefined;\n}\n\nfunction identity(document: DocumentNode) {\n return document;\n}\n\n/**\n * A class for transforming GraphQL documents. See the [Document transforms\n * documentation](https://www.apollographql.com/docs/react/data/document-transforms) for more details on using them.\n *\n * @example\n *\n * ```ts\n * import { DocumentTransform } from \"@apollo/client/utilities\";\n * import { visit } from \"graphql\";\n *\n * const documentTransform = new DocumentTransform((doc) => {\n * return visit(doc, {\n * // ...\n * });\n * });\n *\n * const transformedDoc = documentTransform.transformDocument(myDocument);\n * ```\n */\nexport class DocumentTransform {\n private readonly transform: TransformFn;\n private cached: boolean;\n\n private readonly resultCache = new WeakSet<DocumentNode>();\n\n // This default implementation of getCacheKey can be overridden by providing\n // options.getCacheKey to the DocumentTransform constructor. In general, a\n // getCacheKey function may either return an array of keys (often including\n // the document) to be used as a cache key, or undefined to indicate the\n // transform for this document should not be cached.\n private getCacheKey(\n document: DocumentNode\n ): DocumentTransformCacheKey | undefined {\n return [document];\n }\n\n /**\n * Creates a DocumentTransform that returns the input document unchanged.\n *\n * @returns The input document\n */\n static identity() {\n // No need to cache this transform since it just returns the document\n // unchanged. This should save a bit of memory that would otherwise be\n // needed to populate the `documentCache` of this transform.\n return new DocumentTransform(identity, { cache: false });\n }\n\n /**\n * Creates a DocumentTransform that conditionally applies one of two transforms.\n *\n * @param predicate - Function that determines which transform to apply\n * @param left - Transform to apply when `predicate` returns `true`\n * @param right - Transform to apply when `predicate` returns `false`. If not provided, it defaults to `DocumentTransform.identity()`.\n * @returns A DocumentTransform that conditionally applies a document transform based on the predicate\n *\n * @example\n *\n * ```ts\n * import { isQueryOperation } from \"@apollo/client/utilities\";\n *\n * const conditionalTransform = DocumentTransform.split(\n * (document) => isQueryOperation(document),\n * queryTransform,\n * mutationTransform\n * );\n * ```\n */\n static split(\n predicate: (document: DocumentNode) => boolean,\n left: DocumentTransform,\n right: DocumentTransform = DocumentTransform.identity()\n ) {\n return Object.assign(\n new DocumentTransform(\n (document) => {\n const documentTransform = predicate(document) ? left : right;\n\n return documentTransform.transformDocument(document);\n },\n // Reasonably assume both `left` and `right` transforms handle their own caching\n { cache: false }\n ),\n { left, right }\n );\n }\n\n constructor(transform: TransformFn, options: DocumentTransformOptions = {}) {\n this.transform = transform;\n\n if (options.getCacheKey) {\n // Override default `getCacheKey` function, which returns [document].\n this.getCacheKey = options.getCacheKey;\n }\n this.cached = options.cache !== false;\n\n this.resetCache();\n }\n\n /**\n * Resets the internal cache of this transform, if it is cached.\n */\n resetCache() {\n if (this.cached) {\n const stableCacheKeys = new Trie<WeakKey>();\n this.performWork = wrap(\n DocumentTransform.prototype.performWork.bind(this),\n {\n makeCacheKey: (document) => {\n const cacheKeys = this.getCacheKey(document);\n if (cacheKeys) {\n invariant(\n Array.isArray(cacheKeys),\n \"`getCacheKey` must return an array or undefined\"\n );\n return stableCacheKeys.lookupArray(cacheKeys);\n }\n },\n max: cacheSizes[\"documentTransform.cache\"],\n cache: WeakCache<any, any>,\n }\n );\n }\n }\n\n private performWork(document: DocumentNode) {\n checkDocument(document);\n return this.transform(document);\n }\n\n /**\n * Transforms a GraphQL document using the configured transform function.\n *\n * @remarks\n *\n * Note that `transformDocument` caches the transformed document. Calling\n * `transformDocument` again with the already-transformed document will\n * immediately return it.\n *\n * @param document - The GraphQL document to transform\n * @returns The transformed document\n *\n * @example\n *\n * ```ts\n * const document = gql`\n * # ...\n * `;\n *\n * const documentTransform = new DocumentTransform(transformFn);\n * const transformedDocument = documentTransform.transformDocument(document);\n * ```\n */\n transformDocument(document: DocumentNode) {\n // If a user passes an already transformed result back to this function,\n // immediately return it.\n if (this.resultCache.has(document)) {\n return document;\n }\n\n const transformedDocument = this.performWork(document);\n\n this.resultCache.add(transformedDocument);\n\n return transformedDocument;\n }\n\n /**\n * Combines this document transform with another document transform. The\n * returned document transform first applies the current document transform,\n * then applies the other document transform.\n *\n * @param otherTransform - The transform to apply after this one\n * @returns A new DocumentTransform that applies both transforms in sequence\n *\n * @example\n *\n * ```ts\n * const combinedTransform = addTypenameTransform.concat(\n * removeDirectivesTransform\n * );\n * ```\n */\n concat(otherTransform: DocumentTransform): DocumentTransform {\n return Object.assign(\n new DocumentTransform(\n (document) => {\n return otherTransform.transformDocument(\n this.transformDocument(document)\n );\n },\n // Reasonably assume both transforms handle their own caching\n { cache: false }\n ),\n {\n left: this,\n right: otherTransform,\n }\n );\n }\n\n /**\n * @internal\n * Used to iterate through all transforms that are concatenations or `split` links.\n */\n readonly left?: DocumentTransform;\n /**\n * @internal\n * Used to iterate through all transforms that are concatenations or `split` links.\n */\n readonly right?: DocumentTransform;\n}\n"],"names":[],"mappings":"AAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAA0B,CAA1B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAuC;AACvC,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAqB,CAArB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgC;AAEhC,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAAqB,CAArB,C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kB;YACV,CAAR,CAAA,CAAA,CAAA,CAAa,EAAE,CAAf,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA6B;QAC7B,CAAO,CACF;IACH;;;;;;;IAMS,CAAX,CAAA,CAAA,CAAe;;;;;;;IAKJ,CAAX,CAAA,CAAA,CAAA,CAAgB;AAChB;"}
@@ -1,3 +1,30 @@
1
1
  import type { FormattedExecutionResult } from "graphql";
2
+ /**
3
+ * Determines whether the given object is a valid GraphQL execution result
4
+ * according to the GraphQL specification.
5
+ *
6
+ * @remarks
7
+ *
8
+ * A valid execution result must be an object that contains only `data`,
9
+ * `errors`, and/or `extensions` properties. At least one of `data` or `errors`
10
+ * must be present.
11
+ *
12
+ * @param result - The object to test
13
+ * @returns `true` if the object conforms to the GraphQL execution result format
14
+ *
15
+ * @example
16
+ *
17
+ * ```ts
18
+ * import { isFormattedExecutionResult } from "@apollo/client/utilities";
19
+ *
20
+ * // Valid execution result
21
+ * const validResult = { data: { user: { name: "John" } } };
22
+ * console.log(isFormattedExecutionResult(validResult)); // true
23
+ *
24
+ * // Invalid - contains non-standard properties
25
+ * const invalidResult = { data: {}, customField: "value" };
26
+ * console.log(isFormattedExecutionResult(invalidResult)); // false
27
+ * ```
28
+ */
2
29
  export declare function isFormattedExecutionResult(result?: object): result is FormattedExecutionResult;
3
30
  //# sourceMappingURL=isFormattedExecutionResult.d.ts.map
@@ -1,3 +1,30 @@
1
+ /**
2
+ * Determines whether the given object is a valid GraphQL execution result
3
+ * according to the GraphQL specification.
4
+ *
5
+ * @remarks
6
+ *
7
+ * A valid execution result must be an object that contains only `data`,
8
+ * `errors`, and/or `extensions` properties. At least one of `data` or `errors`
9
+ * must be present.
10
+ *
11
+ * @param result - The object to test
12
+ * @returns `true` if the object conforms to the GraphQL execution result format
13
+ *
14
+ * @example
15
+ *
16
+ * ```ts
17
+ * import { isFormattedExecutionResult } from "@apollo/client/utilities";
18
+ *
19
+ * // Valid execution result
20
+ * const validResult = { data: { user: { name: "John" } } };
21
+ * console.log(isFormattedExecutionResult(validResult)); // true
22
+ *
23
+ * // Invalid - contains non-standard properties
24
+ * const invalidResult = { data: {}, customField: "value" };
25
+ * console.log(isFormattedExecutionResult(invalidResult)); // false
26
+ * ```
27
+ */
1
28
  export function isFormattedExecutionResult(result) {
2
29
  return (!!result &&
3
30
  ("errors" in result || "data" in result) &&
@@ -1 +1 @@
1
- {"version":3,"file":"isFormattedExecutionResult.js","sourceRoot":"","sources":["../../../src/utilities/graphql/isFormattedExecutionResult.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,0BAA0B,CACxC,MAAe;IAEf,OAAO,CACL,CAAC,CAAC,MAAM;QACR,CAAC,QAAQ,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,CAAC;QACxC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CACvB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,MAAM,IAAI,GAAG,KAAK,YAAY,CACpE,CACF,CAAC;AACJ,CAAC","sourcesContent":["import type { FormattedExecutionResult } from \"graphql\";\n\nexport function isFormattedExecutionResult(\n result?: object\n): result is FormattedExecutionResult {\n return (\n !!result &&\n (\"errors\" in result || \"data\" in result) &&\n Object.keys(result).every(\n (key) => key === \"errors\" || key === \"data\" || key === \"extensions\"\n )\n );\n}\n"]}
1
+ {"version":3,"file":"isFormattedExecutionResult.js","sourceRoot":"","sources":["../../../src/utilities/graphql/isFormattedExecutionResult.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,0BAA0B,CACxC,MAAe;IAEf,OAAO,CACL,CAAC,CAAC,MAAM;QACR,CAAC,QAAQ,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,CAAC;QACxC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CACvB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,MAAM,IAAI,GAAG,KAAK,YAAY,CACpE,CACF,CAAC;AACJ,CAAC","sourcesContent":["import type { FormattedExecutionResult } from \"graphql\";\n\n/**\n * Determines whether the given object is a valid GraphQL execution result\n * according to the GraphQL specification.\n *\n * @remarks\n *\n * A valid execution result must be an object that contains only `data`,\n * `errors`, and/or `extensions` properties. At least one of `data` or `errors`\n * must be present.\n *\n * @param result - The object to test\n * @returns `true` if the object conforms to the GraphQL execution result format\n *\n * @example\n *\n * ```ts\n * import { isFormattedExecutionResult } from \"@apollo/client/utilities\";\n *\n * // Valid execution result\n * const validResult = { data: { user: { name: \"John\" } } };\n * console.log(isFormattedExecutionResult(validResult)); // true\n *\n * // Invalid - contains non-standard properties\n * const invalidResult = { data: {}, customField: \"value\" };\n * console.log(isFormattedExecutionResult(invalidResult)); // false\n * ```\n */\nexport function isFormattedExecutionResult(\n result?: object\n): result is FormattedExecutionResult {\n return (\n !!result &&\n (\"errors\" in result || \"data\" in result) &&\n Object.keys(result).every(\n (key) => key === \"errors\" || key === \"data\" || key === \"extensions\"\n )\n );\n}\n"]}