@apollo/client 4.3.0-alpha.1 → 4.3.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/CHANGELOG.md +285 -0
- package/__cjs/cache/core/Scalar.cjs +36 -0
- package/__cjs/cache/core/Scalar.cjs.map +1 -0
- package/__cjs/cache/core/Scalar.d.cts +20 -0
- package/__cjs/cache/core/cache.cjs +8 -1
- package/__cjs/cache/core/cache.cjs.map +1 -1
- package/__cjs/cache/core/cache.d.cts +16 -0
- package/__cjs/cache/index.cjs +3 -1
- package/__cjs/cache/index.cjs.map +1 -1
- package/__cjs/cache/index.d.cts +3 -2
- package/__cjs/cache/inmemory/entityStore.cjs +45 -2
- package/__cjs/cache/inmemory/entityStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/entityStore.d.cts +3 -0
- package/__cjs/cache/inmemory/helpers.d.cts +9 -1
- package/__cjs/cache/inmemory/inMemoryCache.cjs +73 -4
- package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
- package/__cjs/cache/inmemory/inMemoryCache.d.cts +35 -3
- package/__cjs/cache/inmemory/policies.cjs +8 -1
- package/__cjs/cache/inmemory/policies.cjs.map +1 -1
- package/__cjs/cache/inmemory/policies.d.cts +4 -1
- package/__cjs/cache/inmemory/readFromStore.cjs +16 -3
- package/__cjs/cache/inmemory/readFromStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/types.d.cts +20 -4
- package/__cjs/cache/inmemory/writeToStore.cjs +10 -6
- package/__cjs/cache/inmemory/writeToStore.cjs.map +1 -1
- package/__cjs/core/ApolloClient.cjs +2 -2
- package/__cjs/core/ApolloClient.cjs.map +1 -1
- package/__cjs/core/ObservableQuery.cjs +1 -3
- package/__cjs/core/ObservableQuery.cjs.map +1 -1
- package/__cjs/core/QueryInfo.cjs +211 -37
- package/__cjs/core/QueryInfo.cjs.map +1 -1
- package/__cjs/core/QueryInfo.d.cts +5 -2
- package/__cjs/core/QueryManager.cjs +12 -18
- package/__cjs/core/QueryManager.cjs.map +1 -1
- package/__cjs/core/QueryManager.d.cts +1 -3
- package/__cjs/core/index.cjs +2 -1
- package/__cjs/core/index.cjs.map +1 -1
- package/__cjs/core/index.d.cts +2 -2
- package/__cjs/invariantErrorCodes.cjs +12 -7
- package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useLazyQuery.d.cts +13 -13
- package/__cjs/utilities/index.cjs.map +1 -1
- package/__cjs/utilities/index.d.cts +1 -0
- package/__cjs/utilities/internal/collectSiblingFields.cjs +61 -0
- package/__cjs/utilities/internal/collectSiblingFields.cjs.map +1 -0
- package/__cjs/utilities/internal/collectSiblingFields.d.cts +21 -0
- package/__cjs/utilities/internal/getUnwrappedType.cjs +20 -0
- package/__cjs/utilities/internal/getUnwrappedType.cjs.map +1 -0
- package/__cjs/utilities/internal/getUnwrappedType.d.cts +8 -0
- package/__cjs/utilities/internal/index.cjs +10 -2
- package/__cjs/utilities/internal/index.cjs.map +1 -1
- package/__cjs/utilities/internal/index.d.cts +6 -0
- package/__cjs/utilities/internal/isDeferredFragment.cjs +23 -0
- package/__cjs/utilities/internal/isDeferredFragment.cjs.map +1 -0
- package/__cjs/utilities/internal/isDeferredFragment.d.cts +4 -0
- package/__cjs/utilities/internal/isTypenameField.cjs +7 -0
- package/__cjs/utilities/internal/isTypenameField.cjs.map +1 -0
- package/__cjs/utilities/internal/isTypenameField.d.cts +3 -0
- package/__cjs/utilities/internal/types/IsLooselyEqual.cjs +3 -0
- package/__cjs/utilities/internal/types/IsLooselyEqual.cjs.map +1 -0
- package/__cjs/utilities/internal/types/IsLooselyEqual.d.cts +10 -0
- package/__cjs/utilities/policies/pagination.cjs.map +1 -1
- package/__cjs/utilities/policies/pagination.d.cts +1 -1
- package/__cjs/utilities/subscriptions/relay/index.cjs +1 -0
- package/__cjs/utilities/subscriptions/relay/index.cjs.map +1 -1
- package/__cjs/version.cjs +1 -1
- package/cache/core/Scalar.d.ts +20 -0
- package/cache/core/Scalar.js +32 -0
- package/cache/core/Scalar.js.map +1 -0
- package/cache/core/cache.d.ts +16 -0
- package/cache/core/cache.js +8 -1
- package/cache/core/cache.js.map +1 -1
- package/cache/index.d.ts +3 -2
- package/cache/index.js +1 -0
- package/cache/index.js.map +1 -1
- package/cache/inmemory/entityStore.d.ts +3 -0
- package/cache/inmemory/entityStore.js +46 -3
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/helpers.d.ts +9 -1
- package/cache/inmemory/inMemoryCache.d.ts +35 -3
- package/cache/inmemory/inMemoryCache.js +74 -5
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/policies.d.ts +4 -1
- package/cache/inmemory/policies.js +8 -1
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/readFromStore.js +11 -2
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.d.ts +20 -4
- package/cache/inmemory/types.js.map +1 -1
- package/cache/inmemory/writeToStore.js +11 -7
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/ApolloClient.js +2 -2
- package/core/ApolloClient.js.map +1 -1
- package/core/ObservableQuery.js +1 -3
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +5 -2
- package/core/QueryInfo.js +212 -38
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +1 -3
- package/core/QueryManager.js +12 -18
- package/core/QueryManager.js.map +1 -1
- package/core/index.d.ts +2 -2
- package/core/index.js +1 -1
- package/core/index.js.map +1 -1
- package/invariantErrorCodes.js +12 -7
- package/package.json +1 -1
- package/react/hooks/useLazyQuery.d.ts +13 -13
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks-compiled/useLazyQuery.d.ts +13 -13
- package/react/hooks-compiled/useLazyQuery.js.map +1 -1
- package/utilities/index.d.ts +1 -0
- package/utilities/index.js.map +1 -1
- package/utilities/internal/collectSiblingFields.d.ts +21 -0
- package/utilities/internal/collectSiblingFields.js +58 -0
- package/utilities/internal/collectSiblingFields.js.map +1 -0
- package/utilities/internal/getUnwrappedType.d.ts +8 -0
- package/utilities/internal/getUnwrappedType.js +17 -0
- package/utilities/internal/getUnwrappedType.js.map +1 -0
- package/utilities/internal/index.d.ts +6 -0
- package/utilities/internal/index.js +4 -0
- package/utilities/internal/index.js.map +1 -1
- package/utilities/internal/isDeferredFragment.d.ts +4 -0
- package/utilities/internal/isDeferredFragment.js +20 -0
- package/utilities/internal/isDeferredFragment.js.map +1 -0
- package/utilities/internal/isTypenameField.d.ts +3 -0
- package/utilities/internal/isTypenameField.js +4 -0
- package/utilities/internal/isTypenameField.js.map +1 -0
- package/utilities/internal/types/IsLooselyEqual.d.ts +10 -0
- package/utilities/internal/types/IsLooselyEqual.js +2 -0
- package/utilities/internal/types/IsLooselyEqual.js.map +1 -0
- package/utilities/policies/pagination.d.ts +1 -1
- package/utilities/policies/pagination.js.map +1 -1
- package/utilities/subscriptions/relay/index.js +1 -0
- package/utilities/subscriptions/relay/index.js.map +1 -1
- package/version.js +1 -1
|
@@ -128,7 +128,7 @@ class QueryManager {
|
|
|
128
128
|
const mutationStoreValue = this.mutationStore &&
|
|
129
129
|
(this.mutationStore[queryInfo.id] = {
|
|
130
130
|
mutation,
|
|
131
|
-
variables,
|
|
131
|
+
variables: this.cache.serializeVariables(mutation, variables),
|
|
132
132
|
loading: true,
|
|
133
133
|
error: null,
|
|
134
134
|
});
|
|
@@ -341,10 +341,6 @@ class QueryManager {
|
|
|
341
341
|
}),
|
|
342
342
|
}));
|
|
343
343
|
}
|
|
344
|
-
requestIdCounter = 1;
|
|
345
|
-
generateRequestId() {
|
|
346
|
-
return this.requestIdCounter++;
|
|
347
|
-
}
|
|
348
344
|
clearStore(options = {
|
|
349
345
|
discardWatches: true,
|
|
350
346
|
}) {
|
|
@@ -530,6 +526,7 @@ class QueryManager {
|
|
|
530
526
|
const executeContext = {
|
|
531
527
|
client: this.client,
|
|
532
528
|
};
|
|
529
|
+
variables = this.cache.serializeVariables(query, variables);
|
|
533
530
|
if (serverQuery) {
|
|
534
531
|
const { inFlightLinkObservables, link } = this;
|
|
535
532
|
try {
|
|
@@ -631,7 +628,6 @@ class QueryManager {
|
|
|
631
628
|
};
|
|
632
629
|
}
|
|
633
630
|
getResultsFromLink(options, { queryInfo, cacheWriteBehavior, observableQuery, exposeExtensions, }) {
|
|
634
|
-
const requestId = (queryInfo.lastRequestId = this.generateRequestId());
|
|
635
631
|
const { errorPolicy } = options;
|
|
636
632
|
// Performing transformForLink here gives this.cache a chance to fill in
|
|
637
633
|
// missing fragment definitions (for example) before sending this document
|
|
@@ -641,10 +637,11 @@ class QueryManager {
|
|
|
641
637
|
// Use linkDocument rather than queryInfo.document so the
|
|
642
638
|
// operation/fragments used to write the result are the same as the
|
|
643
639
|
// ones used to obtain it from the link.
|
|
644
|
-
const result = queryInfo.markQueryResult(incoming, {
|
|
640
|
+
const { dataState, ...result } = queryInfo.markQueryResult(incoming, {
|
|
645
641
|
...options,
|
|
646
642
|
document: linkDocument,
|
|
647
643
|
cacheWriteBehavior,
|
|
644
|
+
returnPartialData: options.returnPartialData,
|
|
648
645
|
});
|
|
649
646
|
const hasErrors = (0, internal_1.graphQLResultHasError)(result);
|
|
650
647
|
if (hasErrors && errorPolicy === "none") {
|
|
@@ -652,29 +649,26 @@ class QueryManager {
|
|
|
652
649
|
observableQuery?.["resetNotifications"]();
|
|
653
650
|
throw new errors_1.CombinedGraphQLErrors(removeStreamDetailsFromExtensions(result));
|
|
654
651
|
}
|
|
652
|
+
const partial = dataState !== "complete";
|
|
655
653
|
const aqr = {
|
|
656
654
|
data: result.data,
|
|
657
655
|
...(queryInfo.hasNext ?
|
|
658
656
|
{
|
|
659
657
|
loading: true,
|
|
660
658
|
networkStatus: networkStatus_js_1.NetworkStatus.streaming,
|
|
661
|
-
dataState
|
|
662
|
-
partial
|
|
659
|
+
dataState,
|
|
660
|
+
partial,
|
|
663
661
|
}
|
|
664
662
|
: {
|
|
665
|
-
dataState
|
|
663
|
+
dataState,
|
|
666
664
|
loading: false,
|
|
667
665
|
networkStatus: networkStatus_js_1.NetworkStatus.ready,
|
|
668
|
-
partial
|
|
666
|
+
partial,
|
|
669
667
|
}),
|
|
670
668
|
};
|
|
671
669
|
if (exposeExtensions && "extensions" in result) {
|
|
672
670
|
aqr[internal_1.extensionsSymbol] = result.extensions;
|
|
673
671
|
}
|
|
674
|
-
// In the case we start multiple network requests simultaneously, we
|
|
675
|
-
// want to ensure we properly set `data` if we're reporting on an old
|
|
676
|
-
// result which will not be caught by the conditional above that ends up
|
|
677
|
-
// throwing the markError result.
|
|
678
672
|
if (hasErrors) {
|
|
679
673
|
if (errorPolicy === "none") {
|
|
680
674
|
aqr.data = void 0;
|
|
@@ -682,15 +676,14 @@ class QueryManager {
|
|
|
682
676
|
}
|
|
683
677
|
if (errorPolicy !== "ignore") {
|
|
684
678
|
aqr.error = new errors_1.CombinedGraphQLErrors(removeStreamDetailsFromExtensions(result));
|
|
685
|
-
if (aqr.
|
|
679
|
+
if (aqr.networkStatus !== networkStatus_js_1.NetworkStatus.streaming) {
|
|
686
680
|
aqr.networkStatus = networkStatus_js_1.NetworkStatus.error;
|
|
687
681
|
}
|
|
688
682
|
}
|
|
689
683
|
}
|
|
690
684
|
return aqr;
|
|
691
685
|
}), (0, rxjs_2.catchError)((error) => {
|
|
692
|
-
|
|
693
|
-
if (requestId >= queryInfo.lastRequestId && errorPolicy === "none") {
|
|
686
|
+
if (errorPolicy === "none") {
|
|
694
687
|
queryInfo.resetLastWrite();
|
|
695
688
|
observableQuery?.["resetNotifications"]();
|
|
696
689
|
throw error;
|
|
@@ -1059,6 +1052,7 @@ class QueryManager {
|
|
|
1059
1052
|
context,
|
|
1060
1053
|
fetchPolicy,
|
|
1061
1054
|
errorPolicy,
|
|
1055
|
+
returnPartialData,
|
|
1062
1056
|
}, {
|
|
1063
1057
|
cacheWriteBehavior,
|
|
1064
1058
|
queryInfo,
|