@apollo/client 3.7.8 → 3.7.10
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 +186 -168
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +20 -21
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +20 -21
- package/cache/core/types/DataProxy.d.ts +3 -2
- package/cache/core/types/DataProxy.d.ts.map +1 -1
- package/cache/core/types/DataProxy.js.map +1 -1
- package/cache/inmemory/helpers.d.ts +2 -2
- package/cache/inmemory/helpers.d.ts.map +1 -1
- package/cache/inmemory/helpers.js +2 -2
- package/cache/inmemory/helpers.js.map +1 -1
- package/core/ApolloClient.d.ts +3 -3
- package/core/ApolloClient.d.ts.map +1 -1
- package/core/ApolloClient.js +10 -4
- package/core/ApolloClient.js.map +1 -1
- package/core/core.cjs +11 -5
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +11 -5
- package/invariantErrorCodes.js +1 -1
- package/package.json +8 -8
- package/react/hooks/hooks.cjs +2 -1
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +2 -1
- package/react/hooks/useMutation.d.ts.map +1 -1
- package/react/hooks/useMutation.js +2 -1
- package/react/hooks/useMutation.js.map +1 -1
- package/utilities/common/arrays.d.ts +1 -0
- package/utilities/common/arrays.d.ts.map +1 -1
- package/utilities/common/arrays.js +1 -0
- package/utilities/common/arrays.js.map +1 -1
- package/utilities/graphql/getFromAST.d.ts.map +1 -1
- package/utilities/graphql/getFromAST.js +7 -3
- package/utilities/graphql/getFromAST.js.map +1 -1
- package/utilities/graphql/transform.d.ts.map +1 -1
- package/utilities/graphql/transform.js +167 -90
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/utilities.cjs +175 -103
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +175 -103
- package/version.js +1 -1
package/cache/cache.cjs
CHANGED
|
@@ -123,7 +123,6 @@ var hasOwn = Object.prototype.hasOwnProperty;
|
|
|
123
123
|
function isNullish(value) {
|
|
124
124
|
return value === null || value === void 0;
|
|
125
125
|
}
|
|
126
|
-
var isArray = Array.isArray;
|
|
127
126
|
function defaultDataIdFromObject(_a, context) {
|
|
128
127
|
var __typename = _a.__typename, id = _a.id, _id = _a._id;
|
|
129
128
|
if (typeof __typename === "string") {
|
|
@@ -167,7 +166,7 @@ function fieldNameFromStoreName(storeFieldName) {
|
|
|
167
166
|
}
|
|
168
167
|
function selectionSetMatchesResult(selectionSet, result, variables) {
|
|
169
168
|
if (utilities.isNonNullObject(result)) {
|
|
170
|
-
return isArray(result)
|
|
169
|
+
return utilities.isArray(result)
|
|
171
170
|
? result.every(function (item) { return selectionSetMatchesResult(selectionSet, item, variables); })
|
|
172
171
|
: selectionSet.selections.every(function (field) {
|
|
173
172
|
if (utilities.isField(field) && utilities.shouldInclude(field, variables)) {
|
|
@@ -184,7 +183,7 @@ function selectionSetMatchesResult(selectionSet, result, variables) {
|
|
|
184
183
|
function storeValueIsStoreObject(value) {
|
|
185
184
|
return utilities.isNonNullObject(value) &&
|
|
186
185
|
!utilities.isReference(value) &&
|
|
187
|
-
!isArray(value);
|
|
186
|
+
!utilities.isArray(value);
|
|
188
187
|
}
|
|
189
188
|
function makeProcessedFieldsMerger() {
|
|
190
189
|
return new utilities.DeepMerger;
|
|
@@ -664,7 +663,7 @@ function supportsResultCaching(store) {
|
|
|
664
663
|
|
|
665
664
|
function shallowCopy(value) {
|
|
666
665
|
if (utilities.isNonNullObject(value)) {
|
|
667
|
-
return isArray(value)
|
|
666
|
+
return utilities.isArray(value)
|
|
668
667
|
? value.slice(0)
|
|
669
668
|
: tslib.__assign({ __proto__: Object.getPrototypeOf(value) }, value);
|
|
670
669
|
}
|
|
@@ -916,7 +915,7 @@ var StoreReader = (function () {
|
|
|
916
915
|
_a));
|
|
917
916
|
}
|
|
918
917
|
}
|
|
919
|
-
else if (isArray(fieldValue)) {
|
|
918
|
+
else if (utilities.isArray(fieldValue)) {
|
|
920
919
|
fieldValue = handleMissing(_this.executeSubSelectedArray({
|
|
921
920
|
field: selection,
|
|
922
921
|
array: fieldValue,
|
|
@@ -980,7 +979,7 @@ var StoreReader = (function () {
|
|
|
980
979
|
if (item === null) {
|
|
981
980
|
return null;
|
|
982
981
|
}
|
|
983
|
-
if (isArray(item)) {
|
|
982
|
+
if (utilities.isArray(item)) {
|
|
984
983
|
return handleMissing(_this.executeSubSelectedArray({
|
|
985
984
|
field: field,
|
|
986
985
|
array: item,
|
|
@@ -1174,13 +1173,13 @@ function getSpecifierPaths(spec) {
|
|
|
1174
1173
|
var paths_1 = info.paths = [];
|
|
1175
1174
|
var currentPath_1 = [];
|
|
1176
1175
|
spec.forEach(function (s, i) {
|
|
1177
|
-
if (isArray(s)) {
|
|
1176
|
+
if (utilities.isArray(s)) {
|
|
1178
1177
|
getSpecifierPaths(s).forEach(function (p) { return paths_1.push(currentPath_1.concat(p)); });
|
|
1179
1178
|
currentPath_1.length = 0;
|
|
1180
1179
|
}
|
|
1181
1180
|
else {
|
|
1182
1181
|
currentPath_1.push(s);
|
|
1183
|
-
if (!isArray(spec[i + 1])) {
|
|
1182
|
+
if (!utilities.isArray(spec[i + 1])) {
|
|
1184
1183
|
paths_1.push(currentPath_1.slice(0));
|
|
1185
1184
|
currentPath_1.length = 0;
|
|
1186
1185
|
}
|
|
@@ -1195,14 +1194,14 @@ function extractKey(object, key) {
|
|
|
1195
1194
|
function extractKeyPath(object, path, extract) {
|
|
1196
1195
|
extract = extract || extractKey;
|
|
1197
1196
|
return normalize(path.reduce(function reducer(obj, key) {
|
|
1198
|
-
return isArray(obj)
|
|
1197
|
+
return utilities.isArray(obj)
|
|
1199
1198
|
? obj.map(function (child) { return reducer(child, key); })
|
|
1200
1199
|
: obj && extract(obj, key);
|
|
1201
1200
|
}, object));
|
|
1202
1201
|
}
|
|
1203
1202
|
function normalize(value) {
|
|
1204
1203
|
if (utilities.isNonNullObject(value)) {
|
|
1205
|
-
if (isArray(value)) {
|
|
1204
|
+
if (utilities.isArray(value)) {
|
|
1206
1205
|
return value.map(normalize);
|
|
1207
1206
|
}
|
|
1208
1207
|
return collectSpecifierPaths(Object.keys(value).sort(), function (path) { return extractKeyPath(value, path); });
|
|
@@ -1265,7 +1264,7 @@ var Policies = (function () {
|
|
|
1265
1264
|
var keyFn = policy && policy.keyFn || this.config.dataIdFromObject;
|
|
1266
1265
|
while (keyFn) {
|
|
1267
1266
|
var specifierOrId = keyFn(object, context);
|
|
1268
|
-
if (isArray(specifierOrId)) {
|
|
1267
|
+
if (utilities.isArray(specifierOrId)) {
|
|
1269
1268
|
keyFn = keyFieldsFnFromSpecifier(specifierOrId);
|
|
1270
1269
|
}
|
|
1271
1270
|
else {
|
|
@@ -1308,7 +1307,7 @@ var Policies = (function () {
|
|
|
1308
1307
|
setMerge(existing, incoming.merge);
|
|
1309
1308
|
existing.keyFn =
|
|
1310
1309
|
keyFields === false ? nullKeyFieldsFn :
|
|
1311
|
-
isArray(keyFields) ? keyFieldsFnFromSpecifier(keyFields) :
|
|
1310
|
+
utilities.isArray(keyFields) ? keyFieldsFnFromSpecifier(keyFields) :
|
|
1312
1311
|
typeof keyFields === "function" ? keyFields :
|
|
1313
1312
|
existing.keyFn;
|
|
1314
1313
|
if (fields) {
|
|
@@ -1322,7 +1321,7 @@ var Policies = (function () {
|
|
|
1322
1321
|
var keyArgs = incoming.keyArgs, read = incoming.read, merge = incoming.merge;
|
|
1323
1322
|
existing.keyFn =
|
|
1324
1323
|
keyArgs === false ? simpleKeyArgsFn :
|
|
1325
|
-
isArray(keyArgs) ? keyArgsFnFromSpecifier(keyArgs) :
|
|
1324
|
+
utilities.isArray(keyArgs) ? keyArgsFnFromSpecifier(keyArgs) :
|
|
1326
1325
|
typeof keyArgs === "function" ? keyArgs :
|
|
1327
1326
|
existing.keyFn;
|
|
1328
1327
|
if (typeof read === "function") {
|
|
@@ -1467,7 +1466,7 @@ var Policies = (function () {
|
|
|
1467
1466
|
var args = argsFromFieldSpecifier(fieldSpec);
|
|
1468
1467
|
while (keyFn) {
|
|
1469
1468
|
var specifierOrString = keyFn(args, context);
|
|
1470
|
-
if (isArray(specifierOrString)) {
|
|
1469
|
+
if (utilities.isArray(specifierOrString)) {
|
|
1471
1470
|
keyFn = keyArgsFnFromSpecifier(specifierOrString);
|
|
1472
1471
|
}
|
|
1473
1472
|
else {
|
|
@@ -1588,7 +1587,7 @@ function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables)
|
|
|
1588
1587
|
}
|
|
1589
1588
|
function makeMergeObjectsFunction(store) {
|
|
1590
1589
|
return function mergeObjects(existing, incoming) {
|
|
1591
|
-
if (isArray(existing) || isArray(incoming)) {
|
|
1590
|
+
if (utilities.isArray(existing) || utilities.isArray(incoming)) {
|
|
1592
1591
|
throw __DEV__ ? new globals.InvariantError("Cannot automatically merge arrays") : new globals.InvariantError(4);
|
|
1593
1592
|
}
|
|
1594
1593
|
if (utilities.isNonNullObject(existing) &&
|
|
@@ -1806,7 +1805,7 @@ var StoreWriter = (function () {
|
|
|
1806
1805
|
if (!field.selectionSet || value === null) {
|
|
1807
1806
|
return __DEV__ ? utilities.cloneDeep(value) : value;
|
|
1808
1807
|
}
|
|
1809
|
-
if (isArray(value)) {
|
|
1808
|
+
if (utilities.isArray(value)) {
|
|
1810
1809
|
return value.map(function (item, i) {
|
|
1811
1810
|
var value = _this.processFieldValue(item, field, context, getChildMergeTree(mergeTree, i));
|
|
1812
1811
|
maybeRecycleChildMergeTree(mergeTree, i);
|
|
@@ -1874,7 +1873,7 @@ var StoreWriter = (function () {
|
|
|
1874
1873
|
var _a;
|
|
1875
1874
|
var _this = this;
|
|
1876
1875
|
if (mergeTree.map.size && !utilities.isReference(incoming)) {
|
|
1877
|
-
var e_1 = (!isArray(incoming) &&
|
|
1876
|
+
var e_1 = (!utilities.isArray(incoming) &&
|
|
1878
1877
|
(utilities.isReference(existing) || storeValueIsStoreObject(existing))) ? existing : void 0;
|
|
1879
1878
|
var i_1 = incoming;
|
|
1880
1879
|
if (e_1 && !getStorageArgs) {
|
|
@@ -1882,7 +1881,7 @@ var StoreWriter = (function () {
|
|
|
1882
1881
|
}
|
|
1883
1882
|
var changedFields_1;
|
|
1884
1883
|
var getValue_1 = function (from, name) {
|
|
1885
|
-
return isArray(from)
|
|
1884
|
+
return utilities.isArray(from)
|
|
1886
1885
|
? (typeof name === "number" ? from[name] : void 0)
|
|
1887
1886
|
: context.store.getFieldValue(from, String(name));
|
|
1888
1887
|
};
|
|
@@ -1904,7 +1903,7 @@ var StoreWriter = (function () {
|
|
|
1904
1903
|
}
|
|
1905
1904
|
});
|
|
1906
1905
|
if (changedFields_1) {
|
|
1907
|
-
incoming = (isArray(i_1) ? i_1.slice(0) : tslib.__assign({}, i_1));
|
|
1906
|
+
incoming = (utilities.isArray(i_1) ? i_1.slice(0) : tslib.__assign({}, i_1));
|
|
1908
1907
|
changedFields_1.forEach(function (value, name) {
|
|
1909
1908
|
incoming[name] = value;
|
|
1910
1909
|
});
|
|
@@ -1985,8 +1984,8 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
|
|
|
1985
1984
|
return;
|
|
1986
1985
|
warnings.add(typeDotName);
|
|
1987
1986
|
var childTypenames = [];
|
|
1988
|
-
if (!isArray(existing) &&
|
|
1989
|
-
!isArray(incoming)) {
|
|
1987
|
+
if (!utilities.isArray(existing) &&
|
|
1988
|
+
!utilities.isArray(incoming)) {
|
|
1990
1989
|
[existing, incoming].forEach(function (child) {
|
|
1991
1990
|
var typename = store.getFieldValue(child, "__typename");
|
|
1992
1991
|
if (typeof typename === "string" &&
|