@apollo/client 3.5.2 → 3.5.6
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 -1
- package/apollo-client.cjs +138 -129
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +15 -15
- package/cache/cache.cjs.map +1 -1
- package/cache/core/cache.js +2 -2
- package/cache/inmemory/entityStore.js +4 -4
- package/cache/inmemory/helpers.js +1 -1
- package/cache/inmemory/helpers.js.map +1 -1
- package/cache/inmemory/inMemoryCache.js +3 -3
- package/cache/inmemory/key-extractor.js +2 -2
- package/cache/inmemory/key-extractor.js.map +1 -1
- package/cache/inmemory/object-canon.js +2 -2
- package/cache/inmemory/policies.js +4 -4
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/reactiveVars.js +2 -2
- package/cache/inmemory/readFromStore.js +5 -5
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/writeToStore.js +9 -9
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/config/jest/setup.js +1 -1
- package/core/ApolloClient.d.ts +0 -1
- package/core/ApolloClient.d.ts.map +1 -1
- package/core/ApolloClient.js +2 -2
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.js +3 -3
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.d.ts +0 -1
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +4 -4
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +2 -2
- package/core/QueryInfo.d.ts.map +1 -1
- package/core/QueryInfo.js +2 -2
- package/core/QueryManager.d.ts +0 -1
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js +3 -3
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +10 -10
- package/core/core.cjs.map +1 -1
- package/core/index.js +2 -2
- package/errors/errors.cjs +2 -2
- package/errors/errors.cjs.map +1 -1
- package/errors/index.js +3 -3
- package/errors/index.js.map +1 -1
- package/invariantErrorCodes.js +25 -25
- package/link/batch/batch.cjs +1 -1
- package/link/batch/batch.cjs.map +1 -1
- package/link/batch/batchLink.d.ts +0 -1
- package/link/batch/batchLink.d.ts.map +1 -1
- package/link/batch/batchLink.js +1 -1
- package/link/batch/batching.d.ts +0 -1
- package/link/batch/batching.d.ts.map +1 -1
- package/link/batch/batching.js +2 -2
- package/link/batch/batching.js.map +1 -1
- package/link/batch-http/batch-http.cjs +1 -1
- package/link/batch-http/batch-http.cjs.map +1 -1
- package/link/batch-http/batchHttpLink.d.ts +0 -1
- package/link/batch-http/batchHttpLink.d.ts.map +1 -1
- package/link/batch-http/batchHttpLink.js +3 -3
- package/link/batch-http/batchHttpLink.js.map +1 -1
- package/link/context/index.js +1 -1
- package/link/core/ApolloLink.d.ts +0 -1
- package/link/core/ApolloLink.d.ts.map +1 -1
- package/link/core/ApolloLink.js +1 -1
- package/link/core/types.d.ts +0 -1
- package/link/core/types.d.ts.map +1 -1
- package/link/error/index.d.ts +0 -1
- package/link/error/index.d.ts.map +1 -1
- package/link/error/index.js +1 -1
- package/link/http/HttpLink.js +1 -1
- package/link/http/createHttpLink.js +4 -4
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/http.cjs +24 -13
- package/link/http/http.cjs.map +1 -1
- package/link/http/index.d.ts +1 -1
- package/link/http/index.d.ts.map +1 -1
- package/link/http/index.js +1 -1
- package/link/http/index.js.map +1 -1
- package/link/http/parseAndCheckHttpResponse.js +3 -3
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/link/http/rewriteURIForGET.js +1 -1
- package/link/http/rewriteURIForGET.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.d.ts +5 -1
- package/link/http/selectHttpOptionsAndBody.d.ts.map +1 -1
- package/link/http/selectHttpOptionsAndBody.js +20 -9
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/link/http/serializeFetchParameter.js +1 -1
- package/link/http/serializeFetchParameter.js.map +1 -1
- package/link/persisted-queries/index.js +2 -2
- package/link/retry/retryLink.d.ts +0 -1
- package/link/retry/retryLink.d.ts.map +1 -1
- package/link/retry/retryLink.js +1 -1
- package/link/schema/index.d.ts +0 -1
- package/link/schema/index.d.ts.map +1 -1
- package/link/schema/index.js +2 -2
- package/link/utils/createOperation.js +1 -1
- package/link/utils/fromError.d.ts +0 -1
- package/link/utils/fromError.d.ts.map +1 -1
- package/link/utils/fromPromise.d.ts +0 -1
- package/link/utils/fromPromise.d.ts.map +1 -1
- package/link/utils/toPromise.d.ts +0 -1
- package/link/utils/toPromise.d.ts.map +1 -1
- package/link/utils/utils.cjs +1 -1
- package/link/utils/utils.cjs.map +1 -1
- package/link/utils/validateOperation.js +1 -1
- package/link/utils/validateOperation.js.map +1 -1
- package/link/ws/index.d.ts +0 -1
- package/link/ws/index.d.ts.map +1 -1
- package/link/ws/index.js +2 -2
- package/main.cjs +4 -4
- package/package.json +14 -14
- package/react/components/Mutation.js +1 -1
- package/react/components/Query.js +2 -2
- package/react/components/Subscription.js +1 -1
- package/react/components/components.cjs +3 -3
- package/react/context/ApolloConsumer.js +1 -1
- package/react/context/ApolloContext.js +1 -1
- package/react/context/ApolloProvider.js +1 -1
- package/react/context/context.cjs +3 -3
- package/react/hoc/hoc-utils.js +2 -2
- package/react/hoc/hoc.cjs +9 -9
- package/react/hoc/hoc.cjs.map +1 -1
- package/react/hoc/mutation-hoc.js +5 -5
- package/react/hoc/mutation-hoc.js.map +1 -1
- package/react/hoc/query-hoc.js +4 -4
- package/react/hoc/query-hoc.js.map +1 -1
- package/react/hoc/subscription-hoc.js +4 -4
- package/react/hoc/subscription-hoc.js.map +1 -1
- package/react/hoc/withApollo.js +4 -4
- package/react/hoc/withApollo.js.map +1 -1
- package/react/hooks/hooks.cjs +64 -66
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useLazyQuery.js +2 -2
- package/react/hooks/useMutation.d.ts.map +1 -1
- package/react/hooks/useMutation.js +61 -67
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.d.ts.map +1 -1
- package/react/hooks/useQuery.js +9 -5
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useReactiveVar.js +1 -1
- package/react/hooks/useSubscription.js +2 -2
- package/react/parser/index.js +7 -7
- package/react/parser/index.js.map +1 -1
- package/react/parser/parser.cjs +7 -7
- package/react/parser/parser.cjs.map +1 -1
- package/react/react.cjs +2 -2
- package/react/ssr/getDataFromTree.js +2 -2
- package/react/ssr/ssr.cjs +3 -3
- package/react/types/types.d.ts +0 -1
- package/react/types/types.d.ts.map +1 -1
- package/testing/core/core.cjs +2 -2
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/mocking/mockFetch.js +3 -3
- package/testing/core/mocking/mockFetch.js.map +1 -1
- package/testing/core/mocking/mockLink.d.ts +0 -1
- package/testing/core/mocking/mockLink.d.ts.map +1 -1
- package/testing/core/mocking/mockLink.js +5 -5
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/testing/core/mocking/mockSubscriptionLink.d.ts +0 -1
- package/testing/core/mocking/mockSubscriptionLink.d.ts.map +1 -1
- package/testing/core/mocking/mockSubscriptionLink.js +1 -1
- package/testing/core/mocking/mockWatchQuery.js +1 -1
- package/testing/core/observableToPromise.js +2 -2
- package/testing/core/observableToPromise.js.map +1 -1
- package/testing/react/MockedProvider.js +2 -2
- package/testing/testing.cjs +5 -5
- package/utilities/common/makeUniqueId.js +1 -1
- package/utilities/common/makeUniqueId.js.map +1 -1
- package/utilities/common/mergeDeep.js +1 -1
- package/utilities/globals/fix-graphql.js +1 -1
- package/utilities/globals/global.d.ts.map +1 -1
- package/utilities/globals/global.js +1 -1
- package/utilities/globals/global.js.map +1 -1
- package/utilities/globals/globals.cjs +1 -1
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/index.js +1 -1
- package/utilities/graphql/directives.js +5 -5
- package/utilities/graphql/directives.js.map +1 -1
- package/utilities/graphql/fragments.js +4 -4
- package/utilities/graphql/fragments.js.map +1 -1
- package/utilities/graphql/getFromAST.js +2 -2
- package/utilities/graphql/getFromAST.js.map +1 -1
- package/utilities/graphql/storeUtils.js +5 -5
- package/utilities/graphql/storeUtils.js.map +1 -1
- package/utilities/graphql/transform.js +2 -2
- package/utilities/observables/Concast.d.ts +0 -1
- package/utilities/observables/Concast.d.ts.map +1 -1
- package/utilities/observables/Concast.js +1 -1
- package/utilities/observables/Observable.js +2 -2
- package/utilities/observables/asyncMap.d.ts +0 -1
- package/utilities/observables/asyncMap.d.ts.map +1 -1
- package/utilities/observables/subclassing.d.ts +0 -1
- package/utilities/observables/subclassing.d.ts.map +1 -1
- package/utilities/policies/pagination.js +2 -2
- package/utilities/utilities.cjs +15 -15
- package/utilities/utilities.cjs.map +1 -1
- package/version.js +1 -1
package/cache/cache.cjs
CHANGED
|
@@ -117,7 +117,7 @@ function defaultDataIdFromObject(_a, context) {
|
|
|
117
117
|
if (id === void 0)
|
|
118
118
|
id = _id;
|
|
119
119
|
if (id !== void 0) {
|
|
120
|
-
return __typename
|
|
120
|
+
return "".concat(__typename, ":").concat((typeof id === "number" ||
|
|
121
121
|
typeof id === "string") ? id : JSON.stringify(id));
|
|
122
122
|
}
|
|
123
123
|
}
|
|
@@ -853,7 +853,7 @@ var StoreReader = (function () {
|
|
|
853
853
|
!context.store.has(objectOrReference.__ref)) {
|
|
854
854
|
return {
|
|
855
855
|
result: this.canon.empty,
|
|
856
|
-
missing: "Dangling reference to missing "
|
|
856
|
+
missing: "Dangling reference to missing ".concat(objectOrReference.__ref, " object"),
|
|
857
857
|
};
|
|
858
858
|
}
|
|
859
859
|
var variables = context.variables, policies = context.policies, store = context.store;
|
|
@@ -888,7 +888,7 @@ var StoreReader = (function () {
|
|
|
888
888
|
if (fieldValue === void 0) {
|
|
889
889
|
if (!utilities.addTypenameToDocument.added(selection)) {
|
|
890
890
|
missing = context.merge(missing, (_a = {},
|
|
891
|
-
_a[resultName] = "Can't find field '"
|
|
891
|
+
_a[resultName] = "Can't find field '".concat(selection.name.value, "' on ").concat(utilities.isReference(objectOrReference)
|
|
892
892
|
? objectOrReference.__ref + " object"
|
|
893
893
|
: "object " + JSON.stringify(objectOrReference, null, 2)),
|
|
894
894
|
_a));
|
|
@@ -998,7 +998,7 @@ function assertSelectionSetForIdValue(store, field, fieldValue) {
|
|
|
998
998
|
var workSet_1 = new Set([fieldValue]);
|
|
999
999
|
workSet_1.forEach(function (value) {
|
|
1000
1000
|
if (utilities.isNonNullObject(value)) {
|
|
1001
|
-
__DEV__ ? globals.invariant(!utilities.isReference(value), "Missing selection set for object of type "
|
|
1001
|
+
__DEV__ ? globals.invariant(!utilities.isReference(value), "Missing selection set for object of type ".concat(getTypenameFromStoreObject(store, value), " returned for query field ").concat(field.name.value)) : globals.invariant(!utilities.isReference(value), 5);
|
|
1002
1002
|
Object.values(value).forEach(workSet_1.add, workSet_1);
|
|
1003
1003
|
}
|
|
1004
1004
|
});
|
|
@@ -1085,10 +1085,10 @@ function keyFieldsFnFromSpecifier(specifier) {
|
|
|
1085
1085
|
hasOwn.call(object, schemaKeyPath[0])) {
|
|
1086
1086
|
extracted = extractKeyPath(object, schemaKeyPath, extractKey);
|
|
1087
1087
|
}
|
|
1088
|
-
__DEV__ ? globals.invariant(extracted !== void 0, "Missing field '"
|
|
1088
|
+
__DEV__ ? globals.invariant(extracted !== void 0, "Missing field '".concat(schemaKeyPath.join('.'), "' while extracting keyFields from ").concat(JSON.stringify(object))) : globals.invariant(extracted !== void 0, 2);
|
|
1089
1089
|
return extracted;
|
|
1090
1090
|
});
|
|
1091
|
-
return context.typename
|
|
1091
|
+
return "".concat(context.typename, ":").concat(JSON.stringify(keyObject));
|
|
1092
1092
|
});
|
|
1093
1093
|
}
|
|
1094
1094
|
function keyArgsFnFromSpecifier(specifier) {
|
|
@@ -1314,7 +1314,7 @@ var Policies = (function () {
|
|
|
1314
1314
|
var rootId = "ROOT_" + which.toUpperCase();
|
|
1315
1315
|
var old = this.rootTypenamesById[rootId];
|
|
1316
1316
|
if (typename !== old) {
|
|
1317
|
-
__DEV__ ? globals.invariant(!old || old === which, "Cannot change root "
|
|
1317
|
+
__DEV__ ? globals.invariant(!old || old === which, "Cannot change root ".concat(which, " __typename more than once")) : globals.invariant(!old || old === which, 3);
|
|
1318
1318
|
if (old)
|
|
1319
1319
|
delete this.rootIdsByTypename[old];
|
|
1320
1320
|
this.rootIdsByTypename[typename] = rootId;
|
|
@@ -1398,7 +1398,7 @@ var Policies = (function () {
|
|
|
1398
1398
|
if (supertypeSet.has(supertype)) {
|
|
1399
1399
|
if (!typenameSupertypeSet.has(supertype)) {
|
|
1400
1400
|
if (checkingFuzzySubtypes) {
|
|
1401
|
-
__DEV__ && globals.invariant.warn("Inferring subtype "
|
|
1401
|
+
__DEV__ && globals.invariant.warn("Inferring subtype ".concat(typename, " of supertype ").concat(supertype));
|
|
1402
1402
|
}
|
|
1403
1403
|
typenameSupertypeSet.add(supertype);
|
|
1404
1404
|
}
|
|
@@ -1552,7 +1552,7 @@ function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables)
|
|
|
1552
1552
|
}
|
|
1553
1553
|
}
|
|
1554
1554
|
if (__DEV__ && options.from === void 0) {
|
|
1555
|
-
__DEV__ && globals.invariant.warn("Undefined 'from' passed to readField with arguments "
|
|
1555
|
+
__DEV__ && globals.invariant.warn("Undefined 'from' passed to readField with arguments ".concat(utilities.stringifyForDisplay(Array.from(readFieldArgs))));
|
|
1556
1556
|
}
|
|
1557
1557
|
if (void 0 === options.variables) {
|
|
1558
1558
|
options.variables = variables;
|
|
@@ -1592,7 +1592,7 @@ function makeMergeObjectsFunction(store) {
|
|
|
1592
1592
|
}
|
|
1593
1593
|
|
|
1594
1594
|
function getContextFlavor(context, clientOnly, deferred) {
|
|
1595
|
-
var key = ""
|
|
1595
|
+
var key = "".concat(clientOnly).concat(deferred);
|
|
1596
1596
|
var flavored = context.flavors.get(key);
|
|
1597
1597
|
if (!flavored) {
|
|
1598
1598
|
context.flavors.set(key, flavored = (context.clientOnly === clientOnly &&
|
|
@@ -1634,7 +1634,7 @@ var StoreWriter = (function () {
|
|
|
1634
1634
|
context: context,
|
|
1635
1635
|
});
|
|
1636
1636
|
if (!utilities.isReference(ref)) {
|
|
1637
|
-
throw __DEV__ ? new globals.InvariantError("Could not identify object "
|
|
1637
|
+
throw __DEV__ ? new globals.InvariantError("Could not identify object ".concat(JSON.stringify(result))) : new globals.InvariantError(6);
|
|
1638
1638
|
}
|
|
1639
1639
|
context.incomingById.forEach(function (_a, dataId) {
|
|
1640
1640
|
var storeObject = _a.storeObject, mergeTree = _a.mergeTree, fieldNodeSet = _a.fieldNodeSet;
|
|
@@ -1739,7 +1739,7 @@ var StoreWriter = (function () {
|
|
|
1739
1739
|
!context.deferred &&
|
|
1740
1740
|
!utilities.addTypenameToDocument.added(field) &&
|
|
1741
1741
|
!policies.getReadFunction(typename, field.name.value)) {
|
|
1742
|
-
__DEV__ && globals.invariant.error(
|
|
1742
|
+
__DEV__ && globals.invariant.error("Missing field '".concat(utilities.resultKeyNameFromField(field), "' while writing result ").concat(JSON.stringify(result, null, 2)).substring(0, 1000));
|
|
1743
1743
|
}
|
|
1744
1744
|
});
|
|
1745
1745
|
try {
|
|
@@ -1961,7 +1961,7 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
|
|
|
1961
1961
|
var parentType = store.getFieldValue(existingRef, "__typename") ||
|
|
1962
1962
|
store.getFieldValue(incomingObj, "__typename");
|
|
1963
1963
|
var fieldName = fieldNameFromStoreName(storeFieldName);
|
|
1964
|
-
var typeDotName = parentType
|
|
1964
|
+
var typeDotName = "".concat(parentType, ".").concat(fieldName);
|
|
1965
1965
|
if (warnings.has(typeDotName))
|
|
1966
1966
|
return;
|
|
1967
1967
|
warnings.add(typeDotName);
|
|
@@ -1976,10 +1976,10 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
|
|
|
1976
1976
|
}
|
|
1977
1977
|
});
|
|
1978
1978
|
}
|
|
1979
|
-
__DEV__ && globals.invariant.warn("Cache data may be lost when replacing the "
|
|
1979
|
+
__DEV__ && globals.invariant.warn("Cache data may be lost when replacing the ".concat(fieldName, " field of a ").concat(parentType, " object.\n\nTo address this problem (which is not a bug in Apollo Client), ").concat(childTypenames.length
|
|
1980
1980
|
? "either ensure all objects of type " +
|
|
1981
1981
|
childTypenames.join(" and ") + " have an ID or a custom merge function, or "
|
|
1982
|
-
: ""
|
|
1982
|
+
: "", "define a custom merge function for the ").concat(typeDotName, " field, so InMemoryCache can safely merge these objects:\n\n existing: ").concat(JSON.stringify(existing).slice(0, 1000), "\n incoming: ").concat(JSON.stringify(incoming).slice(0, 1000), "\n\nFor more information about these options, please refer to the documentation:\n\n * Ensuring entity objects have IDs: https://go.apollo.dev/c/generating-unique-identifiers\n * Defining custom merge functions: https://go.apollo.dev/c/merging-non-normalized-objects\n"));
|
|
1983
1983
|
}
|
|
1984
1984
|
|
|
1985
1985
|
var InMemoryCache = (function (_super) {
|