@octanejs/apollo-client 0.1.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 (85) hide show
  1. package/LICENSE +49 -0
  2. package/README.md +97 -0
  3. package/package.json +77 -0
  4. package/src/index.d.ts +1 -0
  5. package/src/index.js +3 -0
  6. package/src/react/context/ApolloContext.d.ts +8 -0
  7. package/src/react/context/ApolloContext.js +21 -0
  8. package/src/react/context/ApolloProvider.d.ts +9 -0
  9. package/src/react/context/ApolloProvider.js +15 -0
  10. package/src/react/hooks/constants.d.ts +2 -0
  11. package/src/react/hooks/constants.js +1 -0
  12. package/src/react/hooks/internal/__use.d.ts +3 -0
  13. package/src/react/hooks/internal/__use.js +9 -0
  14. package/src/react/hooks/internal/index.d.ts +5 -0
  15. package/src/react/hooks/internal/index.js +6 -0
  16. package/src/react/hooks/internal/site.d.ts +2 -0
  17. package/src/react/hooks/internal/site.js +20 -0
  18. package/src/react/hooks/internal/useDeepMemo.d.ts +5 -0
  19. package/src/react/hooks/internal/useDeepMemo.js +11 -0
  20. package/src/react/hooks/internal/useIsomorphicLayoutEffect.d.ts +2 -0
  21. package/src/react/hooks/internal/useIsomorphicLayoutEffect.js +8 -0
  22. package/src/react/hooks/internal/useRenderGuard.d.ts +1 -0
  23. package/src/react/hooks/internal/useRenderGuard.js +14 -0
  24. package/src/react/hooks/internal/useSuspenseHookCacheKey.d.ts +13 -0
  25. package/src/react/hooks/internal/useSuspenseHookCacheKey.js +19 -0
  26. package/src/react/hooks/internal/validateSuspenseHookOptions.d.ts +4 -0
  27. package/src/react/hooks/internal/validateSuspenseHookOptions.js +16 -0
  28. package/src/react/hooks/internal/wrapHook.d.ts +77 -0
  29. package/src/react/hooks/internal/wrapHook.js +64 -0
  30. package/src/react/hooks/useApolloClient.d.ts +17 -0
  31. package/src/react/hooks/useApolloClient.js +27 -0
  32. package/src/react/hooks/useBackgroundQuery.d.ts +3061 -0
  33. package/src/react/hooks/useBackgroundQuery.js +88 -0
  34. package/src/react/hooks/useFragment.d.ts +205 -0
  35. package/src/react/hooks/useFragment.js +75 -0
  36. package/src/react/hooks/useLazyQuery.d.ts +947 -0
  37. package/src/react/hooks/useLazyQuery.js +156 -0
  38. package/src/react/hooks/useLoadableQuery.d.ts +955 -0
  39. package/src/react/hooks/useLoadableQuery.js +98 -0
  40. package/src/react/hooks/useMutation.d.ts +585 -0
  41. package/src/react/hooks/useMutation.js +121 -0
  42. package/src/react/hooks/useQuery.d.ts +1401 -0
  43. package/src/react/hooks/useQuery.js +234 -0
  44. package/src/react/hooks/useQueryRefHandlers.d.ts +85 -0
  45. package/src/react/hooks/useQueryRefHandlers.js +79 -0
  46. package/src/react/hooks/useReactiveVar.d.ts +21 -0
  47. package/src/react/hooks/useReactiveVar.js +41 -0
  48. package/src/react/hooks/useReadQuery.d.ts +104 -0
  49. package/src/react/hooks/useReadQuery.js +83 -0
  50. package/src/react/hooks/useSubscription.d.ts +289 -0
  51. package/src/react/hooks/useSubscription.js +258 -0
  52. package/src/react/hooks/useSuspenseFragment.d.ts +154 -0
  53. package/src/react/hooks/useSuspenseFragment.js +50 -0
  54. package/src/react/hooks/useSuspenseQuery.d.ts +1629 -0
  55. package/src/react/hooks/useSuspenseQuery.js +130 -0
  56. package/src/react/hooks/useSyncExternalStore.d.ts +2 -0
  57. package/src/react/hooks/useSyncExternalStore.js +125 -0
  58. package/src/react/index.d.ts +68 -0
  59. package/src/react/index.js +18 -0
  60. package/src/react/internal/cache/FragmentReference.d.ts +41 -0
  61. package/src/react/internal/cache/FragmentReference.js +117 -0
  62. package/src/react/internal/cache/QueryReference.d.ts +180 -0
  63. package/src/react/internal/cache/QueryReference.js +310 -0
  64. package/src/react/internal/cache/SuspenseCache.d.ts +38 -0
  65. package/src/react/internal/cache/SuspenseCache.js +39 -0
  66. package/src/react/internal/cache/getSuspenseCache.d.ts +26 -0
  67. package/src/react/internal/cache/getSuspenseCache.js +8 -0
  68. package/src/react/internal/cache/types.d.ts +13 -0
  69. package/src/react/internal/cache/types.js +1 -0
  70. package/src/react/internal/index.d.ts +16 -0
  71. package/src/react/internal/index.js +10 -0
  72. package/src/react/internal/types.d.ts +15 -0
  73. package/src/react/internal/types.js +1 -0
  74. package/src/react/query-preloader/createQueryPreloader.d.ts +630 -0
  75. package/src/react/query-preloader/createQueryPreloader.js +89 -0
  76. package/src/react/types/deprecated.d.ts +140 -0
  77. package/src/react/types/deprecated.js +1 -0
  78. package/src/react/types/types.documentation.d.ts +551 -0
  79. package/src/react/types/types.documentation.js +1 -0
  80. package/src/testing/index.d.ts +1 -0
  81. package/src/testing/index.js +1 -0
  82. package/src/testing/react/MockedProvider.d.ts +21 -0
  83. package/src/testing/react/MockedProvider.js +53 -0
  84. package/src/testing/react/index.d.ts +2 -0
  85. package/src/testing/react/index.js +1 -0
@@ -0,0 +1,1401 @@
1
+ import type {
2
+ DataState,
3
+ DefaultContext,
4
+ DocumentNode,
5
+ ErrorLike,
6
+ ErrorPolicy,
7
+ GetDataState,
8
+ InternalTypes,
9
+ ObservableQuery,
10
+ OperationVariables,
11
+ RefetchOn,
12
+ RefetchWritePolicy,
13
+ SubscribeToMoreFunction,
14
+ TypedDocumentNode,
15
+ UpdateQueryMapFn,
16
+ WatchQueryFetchPolicy,
17
+ } from '@apollo/client';
18
+ import type { ApolloClient } from '@apollo/client';
19
+ import { NetworkStatus } from '@apollo/client';
20
+ import type { MaybeMasked } from '@apollo/client/masking';
21
+ import type {
22
+ DocumentationTypes as UtilityDocumentationTypes,
23
+ LazyType,
24
+ NoInfer,
25
+ OptionWithFallback,
26
+ SignatureStyle,
27
+ VariablesOption,
28
+ } from '@apollo/client/utilities/internal';
29
+ import type { SkipToken } from './constants.js';
30
+ export declare namespace useQuery {
31
+ namespace Base {
32
+ interface Options<TData = unknown, TVariables extends OperationVariables = OperationVariables> {
33
+ /**
34
+ * 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).
35
+ *
36
+ * For details, see [Setting a fetch policy](https://www.apollographql.com/docs/react/data/queries/#setting-a-fetch-policy).
37
+ *
38
+ * The default value is `cache-first`.
39
+ *
40
+ * @docGroup 3. Caching options
41
+ */
42
+ fetchPolicy?: WatchQueryFetchPolicy;
43
+ /**
44
+ * Specifies the `FetchPolicy` to be used after this query has completed.
45
+ *
46
+ * @docGroup 3. Caching options
47
+ */
48
+ nextFetchPolicy?:
49
+ | WatchQueryFetchPolicy
50
+ | ((
51
+ this: ApolloClient.WatchQueryOptions<TData, TVariables>,
52
+ currentFetchPolicy: WatchQueryFetchPolicy,
53
+ context: InternalTypes.NextFetchPolicyContext<TData, TVariables>,
54
+ ) => WatchQueryFetchPolicy);
55
+ /**
56
+ * Defaults to the initial value of options.fetchPolicy, but can be explicitly
57
+ * configured to specify the WatchQueryFetchPolicy to revert back to whenever
58
+ * variables change (unless nextFetchPolicy intervenes).
59
+ *
60
+ * @docGroup 3. Caching options
61
+ */
62
+ initialFetchPolicy?: WatchQueryFetchPolicy;
63
+ /**
64
+ * Specifies whether a `NetworkStatus.refetch` operation should merge
65
+ * incoming field data with existing data, or overwrite the existing data.
66
+ * Overwriting is probably preferable, but merging is currently the default
67
+ * behavior, for backwards compatibility with Apollo Client 3.x.
68
+ *
69
+ * @docGroup 3. Caching options
70
+ */
71
+ refetchWritePolicy?: RefetchWritePolicy;
72
+ /**
73
+ * Specifies how the query handles a response that returns both GraphQL errors and partial results.
74
+ *
75
+ * For details, see [GraphQL error policies](https://www.apollographql.com/docs/react/data/error-handling/#graphql-error-policies).
76
+ *
77
+ * The default value is `none`, meaning that the query result includes error details but not partial results.
78
+ *
79
+ * @docGroup 1. Operation options
80
+ */
81
+ errorPolicy?: ErrorPolicy;
82
+ /**
83
+ * Specifies the interval (in milliseconds) at which the query polls for updated results.
84
+ *
85
+ * The default value is `0` (no polling).
86
+ *
87
+ * @docGroup 2. Networking options
88
+ */
89
+ pollInterval?: number;
90
+ /**
91
+ * If `true`, the in-progress query's associated component re-renders whenever the network status changes or a network error occurs.
92
+ *
93
+ * The default value is `true`.
94
+ *
95
+ * @docGroup 2. Networking options
96
+ */
97
+ notifyOnNetworkStatusChange?: boolean;
98
+ /**
99
+ * If `true`, the query can return partial results from the cache if the cache doesn't contain results for all queried fields.
100
+ *
101
+ * The default value is `false`.
102
+ *
103
+ * @docGroup 3. Caching options
104
+ */
105
+ returnPartialData?: boolean;
106
+ /**
107
+ * A callback function that's called whenever a refetch attempt occurs
108
+ * while polling. If the function returns `true`, the refetch is
109
+ * skipped and not reattempted until the next poll interval.
110
+ *
111
+ * @docGroup 2. Networking options
112
+ */
113
+ skipPollAttempt?: () => boolean;
114
+ /**
115
+ * Pass `false` to skip executing the query during [server-side rendering](https://www.apollographql.com/docs/react/performance/server-side-rendering/).
116
+ *
117
+ * @docGroup 2. Networking options
118
+ */
119
+ ssr?: boolean;
120
+ /**
121
+ * The instance of `ApolloClient` to use to execute the query.
122
+ *
123
+ * By default, the instance that's passed down via context is used, but you
124
+ * can provide a different instance here.
125
+ *
126
+ * @docGroup 1. Operation options
127
+ */
128
+ client?: ApolloClient;
129
+ /**
130
+ * 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.
131
+ *
132
+ * @docGroup 2. Networking options
133
+ */
134
+ context?: DefaultContext;
135
+ /**
136
+ * If true, the query is not executed.
137
+ *
138
+ * The default value is `false`.
139
+ *
140
+ * @docGroup 1. Operation options
141
+ */
142
+ skip?: boolean;
143
+ /**
144
+ * Determines whether events trigger refetches for the query. Provide an
145
+ * object mapping each refetch event to `true` (enable), `false` (disable)
146
+ * or a callback function that returns `true`/`false` to control individual
147
+ * events. Provide `false` to disable all automatic refetch events for this
148
+ * query. Provide `true` to enable all automatic refetch events for this query.
149
+ * Provide a callback function to perform additional logic to determine
150
+ * whether to enable or disable a refetch for a query.
151
+ *
152
+ * `@remarks`
153
+ * `refetchOn` inherits from `defaultOptions.watchQuery.refetchOn`. If
154
+ * `defaultOptions.watchQuery.refetchOn` is not set, all refetch events are
155
+ * enabled by default.
156
+ *
157
+ * This option only has an effect when the client is configured with a
158
+ * `refetchEventManager`.
159
+ * @docGroup 1. Operation options
160
+ */
161
+ refetchOn?: RefetchOn.Option;
162
+ }
163
+ }
164
+ type Options<
165
+ TData = unknown,
166
+ TVariables extends OperationVariables = OperationVariables,
167
+ > = Base.Options<TData, TVariables> & VariablesOption<TVariables>;
168
+ namespace DocumentationTypes {
169
+ namespace useQuery {
170
+ interface Options<TData = unknown, TVariables extends OperationVariables = OperationVariables>
171
+ extends
172
+ Base.Options<TData, TVariables>,
173
+ UtilityDocumentationTypes.VariableOptions<TVariables> {}
174
+ }
175
+ }
176
+ namespace Base {
177
+ interface Result<
178
+ TData = unknown,
179
+ TVariables extends OperationVariables = OperationVariables,
180
+ TReturnVariables extends OperationVariables = TVariables,
181
+ > {
182
+ /**
183
+ * The instance of Apollo Client that executed the query.
184
+ * Can be useful for manually executing followup queries or writing data to the cache.
185
+ *
186
+ * @docGroup 2. Network info
187
+ */
188
+ client: ApolloClient;
189
+ /**
190
+ * A reference to the internal `ObservableQuery` used by the hook.
191
+ */
192
+ observable: ObservableQuery<TData, TVariables>;
193
+ /**
194
+ * An object containing the result from the most recent _previous_ execution of this query.
195
+ *
196
+ * This value is `undefined` if this is the query's first execution.
197
+ *
198
+ * @docGroup 1. Operation data
199
+ */
200
+ previousData?: MaybeMasked<TData>;
201
+ /**
202
+ * A single ErrorLike object describing the error that occurred during the latest
203
+ * query execution.
204
+ *
205
+ * For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).
206
+ *
207
+ * @docGroup 1. Operation data
208
+ */
209
+ error?: ErrorLike;
210
+ /**
211
+ * If `true`, the query is still in flight.
212
+ *
213
+ * @docGroup 2. Network info
214
+ */
215
+ loading: boolean;
216
+ /**
217
+ * 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)
218
+ *
219
+ * Used in conjunction with the [`notifyOnNetworkStatusChange`](#notifyonnetworkstatuschange) option.
220
+ *
221
+ * @docGroup 2. Network info
222
+ */
223
+ networkStatus: NetworkStatus;
224
+ /**
225
+ * A function that instructs the query to begin re-executing at a specified interval (in milliseconds).
226
+ *
227
+ *
228
+ * @docGroup 3. Helper functions
229
+ */
230
+ startPolling: (pollInterval: number) => void;
231
+ /**
232
+ * A function that instructs the query to stop polling after a previous call to `startPolling`.
233
+ *
234
+ *
235
+ * @docGroup 3. Helper functions
236
+ */
237
+ stopPolling: () => void;
238
+ /**
239
+ * A function that enables you to execute a [subscription](https://www.apollographql.com/docs/react/data/subscriptions/), usually to subscribe to specific fields that were included in the query.
240
+ *
241
+ * This function returns _another_ function that you can call to terminate the subscription.
242
+ *
243
+ *
244
+ * @docGroup 3. Helper functions
245
+ */
246
+ subscribeToMore: SubscribeToMoreFunction<TData, TVariables>;
247
+ /**
248
+ * A function that enables you to update the query's cached result without executing a followup GraphQL operation.
249
+ *
250
+ * See [using updateQuery and updateFragment](https://www.apollographql.com/docs/react/caching/cache-interaction/#using-updatequery-and-updatefragment) for additional information.
251
+ *
252
+ *
253
+ * @docGroup 3. Helper functions
254
+ */
255
+ updateQuery: (mapFn: UpdateQueryMapFn<TData, TVariables>) => void;
256
+ /**
257
+ * A function that enables you to re-execute the query, optionally passing in new `variables`.
258
+ *
259
+ * 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).
260
+ *
261
+ * See also [Refetching](https://www.apollographql.com/docs/react/data/queries/#refetching).
262
+ *
263
+ * Returns a `ResultPromise` with an additional `.retain()` method. Calling
264
+ * `.retain()` keeps the network operation running even if the `ObservableQuery`
265
+ * no longer requires the result.
266
+ *
267
+ * @docGroup 3. Helper functions
268
+ */
269
+ refetch: (
270
+ variables?: Partial<TVariables>,
271
+ ) => Promise<ApolloClient.QueryResult<MaybeMasked<TData>>>;
272
+ /**
273
+ * An object containing the variables that were provided for the query.
274
+ *
275
+ * @docGroup 1. Operation data
276
+ */
277
+ variables: TReturnVariables;
278
+ /**
279
+ * A function that helps you fetch the next set of results for a [paginated list field](https://www.apollographql.com/docs/react/pagination/core-api/).
280
+ *
281
+ *
282
+ * @docGroup 3. Helper functions
283
+ */
284
+ fetchMore: <TFetchData = TData, TFetchVars extends OperationVariables = TVariables>(
285
+ fetchMoreOptions: ObservableQuery.FetchMoreOptions<
286
+ TData,
287
+ TVariables,
288
+ TFetchData,
289
+ TFetchVars
290
+ >,
291
+ ) => Promise<ApolloClient.QueryResult<MaybeMasked<TFetchData>>>;
292
+ }
293
+ }
294
+ type Result<
295
+ TData = unknown,
296
+ TVariables extends OperationVariables = OperationVariables,
297
+ TStates extends DataState<TData>['dataState'] = DataState<TData>['dataState'],
298
+ TReturnVariables extends OperationVariables = TVariables,
299
+ > = Base.Result<TData, TVariables, TReturnVariables> & GetDataState<MaybeMasked<TData>, TStates>;
300
+ interface DefaultOptions extends ApolloClient.DefaultOptions.WatchQuery.Calculated {
301
+ skip: false;
302
+ }
303
+ type ResultForOptions<
304
+ TData,
305
+ TVariables extends OperationVariables,
306
+ TOptions extends Record<string, never> | Options<TData, TVariables> | SkipToken,
307
+ > = LazyType<
308
+ Result<
309
+ TData,
310
+ TVariables,
311
+ | 'complete'
312
+ | 'streaming'
313
+ | 'empty'
314
+ | (TOptions extends any
315
+ ? TOptions extends SkipToken
316
+ ? never
317
+ : OptionWithFallback<TOptions, DefaultOptions, 'returnPartialData'> extends false
318
+ ? never
319
+ : 'partial'
320
+ : never)
321
+ >
322
+ >;
323
+ namespace DocumentationTypes {
324
+ namespace useQuery {
325
+ interface Result<TData = unknown, TVariables extends OperationVariables = OperationVariables>
326
+ extends Base.Result<TData, TVariables>, UtilityDocumentationTypes.DataState<TData> {}
327
+ }
328
+ }
329
+ namespace DocumentationTypes {
330
+ interface useQuery {
331
+ /**
332
+ * A hook for executing queries in an Apollo application.
333
+ *
334
+ * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.
335
+ *
336
+ * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, `dataState`, and `data` properties you can use to render your UI.
337
+ *
338
+ * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.
339
+ *
340
+ * @example
341
+ *
342
+ * ```jsx
343
+ * import { gql } from "@apollo/client";
344
+ * import { useQuery } from "@octanejs/apollo-client/react";
345
+ *
346
+ * const GET_GREETING = gql`
347
+ * query GetGreeting($language: String!) {
348
+ * greeting(language: $language) {
349
+ * message
350
+ * }
351
+ * }
352
+ * `;
353
+ *
354
+ * function Hello() {
355
+ * const { loading, error, data } = useQuery(GET_GREETING, {
356
+ * variables: { language: "english" },
357
+ * });
358
+ * if (loading) return <p>Loading ...</p>;
359
+ * return <h1>Hello {data.greeting.message}!</h1>;
360
+ * }
361
+ * ```
362
+ *
363
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
364
+ * @param options - Options to control how the query is executed.
365
+ * @returns Query result object
366
+ */
367
+ <TData = unknown, TVariables extends OperationVariables = OperationVariables>(
368
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
369
+ options: useQuery.Options<TData, TVariables>,
370
+ ): useQuery.Result<TData, TVariables>;
371
+ }
372
+ interface useQuery_Deprecated {
373
+ /**
374
+ * @deprecated Avoid manually specifying generics on `useQuery`.
375
+ * Instead, rely on TypeScript's type inference along with a correctly typed `TypedDocumentNode` to get accurate types for your query results.
376
+ *
377
+ *
378
+ * A hook for executing queries in an Apollo application.
379
+ *
380
+ * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.
381
+ *
382
+ * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, `dataState`, and `data` properties you can use to render your UI.
383
+ *
384
+ * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.
385
+ *
386
+ * @example
387
+ *
388
+ * ```jsx
389
+ * import { gql } from "@apollo/client";
390
+ * import { useQuery } from "@octanejs/apollo-client/react";
391
+ *
392
+ * const GET_GREETING = gql`
393
+ * query GetGreeting($language: String!) {
394
+ * greeting(language: $language) {
395
+ * message
396
+ * }
397
+ * }
398
+ * `;
399
+ *
400
+ * function Hello() {
401
+ * const { loading, error, data } = useQuery(GET_GREETING, {
402
+ * variables: { language: "english" },
403
+ * });
404
+ * if (loading) return <p>Loading ...</p>;
405
+ * return <h1>Hello {data.greeting.message}!</h1>;
406
+ * }
407
+ * ```
408
+ *
409
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
410
+ * @param options - Options to control how the query is executed.
411
+ * @returns Query result object
412
+ */
413
+ <TData = unknown, TVariables extends OperationVariables = OperationVariables>(
414
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
415
+ options: useQuery.Options<TData, TVariables>,
416
+ ): useQuery.Result<TData, TVariables>;
417
+ }
418
+ }
419
+ namespace Signatures {
420
+ /**
421
+ * A hook for executing queries in an Apollo application.
422
+ *
423
+ * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.
424
+ *
425
+ * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, `dataState`, and `data` properties you can use to render your UI.
426
+ *
427
+ * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.
428
+ *
429
+ * @example
430
+ *
431
+ * ```jsx
432
+ * import { gql } from "@apollo/client";
433
+ * import { useQuery } from "@octanejs/apollo-client/react";
434
+ *
435
+ * const GET_GREETING = gql`
436
+ * query GetGreeting($language: String!) {
437
+ * greeting(language: $language) {
438
+ * message
439
+ * }
440
+ * }
441
+ * `;
442
+ *
443
+ * function Hello() {
444
+ * const { loading, error, data } = useQuery(GET_GREETING, {
445
+ * variables: { language: "english" },
446
+ * });
447
+ * if (loading) return <p>Loading ...</p>;
448
+ * return <h1>Hello {data.greeting.message}!</h1>;
449
+ * }
450
+ * ```
451
+ *
452
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
453
+ * @param options - Options to control how the query is executed.
454
+ * @returns Query result object
455
+ */
456
+ interface Classic {
457
+ /**
458
+ * A hook for executing queries in an Apollo application.
459
+ *
460
+ * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.
461
+ *
462
+ * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, `dataState`, and `data` properties you can use to render your UI.
463
+ *
464
+ * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.
465
+ *
466
+ * @example
467
+ *
468
+ * ```jsx
469
+ * import { gql } from "@apollo/client";
470
+ * import { useQuery } from "@octanejs/apollo-client/react";
471
+ *
472
+ * const GET_GREETING = gql`
473
+ * query GetGreeting($language: String!) {
474
+ * greeting(language: $language) {
475
+ * message
476
+ * }
477
+ * }
478
+ * `;
479
+ *
480
+ * function Hello() {
481
+ * const { loading, error, data } = useQuery(GET_GREETING, {
482
+ * variables: { language: "english" },
483
+ * });
484
+ * if (loading) return <p>Loading ...</p>;
485
+ * return <h1>Hello {data.greeting.message}!</h1>;
486
+ * }
487
+ * ```
488
+ *
489
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
490
+ * @param options - Options to control how the query is executed.
491
+ * @returns Query result object
492
+ */
493
+ <
494
+ TData,
495
+ TVariables extends OperationVariables,
496
+ _INFERENCE_ONLY_DO_NOT_SPECIFY extends 'inferred',
497
+ >(
498
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
499
+ options: useQuery.Options<NoInfer<TData>, NoInfer<TVariables>> & {
500
+ returnPartialData: true;
501
+ },
502
+ ): useQuery.Result<TData, TVariables, 'empty' | 'complete' | 'streaming' | 'partial'>;
503
+ /**
504
+ * A hook for executing queries in an Apollo application.
505
+ *
506
+ * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.
507
+ *
508
+ * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, `dataState`, and `data` properties you can use to render your UI.
509
+ *
510
+ * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.
511
+ *
512
+ * @example
513
+ *
514
+ * ```jsx
515
+ * import { gql } from "@apollo/client";
516
+ * import { useQuery } from "@octanejs/apollo-client/react";
517
+ *
518
+ * const GET_GREETING = gql`
519
+ * query GetGreeting($language: String!) {
520
+ * greeting(language: $language) {
521
+ * message
522
+ * }
523
+ * }
524
+ * `;
525
+ *
526
+ * function Hello() {
527
+ * const { loading, error, data } = useQuery(GET_GREETING, {
528
+ * variables: { language: "english" },
529
+ * });
530
+ * if (loading) return <p>Loading ...</p>;
531
+ * return <h1>Hello {data.greeting.message}!</h1>;
532
+ * }
533
+ * ```
534
+ *
535
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
536
+ * @param options - Options to control how the query is executed.
537
+ * @returns Query result object
538
+ */
539
+ <
540
+ TData,
541
+ TVariables extends OperationVariables,
542
+ _INFERENCE_ONLY_DO_NOT_SPECIFY extends 'inferred',
543
+ >(
544
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
545
+ options: SkipToken,
546
+ ): useQuery.Result<TData, TVariables, 'empty', Record<string, never>>;
547
+ /**
548
+ * A hook for executing queries in an Apollo application.
549
+ *
550
+ * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.
551
+ *
552
+ * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, `dataState`, and `data` properties you can use to render your UI.
553
+ *
554
+ * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.
555
+ *
556
+ * @example
557
+ *
558
+ * ```jsx
559
+ * import { gql } from "@apollo/client";
560
+ * import { useQuery } from "@octanejs/apollo-client/react";
561
+ *
562
+ * const GET_GREETING = gql`
563
+ * query GetGreeting($language: String!) {
564
+ * greeting(language: $language) {
565
+ * message
566
+ * }
567
+ * }
568
+ * `;
569
+ *
570
+ * function Hello() {
571
+ * const { loading, error, data } = useQuery(GET_GREETING, {
572
+ * variables: { language: "english" },
573
+ * });
574
+ * if (loading) return <p>Loading ...</p>;
575
+ * return <h1>Hello {data.greeting.message}!</h1>;
576
+ * }
577
+ * ```
578
+ *
579
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
580
+ * @param options - Options to control how the query is executed.
581
+ * @returns Query result object
582
+ */
583
+ <
584
+ TData,
585
+ TVariables extends OperationVariables,
586
+ _INFERENCE_ONLY_DO_NOT_SPECIFY extends 'inferred',
587
+ >(
588
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
589
+ options:
590
+ | SkipToken
591
+ | (useQuery.Options<NoInfer<TData>, NoInfer<TVariables>> & {
592
+ returnPartialData: true;
593
+ }),
594
+ ): useQuery.Result<
595
+ TData,
596
+ TVariables,
597
+ 'empty' | 'complete' | 'streaming' | 'partial',
598
+ Partial<TVariables>
599
+ >;
600
+ /**
601
+ * A hook for executing queries in an Apollo application.
602
+ *
603
+ * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.
604
+ *
605
+ * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, `dataState`, and `data` properties you can use to render your UI.
606
+ *
607
+ * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.
608
+ *
609
+ * @example
610
+ *
611
+ * ```jsx
612
+ * import { gql } from "@apollo/client";
613
+ * import { useQuery } from "@octanejs/apollo-client/react";
614
+ *
615
+ * const GET_GREETING = gql`
616
+ * query GetGreeting($language: String!) {
617
+ * greeting(language: $language) {
618
+ * message
619
+ * }
620
+ * }
621
+ * `;
622
+ *
623
+ * function Hello() {
624
+ * const { loading, error, data } = useQuery(GET_GREETING, {
625
+ * variables: { language: "english" },
626
+ * });
627
+ * if (loading) return <p>Loading ...</p>;
628
+ * return <h1>Hello {data.greeting.message}!</h1>;
629
+ * }
630
+ * ```
631
+ *
632
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
633
+ * @param options - Options to control how the query is executed.
634
+ * @returns Query result object
635
+ */
636
+ <
637
+ TData,
638
+ TVariables extends OperationVariables,
639
+ _INFERENCE_ONLY_DO_NOT_SPECIFY extends 'inferred',
640
+ >(
641
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
642
+ options: useQuery.Options<NoInfer<TData>, NoInfer<TVariables>> & {
643
+ returnPartialData: boolean;
644
+ },
645
+ ): useQuery.Result<TData, TVariables, 'empty' | 'complete' | 'streaming' | 'partial'>;
646
+ /**
647
+ * A hook for executing queries in an Apollo application.
648
+ *
649
+ * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.
650
+ *
651
+ * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, `dataState`, and `data` properties you can use to render your UI.
652
+ *
653
+ * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.
654
+ *
655
+ * @example
656
+ *
657
+ * ```jsx
658
+ * import { gql } from "@apollo/client";
659
+ * import { useQuery } from "@octanejs/apollo-client/react";
660
+ *
661
+ * const GET_GREETING = gql`
662
+ * query GetGreeting($language: String!) {
663
+ * greeting(language: $language) {
664
+ * message
665
+ * }
666
+ * }
667
+ * `;
668
+ *
669
+ * function Hello() {
670
+ * const { loading, error, data } = useQuery(GET_GREETING, {
671
+ * variables: { language: "english" },
672
+ * });
673
+ * if (loading) return <p>Loading ...</p>;
674
+ * return <h1>Hello {data.greeting.message}!</h1>;
675
+ * }
676
+ * ```
677
+ *
678
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
679
+ * @param options - Options to control how the query is executed.
680
+ * @returns Query result object
681
+ */
682
+ <
683
+ TData,
684
+ TVariables extends OperationVariables,
685
+ _INFERENCE_ONLY_DO_NOT_SPECIFY extends 'inferred',
686
+ >(
687
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
688
+ options:
689
+ | SkipToken
690
+ | (useQuery.Options<NoInfer<TData>, NoInfer<TVariables>> & {
691
+ returnPartialData: boolean;
692
+ }),
693
+ ): useQuery.Result<
694
+ TData,
695
+ TVariables,
696
+ 'empty' | 'complete' | 'streaming' | 'partial',
697
+ Partial<TVariables>
698
+ >;
699
+ /**
700
+ * A hook for executing queries in an Apollo application.
701
+ *
702
+ * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.
703
+ *
704
+ * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, `dataState`, and `data` properties you can use to render your UI.
705
+ *
706
+ * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.
707
+ *
708
+ * @example
709
+ *
710
+ * ```jsx
711
+ * import { gql } from "@apollo/client";
712
+ * import { useQuery } from "@octanejs/apollo-client/react";
713
+ *
714
+ * const GET_GREETING = gql`
715
+ * query GetGreeting($language: String!) {
716
+ * greeting(language: $language) {
717
+ * message
718
+ * }
719
+ * }
720
+ * `;
721
+ *
722
+ * function Hello() {
723
+ * const { loading, error, data } = useQuery(GET_GREETING, {
724
+ * variables: { language: "english" },
725
+ * });
726
+ * if (loading) return <p>Loading ...</p>;
727
+ * return <h1>Hello {data.greeting.message}!</h1>;
728
+ * }
729
+ * ```
730
+ *
731
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
732
+ * @param options - Options to control how the query is executed.
733
+ * @returns Query result object
734
+ */
735
+ <
736
+ TData,
737
+ TVariables extends OperationVariables,
738
+ _INFERENCE_ONLY_DO_NOT_SPECIFY extends 'inferred',
739
+ >(
740
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
741
+ ...[options]: {} extends TVariables
742
+ ? [options?: useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>]
743
+ : [options: useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>]
744
+ ): useQuery.Result<TData, TVariables, 'empty' | 'complete' | 'streaming'>;
745
+ /**
746
+ * A hook for executing queries in an Apollo application.
747
+ *
748
+ * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.
749
+ *
750
+ * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, `dataState`, and `data` properties you can use to render your UI.
751
+ *
752
+ * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.
753
+ *
754
+ * @example
755
+ *
756
+ * ```jsx
757
+ * import { gql } from "@apollo/client";
758
+ * import { useQuery } from "@octanejs/apollo-client/react";
759
+ *
760
+ * const GET_GREETING = gql`
761
+ * query GetGreeting($language: String!) {
762
+ * greeting(language: $language) {
763
+ * message
764
+ * }
765
+ * }
766
+ * `;
767
+ *
768
+ * function Hello() {
769
+ * const { loading, error, data } = useQuery(GET_GREETING, {
770
+ * variables: { language: "english" },
771
+ * });
772
+ * if (loading) return <p>Loading ...</p>;
773
+ * return <h1>Hello {data.greeting.message}!</h1>;
774
+ * }
775
+ * ```
776
+ *
777
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
778
+ * @param options - Options to control how the query is executed.
779
+ * @returns Query result object
780
+ */
781
+ <
782
+ TData,
783
+ TVariables extends OperationVariables,
784
+ _INFERENCE_ONLY_DO_NOT_SPECIFY extends 'inferred',
785
+ >(
786
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
787
+ ...[options]: {} extends TVariables
788
+ ? [options?: SkipToken | useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>]
789
+ : [options: SkipToken | useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>]
790
+ ): useQuery.Result<
791
+ TData,
792
+ TVariables,
793
+ 'empty' | 'complete' | 'streaming',
794
+ Partial<TVariables>
795
+ >;
796
+ /**
797
+ * @deprecated Avoid manually specifying generics on `useQuery`.
798
+ * Instead, rely on TypeScript's type inference along with a correctly typed `TypedDocumentNode` to get accurate types for your query results.
799
+ *
800
+ *
801
+ * A hook for executing queries in an Apollo application.
802
+ *
803
+ * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.
804
+ *
805
+ * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, `dataState`, and `data` properties you can use to render your UI.
806
+ *
807
+ * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.
808
+ *
809
+ * @example
810
+ *
811
+ * ```jsx
812
+ * import { gql } from "@apollo/client";
813
+ * import { useQuery } from "@octanejs/apollo-client/react";
814
+ *
815
+ * const GET_GREETING = gql`
816
+ * query GetGreeting($language: String!) {
817
+ * greeting(language: $language) {
818
+ * message
819
+ * }
820
+ * }
821
+ * `;
822
+ *
823
+ * function Hello() {
824
+ * const { loading, error, data } = useQuery(GET_GREETING, {
825
+ * variables: { language: "english" },
826
+ * });
827
+ * if (loading) return <p>Loading ...</p>;
828
+ * return <h1>Hello {data.greeting.message}!</h1>;
829
+ * }
830
+ * ```
831
+ *
832
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
833
+ * @param options - Options to control how the query is executed.
834
+ * @returns Query result object
835
+ */
836
+ <TData, TVariables extends OperationVariables = OperationVariables>(
837
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
838
+ options: useQuery.Options<NoInfer<TData>, NoInfer<TVariables>> & {
839
+ returnPartialData: true;
840
+ },
841
+ ): useQuery.Result<TData, TVariables, 'empty' | 'complete' | 'streaming' | 'partial'>;
842
+ /**
843
+ * @deprecated Avoid manually specifying generics on `useQuery`.
844
+ * Instead, rely on TypeScript's type inference along with a correctly typed `TypedDocumentNode` to get accurate types for your query results.
845
+ *
846
+ *
847
+ * A hook for executing queries in an Apollo application.
848
+ *
849
+ * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.
850
+ *
851
+ * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, `dataState`, and `data` properties you can use to render your UI.
852
+ *
853
+ * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.
854
+ *
855
+ * @example
856
+ *
857
+ * ```jsx
858
+ * import { gql } from "@apollo/client";
859
+ * import { useQuery } from "@octanejs/apollo-client/react";
860
+ *
861
+ * const GET_GREETING = gql`
862
+ * query GetGreeting($language: String!) {
863
+ * greeting(language: $language) {
864
+ * message
865
+ * }
866
+ * }
867
+ * `;
868
+ *
869
+ * function Hello() {
870
+ * const { loading, error, data } = useQuery(GET_GREETING, {
871
+ * variables: { language: "english" },
872
+ * });
873
+ * if (loading) return <p>Loading ...</p>;
874
+ * return <h1>Hello {data.greeting.message}!</h1>;
875
+ * }
876
+ * ```
877
+ *
878
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
879
+ * @param options - Options to control how the query is executed.
880
+ * @returns Query result object
881
+ */
882
+ <TData, TVariables extends OperationVariables = OperationVariables>(
883
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
884
+ options: SkipToken,
885
+ ): useQuery.Result<TData, TVariables, 'empty', Record<string, never>>;
886
+ /**
887
+ * @deprecated Avoid manually specifying generics on `useQuery`.
888
+ * Instead, rely on TypeScript's type inference along with a correctly typed `TypedDocumentNode` to get accurate types for your query results.
889
+ *
890
+ *
891
+ * A hook for executing queries in an Apollo application.
892
+ *
893
+ * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.
894
+ *
895
+ * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, `dataState`, and `data` properties you can use to render your UI.
896
+ *
897
+ * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.
898
+ *
899
+ * @example
900
+ *
901
+ * ```jsx
902
+ * import { gql } from "@apollo/client";
903
+ * import { useQuery } from "@octanejs/apollo-client/react";
904
+ *
905
+ * const GET_GREETING = gql`
906
+ * query GetGreeting($language: String!) {
907
+ * greeting(language: $language) {
908
+ * message
909
+ * }
910
+ * }
911
+ * `;
912
+ *
913
+ * function Hello() {
914
+ * const { loading, error, data } = useQuery(GET_GREETING, {
915
+ * variables: { language: "english" },
916
+ * });
917
+ * if (loading) return <p>Loading ...</p>;
918
+ * return <h1>Hello {data.greeting.message}!</h1>;
919
+ * }
920
+ * ```
921
+ *
922
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
923
+ * @param options - Options to control how the query is executed.
924
+ * @returns Query result object
925
+ */
926
+ <TData, TVariables extends OperationVariables = OperationVariables>(
927
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
928
+ options:
929
+ | SkipToken
930
+ | (useQuery.Options<NoInfer<TData>, NoInfer<TVariables>> & {
931
+ returnPartialData: true;
932
+ }),
933
+ ): useQuery.Result<
934
+ TData,
935
+ TVariables,
936
+ 'empty' | 'complete' | 'streaming' | 'partial',
937
+ Partial<TVariables>
938
+ >;
939
+ /**
940
+ * @deprecated Avoid manually specifying generics on `useQuery`.
941
+ * Instead, rely on TypeScript's type inference along with a correctly typed `TypedDocumentNode` to get accurate types for your query results.
942
+ *
943
+ *
944
+ * A hook for executing queries in an Apollo application.
945
+ *
946
+ * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.
947
+ *
948
+ * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, `dataState`, and `data` properties you can use to render your UI.
949
+ *
950
+ * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.
951
+ *
952
+ * @example
953
+ *
954
+ * ```jsx
955
+ * import { gql } from "@apollo/client";
956
+ * import { useQuery } from "@octanejs/apollo-client/react";
957
+ *
958
+ * const GET_GREETING = gql`
959
+ * query GetGreeting($language: String!) {
960
+ * greeting(language: $language) {
961
+ * message
962
+ * }
963
+ * }
964
+ * `;
965
+ *
966
+ * function Hello() {
967
+ * const { loading, error, data } = useQuery(GET_GREETING, {
968
+ * variables: { language: "english" },
969
+ * });
970
+ * if (loading) return <p>Loading ...</p>;
971
+ * return <h1>Hello {data.greeting.message}!</h1>;
972
+ * }
973
+ * ```
974
+ *
975
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
976
+ * @param options - Options to control how the query is executed.
977
+ * @returns Query result object
978
+ */
979
+ <TData, TVariables extends OperationVariables = OperationVariables>(
980
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
981
+ options: useQuery.Options<NoInfer<TData>, NoInfer<TVariables>> & {
982
+ returnPartialData: boolean;
983
+ },
984
+ ): useQuery.Result<TData, TVariables, 'empty' | 'complete' | 'streaming' | 'partial'>;
985
+ /**
986
+ * @deprecated Avoid manually specifying generics on `useQuery`.
987
+ * Instead, rely on TypeScript's type inference along with a correctly typed `TypedDocumentNode` to get accurate types for your query results.
988
+ *
989
+ *
990
+ * A hook for executing queries in an Apollo application.
991
+ *
992
+ * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.
993
+ *
994
+ * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, `dataState`, and `data` properties you can use to render your UI.
995
+ *
996
+ * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.
997
+ *
998
+ * @example
999
+ *
1000
+ * ```jsx
1001
+ * import { gql } from "@apollo/client";
1002
+ * import { useQuery } from "@octanejs/apollo-client/react";
1003
+ *
1004
+ * const GET_GREETING = gql`
1005
+ * query GetGreeting($language: String!) {
1006
+ * greeting(language: $language) {
1007
+ * message
1008
+ * }
1009
+ * }
1010
+ * `;
1011
+ *
1012
+ * function Hello() {
1013
+ * const { loading, error, data } = useQuery(GET_GREETING, {
1014
+ * variables: { language: "english" },
1015
+ * });
1016
+ * if (loading) return <p>Loading ...</p>;
1017
+ * return <h1>Hello {data.greeting.message}!</h1>;
1018
+ * }
1019
+ * ```
1020
+ *
1021
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
1022
+ * @param options - Options to control how the query is executed.
1023
+ * @returns Query result object
1024
+ */
1025
+ <TData, TVariables extends OperationVariables = OperationVariables>(
1026
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
1027
+ options:
1028
+ | SkipToken
1029
+ | (useQuery.Options<NoInfer<TData>, NoInfer<TVariables>> & {
1030
+ returnPartialData: boolean;
1031
+ }),
1032
+ ): useQuery.Result<
1033
+ TData,
1034
+ TVariables,
1035
+ 'empty' | 'complete' | 'streaming' | 'partial',
1036
+ Partial<TVariables>
1037
+ >;
1038
+ /**
1039
+ * @deprecated Avoid manually specifying generics on `useQuery`.
1040
+ * Instead, rely on TypeScript's type inference along with a correctly typed `TypedDocumentNode` to get accurate types for your query results.
1041
+ *
1042
+ *
1043
+ * A hook for executing queries in an Apollo application.
1044
+ *
1045
+ * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.
1046
+ *
1047
+ * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, `dataState`, and `data` properties you can use to render your UI.
1048
+ *
1049
+ * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.
1050
+ *
1051
+ * @example
1052
+ *
1053
+ * ```jsx
1054
+ * import { gql } from "@apollo/client";
1055
+ * import { useQuery } from "@octanejs/apollo-client/react";
1056
+ *
1057
+ * const GET_GREETING = gql`
1058
+ * query GetGreeting($language: String!) {
1059
+ * greeting(language: $language) {
1060
+ * message
1061
+ * }
1062
+ * }
1063
+ * `;
1064
+ *
1065
+ * function Hello() {
1066
+ * const { loading, error, data } = useQuery(GET_GREETING, {
1067
+ * variables: { language: "english" },
1068
+ * });
1069
+ * if (loading) return <p>Loading ...</p>;
1070
+ * return <h1>Hello {data.greeting.message}!</h1>;
1071
+ * }
1072
+ * ```
1073
+ *
1074
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
1075
+ * @param options - Options to control how the query is executed.
1076
+ * @returns Query result object
1077
+ */
1078
+ <TData, TVariables extends OperationVariables = OperationVariables>(
1079
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
1080
+ ...[options]: {} extends TVariables
1081
+ ? [options?: useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>]
1082
+ : [options: useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>]
1083
+ ): useQuery.Result<TData, TVariables, 'empty' | 'complete' | 'streaming'>;
1084
+ /**
1085
+ * @deprecated Avoid manually specifying generics on `useQuery`.
1086
+ * Instead, rely on TypeScript's type inference along with a correctly typed `TypedDocumentNode` to get accurate types for your query results.
1087
+ *
1088
+ *
1089
+ * A hook for executing queries in an Apollo application.
1090
+ *
1091
+ * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.
1092
+ *
1093
+ * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, `dataState`, and `data` properties you can use to render your UI.
1094
+ *
1095
+ * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.
1096
+ *
1097
+ * @example
1098
+ *
1099
+ * ```jsx
1100
+ * import { gql } from "@apollo/client";
1101
+ * import { useQuery } from "@octanejs/apollo-client/react";
1102
+ *
1103
+ * const GET_GREETING = gql`
1104
+ * query GetGreeting($language: String!) {
1105
+ * greeting(language: $language) {
1106
+ * message
1107
+ * }
1108
+ * }
1109
+ * `;
1110
+ *
1111
+ * function Hello() {
1112
+ * const { loading, error, data } = useQuery(GET_GREETING, {
1113
+ * variables: { language: "english" },
1114
+ * });
1115
+ * if (loading) return <p>Loading ...</p>;
1116
+ * return <h1>Hello {data.greeting.message}!</h1>;
1117
+ * }
1118
+ * ```
1119
+ *
1120
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
1121
+ * @param options - Options to control how the query is executed.
1122
+ * @returns Query result object
1123
+ */
1124
+ <TData, TVariables extends OperationVariables = OperationVariables>(
1125
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
1126
+ ...[options]: {} extends TVariables
1127
+ ? [options?: SkipToken | useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>]
1128
+ : [options: SkipToken | useQuery.Options<NoInfer<TData>, NoInfer<TVariables>>]
1129
+ ): useQuery.Result<
1130
+ TData,
1131
+ TVariables,
1132
+ 'empty' | 'complete' | 'streaming',
1133
+ Partial<TVariables>
1134
+ >;
1135
+ ssrDisabledResult: ObservableQuery.Result<any>;
1136
+ }
1137
+ /**
1138
+ * A hook for executing queries in an Apollo application.
1139
+ *
1140
+ * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.
1141
+ *
1142
+ * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, `dataState`, and `data` properties you can use to render your UI.
1143
+ *
1144
+ * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.
1145
+ *
1146
+ * @example
1147
+ *
1148
+ * ```jsx
1149
+ * import { gql } from "@apollo/client";
1150
+ * import { useQuery } from "@octanejs/apollo-client/react";
1151
+ *
1152
+ * const GET_GREETING = gql`
1153
+ * query GetGreeting($language: String!) {
1154
+ * greeting(language: $language) {
1155
+ * message
1156
+ * }
1157
+ * }
1158
+ * `;
1159
+ *
1160
+ * function Hello() {
1161
+ * const { loading, error, data } = useQuery(GET_GREETING, {
1162
+ * variables: { language: "english" },
1163
+ * });
1164
+ * if (loading) return <p>Loading ...</p>;
1165
+ * return <h1>Hello {data.greeting.message}!</h1>;
1166
+ * }
1167
+ * ```
1168
+ *
1169
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
1170
+ * @param options - Options to control how the query is executed.
1171
+ * @returns Query result object
1172
+ */
1173
+ interface Modern {
1174
+ /**
1175
+ * A hook for executing queries in an Apollo application.
1176
+ *
1177
+ * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.
1178
+ *
1179
+ * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, `dataState`, and `data` properties you can use to render your UI.
1180
+ *
1181
+ * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.
1182
+ *
1183
+ * @example
1184
+ *
1185
+ * ```jsx
1186
+ * import { gql } from "@apollo/client";
1187
+ * import { useQuery } from "@octanejs/apollo-client/react";
1188
+ *
1189
+ * const GET_GREETING = gql`
1190
+ * query GetGreeting($language: String!) {
1191
+ * greeting(language: $language) {
1192
+ * message
1193
+ * }
1194
+ * }
1195
+ * `;
1196
+ *
1197
+ * function Hello() {
1198
+ * const { loading, error, data } = useQuery(GET_GREETING, {
1199
+ * variables: { language: "english" },
1200
+ * });
1201
+ * if (loading) return <p>Loading ...</p>;
1202
+ * return <h1>Hello {data.greeting.message}!</h1>;
1203
+ * }
1204
+ * ```
1205
+ *
1206
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
1207
+ * @param options - Options to control how the query is executed.
1208
+ * @returns Query result object
1209
+ */
1210
+ <TData, TVariables extends OperationVariables, Options extends never>(
1211
+ query: {} extends TVariables ? DocumentNode | TypedDocumentNode<TData, TVariables> : never,
1212
+ ): useQuery.ResultForOptions<TData, TVariables, Record<string, never>>;
1213
+ /**
1214
+ * A hook for executing queries in an Apollo application.
1215
+ *
1216
+ * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.
1217
+ *
1218
+ * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, `dataState`, and `data` properties you can use to render your UI.
1219
+ *
1220
+ * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.
1221
+ *
1222
+ * @example
1223
+ *
1224
+ * ```jsx
1225
+ * import { gql } from "@apollo/client";
1226
+ * import { useQuery } from "@octanejs/apollo-client/react";
1227
+ *
1228
+ * const GET_GREETING = gql`
1229
+ * query GetGreeting($language: String!) {
1230
+ * greeting(language: $language) {
1231
+ * message
1232
+ * }
1233
+ * }
1234
+ * `;
1235
+ *
1236
+ * function Hello() {
1237
+ * const { loading, error, data } = useQuery(GET_GREETING, {
1238
+ * variables: { language: "english" },
1239
+ * });
1240
+ * if (loading) return <p>Loading ...</p>;
1241
+ * return <h1>Hello {data.greeting.message}!</h1>;
1242
+ * }
1243
+ * ```
1244
+ *
1245
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
1246
+ * @param options - Options to control how the query is executed.
1247
+ * @returns Query result object
1248
+ */
1249
+ <
1250
+ TData,
1251
+ TVariables extends OperationVariables,
1252
+ TOptions extends useQuery.Options<TData, NoInfer<TVariables>> &
1253
+ VariablesOption<
1254
+ TVariables & {
1255
+ [K in Exclude<keyof TOptions['variables'], keyof TVariables>]?: never;
1256
+ }
1257
+ >,
1258
+ >(
1259
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
1260
+ ...[options]: [TVariables] extends [never]
1261
+ ? [options: never]
1262
+ : {} extends TVariables
1263
+ ? [options?: TOptions]
1264
+ : [options: TOptions]
1265
+ ): useQuery.ResultForOptions<TData, TVariables, TOptions>;
1266
+ /**
1267
+ * A hook for executing queries in an Apollo application.
1268
+ *
1269
+ * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.
1270
+ *
1271
+ * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, `dataState`, and `data` properties you can use to render your UI.
1272
+ *
1273
+ * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.
1274
+ *
1275
+ * @example
1276
+ *
1277
+ * ```jsx
1278
+ * import { gql } from "@apollo/client";
1279
+ * import { useQuery } from "@octanejs/apollo-client/react";
1280
+ *
1281
+ * const GET_GREETING = gql`
1282
+ * query GetGreeting($language: String!) {
1283
+ * greeting(language: $language) {
1284
+ * message
1285
+ * }
1286
+ * }
1287
+ * `;
1288
+ *
1289
+ * function Hello() {
1290
+ * const { loading, error, data } = useQuery(GET_GREETING, {
1291
+ * variables: { language: "english" },
1292
+ * });
1293
+ * if (loading) return <p>Loading ...</p>;
1294
+ * return <h1>Hello {data.greeting.message}!</h1>;
1295
+ * }
1296
+ * ```
1297
+ *
1298
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
1299
+ * @param options - Options to control how the query is executed.
1300
+ * @returns Query result object
1301
+ */
1302
+ <TData, TVariables extends OperationVariables, TOptions extends SkipToken>(
1303
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
1304
+ options: SkipToken,
1305
+ ): useQuery.Result<TData, TVariables, 'empty', Record<string, never>>;
1306
+ /**
1307
+ * A hook for executing queries in an Apollo application.
1308
+ *
1309
+ * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.
1310
+ *
1311
+ * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, `dataState`, and `data` properties you can use to render your UI.
1312
+ *
1313
+ * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.
1314
+ *
1315
+ * @example
1316
+ *
1317
+ * ```jsx
1318
+ * import { gql } from "@apollo/client";
1319
+ * import { useQuery } from "@octanejs/apollo-client/react";
1320
+ *
1321
+ * const GET_GREETING = gql`
1322
+ * query GetGreeting($language: String!) {
1323
+ * greeting(language: $language) {
1324
+ * message
1325
+ * }
1326
+ * }
1327
+ * `;
1328
+ *
1329
+ * function Hello() {
1330
+ * const { loading, error, data } = useQuery(GET_GREETING, {
1331
+ * variables: { language: "english" },
1332
+ * });
1333
+ * if (loading) return <p>Loading ...</p>;
1334
+ * return <h1>Hello {data.greeting.message}!</h1>;
1335
+ * }
1336
+ * ```
1337
+ *
1338
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
1339
+ * @param options - Options to control how the query is executed.
1340
+ * @returns Query result object
1341
+ */
1342
+ <
1343
+ TData,
1344
+ TVariables extends OperationVariables,
1345
+ TOptions extends useQuery.Options<TData, NoInfer<TVariables>> &
1346
+ VariablesOption<
1347
+ TVariables & {
1348
+ [K in Exclude<keyof TOptions['variables'], keyof TVariables>]?: never;
1349
+ }
1350
+ >,
1351
+ >(
1352
+ query: DocumentNode | TypedDocumentNode<TData, TVariables>,
1353
+ ...[options]: [TVariables] extends [never]
1354
+ ? [options: never]
1355
+ : {} extends TVariables
1356
+ ? [options?: TOptions | SkipToken]
1357
+ : [options: TOptions | SkipToken]
1358
+ ): useQuery.ResultForOptions<TData, TVariables, TOptions | SkipToken>;
1359
+ ssrDisabledResult: ObservableQuery.Result<any>;
1360
+ }
1361
+ type Evaluated = SignatureStyle extends 'classic' ? Classic : Modern;
1362
+ }
1363
+ /**
1364
+ * A hook for executing queries in an Apollo application.
1365
+ *
1366
+ * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.
1367
+ *
1368
+ * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, `dataState`, and `data` properties you can use to render your UI.
1369
+ *
1370
+ * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.
1371
+ *
1372
+ * @example
1373
+ *
1374
+ * ```jsx
1375
+ * import { gql } from "@apollo/client";
1376
+ * import { useQuery } from "@octanejs/apollo-client/react";
1377
+ *
1378
+ * const GET_GREETING = gql`
1379
+ * query GetGreeting($language: String!) {
1380
+ * greeting(language: $language) {
1381
+ * message
1382
+ * }
1383
+ * }
1384
+ * `;
1385
+ *
1386
+ * function Hello() {
1387
+ * const { loading, error, data } = useQuery(GET_GREETING, {
1388
+ * variables: { language: "english" },
1389
+ * });
1390
+ * if (loading) return <p>Loading ...</p>;
1391
+ * return <h1>Hello {data.greeting.message}!</h1>;
1392
+ * }
1393
+ * ```
1394
+ *
1395
+ * @param query - A GraphQL query document parsed into an AST by `gql`.
1396
+ * @param options - Options to control how the query is executed.
1397
+ * @returns Query result object
1398
+ */
1399
+ interface Signature extends Signatures.Evaluated {}
1400
+ }
1401
+ export declare const useQuery: useQuery.Signature;