@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,4 +1,5 @@
|
|
|
1
1
|
import type { DocumentNode, FieldNode } from "graphql";
|
|
2
|
+
import type { OperationVariables } from "@apollo/client/core";
|
|
2
3
|
import type { Reference, StoreObject, StoreValue } from "@apollo/client/utilities";
|
|
3
4
|
import type { Transaction } from "../core/cache.cjs";
|
|
4
5
|
import type { AllFieldsModifier, CanReadFunction, Modifiers, ToReferenceFunction } from "../core/types/common.cjs";
|
|
@@ -60,7 +61,7 @@ export interface NormalizedCacheObject {
|
|
|
60
61
|
export type OptimisticStoreItem = {
|
|
61
62
|
id: string;
|
|
62
63
|
data: NormalizedCacheObject;
|
|
63
|
-
transaction: Transaction
|
|
64
|
+
transaction: Transaction;
|
|
64
65
|
};
|
|
65
66
|
export type ReadQueryOptions = {
|
|
66
67
|
/**
|
|
@@ -73,14 +74,6 @@ export type ReadQueryOptions = {
|
|
|
73
74
|
query: DocumentNode;
|
|
74
75
|
variables?: Object;
|
|
75
76
|
previousResult?: any;
|
|
76
|
-
/**
|
|
77
|
-
* @deprecated
|
|
78
|
-
* Using `canonizeResults` can result in memory leaks so we generally do not
|
|
79
|
-
* recommend using this option anymore.
|
|
80
|
-
* A future version of Apollo Client will contain a similar feature without
|
|
81
|
-
* the risk of memory leaks.
|
|
82
|
-
*/
|
|
83
|
-
canonizeResults?: boolean;
|
|
84
77
|
rootId?: string;
|
|
85
78
|
config?: ApolloReducerConfig;
|
|
86
79
|
};
|
|
@@ -99,13 +92,6 @@ export interface InMemoryCacheConfig extends ApolloReducerConfig {
|
|
|
99
92
|
* Please use `cacheSizes` instead.
|
|
100
93
|
*/
|
|
101
94
|
resultCacheMaxSize?: number;
|
|
102
|
-
/**
|
|
103
|
-
* @deprecated
|
|
104
|
-
* Using `canonizeResults` can result in memory leaks so we generally do not
|
|
105
|
-
* recommend using this option anymore.
|
|
106
|
-
* A future version of Apollo Client will contain a similar feature.
|
|
107
|
-
*/
|
|
108
|
-
canonizeResults?: boolean;
|
|
109
95
|
fragments?: FragmentRegistryAPI;
|
|
110
96
|
}
|
|
111
97
|
export interface MergeInfo {
|
|
@@ -119,7 +105,7 @@ export interface MergeTree {
|
|
|
119
105
|
}
|
|
120
106
|
export interface ReadMergeModifyContext {
|
|
121
107
|
store: NormalizedCache;
|
|
122
|
-
variables?:
|
|
108
|
+
variables?: OperationVariables;
|
|
123
109
|
varString?: string;
|
|
124
110
|
}
|
|
125
111
|
//# sourceMappingURL=types.d.cts.map
|
|
@@ -42,7 +42,7 @@ class StoreWriter {
|
|
|
42
42
|
this.reader = reader;
|
|
43
43
|
this.fragments = fragments;
|
|
44
44
|
}
|
|
45
|
-
writeToStore(store, { query, result, dataId, variables, overwrite }) {
|
|
45
|
+
writeToStore(store, { query, result, dataId, variables, overwrite, }) {
|
|
46
46
|
const operationDefinition = (0, utilities_1.getOperationDefinition)(query);
|
|
47
47
|
const merger = (0, helpers_js_1.makeProcessedFieldsMerger)();
|
|
48
48
|
variables = {
|
|
@@ -55,7 +55,7 @@ class StoreWriter {
|
|
|
55
55
|
merge(existing, incoming) {
|
|
56
56
|
return merger.merge(existing, incoming);
|
|
57
57
|
},
|
|
58
|
-
variables,
|
|
58
|
+
variables: variables,
|
|
59
59
|
varString: (0, utilities_1.canonicalStringify)(variables),
|
|
60
60
|
...(0, helpers_js_1.extractFragmentContext)(query, this.fragments),
|
|
61
61
|
overwrite: !!overwrite,
|
|
@@ -149,8 +149,8 @@ class StoreWriter {
|
|
|
149
149
|
// pending in context.incomingById, which is important whenever keyFields
|
|
150
150
|
// need to be extracted from a child object that processSelectionSet has
|
|
151
151
|
// turned into a Reference.
|
|
152
|
-
const readField =
|
|
153
|
-
const options = (0, policies_js_1.normalizeReadFieldOptions)(
|
|
152
|
+
const readField = (...args) => {
|
|
153
|
+
const options = (0, policies_js_1.normalizeReadFieldOptions)(args, incoming, context.variables);
|
|
154
154
|
if ((0, utilities_1.isReference)(options.from)) {
|
|
155
155
|
const info = context.incomingById.get(options.from.__ref);
|
|
156
156
|
if (info) {
|