@apollo/client 3.7.5 → 3.7.7
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/README.md +1 -0
- package/apollo-client.cjs +108 -56
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/core/cache.d.ts +1 -1
- package/cache/core/cache.d.ts.map +1 -1
- package/cache/core/cache.js.map +1 -1
- package/cache/core/types/common.d.ts +7 -7
- package/cache/core/types/common.d.ts.map +1 -1
- package/cache/inmemory/entityStore.d.ts +1 -1
- package/cache/inmemory/entityStore.d.ts.map +1 -1
- package/cache/inmemory/helpers.js.map +1 -1
- package/cache/inmemory/inMemoryCache.d.ts +3 -2
- package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/policies.d.ts +12 -12
- package/cache/inmemory/policies.d.ts.map +1 -1
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/reactiveVars.d.ts +1 -1
- package/cache/inmemory/reactiveVars.d.ts.map +1 -1
- package/cache/inmemory/readFromStore.d.ts +2 -2
- package/cache/inmemory/readFromStore.d.ts.map +1 -1
- package/cache/inmemory/types.d.ts +4 -4
- package/cache/inmemory/types.d.ts.map +1 -1
- package/cache/inmemory/writeToStore.d.ts +1 -1
- package/cache/inmemory/writeToStore.d.ts.map +1 -1
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/ApolloClient.d.ts +5 -5
- package/core/ApolloClient.d.ts.map +1 -1
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.d.ts +9 -6
- package/core/LocalState.d.ts.map +1 -1
- package/core/LocalState.js +64 -14
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.d.ts +5 -5
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +1 -1
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +1 -1
- package/core/QueryInfo.d.ts.map +1 -1
- package/core/QueryManager.d.ts +7 -7
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js +12 -9
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +77 -24
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +77 -24
- package/core/types.d.ts +16 -16
- package/core/types.d.ts.map +1 -1
- package/core/watchQueryOptions.d.ts +9 -9
- package/core/watchQueryOptions.d.ts.map +1 -1
- package/core/watchQueryOptions.js.map +1 -1
- package/errors/index.d.ts +2 -2
- package/errors/index.d.ts.map +1 -1
- package/invariantErrorCodes.js +48 -43
- package/link/batch/batch.cjs +5 -3
- package/link/batch/batch.cjs.map +1 -1
- package/link/batch/batch.cjs.native.js +5 -3
- package/link/batch/batching.d.ts +2 -2
- package/link/batch/batching.d.ts.map +1 -1
- package/link/batch/batching.js +5 -3
- package/link/batch/batching.js.map +1 -1
- package/link/context/index.d.ts +1 -1
- package/link/context/index.d.ts.map +1 -1
- package/link/core/ApolloLink.js +1 -1
- package/link/core/core.cjs +1 -1
- package/link/core/core.cjs.map +1 -1
- package/link/core/core.cjs.native.js +1 -1
- package/link/core/types.d.ts +6 -6
- package/link/core/types.d.ts.map +1 -1
- package/link/http/checkFetcher.js +1 -1
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/http.cjs +2 -2
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +2 -2
- package/link/http/iterators/async.js.map +1 -1
- package/link/http/iterators/nodeStream.js.map +1 -1
- package/link/http/iterators/promise.js.map +1 -1
- package/link/http/iterators/reader.js.map +1 -1
- package/link/http/parseAndCheckHttpResponse.d.ts +2 -2
- package/link/http/parseAndCheckHttpResponse.d.ts.map +1 -1
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/link/http/serializeFetchParameter.d.ts +1 -1
- package/link/http/serializeFetchParameter.d.ts.map +1 -1
- package/link/http/serializeFetchParameter.js +1 -1
- package/link/persisted-queries/index.d.ts +2 -2
- package/link/persisted-queries/index.d.ts.map +1 -1
- package/link/persisted-queries/index.js +2 -2
- package/link/persisted-queries/persisted-queries.cjs +2 -2
- package/link/persisted-queries/persisted-queries.cjs.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.native.js +2 -2
- package/link/utils/throwServerError.d.ts +1 -1
- package/link/utils/throwServerError.d.ts.map +1 -1
- package/link/utils/utils.cjs +1 -1
- package/link/utils/utils.cjs.map +1 -1
- package/link/utils/utils.cjs.native.js +1 -1
- package/link/utils/validateOperation.js +1 -1
- package/package.json +9 -9
- package/react/components/Query.d.ts +2 -2
- package/react/components/Query.d.ts.map +1 -1
- package/react/components/Query.js.map +1 -1
- package/react/components/Subscription.d.ts +2 -2
- package/react/components/Subscription.d.ts.map +1 -1
- package/react/components/Subscription.js.map +1 -1
- package/react/components/types.d.ts +2 -2
- package/react/components/types.d.ts.map +1 -1
- package/react/components/types.js.map +1 -1
- package/react/context/ApolloConsumer.js +1 -1
- package/react/context/ApolloProvider.js +1 -1
- package/react/context/context.cjs +2 -2
- package/react/context/context.cjs.map +1 -1
- package/react/context/context.cjs.native.js +2 -2
- package/react/hoc/graphql.d.ts +2 -1
- package/react/hoc/graphql.d.ts.map +1 -1
- package/react/hoc/graphql.js.map +1 -1
- package/react/hoc/hoc-utils.d.ts +1 -1
- package/react/hoc/hoc-utils.d.ts.map +1 -1
- package/react/hoc/hoc-utils.js +1 -1
- package/react/hoc/hoc.cjs +2 -2
- package/react/hoc/hoc.cjs.map +1 -1
- package/react/hoc/hoc.cjs.native.js +2 -2
- package/react/hoc/mutation-hoc.d.ts +2 -2
- package/react/hoc/mutation-hoc.d.ts.map +1 -1
- package/react/hoc/mutation-hoc.js.map +1 -1
- package/react/hoc/query-hoc.d.ts +1 -1
- package/react/hoc/query-hoc.d.ts.map +1 -1
- package/react/hoc/query-hoc.js.map +1 -1
- package/react/hoc/subscription-hoc.d.ts +1 -1
- package/react/hoc/subscription-hoc.d.ts.map +1 -1
- package/react/hoc/subscription-hoc.js.map +1 -1
- package/react/hoc/types.d.ts +6 -6
- package/react/hoc/types.d.ts.map +1 -1
- package/react/hoc/types.js.map +1 -1
- package/react/hoc/withApollo.js +1 -1
- package/react/hooks/hooks.cjs +4 -5
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +4 -5
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useLazyQuery.d.ts +1 -1
- package/react/hooks/useLazyQuery.d.ts.map +1 -1
- package/react/hooks/useLazyQuery.js +3 -4
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useQuery.d.ts +3 -3
- package/react/hooks/useQuery.d.ts.map +1 -1
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useSubscription.d.ts +1 -1
- package/react/hooks/useSubscription.d.ts.map +1 -1
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSyncExternalStore.d.ts +1 -1
- package/react/hooks/useSyncExternalStore.d.ts.map +1 -1
- package/react/parser/index.js +5 -5
- package/react/parser/parser.cjs +5 -5
- package/react/parser/parser.cjs.map +1 -1
- package/react/parser/parser.cjs.native.js +5 -5
- package/react/ssr/RenderPromises.d.ts +4 -4
- package/react/ssr/RenderPromises.d.ts.map +1 -1
- package/react/ssr/RenderPromises.js.map +1 -1
- package/react/ssr/getDataFromTree.d.ts +1 -1
- package/react/ssr/getDataFromTree.d.ts.map +1 -1
- package/react/types/types.d.ts +17 -17
- package/react/types/types.d.ts.map +1 -1
- package/react/types/types.js.map +1 -1
- package/testing/core/core.cjs +13 -3
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +13 -3
- package/testing/core/index.d.ts +1 -1
- package/testing/core/index.d.ts.map +1 -1
- package/testing/core/index.js.map +1 -1
- package/testing/core/mocking/mockFetch.js.map +1 -1
- package/testing/core/mocking/mockLink.d.ts +6 -2
- package/testing/core/mocking/mockLink.d.ts.map +1 -1
- package/testing/core/mocking/mockLink.js +13 -3
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/testing/core/mocking/mockQueryManager.d.ts +1 -1
- package/testing/core/mocking/mockQueryManager.d.ts.map +1 -1
- package/testing/core/mocking/mockQueryManager.js +3 -3
- package/testing/core/mocking/mockQueryManager.js.map +1 -1
- package/testing/core/mocking/mockWatchQuery.d.ts +1 -1
- package/testing/core/mocking/mockWatchQuery.d.ts.map +1 -1
- package/testing/core/mocking/mockWatchQuery.js +4 -5
- package/testing/core/mocking/mockWatchQuery.js.map +1 -1
- package/testing/core/observableToPromise.d.ts +2 -2
- package/testing/core/observableToPromise.d.ts.map +1 -1
- package/testing/core/observableToPromise.js.map +1 -1
- package/testing/react/MockedProvider.d.ts +1 -0
- package/testing/react/MockedProvider.d.ts.map +1 -1
- package/testing/react/MockedProvider.js +2 -2
- package/testing/react/MockedProvider.js.map +1 -1
- package/testing/testing.cjs +2 -2
- package/testing/testing.cjs.map +1 -1
- package/testing/testing.cjs.native.js +2 -2
- package/utilities/common/cloneDeep.js.map +1 -1
- package/utilities/common/errorHandling.d.ts +2 -2
- package/utilities/common/errorHandling.d.ts.map +1 -1
- package/utilities/common/errorHandling.js.map +1 -1
- package/utilities/common/incrementalResult.d.ts +4 -4
- package/utilities/common/incrementalResult.d.ts.map +1 -1
- package/utilities/common/incrementalResult.js.map +1 -1
- package/utilities/common/mergeDeep.d.ts +2 -2
- package/utilities/common/mergeDeep.d.ts.map +1 -1
- package/utilities/common/mergeOptions.d.ts +3 -3
- package/utilities/common/mergeOptions.d.ts.map +1 -1
- package/utilities/common/mergeOptions.js.map +1 -1
- package/utilities/globals/globals.cjs +1 -1
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +1 -1
- package/utilities/globals/index.js +1 -1
- package/utilities/graphql/directives.d.ts +2 -2
- package/utilities/graphql/directives.d.ts.map +1 -1
- package/utilities/graphql/directives.js +4 -4
- package/utilities/graphql/directives.js.map +1 -1
- package/utilities/graphql/fragments.d.ts +1 -1
- package/utilities/graphql/fragments.d.ts.map +1 -1
- package/utilities/graphql/fragments.js +3 -3
- package/utilities/graphql/getFromAST.js +8 -8
- package/utilities/graphql/storeUtils.d.ts +3 -3
- package/utilities/graphql/storeUtils.d.ts.map +1 -1
- package/utilities/graphql/storeUtils.js +1 -1
- package/utilities/graphql/storeUtils.js.map +1 -1
- package/utilities/graphql/transform.d.ts +9 -9
- package/utilities/graphql/transform.d.ts.map +1 -1
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/observables/Concast.d.ts +5 -5
- package/utilities/observables/Concast.d.ts.map +1 -1
- package/utilities/observables/asyncMap.js.map +1 -1
- package/utilities/policies/pagination.d.ts +7 -7
- package/utilities/policies/pagination.d.ts.map +1 -1
- package/utilities/policies/pagination.js.map +1 -1
- package/utilities/types/IsStrictlyAny.d.ts +3 -3
- package/utilities/types/IsStrictlyAny.d.ts.map +1 -1
- package/utilities/utilities.cjs +16 -16
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +16 -16
- package/version.js +1 -1
package/core/core.cjs
CHANGED
|
@@ -15,7 +15,7 @@ var utils = require('../link/utils');
|
|
|
15
15
|
var tsInvariant = require('ts-invariant');
|
|
16
16
|
var graphqlTag = require('graphql-tag');
|
|
17
17
|
|
|
18
|
-
var version = '3.7.
|
|
18
|
+
var version = '3.7.7';
|
|
19
19
|
|
|
20
20
|
function isNonEmptyArray(value) {
|
|
21
21
|
return Array.isArray(value) && value.length > 0;
|
|
@@ -475,7 +475,7 @@ var ObservableQuery = (function (_super) {
|
|
|
475
475
|
pollingInfo.interval === pollInterval) {
|
|
476
476
|
return;
|
|
477
477
|
}
|
|
478
|
-
__DEV__ ? globals.invariant(pollInterval, 'Attempted to start a polling query without a polling interval.') : globals.invariant(pollInterval,
|
|
478
|
+
__DEV__ ? globals.invariant(pollInterval, 'Attempted to start a polling query without a polling interval.') : globals.invariant(pollInterval, 13);
|
|
479
479
|
var info = pollingInfo || (this.pollingInfo = {});
|
|
480
480
|
info.interval = pollInterval;
|
|
481
481
|
var maybeFetch = function () {
|
|
@@ -621,6 +621,7 @@ function logMissingFieldErrors(missing) {
|
|
|
621
621
|
var LocalState = (function () {
|
|
622
622
|
function LocalState(_a) {
|
|
623
623
|
var cache = _a.cache, client = _a.client, resolvers = _a.resolvers, fragmentMatcher = _a.fragmentMatcher;
|
|
624
|
+
this.selectionsToResolveCache = new WeakMap();
|
|
624
625
|
this.cache = cache;
|
|
625
626
|
if (client) {
|
|
626
627
|
this.client = client;
|
|
@@ -731,13 +732,13 @@ var LocalState = (function () {
|
|
|
731
732
|
if (fragmentMatcher === void 0) { fragmentMatcher = function () { return true; }; }
|
|
732
733
|
if (onlyRunForcedResolvers === void 0) { onlyRunForcedResolvers = false; }
|
|
733
734
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
734
|
-
var mainDefinition, fragments, fragmentMap, definitionOperation, defaultOperationType, _a, cache, client, execContext;
|
|
735
|
+
var mainDefinition, fragments, fragmentMap, selectionsToResolve, definitionOperation, defaultOperationType, _a, cache, client, execContext, isClientFieldDescendant;
|
|
735
736
|
return tslib.__generator(this, function (_b) {
|
|
736
737
|
mainDefinition = utilities.getMainDefinition(document);
|
|
737
738
|
fragments = utilities.getFragmentDefinitions(document);
|
|
738
739
|
fragmentMap = utilities.createFragmentMap(fragments);
|
|
739
|
-
|
|
740
|
-
|
|
740
|
+
selectionsToResolve = this.collectSelectionsToResolve(mainDefinition, fragmentMap);
|
|
741
|
+
definitionOperation = mainDefinition.operation;
|
|
741
742
|
defaultOperationType = definitionOperation
|
|
742
743
|
? definitionOperation.charAt(0).toUpperCase() +
|
|
743
744
|
definitionOperation.slice(1)
|
|
@@ -750,16 +751,18 @@ var LocalState = (function () {
|
|
|
750
751
|
fragmentMatcher: fragmentMatcher,
|
|
751
752
|
defaultOperationType: defaultOperationType,
|
|
752
753
|
exportedVariables: {},
|
|
754
|
+
selectionsToResolve: selectionsToResolve,
|
|
753
755
|
onlyRunForcedResolvers: onlyRunForcedResolvers,
|
|
754
756
|
};
|
|
755
|
-
|
|
757
|
+
isClientFieldDescendant = false;
|
|
758
|
+
return [2, this.resolveSelectionSet(mainDefinition.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (result) { return ({
|
|
756
759
|
result: result,
|
|
757
760
|
exportedVariables: execContext.exportedVariables,
|
|
758
761
|
}); })];
|
|
759
762
|
});
|
|
760
763
|
});
|
|
761
764
|
};
|
|
762
|
-
LocalState.prototype.resolveSelectionSet = function (selectionSet, rootValue, execContext) {
|
|
765
|
+
LocalState.prototype.resolveSelectionSet = function (selectionSet, isClientFieldDescendant, rootValue, execContext) {
|
|
763
766
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
764
767
|
var fragmentMap, context, variables, resultsToMerge, execute;
|
|
765
768
|
var _this = this;
|
|
@@ -769,11 +772,14 @@ var LocalState = (function () {
|
|
|
769
772
|
execute = function (selection) { return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
770
773
|
var fragment, typeCondition;
|
|
771
774
|
return tslib.__generator(this, function (_a) {
|
|
775
|
+
if (!isClientFieldDescendant && !execContext.selectionsToResolve.has(selection)) {
|
|
776
|
+
return [2];
|
|
777
|
+
}
|
|
772
778
|
if (!utilities.shouldInclude(selection, variables)) {
|
|
773
779
|
return [2];
|
|
774
780
|
}
|
|
775
781
|
if (utilities.isField(selection)) {
|
|
776
|
-
return [2, this.resolveField(selection, rootValue, execContext).then(function (fieldResult) {
|
|
782
|
+
return [2, this.resolveField(selection, isClientFieldDescendant, rootValue, execContext).then(function (fieldResult) {
|
|
777
783
|
var _a;
|
|
778
784
|
if (typeof fieldResult !== 'undefined') {
|
|
779
785
|
resultsToMerge.push((_a = {},
|
|
@@ -792,7 +798,7 @@ var LocalState = (function () {
|
|
|
792
798
|
if (fragment && fragment.typeCondition) {
|
|
793
799
|
typeCondition = fragment.typeCondition.name.value;
|
|
794
800
|
if (execContext.fragmentMatcher(rootValue, typeCondition, context)) {
|
|
795
|
-
return [2, this.resolveSelectionSet(fragment.selectionSet, rootValue, execContext).then(function (fragmentResult) {
|
|
801
|
+
return [2, this.resolveSelectionSet(fragment.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (fragmentResult) {
|
|
796
802
|
resultsToMerge.push(fragmentResult);
|
|
797
803
|
})];
|
|
798
804
|
}
|
|
@@ -806,11 +812,14 @@ var LocalState = (function () {
|
|
|
806
812
|
});
|
|
807
813
|
});
|
|
808
814
|
};
|
|
809
|
-
LocalState.prototype.resolveField = function (field, rootValue, execContext) {
|
|
815
|
+
LocalState.prototype.resolveField = function (field, isClientFieldDescendant, rootValue, execContext) {
|
|
810
816
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
811
817
|
var variables, fieldName, aliasedFieldName, aliasUsed, defaultResult, resultPromise, resolverType, resolverMap, resolve;
|
|
812
818
|
var _this = this;
|
|
813
819
|
return tslib.__generator(this, function (_a) {
|
|
820
|
+
if (!rootValue) {
|
|
821
|
+
return [2, null];
|
|
822
|
+
}
|
|
814
823
|
variables = execContext.variables;
|
|
815
824
|
fieldName = field.name.value;
|
|
816
825
|
aliasedFieldName = utilities.resultKeyNameFromField(field);
|
|
@@ -834,6 +843,7 @@ var LocalState = (function () {
|
|
|
834
843
|
}
|
|
835
844
|
}
|
|
836
845
|
return [2, resultPromise.then(function (result) {
|
|
846
|
+
var _a, _b;
|
|
837
847
|
if (result === void 0) { result = defaultResult; }
|
|
838
848
|
if (field.directives) {
|
|
839
849
|
field.directives.forEach(function (directive) {
|
|
@@ -852,30 +862,70 @@ var LocalState = (function () {
|
|
|
852
862
|
if (result == null) {
|
|
853
863
|
return result;
|
|
854
864
|
}
|
|
865
|
+
var isClientField = (_b = (_a = field.directives) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d.name.value === 'client'; })) !== null && _b !== void 0 ? _b : false;
|
|
855
866
|
if (Array.isArray(result)) {
|
|
856
|
-
return _this.resolveSubSelectedArray(field, result, execContext);
|
|
867
|
+
return _this.resolveSubSelectedArray(field, isClientFieldDescendant || isClientField, result, execContext);
|
|
857
868
|
}
|
|
858
869
|
if (field.selectionSet) {
|
|
859
|
-
return _this.resolveSelectionSet(field.selectionSet, result, execContext);
|
|
870
|
+
return _this.resolveSelectionSet(field.selectionSet, isClientFieldDescendant || isClientField, result, execContext);
|
|
860
871
|
}
|
|
861
872
|
})];
|
|
862
873
|
});
|
|
863
874
|
});
|
|
864
875
|
};
|
|
865
|
-
LocalState.prototype.resolveSubSelectedArray = function (field, result, execContext) {
|
|
876
|
+
LocalState.prototype.resolveSubSelectedArray = function (field, isClientFieldDescendant, result, execContext) {
|
|
866
877
|
var _this = this;
|
|
867
878
|
return Promise.all(result.map(function (item) {
|
|
868
879
|
if (item === null) {
|
|
869
880
|
return null;
|
|
870
881
|
}
|
|
871
882
|
if (Array.isArray(item)) {
|
|
872
|
-
return _this.resolveSubSelectedArray(field, item, execContext);
|
|
883
|
+
return _this.resolveSubSelectedArray(field, isClientFieldDescendant, item, execContext);
|
|
873
884
|
}
|
|
874
885
|
if (field.selectionSet) {
|
|
875
|
-
return _this.resolveSelectionSet(field.selectionSet, item, execContext);
|
|
886
|
+
return _this.resolveSelectionSet(field.selectionSet, isClientFieldDescendant, item, execContext);
|
|
876
887
|
}
|
|
877
888
|
}));
|
|
878
889
|
};
|
|
890
|
+
LocalState.prototype.collectSelectionsToResolve = function (mainDefinition, fragmentMap) {
|
|
891
|
+
var isSingleASTNode = function (node) { return !Array.isArray(node); };
|
|
892
|
+
var selectionsToResolveCache = this.selectionsToResolveCache;
|
|
893
|
+
function collectByDefinition(definitionNode) {
|
|
894
|
+
if (!selectionsToResolveCache.has(definitionNode)) {
|
|
895
|
+
var matches_1 = new Set();
|
|
896
|
+
selectionsToResolveCache.set(definitionNode, matches_1);
|
|
897
|
+
graphql.visit(definitionNode, {
|
|
898
|
+
Directive: function (node, _, __, ___, ancestors) {
|
|
899
|
+
if (node.name.value === 'client') {
|
|
900
|
+
ancestors.forEach(function (node) {
|
|
901
|
+
if (isSingleASTNode(node) && graphql.isSelectionNode(node)) {
|
|
902
|
+
matches_1.add(node);
|
|
903
|
+
}
|
|
904
|
+
});
|
|
905
|
+
}
|
|
906
|
+
},
|
|
907
|
+
FragmentSpread: function (spread, _, __, ___, ancestors) {
|
|
908
|
+
var fragment = fragmentMap[spread.name.value];
|
|
909
|
+
__DEV__ ? globals.invariant(fragment, "No fragment named ".concat(spread.name.value)) : globals.invariant(fragment, 12);
|
|
910
|
+
var fragmentSelections = collectByDefinition(fragment);
|
|
911
|
+
if (fragmentSelections.size > 0) {
|
|
912
|
+
ancestors.forEach(function (node) {
|
|
913
|
+
if (isSingleASTNode(node) && graphql.isSelectionNode(node)) {
|
|
914
|
+
matches_1.add(node);
|
|
915
|
+
}
|
|
916
|
+
});
|
|
917
|
+
matches_1.add(spread);
|
|
918
|
+
fragmentSelections.forEach(function (selection) {
|
|
919
|
+
matches_1.add(selection);
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
return selectionsToResolveCache.get(definitionNode);
|
|
926
|
+
}
|
|
927
|
+
return collectByDefinition(mainDefinition);
|
|
928
|
+
};
|
|
879
929
|
return LocalState;
|
|
880
930
|
}());
|
|
881
931
|
|
|
@@ -1186,7 +1236,7 @@ var QueryManager = (function () {
|
|
|
1186
1236
|
this.queries.forEach(function (_info, queryId) {
|
|
1187
1237
|
_this.stopQueryNoBroadcast(queryId);
|
|
1188
1238
|
});
|
|
1189
|
-
this.cancelPendingFetches(__DEV__ ? new globals.InvariantError('QueryManager stopped while query was in flight') : new globals.InvariantError(
|
|
1239
|
+
this.cancelPendingFetches(__DEV__ ? new globals.InvariantError('QueryManager stopped while query was in flight') : new globals.InvariantError(14));
|
|
1190
1240
|
};
|
|
1191
1241
|
QueryManager.prototype.cancelPendingFetches = function (error) {
|
|
1192
1242
|
this.fetchCancelFns.forEach(function (cancel) { return cancel(error); });
|
|
@@ -1200,10 +1250,10 @@ var QueryManager = (function () {
|
|
|
1200
1250
|
return tslib.__generator(this, function (_j) {
|
|
1201
1251
|
switch (_j.label) {
|
|
1202
1252
|
case 0:
|
|
1203
|
-
__DEV__ ? globals.invariant(mutation, 'mutation option is required. You must specify your GraphQL document in the mutation option.') : globals.invariant(mutation,
|
|
1253
|
+
__DEV__ ? globals.invariant(mutation, 'mutation option is required. You must specify your GraphQL document in the mutation option.') : globals.invariant(mutation, 15);
|
|
1204
1254
|
__DEV__ ? globals.invariant(fetchPolicy === 'network-only' ||
|
|
1205
1255
|
fetchPolicy === 'no-cache', "Mutations support only 'network-only' or 'no-cache' fetchPolicy strings. The default `network-only` behavior automatically writes mutation results to the cache. Passing `no-cache` skips the cache write.") : globals.invariant(fetchPolicy === 'network-only' ||
|
|
1206
|
-
fetchPolicy === 'no-cache',
|
|
1256
|
+
fetchPolicy === 'no-cache', 16);
|
|
1207
1257
|
mutationId = this.generateMutationId();
|
|
1208
1258
|
_h = this.transform(mutation), document = _h.document, hasClientExports = _h.hasClientExports;
|
|
1209
1259
|
mutation = this.cache.transformForLink(document);
|
|
@@ -1320,7 +1370,10 @@ var QueryManager = (function () {
|
|
|
1320
1370
|
optimistic: false,
|
|
1321
1371
|
returnPartialData: true,
|
|
1322
1372
|
});
|
|
1323
|
-
var mergedData =
|
|
1373
|
+
var mergedData = void 0;
|
|
1374
|
+
if (diff.result) {
|
|
1375
|
+
mergedData = mergeIncrementalData(diff.result, result);
|
|
1376
|
+
}
|
|
1324
1377
|
if (typeof mergedData !== 'undefined') {
|
|
1325
1378
|
result.data = mergedData;
|
|
1326
1379
|
cacheWrites.push({
|
|
@@ -1522,10 +1575,10 @@ var QueryManager = (function () {
|
|
|
1522
1575
|
var _this = this;
|
|
1523
1576
|
if (queryId === void 0) { queryId = this.generateQueryId(); }
|
|
1524
1577
|
__DEV__ ? globals.invariant(options.query, 'query option is required. You must specify your GraphQL document ' +
|
|
1525
|
-
'in the query option.') : globals.invariant(options.query,
|
|
1526
|
-
__DEV__ ? globals.invariant(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.') : globals.invariant(options.query.kind === 'Document',
|
|
1527
|
-
__DEV__ ? globals.invariant(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.') : globals.invariant(!options.returnPartialData,
|
|
1528
|
-
__DEV__ ? globals.invariant(!options.pollInterval, 'pollInterval option only supported on watchQuery.') : globals.invariant(!options.pollInterval,
|
|
1578
|
+
'in the query option.') : globals.invariant(options.query, 17);
|
|
1579
|
+
__DEV__ ? globals.invariant(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.') : globals.invariant(options.query.kind === 'Document', 18);
|
|
1580
|
+
__DEV__ ? globals.invariant(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.') : globals.invariant(!options.returnPartialData, 19);
|
|
1581
|
+
__DEV__ ? globals.invariant(!options.pollInterval, 'pollInterval option only supported on watchQuery.') : globals.invariant(!options.pollInterval, 20);
|
|
1529
1582
|
return this.fetchQuery(queryId, options).finally(function () { return _this.stopQuery(queryId); });
|
|
1530
1583
|
};
|
|
1531
1584
|
QueryManager.prototype.generateQueryId = function () {
|
|
@@ -1550,7 +1603,7 @@ var QueryManager = (function () {
|
|
|
1550
1603
|
if (options === void 0) { options = {
|
|
1551
1604
|
discardWatches: true,
|
|
1552
1605
|
}; }
|
|
1553
|
-
this.cancelPendingFetches(__DEV__ ? new globals.InvariantError('Store reset while query was in flight (not completed in link chain)') : new globals.InvariantError(
|
|
1606
|
+
this.cancelPendingFetches(__DEV__ ? new globals.InvariantError('Store reset while query was in flight (not completed in link chain)') : new globals.InvariantError(21));
|
|
1554
1607
|
this.queries.forEach(function (queryInfo) {
|
|
1555
1608
|
if (queryInfo.observableQuery) {
|
|
1556
1609
|
queryInfo.networkStatus = exports.NetworkStatus.loading;
|