@apollo/client 3.5.10 → 3.6.5
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/LICENSE +1 -1
- package/apollo-client.cjs +541 -369
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +9 -10
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +2288 -0
- package/cache/inmemory/readFromStore.d.ts.map +1 -1
- package/cache/inmemory/readFromStore.js +10 -11
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/core/ApolloClient.d.ts +2 -3
- package/core/ApolloClient.d.ts.map +1 -1
- package/core/ApolloClient.js +4 -8
- package/core/ApolloClient.js.map +1 -1
- package/core/ObservableQuery.d.ts +10 -4
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +97 -45
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts.map +1 -1
- package/core/QueryInfo.js +4 -2
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +5 -2
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js +29 -23
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +138 -85
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +2141 -0
- package/core/index.d.ts +1 -1
- package/core/index.d.ts.map +1 -1
- package/core/index.js +1 -1
- package/core/index.js.map +1 -1
- package/core/watchQueryOptions.d.ts +9 -1
- package/core/watchQueryOptions.d.ts.map +1 -1
- package/core/watchQueryOptions.js.map +1 -1
- package/errors/errors.cjs.native.js +48 -0
- package/invariantErrorCodes.js +1 -1
- package/link/batch/batch.cjs +47 -37
- package/link/batch/batch.cjs.map +1 -1
- package/link/batch/batch.cjs.native.js +161 -0
- package/link/batch/batching.d.ts +2 -6
- package/link/batch/batching.d.ts.map +1 -1
- package/link/batch/batching.js +47 -37
- package/link/batch/batching.js.map +1 -1
- package/link/batch-http/batch-http.cjs.native.js +127 -0
- package/link/context/context.cjs.native.js +38 -0
- package/link/core/core.cjs.native.js +121 -0
- package/link/error/error.cjs.native.js +90 -0
- package/link/http/http.cjs.native.js +320 -0
- package/link/http/selectHttpOptionsAndBody.d.ts.map +1 -1
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/link/persisted-queries/index.d.ts +2 -1
- package/link/persisted-queries/index.d.ts.map +1 -1
- package/link/persisted-queries/index.js +26 -13
- package/link/persisted-queries/index.js.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs +25 -12
- package/link/persisted-queries/persisted-queries.cjs.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.native.js +174 -0
- package/link/retry/retry.cjs.native.js +170 -0
- package/link/schema/schema.cjs.native.js +56 -0
- package/link/subscriptions/subscriptions.cjs.native.js +45 -0
- package/link/utils/utils.cjs.native.js +115 -0
- package/link/ws/ws.cjs.native.js +28 -0
- package/main.cjs.native.js +16 -0
- package/package.json +28 -26
- package/react/components/components.cjs.native.js +79 -0
- package/react/context/ApolloConsumer.js +2 -2
- package/react/context/ApolloProvider.js +2 -2
- package/react/context/context.cjs +4 -4
- package/react/context/context.cjs.map +1 -1
- package/react/context/context.cjs.native.js +67 -0
- package/react/hoc/hoc.cjs.native.js +325 -0
- package/react/hooks/hooks.cjs +365 -253
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +612 -0
- package/react/hooks/index.d.ts +1 -1
- package/react/hooks/index.d.ts.map +1 -1
- package/react/hooks/index.js +1 -1
- package/react/hooks/index.js.map +1 -1
- package/react/hooks/useLazyQuery.d.ts +2 -2
- package/react/hooks/useLazyQuery.d.ts.map +1 -1
- package/react/hooks/useLazyQuery.js +26 -21
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useMutation.d.ts.map +1 -1
- package/react/hooks/useMutation.js +13 -10
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.d.ts +36 -2
- package/react/hooks/useQuery.d.ts.map +1 -1
- package/react/hooks/useQuery.js +245 -206
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useSubscription.d.ts.map +1 -1
- package/react/hooks/useSubscription.js +17 -7
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSyncExternalStore.d.ts +4 -0
- package/react/hooks/useSyncExternalStore.d.ts.map +1 -0
- package/react/hooks/useSyncExternalStore.js +48 -0
- package/react/hooks/useSyncExternalStore.js.map +1 -0
- package/react/parser/index.d.ts.map +1 -1
- package/react/parser/index.js +24 -10
- package/react/parser/index.js.map +1 -1
- package/react/parser/parser.cjs +24 -10
- package/react/parser/parser.cjs.map +1 -1
- package/react/parser/parser.cjs.native.js +103 -0
- package/react/react.cjs.native.js +22 -0
- package/react/ssr/RenderPromises.d.ts +3 -2
- package/react/ssr/RenderPromises.d.ts.map +1 -1
- package/react/ssr/RenderPromises.js +25 -3
- package/react/ssr/RenderPromises.js.map +1 -1
- package/react/ssr/ssr.cjs +25 -3
- package/react/ssr/ssr.cjs.map +1 -1
- package/react/ssr/ssr.cjs.native.js +150 -0
- package/react/types/types.d.ts +10 -11
- package/react/types/types.d.ts.map +1 -1
- package/react/types/types.js.map +1 -1
- package/testing/core/core.cjs.native.js +288 -0
- package/testing/core/mocking/mockFetch.js +1 -1
- package/testing/core/mocking/mockFetch.js.map +1 -1
- package/testing/core/mocking/mockQueryManager.js +1 -1
- package/testing/core/mocking/mockWatchQuery.js +1 -1
- package/testing/core/wrap.js +1 -1
- package/testing/testing.cjs.native.js +58 -0
- package/utilities/common/canUse.d.ts +2 -0
- package/utilities/common/canUse.d.ts.map +1 -1
- package/utilities/common/canUse.js +6 -2
- package/utilities/common/canUse.js.map +1 -1
- package/utilities/common/mergeDeep.d.ts.map +1 -1
- package/utilities/common/mergeDeep.js +8 -11
- package/utilities/common/mergeDeep.js.map +1 -1
- package/utilities/common/mergeOptions.d.ts +5 -0
- package/utilities/common/mergeOptions.d.ts.map +1 -0
- package/utilities/common/mergeOptions.js +8 -0
- package/utilities/common/mergeOptions.js.map +1 -0
- package/utilities/globals/global.js +1 -2
- package/utilities/globals/globals.cjs.native.js +56 -0
- package/utilities/graphql/transform.d.ts +2 -2
- package/utilities/graphql/transform.d.ts.map +1 -1
- package/utilities/graphql/transform.js +1 -1
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/index.d.ts +1 -0
- package/utilities/index.d.ts.map +1 -1
- package/utilities/index.js +1 -0
- package/utilities/index.js.map +1 -1
- package/utilities/observables/Concast.d.ts.map +1 -1
- package/utilities/observables/Concast.js +5 -2
- package/utilities/observables/Concast.js.map +1 -1
- package/utilities/policies/pagination.d.ts.map +1 -1
- package/utilities/policies/pagination.js +9 -7
- package/utilities/policies/pagination.js.map +1 -1
- package/utilities/utilities.cjs +37 -23
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +1281 -0
- package/version.js +1 -1
package/cache/cache.cjs
CHANGED
|
@@ -805,7 +805,6 @@ var StoreReader = (function () {
|
|
|
805
805
|
var policies = this.config.cache.policies;
|
|
806
806
|
variables = tslib.__assign(tslib.__assign({}, utilities.getDefaultValues(utilities.getQueryDefinition(query))), variables);
|
|
807
807
|
var rootRef = utilities.makeReference(rootId);
|
|
808
|
-
var merger = new utilities.DeepMerger;
|
|
809
808
|
var execResult = this.executeSelectionSet({
|
|
810
809
|
selectionSet: utilities.getMainDefinition(query).selectionSet,
|
|
811
810
|
objectOrReference: rootRef,
|
|
@@ -818,9 +817,6 @@ var StoreReader = (function () {
|
|
|
818
817
|
varString: canonicalStringify(variables),
|
|
819
818
|
canonizeResults: canonizeResults,
|
|
820
819
|
fragmentMap: utilities.createFragmentMap(utilities.getFragmentDefinitions(query)),
|
|
821
|
-
merge: function (a, b) {
|
|
822
|
-
return merger.merge(a, b);
|
|
823
|
-
},
|
|
824
820
|
},
|
|
825
821
|
});
|
|
826
822
|
var missing;
|
|
@@ -859,17 +855,18 @@ var StoreReader = (function () {
|
|
|
859
855
|
}
|
|
860
856
|
var variables = context.variables, policies = context.policies, store = context.store;
|
|
861
857
|
var typename = store.getFieldValue(objectOrReference, "__typename");
|
|
862
|
-
var
|
|
858
|
+
var objectsToMerge = [];
|
|
863
859
|
var missing;
|
|
860
|
+
var missingMerger = new utilities.DeepMerger();
|
|
864
861
|
if (this.config.addTypename &&
|
|
865
862
|
typeof typename === "string" &&
|
|
866
863
|
!policies.rootIdsByTypename[typename]) {
|
|
867
|
-
|
|
864
|
+
objectsToMerge.push({ __typename: typename });
|
|
868
865
|
}
|
|
869
866
|
function handleMissing(result, resultName) {
|
|
870
867
|
var _a;
|
|
871
868
|
if (result.missing) {
|
|
872
|
-
missing =
|
|
869
|
+
missing = missingMerger.merge(missing, (_a = {}, _a[resultName] = result.missing, _a));
|
|
873
870
|
}
|
|
874
871
|
return result.result;
|
|
875
872
|
}
|
|
@@ -888,7 +885,7 @@ var StoreReader = (function () {
|
|
|
888
885
|
var resultName = utilities.resultKeyNameFromField(selection);
|
|
889
886
|
if (fieldValue === void 0) {
|
|
890
887
|
if (!utilities.addTypenameToDocument.added(selection)) {
|
|
891
|
-
missing =
|
|
888
|
+
missing = missingMerger.merge(missing, (_a = {},
|
|
892
889
|
_a[resultName] = "Can't find field '".concat(selection.name.value, "' on ").concat(utilities.isReference(objectOrReference)
|
|
893
890
|
? objectOrReference.__ref + " object"
|
|
894
891
|
: "object " + JSON.stringify(objectOrReference, null, 2)),
|
|
@@ -917,7 +914,7 @@ var StoreReader = (function () {
|
|
|
917
914
|
}), resultName);
|
|
918
915
|
}
|
|
919
916
|
if (fieldValue !== void 0) {
|
|
920
|
-
|
|
917
|
+
objectsToMerge.push((_b = {}, _b[resultName] = fieldValue, _b));
|
|
921
918
|
}
|
|
922
919
|
}
|
|
923
920
|
else {
|
|
@@ -927,6 +924,7 @@ var StoreReader = (function () {
|
|
|
927
924
|
}
|
|
928
925
|
}
|
|
929
926
|
});
|
|
927
|
+
var result = utilities.mergeDeepArray(objectsToMerge);
|
|
930
928
|
var finalResult = { result: result, missing: missing };
|
|
931
929
|
var frozen = context.canonizeResults
|
|
932
930
|
? this.canon.admit(finalResult)
|
|
@@ -940,10 +938,11 @@ var StoreReader = (function () {
|
|
|
940
938
|
var _this = this;
|
|
941
939
|
var field = _a.field, array = _a.array, enclosingRef = _a.enclosingRef, context = _a.context;
|
|
942
940
|
var missing;
|
|
941
|
+
var missingMerger = new utilities.DeepMerger();
|
|
943
942
|
function handleMissing(childResult, i) {
|
|
944
943
|
var _a;
|
|
945
944
|
if (childResult.missing) {
|
|
946
|
-
missing =
|
|
945
|
+
missing = missingMerger.merge(missing, (_a = {}, _a[i] = childResult.missing, _a));
|
|
947
946
|
}
|
|
948
947
|
return childResult.result;
|
|
949
948
|
}
|