@apollo/client 4.0.0-rc.3 → 4.0.0-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +53 -0
- package/__cjs/cache/core/cache.cjs +2 -6
- package/__cjs/cache/core/cache.cjs.map +1 -1
- package/__cjs/cache/core/cache.d.cts +42 -13
- package/__cjs/cache/inmemory/entityStore.cjs +3 -3
- package/__cjs/cache/inmemory/entityStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/entityStore.d.cts +1 -1
- package/__cjs/cache/inmemory/inMemoryCache.cjs +1 -1
- package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
- package/__cjs/cache/inmemory/types.d.cts +1 -1
- package/__cjs/core/ApolloClient.cjs +45 -7
- package/__cjs/core/ApolloClient.cjs.map +1 -1
- package/__cjs/core/ApolloClient.d.cts +17 -4
- package/__cjs/core/ObservableQuery.cjs +40 -10
- package/__cjs/core/ObservableQuery.cjs.map +1 -1
- package/__cjs/core/ObservableQuery.d.cts +73 -9
- package/__cjs/core/types.d.cts +87 -10
- package/__cjs/link/http/HttpLink.cjs.map +1 -1
- package/__cjs/link/http/HttpLink.d.cts +11 -1
- package/__cjs/react/hooks/useBackgroundQuery.d.cts +4 -0
- package/__cjs/react/hooks/useFragment.cjs +4 -5
- package/__cjs/react/hooks/useFragment.cjs.map +1 -1
- package/__cjs/react/hooks/useFragment.d.cts +4 -7
- package/__cjs/react/hooks/useLazyQuery.d.cts +5 -1
- package/__cjs/react/hooks/useLoadableQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useLoadableQuery.d.cts +209 -10
- package/__cjs/react/hooks/useQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useQuery.d.cts +270 -246
- package/__cjs/react/hooks/useQueryRefHandlers.d.cts +4 -0
- package/__cjs/react/hooks/useSubscription.cjs.map +1 -1
- package/__cjs/react/hooks/useSubscription.d.cts +79 -62
- package/__cjs/react/hooks/useSuspenseFragment.cjs.map +1 -1
- package/__cjs/react/hooks/useSuspenseFragment.d.cts +2 -2
- package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useSuspenseQuery.d.cts +185 -161
- package/__cjs/react/index.cjs +1 -3
- package/__cjs/react/index.cjs.map +1 -1
- package/__cjs/react/index.d.cts +0 -1
- package/__cjs/react/internal/cache/FragmentReference.cjs +1 -1
- package/__cjs/react/internal/cache/FragmentReference.cjs.map +1 -1
- package/__cjs/react/types/types.documentation.d.cts +12 -1
- package/__cjs/utilities/internal/getStoreKeyName.cjs +8 -5
- package/__cjs/utilities/internal/getStoreKeyName.cjs.map +1 -1
- package/__cjs/utilities/internal/index.cjs +4 -2
- package/__cjs/utilities/internal/index.cjs.map +1 -1
- package/__cjs/utilities/internal/index.d.cts +2 -0
- package/__cjs/utilities/internal/removeFragmentSpreads.cjs +14 -0
- package/__cjs/utilities/internal/removeFragmentSpreads.cjs.map +1 -0
- package/__cjs/utilities/internal/removeFragmentSpreads.d.cts +3 -0
- package/__cjs/utilities/internal/types/DocumentationTypes.cjs +3 -0
- package/__cjs/utilities/internal/types/DocumentationTypes.cjs.map +1 -0
- package/__cjs/utilities/internal/types/DocumentationTypes.d.cts +82 -0
- package/__cjs/version.cjs +1 -1
- package/cache/core/cache.d.ts +42 -13
- package/cache/core/cache.js +2 -6
- package/cache/core/cache.js.map +1 -1
- package/cache/inmemory/entityStore.d.ts +1 -1
- package/cache/inmemory/entityStore.js +3 -3
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/inMemoryCache.js +1 -1
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/types.d.ts +1 -1
- package/cache/inmemory/types.js.map +1 -1
- package/core/ApolloClient.d.ts +17 -4
- package/core/ApolloClient.js +46 -8
- package/core/ApolloClient.js.map +1 -1
- package/core/ObservableQuery.d.ts +73 -9
- package/core/ObservableQuery.js +40 -10
- package/core/ObservableQuery.js.map +1 -1
- package/core/types.d.ts +87 -10
- package/core/types.js.map +1 -1
- package/link/http/HttpLink.d.ts +11 -1
- package/link/http/HttpLink.js.map +1 -1
- package/package.json +1 -1
- package/react/hooks/useBackgroundQuery.d.ts +4 -0
- package/react/hooks/useFragment.d.ts +4 -7
- package/react/hooks/useFragment.js +4 -5
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useLazyQuery.d.ts +5 -1
- package/react/hooks/useLoadableQuery.d.ts +209 -10
- package/react/hooks/useLoadableQuery.js.map +1 -1
- package/react/hooks/useQuery.d.ts +270 -246
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useQueryRefHandlers.d.ts +4 -0
- package/react/hooks/useSubscription.d.ts +79 -62
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseFragment.d.ts +2 -2
- package/react/hooks/useSuspenseFragment.js.map +1 -1
- package/react/hooks/useSuspenseQuery.d.ts +185 -161
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/hooks-compiled/useBackgroundQuery.d.ts +4 -0
- package/react/hooks-compiled/useFragment.d.ts +4 -7
- package/react/hooks-compiled/useFragment.js +4 -5
- package/react/hooks-compiled/useFragment.js.map +1 -1
- package/react/hooks-compiled/useLazyQuery.d.ts +5 -1
- package/react/hooks-compiled/useLoadableQuery.d.ts +209 -10
- package/react/hooks-compiled/useLoadableQuery.js.map +1 -1
- package/react/hooks-compiled/useQuery.d.ts +270 -246
- package/react/hooks-compiled/useQuery.js.map +1 -1
- package/react/hooks-compiled/useQueryRefHandlers.d.ts +4 -0
- package/react/hooks-compiled/useSubscription.d.ts +79 -62
- package/react/hooks-compiled/useSubscription.js.map +1 -1
- package/react/hooks-compiled/useSuspenseFragment.d.ts +2 -2
- package/react/hooks-compiled/useSuspenseFragment.js.map +1 -1
- package/react/hooks-compiled/useSuspenseQuery.d.ts +185 -161
- package/react/hooks-compiled/useSuspenseQuery.js.map +1 -1
- package/react/index.compiled.d.ts +0 -1
- package/react/index.compiled.js +0 -1
- package/react/index.compiled.js.map +1 -1
- package/react/index.d.ts +0 -1
- package/react/index.js +0 -1
- package/react/index.js.map +1 -1
- package/react/internal/cache/FragmentReference.js +1 -1
- package/react/internal/cache/FragmentReference.js.map +1 -1
- package/react/types/types.documentation.d.ts +12 -1
- package/react/types/types.documentation.js.map +1 -1
- package/utilities/internal/getStoreKeyName.js +8 -5
- package/utilities/internal/getStoreKeyName.js.map +1 -1
- package/utilities/internal/index.d.ts +2 -0
- package/utilities/internal/index.js +1 -0
- package/utilities/internal/index.js.map +1 -1
- package/utilities/internal/removeFragmentSpreads.d.ts +3 -0
- package/utilities/internal/removeFragmentSpreads.js +11 -0
- package/utilities/internal/removeFragmentSpreads.js.map +1 -0
- package/utilities/internal/types/DocumentationTypes.d.ts +82 -0
- package/utilities/internal/types/DocumentationTypes.js +2 -0
- package/utilities/internal/types/DocumentationTypes.js.map +1 -0
- package/version.js +1 -1
|
@@ -170,7 +170,32 @@ class ObservableQuery {
|
|
|
170
170
|
// We can't use Observable['subscribe'] here as the type as it conflicts with
|
|
171
171
|
// the ability to infer T from Subscribable<T>. This limits the surface area
|
|
172
172
|
// to the non-deprecated signature which works properly with type inference.
|
|
173
|
+
/**
|
|
174
|
+
* Subscribes to the `ObservableQuery`.
|
|
175
|
+
* @param observerOrNext - Either an RxJS `Observer` with some or all callback methods,
|
|
176
|
+
* or the `next` handler that is called for each value emitted from the subscribed Observable.
|
|
177
|
+
* @returns A subscription reference to the registered handlers.
|
|
178
|
+
*/
|
|
173
179
|
subscribe;
|
|
180
|
+
/**
|
|
181
|
+
* Used to stitch together functional operators into a chain.
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
*
|
|
185
|
+
* ```ts
|
|
186
|
+
* import { filter, map } from 'rxjs';
|
|
187
|
+
*
|
|
188
|
+
* observableQuery
|
|
189
|
+
* .pipe(
|
|
190
|
+
* filter(...),
|
|
191
|
+
* map(...),
|
|
192
|
+
* )
|
|
193
|
+
* .subscribe(x => console.log(x));
|
|
194
|
+
* ```
|
|
195
|
+
*
|
|
196
|
+
* @returns The Observable result of all the operators having been called
|
|
197
|
+
* in the order they were passed in.
|
|
198
|
+
*/
|
|
174
199
|
pipe;
|
|
175
200
|
[Symbol.observable];
|
|
176
201
|
["@@observable"];
|
|
@@ -326,6 +351,13 @@ class ObservableQuery {
|
|
|
326
351
|
* Update the variables of this observable query, and fetch the new results.
|
|
327
352
|
* This method should be preferred over `setVariables` in most use cases.
|
|
328
353
|
*
|
|
354
|
+
* Returns a `ResultPromise` with an additional `.retain()` method. Calling
|
|
355
|
+
* `.retain()` keeps the network operation running even if the `ObservableQuery`
|
|
356
|
+
* no longer requires the result.
|
|
357
|
+
*
|
|
358
|
+
* Note: `refetch()` guarantees that a value will be emitted from the
|
|
359
|
+
* observable, even if the result is deep equal to the previous value.
|
|
360
|
+
*
|
|
329
361
|
* @param variables - The new set of variables. If there are missing variables,
|
|
330
362
|
* the previous values of those variables will be used.
|
|
331
363
|
*/
|
|
@@ -361,9 +393,6 @@ class ObservableQuery {
|
|
|
361
393
|
newNetworkStatus: networkStatus_js_1.NetworkStatus.refetch,
|
|
362
394
|
});
|
|
363
395
|
}
|
|
364
|
-
/**
|
|
365
|
-
* 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/).
|
|
366
|
-
*/
|
|
367
396
|
fetchMore({ query, variables, context, errorPolicy, updateQuery, }) {
|
|
368
397
|
(0, invariant_1.invariant)(
|
|
369
398
|
this.options.fetchPolicy !== "cache-only",
|
|
@@ -568,14 +597,12 @@ class ObservableQuery {
|
|
|
568
597
|
* `setVariables` in order to to be properly notified of results even when
|
|
569
598
|
* they come from the cache.
|
|
570
599
|
*
|
|
571
|
-
* Note:
|
|
572
|
-
*
|
|
573
|
-
*
|
|
574
|
-
* Note: the promise will return the old results immediately if the variables
|
|
575
|
-
* have not changed.
|
|
600
|
+
* Note: `setVariables()` guarantees that a value will be emitted from the
|
|
601
|
+
* observable, even if the result is deeply equal to the previous value.
|
|
576
602
|
*
|
|
577
|
-
* Note: the promise will
|
|
578
|
-
*
|
|
603
|
+
* Note: the promise will resolve with the last emitted result
|
|
604
|
+
* when either the variables match the current variables or there
|
|
605
|
+
* are no subscribers to the query.
|
|
579
606
|
*
|
|
580
607
|
* @param variables - The new set of variables. If there are missing variables,
|
|
581
608
|
* the previous values of those variables will be used.
|
|
@@ -831,6 +858,9 @@ class ObservableQuery {
|
|
|
831
858
|
/**
|
|
832
859
|
* Reevaluate the query, optionally against new options. New options will be
|
|
833
860
|
* merged with the current options when given.
|
|
861
|
+
*
|
|
862
|
+
* Note: `variables` can be reset back to their defaults (typically empty) by calling `reobserve` with
|
|
863
|
+
* `variables: undefined`.
|
|
834
864
|
*/
|
|
835
865
|
reobserve(newOptions) {
|
|
836
866
|
return this._reobserve(newOptions);
|