@apollo/client 4.0.0-alpha.1 → 4.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.changeset/cuddly-spiders-tie.md +5 -0
- package/.changeset/four-ghosts-watch.md +5 -0
- package/.changeset/gorgeous-chefs-tap.md +5 -0
- package/.changeset/hip-vans-act.md +5 -0
- package/.changeset/nervous-goats-allow.md +5 -0
- package/.changeset/pre.json +10 -0
- package/.changeset/slimy-maps-press.md +5 -0
- package/.changeset/small-buttons-rhyme.md +5 -0
- package/.changeset/tall-bikes-develop.md +5 -0
- package/.changeset/unlucky-kiwis-sell.md +5 -0
- package/.changeset/young-phones-fold.md +5 -0
- package/CHANGELOG.md +36 -0
- package/__cjs/cache/core/cache.cjs +1 -1
- package/__cjs/cache/core/cache.cjs.map +1 -1
- package/__cjs/cache/core/cache.d.cts +17 -17
- package/__cjs/cache/core/types/Cache.cjs.map +1 -1
- package/__cjs/cache/core/types/Cache.d.cts +9 -16
- package/__cjs/cache/core/types/DataProxy.d.cts +8 -23
- package/__cjs/cache/inmemory/entityStore.cjs +2 -4
- package/__cjs/cache/inmemory/entityStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/entityStore.d.cts +2 -2
- package/__cjs/cache/inmemory/fragmentRegistry.cjs +3 -3
- package/__cjs/cache/inmemory/fragmentRegistry.cjs.map +1 -1
- package/__cjs/cache/inmemory/helpers.cjs +0 -8
- package/__cjs/cache/inmemory/helpers.cjs.map +1 -1
- package/__cjs/cache/inmemory/helpers.d.cts +3 -4
- package/__cjs/cache/inmemory/inMemoryCache.cjs +4 -12
- package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
- package/__cjs/cache/inmemory/inMemoryCache.d.cts +7 -8
- package/__cjs/cache/inmemory/policies.cjs +5 -5
- package/__cjs/cache/inmemory/policies.cjs.map +1 -1
- package/__cjs/cache/inmemory/policies.d.cts +1 -1
- package/__cjs/cache/inmemory/reactiveVars.cjs.map +1 -1
- package/__cjs/cache/inmemory/reactiveVars.d.cts +6 -6
- package/__cjs/cache/inmemory/readFromStore.cjs +12 -54
- package/__cjs/cache/inmemory/readFromStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/readFromStore.d.cts +1 -6
- package/__cjs/cache/inmemory/types.d.cts +3 -17
- package/__cjs/cache/inmemory/writeToStore.cjs +4 -4
- package/__cjs/cache/inmemory/writeToStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/writeToStore.d.cts +2 -2
- package/__cjs/core/ApolloClient.cjs.map +1 -1
- package/__cjs/core/ApolloClient.d.cts +18 -18
- package/__cjs/core/LocalState.cjs.map +1 -1
- package/__cjs/core/LocalState.d.cts +8 -8
- package/__cjs/core/ObservableQuery.cjs.map +1 -1
- package/__cjs/core/ObservableQuery.d.cts +4 -4
- package/__cjs/core/QueryInfo.cjs +8 -8
- package/__cjs/core/QueryInfo.cjs.map +1 -1
- package/__cjs/core/QueryInfo.d.cts +2 -1
- package/__cjs/core/QueryManager.cjs +22 -11
- package/__cjs/core/QueryManager.cjs.map +1 -1
- package/__cjs/core/QueryManager.d.cts +26 -16
- package/__cjs/core/types.d.cts +4 -4
- package/__cjs/core/watchQueryOptions.d.cts +10 -26
- package/__cjs/link/http/createHttpLink.d.cts +2 -1
- package/__cjs/link/persisted-queries/index.cjs +1 -1
- package/__cjs/link/persisted-queries/index.cjs.map +1 -1
- package/__cjs/link/persisted-queries/index.d.cts +12 -1
- package/__cjs/link/remove-typename/removeTypenameFromVariables.cjs +1 -1
- package/__cjs/link/remove-typename/removeTypenameFromVariables.cjs.map +1 -1
- package/__cjs/link/remove-typename/removeTypenameFromVariables.d.cts +10 -1
- package/__cjs/masking/maskDefinition.cjs.map +1 -1
- package/__cjs/masking/maskDefinition.d.cts +1 -1
- package/__cjs/masking/maskFragment.cjs.map +1 -1
- package/__cjs/masking/maskFragment.d.cts +1 -1
- package/__cjs/masking/maskOperation.cjs.map +1 -1
- package/__cjs/masking/maskOperation.d.cts +1 -1
- package/__cjs/react/context/ApolloConsumer.cjs.map +1 -1
- package/__cjs/react/context/ApolloConsumer.d.cts +1 -1
- package/__cjs/react/context/ApolloContext.cjs.map +1 -1
- package/__cjs/react/context/ApolloContext.d.cts +1 -1
- package/__cjs/react/context/ApolloProvider.cjs.map +1 -1
- package/__cjs/react/context/ApolloProvider.d.cts +3 -3
- package/__cjs/react/hooks/internal/__use.d.cts +3 -1
- package/__cjs/react/hooks/internal/useIsomorphicLayoutEffect.d.cts +1 -1
- package/__cjs/react/hooks/internal/wrapHook.cjs.map +1 -1
- package/__cjs/react/hooks/internal/wrapHook.d.cts +1 -1
- package/__cjs/react/hooks/useApolloClient.cjs.map +1 -1
- package/__cjs/react/hooks/useApolloClient.d.cts +1 -1
- package/__cjs/react/hooks/useFragment.cjs.map +1 -1
- package/__cjs/react/hooks/useFragment.d.cts +3 -3
- package/__cjs/react/hooks/useLazyQuery.cjs +2 -2
- package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useLazyQuery.d.cts +8 -20
- package/__cjs/react/hooks/useMutation.cjs.map +1 -1
- package/__cjs/react/hooks/useMutation.d.cts +1 -1
- package/__cjs/react/hooks/useQuery.cjs +11 -21
- package/__cjs/react/hooks/useQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useQuery.d.cts +1 -1
- package/__cjs/react/hooks/useQueryRefHandlers.cjs.map +1 -1
- package/__cjs/react/hooks/useReadQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useSubscription.cjs.map +1 -1
- package/__cjs/react/hooks/useSubscription.d.cts +7 -1
- package/__cjs/react/hooks/useSuspenseFragment.cjs.map +1 -1
- package/__cjs/react/hooks/useSuspenseFragment.d.cts +1 -1
- package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useSuspenseQuery.d.cts +2 -2
- package/__cjs/react/internal/cache/FragmentReference.cjs.map +1 -1
- package/__cjs/react/internal/cache/FragmentReference.d.cts +3 -3
- package/__cjs/react/internal/cache/QueryReference.cjs +3 -14
- package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
- package/__cjs/react/internal/cache/QueryReference.d.cts +6 -6
- package/__cjs/react/internal/cache/SuspenseCache.cjs.map +1 -1
- package/__cjs/react/internal/cache/SuspenseCache.d.cts +3 -3
- package/__cjs/react/internal/cache/getSuspenseCache.cjs.map +1 -1
- package/__cjs/react/internal/cache/getSuspenseCache.d.cts +2 -2
- package/__cjs/react/parser/index.cjs +1 -1
- package/__cjs/react/parser/index.cjs.map +1 -1
- package/__cjs/react/query-preloader/createQueryPreloader.cjs.map +1 -1
- package/__cjs/react/query-preloader/createQueryPreloader.d.cts +1 -9
- package/__cjs/react/types/types.d.cts +31 -59
- package/__cjs/react/types/types.documentation.d.cts +0 -20
- package/__cjs/testing/core/mocking/mockClient.cjs.map +1 -1
- package/__cjs/testing/core/mocking/mockClient.d.cts +1 -2
- package/__cjs/testing/internal/disposables/withProdMode.d.cts +1 -1
- package/__cjs/testing/internal/incremental.d.cts +3 -2
- package/__cjs/testing/internal/renderHelpers.cjs.map +1 -1
- package/__cjs/testing/internal/renderHelpers.d.cts +2 -2
- package/__cjs/testing/internal/scenarios/index.d.cts +16 -5
- package/__cjs/testing/matchers/toEqualQueryResult.cjs +0 -1
- package/__cjs/testing/matchers/toEqualQueryResult.cjs.map +1 -1
- package/__cjs/testing/matchers/toEqualQueryResult.d.cts +1 -1
- package/__cjs/testing/react/MockedProvider.cjs.map +1 -1
- package/__cjs/testing/react/MockedProvider.d.cts +3 -3
- package/__cjs/utilities/common/errorHandling.d.cts +1 -1
- package/__cjs/utilities/internal/getMemoryInternals.cjs.map +1 -1
- package/__cjs/utilities/internal/getMemoryInternals.d.cts +1 -1
- package/__cjs/utilities/types/NoInfer.d.cts +1 -1
- package/__cjs/version.cjs +1 -1
- package/__cjs/version.d.cts +1 -1
- package/cache/core/cache.d.ts +17 -17
- package/cache/core/cache.js.map +1 -1
- package/cache/core/types/Cache.d.ts +9 -16
- package/cache/core/types/Cache.js.map +1 -1
- package/cache/core/types/DataProxy.d.ts +8 -23
- package/cache/inmemory/entityStore.d.ts +2 -2
- package/cache/inmemory/entityStore.js +2 -4
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/helpers.d.ts +0 -1
- package/cache/inmemory/helpers.js +0 -7
- package/cache/inmemory/helpers.js.map +1 -1
- package/cache/inmemory/inMemoryCache.d.ts +7 -8
- package/cache/inmemory/inMemoryCache.js +4 -12
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/policies.d.ts +1 -1
- package/cache/inmemory/policies.js +5 -5
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/reactiveVars.d.ts +6 -6
- package/cache/inmemory/reactiveVars.js.map +1 -1
- package/cache/inmemory/readFromStore.d.ts +1 -6
- package/cache/inmemory/readFromStore.js +12 -54
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.d.ts +3 -17
- package/cache/inmemory/writeToStore.d.ts +2 -2
- package/cache/inmemory/writeToStore.js +4 -4
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/ApolloClient.d.ts +18 -18
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.d.ts +6 -6
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.d.ts +3 -3
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +2 -1
- package/core/QueryInfo.js +8 -8
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +13 -13
- package/core/QueryManager.js +21 -10
- package/core/QueryManager.js.map +1 -1
- package/core/types.d.ts +4 -4
- package/core/watchQueryOptions.d.ts +10 -26
- package/masking/maskDefinition.d.ts +1 -1
- package/masking/maskDefinition.js.map +1 -1
- package/masking/maskFragment.d.ts +1 -1
- package/masking/maskFragment.js.map +1 -1
- package/masking/maskOperation.d.ts +1 -1
- package/masking/maskOperation.js.map +1 -1
- package/package.json +1 -1
- package/react/context/ApolloConsumer.d.ts +1 -1
- package/react/context/ApolloConsumer.js.map +1 -1
- package/react/context/ApolloContext.d.ts +1 -1
- package/react/context/ApolloContext.js.map +1 -1
- package/react/context/ApolloProvider.d.ts +3 -3
- package/react/context/ApolloProvider.js.map +1 -1
- package/react/hooks/internal/wrapHook.d.ts +1 -1
- package/react/hooks/internal/wrapHook.js.map +1 -1
- package/react/hooks/useApolloClient.d.ts +1 -1
- package/react/hooks/useApolloClient.js.map +1 -1
- package/react/hooks/useFragment.d.ts +3 -3
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useLazyQuery.d.ts +8 -20
- package/react/hooks/useLazyQuery.js +2 -2
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useMutation.d.ts +1 -1
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.d.ts +1 -1
- package/react/hooks/useQuery.js +11 -21
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useQueryRefHandlers.js.map +1 -1
- package/react/hooks/useReadQuery.js.map +1 -1
- package/react/hooks/useSubscription.d.ts +1 -1
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseFragment.d.ts +1 -1
- package/react/hooks/useSuspenseFragment.js.map +1 -1
- package/react/hooks/useSuspenseQuery.d.ts +2 -2
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/internal/cache/FragmentReference.d.ts +3 -3
- package/react/internal/cache/FragmentReference.js.map +1 -1
- package/react/internal/cache/QueryReference.d.ts +1 -1
- package/react/internal/cache/QueryReference.js +3 -14
- package/react/internal/cache/QueryReference.js.map +1 -1
- package/react/internal/cache/SuspenseCache.d.ts +3 -3
- package/react/internal/cache/SuspenseCache.js.map +1 -1
- package/react/internal/cache/getSuspenseCache.d.ts +1 -1
- package/react/internal/cache/getSuspenseCache.js.map +1 -1
- package/react/query-preloader/createQueryPreloader.d.ts +1 -9
- package/react/query-preloader/createQueryPreloader.js.map +1 -1
- package/react/types/types.d.ts +31 -59
- package/react/types/types.documentation.d.ts +0 -20
- package/testing/core/mocking/mockClient.d.ts +1 -2
- package/testing/core/mocking/mockClient.js.map +1 -1
- package/testing/internal/renderHelpers.d.ts +2 -2
- package/testing/internal/renderHelpers.js.map +1 -1
- package/testing/matchers/toEqualQueryResult.d.ts +1 -1
- package/testing/matchers/toEqualQueryResult.js +0 -1
- package/testing/matchers/toEqualQueryResult.js.map +1 -1
- package/testing/react/MockedProvider.d.ts +3 -3
- package/testing/react/MockedProvider.js.map +1 -1
- package/utilities/internal/getMemoryInternals.js.map +1 -1
- package/utilities/types/NoInfer.d.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/__cjs/cache/inmemory/object-canon.cjs +0 -180
- package/__cjs/cache/inmemory/object-canon.cjs.map +0 -1
- package/__cjs/cache/inmemory/object-canon.d.cts +0 -12
- package/cache/inmemory/object-canon.d.ts +0 -12
- package/cache/inmemory/object-canon.js +0 -176
- package/cache/inmemory/object-canon.js.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { TypedDocumentNode } from "@graphql-typed-document-node/core";
|
|
2
2
|
import type { DocumentNode } from "graphql";
|
|
3
|
+
import type { OperationVariables } from "@apollo/client/core";
|
|
3
4
|
import type { Unmasked } from "@apollo/client/masking";
|
|
4
5
|
import type { DeepPartial, Reference } from "@apollo/client/utilities";
|
|
5
6
|
import type { MissingFieldError } from "./common.js";
|
|
@@ -59,14 +60,6 @@ export declare namespace DataProxy {
|
|
|
59
60
|
* readQuery method can be omitted. Defaults to false.
|
|
60
61
|
*/
|
|
61
62
|
optimistic?: boolean;
|
|
62
|
-
/**
|
|
63
|
-
* Whether to canonize cache results before returning them. Canonization takes some extra time, but it speeds up future deep equality comparisons. Defaults to false.
|
|
64
|
-
*
|
|
65
|
-
* @deprecated
|
|
66
|
-
*
|
|
67
|
-
* Using `canonizeResults` can result in memory leaks so we generally do not recommend using this option anymore. A future version of Apollo Client will contain a similar feature without the risk of memory leaks.
|
|
68
|
-
*/
|
|
69
|
-
canonizeResults?: boolean;
|
|
70
63
|
}
|
|
71
64
|
interface ReadFragmentOptions<TData, TVariables> extends Fragment<TVariables, TData> {
|
|
72
65
|
/**
|
|
@@ -80,14 +73,6 @@ export declare namespace DataProxy {
|
|
|
80
73
|
* readQuery method can be omitted. Defaults to false.
|
|
81
74
|
*/
|
|
82
75
|
optimistic?: boolean;
|
|
83
|
-
/**
|
|
84
|
-
* Whether to canonize cache results before returning them. Canonization takes some extra time, but it speeds up future deep equality comparisons. Defaults to false.
|
|
85
|
-
*
|
|
86
|
-
* @deprecated
|
|
87
|
-
*
|
|
88
|
-
* Using `canonizeResults` can result in memory leaks so we generally do not recommend using this option anymore. A future version of Apollo Client will contain a similar feature without the risk of memory leaks.
|
|
89
|
-
*/
|
|
90
|
-
canonizeResults?: boolean;
|
|
91
76
|
}
|
|
92
77
|
interface WriteOptions<TData> {
|
|
93
78
|
/**
|
|
@@ -112,13 +97,13 @@ export declare namespace DataProxy {
|
|
|
112
97
|
}
|
|
113
98
|
interface UpdateFragmentOptions<TData, TVariables> extends Omit<ReadFragmentOptions<TData, TVariables> & WriteFragmentOptions<TData, TVariables>, "data"> {
|
|
114
99
|
}
|
|
115
|
-
type DiffResult<
|
|
116
|
-
result:
|
|
100
|
+
type DiffResult<TData> = {
|
|
101
|
+
result: TData;
|
|
117
102
|
complete: true;
|
|
118
103
|
missing?: never;
|
|
119
104
|
fromOptimisticTransaction?: boolean;
|
|
120
105
|
} | {
|
|
121
|
-
result: DeepPartial<
|
|
106
|
+
result: DeepPartial<TData> | null;
|
|
122
107
|
complete: false;
|
|
123
108
|
missing?: MissingFieldError;
|
|
124
109
|
fromOptimisticTransaction?: boolean;
|
|
@@ -134,22 +119,22 @@ export interface DataProxy {
|
|
|
134
119
|
/**
|
|
135
120
|
* Reads a GraphQL query from the root query id.
|
|
136
121
|
*/
|
|
137
|
-
readQuery<
|
|
122
|
+
readQuery<TData = unknown, TVariables = OperationVariables>(options: DataProxy.ReadQueryOptions<TData, TVariables>, optimistic?: boolean): Unmasked<TData> | null;
|
|
138
123
|
/**
|
|
139
124
|
* Reads a GraphQL fragment from any arbitrary id. If there is more than
|
|
140
125
|
* one fragment in the provided document then a `fragmentName` must be
|
|
141
126
|
* provided to select the correct fragment.
|
|
142
127
|
*/
|
|
143
|
-
readFragment<
|
|
128
|
+
readFragment<TData = unknown, TVariables = OperationVariables>(options: DataProxy.ReadFragmentOptions<TData, TVariables>, optimistic?: boolean): Unmasked<TData> | null;
|
|
144
129
|
/**
|
|
145
130
|
* Writes a GraphQL query to the root query id.
|
|
146
131
|
*/
|
|
147
|
-
writeQuery<TData =
|
|
132
|
+
writeQuery<TData = unknown, TVariables = OperationVariables>(options: DataProxy.WriteQueryOptions<TData, TVariables>): Reference | undefined;
|
|
148
133
|
/**
|
|
149
134
|
* Writes a GraphQL fragment to any arbitrary id. If there is more than
|
|
150
135
|
* one fragment in the provided document then a `fragmentName` must be
|
|
151
136
|
* provided to select the correct fragment.
|
|
152
137
|
*/
|
|
153
|
-
writeFragment<TData =
|
|
138
|
+
writeFragment<TData = unknown, TVariables = OperationVariables>(options: DataProxy.WriteFragmentOptions<TData, TVariables>): Reference | undefined;
|
|
154
139
|
}
|
|
155
140
|
//# sourceMappingURL=DataProxy.d.ts.map
|
|
@@ -34,7 +34,7 @@ export declare abstract class EntityStore implements NormalizedCache {
|
|
|
34
34
|
/** overload for `InMemoryCache.maybeBroadcastWatch` */
|
|
35
35
|
makeCacheKey(document: DocumentNode, callback: Cache.WatchCallback<any>, details: string): object;
|
|
36
36
|
/** overload for `StoreReader.executeSelectionSet` */
|
|
37
|
-
makeCacheKey(selectionSet: SelectionSetNode, parent: string | StoreObject, varString: string | undefined
|
|
37
|
+
makeCacheKey(selectionSet: SelectionSetNode, parent: string | StoreObject, varString: string | undefined): object;
|
|
38
38
|
/** overload for `StoreReader.executeSubSelectedArray` */
|
|
39
39
|
makeCacheKey(field: FieldNode, array: readonly any[], varString: string | undefined): object;
|
|
40
40
|
/** @deprecated This is only meant for internal usage,
|
|
@@ -80,7 +80,7 @@ declare class Layer extends EntityStore {
|
|
|
80
80
|
removeLayer(layerId: string): EntityStore;
|
|
81
81
|
toObject(): NormalizedCacheObject;
|
|
82
82
|
findChildRefIds(dataId: string): Record<string, true>;
|
|
83
|
-
getStorage(): StorageType;
|
|
83
|
+
getStorage(...args: Parameters<EntityStore["getStorage"]>): StorageType;
|
|
84
84
|
}
|
|
85
85
|
declare class Stump extends Layer {
|
|
86
86
|
constructor(root: EntityStore.Root);
|
|
@@ -621,13 +621,11 @@ class Layer extends EntityStore {
|
|
|
621
621
|
}
|
|
622
622
|
: fromParent;
|
|
623
623
|
}
|
|
624
|
-
getStorage() {
|
|
624
|
+
getStorage(...args) {
|
|
625
625
|
let p = this.parent;
|
|
626
626
|
while (p.parent)
|
|
627
627
|
p = p.parent;
|
|
628
|
-
return p.getStorage
|
|
629
|
-
// @ts-expect-error
|
|
630
|
-
arguments);
|
|
628
|
+
return p.getStorage(...args);
|
|
631
629
|
}
|
|
632
630
|
}
|
|
633
631
|
// Represents a Layer permanently installed just above the Root, which allows
|