@apollo/client 4.2.0-alpha.3 → 4.2.0-alpha.4
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 +179 -0
- package/__cjs/cache/core/cache.cjs +1 -1
- package/__cjs/cache/inmemory/entityStore.cjs +3 -3
- package/__cjs/cache/inmemory/entityStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
- package/__cjs/cache/inmemory/policies.cjs +4 -4
- package/__cjs/cache/inmemory/readFromStore.cjs +2 -2
- package/__cjs/cache/inmemory/writeToStore.cjs +4 -4
- package/__cjs/core/ApolloClient.cjs +43 -11
- package/__cjs/core/ApolloClient.cjs.map +1 -1
- package/__cjs/core/ApolloClient.d.cts +28 -1
- package/__cjs/core/ObservableQuery.cjs +7 -7
- package/__cjs/core/ObservableQuery.cjs.map +1 -1
- package/__cjs/core/ObservableQuery.d.cts +20 -1
- package/__cjs/core/QueryManager.cjs +12 -12
- package/__cjs/core/QueryManager.cjs.map +1 -1
- package/__cjs/core/RefetchEventManager.cjs +134 -0
- package/__cjs/core/RefetchEventManager.cjs.map +1 -0
- package/__cjs/core/RefetchEventManager.d.cts +130 -0
- package/__cjs/core/index.cjs +7 -1
- package/__cjs/core/index.cjs.map +1 -1
- package/__cjs/core/index.d.cts +4 -1
- package/__cjs/core/refetchSources/onlineSource.cjs +10 -0
- package/__cjs/core/refetchSources/onlineSource.cjs.map +1 -0
- package/__cjs/core/refetchSources/onlineSource.d.cts +3 -0
- package/__cjs/core/refetchSources/windowFocusSource.cjs +13 -0
- package/__cjs/core/refetchSources/windowFocusSource.cjs.map +1 -0
- package/__cjs/core/refetchSources/windowFocusSource.d.cts +3 -0
- package/__cjs/core/types.d.cts +20 -0
- package/__cjs/invariantErrorCodes.cjs +69 -44
- package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useBackgroundQuery.d.cts +20 -1
- package/__cjs/react/hooks/useLazyQuery.cjs +1 -0
- package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useLazyQuery.d.cts +20 -1
- package/__cjs/react/hooks/useLoadableQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useLoadableQuery.d.cts +20 -1
- package/__cjs/react/hooks/useQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useQuery.d.cts +20 -1
- package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useSuspenseQuery.d.cts +20 -1
- package/__cjs/react/internal/cache/QueryReference.cjs +1 -0
- package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
- package/__cjs/react/internal/cache/QueryReference.d.cts +1 -1
- package/__cjs/react/query-preloader/createQueryPreloader.cjs.map +1 -1
- package/__cjs/react/query-preloader/createQueryPreloader.d.cts +20 -1
- package/__cjs/react/types/types.documentation.d.cts +19 -0
- package/__cjs/version.cjs +1 -1
- package/cache/core/cache.js +1 -1
- package/cache/inmemory/entityStore.js +3 -3
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/key-extractor.js +1 -1
- package/cache/inmemory/policies.js +4 -4
- package/cache/inmemory/readFromStore.js +2 -2
- package/cache/inmemory/writeToStore.js +4 -4
- package/core/ApolloClient.d.ts +28 -1
- package/core/ApolloClient.js +44 -12
- package/core/ApolloClient.js.map +1 -1
- package/core/ObservableQuery.d.ts +20 -1
- package/core/ObservableQuery.js +7 -7
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryManager.js +12 -12
- package/core/QueryManager.js.map +1 -1
- package/core/RefetchEventManager.d.ts +130 -0
- package/core/RefetchEventManager.js +126 -0
- package/core/RefetchEventManager.js.map +1 -0
- package/core/index.d.ts +4 -1
- package/core/index.js +3 -0
- package/core/index.js.map +1 -1
- package/core/refetchSources/onlineSource.d.ts +3 -0
- package/core/refetchSources/onlineSource.js +6 -0
- package/core/refetchSources/onlineSource.js.map +1 -0
- package/core/refetchSources/windowFocusSource.d.ts +3 -0
- package/core/refetchSources/windowFocusSource.js +9 -0
- package/core/refetchSources/windowFocusSource.js.map +1 -0
- package/core/types.d.ts +20 -0
- package/core/types.js.map +1 -1
- package/invariantErrorCodes.js +69 -44
- package/package.json +1 -1
- package/react/hooks/useBackgroundQuery.d.ts +20 -1
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useLazyQuery.d.ts +20 -1
- package/react/hooks/useLazyQuery.js +1 -0
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useLoadableQuery.d.ts +20 -1
- package/react/hooks/useLoadableQuery.js.map +1 -1
- package/react/hooks/useQuery.d.ts +20 -1
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useSuspenseQuery.d.ts +20 -1
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/hooks-compiled/useBackgroundQuery.d.ts +20 -1
- package/react/hooks-compiled/useBackgroundQuery.js.map +1 -1
- package/react/hooks-compiled/useLazyQuery.d.ts +20 -1
- package/react/hooks-compiled/useLazyQuery.js +1 -0
- package/react/hooks-compiled/useLazyQuery.js.map +1 -1
- package/react/hooks-compiled/useLoadableQuery.d.ts +20 -1
- package/react/hooks-compiled/useLoadableQuery.js.map +1 -1
- package/react/hooks-compiled/useQuery.d.ts +20 -1
- package/react/hooks-compiled/useQuery.js.map +1 -1
- package/react/hooks-compiled/useSuspenseQuery.d.ts +20 -1
- package/react/hooks-compiled/useSuspenseQuery.js.map +1 -1
- package/react/internal/cache/QueryReference.d.ts +1 -1
- package/react/internal/cache/QueryReference.js +1 -0
- package/react/internal/cache/QueryReference.js.map +1 -1
- package/react/query-preloader/createQueryPreloader.d.ts +20 -1
- package/react/query-preloader/createQueryPreloader.js.map +1 -1
- package/react/types/types.documentation.d.ts +19 -0
- package/react/types/types.documentation.js.map +1 -1
- package/version.js +1 -1
package/core/QueryManager.js
CHANGED
|
@@ -92,7 +92,7 @@ export class QueryManager {
|
|
|
92
92
|
*/
|
|
93
93
|
stop() {
|
|
94
94
|
this.obsQueries.forEach((oq) => oq.stop());
|
|
95
|
-
this.cancelPendingFetches(newInvariantError(
|
|
95
|
+
this.cancelPendingFetches(newInvariantError(89));
|
|
96
96
|
}
|
|
97
97
|
cancelPendingFetches(error) {
|
|
98
98
|
this.fetchCancelFns.forEach((cancel) => cancel(error));
|
|
@@ -105,7 +105,7 @@ export class QueryManager {
|
|
|
105
105
|
variables = this.getVariables(mutation, variables);
|
|
106
106
|
if (hasClientExports) {
|
|
107
107
|
if (__DEV__) {
|
|
108
|
-
invariant(this.localState,
|
|
108
|
+
invariant(this.localState, 90, getOperationName(mutation, "(anonymous)"));
|
|
109
109
|
}
|
|
110
110
|
variables = await this.localState.getExportedVariables({
|
|
111
111
|
client: this.client,
|
|
@@ -342,7 +342,7 @@ export class QueryManager {
|
|
|
342
342
|
// depend on values that previously existed in the data portion of the
|
|
343
343
|
// store. So, we cancel the promises and observers that we have issued
|
|
344
344
|
// so far and not yet resolved (in the case of queries).
|
|
345
|
-
this.cancelPendingFetches(newInvariantError(
|
|
345
|
+
this.cancelPendingFetches(newInvariantError(91));
|
|
346
346
|
this.obsQueries.forEach((observableQuery) => {
|
|
347
347
|
// Set loading to true so listeners don't trigger unless they want
|
|
348
348
|
// results with partial data.
|
|
@@ -412,10 +412,10 @@ export class QueryManager {
|
|
|
412
412
|
if (!included) {
|
|
413
413
|
const queryName = queryNames.get(nameOrQueryString);
|
|
414
414
|
if (queryName) {
|
|
415
|
-
__DEV__ && invariant.warn(
|
|
415
|
+
__DEV__ && invariant.warn(92, queryName);
|
|
416
416
|
}
|
|
417
417
|
else {
|
|
418
|
-
__DEV__ && invariant.warn(
|
|
418
|
+
__DEV__ && invariant.warn(93);
|
|
419
419
|
}
|
|
420
420
|
}
|
|
421
421
|
});
|
|
@@ -444,7 +444,7 @@ export class QueryManager {
|
|
|
444
444
|
if (__DEV__) {
|
|
445
445
|
invariant(
|
|
446
446
|
!this.getDocumentInfo(query).hasClientExports || this.localState,
|
|
447
|
-
|
|
447
|
+
94,
|
|
448
448
|
getOperationName(query, "(anonymous)")
|
|
449
449
|
);
|
|
450
450
|
}
|
|
@@ -588,14 +588,14 @@ export class QueryManager {
|
|
|
588
588
|
if (__DEV__) {
|
|
589
589
|
invariant(
|
|
590
590
|
this.localState,
|
|
591
|
-
|
|
591
|
+
95,
|
|
592
592
|
operation[0].toUpperCase() + operation.slice(1),
|
|
593
593
|
operationName ?? "(anonymous)"
|
|
594
594
|
);
|
|
595
595
|
}
|
|
596
596
|
invariant(
|
|
597
597
|
!hasIncrementalDirective,
|
|
598
|
-
|
|
598
|
+
96,
|
|
599
599
|
operation[0].toUpperCase() + operation.slice(1),
|
|
600
600
|
operationName ?? "(anonymous)"
|
|
601
601
|
);
|
|
@@ -771,7 +771,7 @@ export class QueryManager {
|
|
|
771
771
|
// we deprecated and removed LocalState.
|
|
772
772
|
if (this.getDocumentInfo(normalized.query).hasClientExports) {
|
|
773
773
|
if (__DEV__) {
|
|
774
|
-
invariant(this.localState,
|
|
774
|
+
invariant(this.localState, 97, getOperationName(normalized.query, "(anonymous)"));
|
|
775
775
|
}
|
|
776
776
|
observable = from(this.localState.getExportedVariables({
|
|
777
777
|
client: this.client,
|
|
@@ -944,7 +944,7 @@ export class QueryManager {
|
|
|
944
944
|
!isFullyUnmaskedOperation(document) &&
|
|
945
945
|
!this.noCacheWarningsByCause.has(cause)) {
|
|
946
946
|
this.noCacheWarningsByCause.add(cause);
|
|
947
|
-
__DEV__ && invariant.warn(
|
|
947
|
+
__DEV__ && invariant.warn(98, getOperationName(document, `Unnamed ${operationType ?? "operation"}`));
|
|
948
948
|
}
|
|
949
949
|
}
|
|
950
950
|
return (this.dataMasking ?
|
|
@@ -1002,7 +1002,7 @@ export class QueryManager {
|
|
|
1002
1002
|
(diff.complete || returnPartialData) &&
|
|
1003
1003
|
this.getDocumentInfo(query).hasForcedResolvers) {
|
|
1004
1004
|
if (__DEV__) {
|
|
1005
|
-
invariant(this.localState,
|
|
1005
|
+
invariant(this.localState, 99, getOperationName(query, "(anonymous)"));
|
|
1006
1006
|
}
|
|
1007
1007
|
onCacheHit();
|
|
1008
1008
|
return from(this.localState.execute({
|
|
@@ -1095,7 +1095,7 @@ function validateDidEmitValue() {
|
|
|
1095
1095
|
didEmitValue = true;
|
|
1096
1096
|
},
|
|
1097
1097
|
complete() {
|
|
1098
|
-
invariant(didEmitValue,
|
|
1098
|
+
invariant(didEmitValue, 100);
|
|
1099
1099
|
},
|
|
1100
1100
|
});
|
|
1101
1101
|
}
|