@apollo/client 3.6.0-beta.5 → 3.6.0-beta.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/apollo-client.cjs +22 -21
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +21 -20
- package/cache/cache.cjs.map +1 -1
- package/cache/inmemory/helpers.d.ts +1 -0
- package/cache/inmemory/helpers.d.ts.map +1 -1
- package/cache/inmemory/helpers.js +3 -2
- package/cache/inmemory/helpers.js.map +1 -1
- package/cache/inmemory/key-extractor.js +5 -5
- package/cache/inmemory/key-extractor.js.map +1 -1
- package/cache/inmemory/object-canon.d.ts.map +1 -1
- package/cache/inmemory/object-canon.js +2 -1
- package/cache/inmemory/object-canon.js.map +1 -1
- package/cache/inmemory/policies.d.ts +1 -1
- package/cache/inmemory/policies.d.ts.map +1 -1
- package/cache/inmemory/policies.js +6 -6
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/readFromStore.js +3 -3
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/writeToStore.js +7 -7
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/core.cjs +1 -1
- package/core/core.cjs.map +1 -1
- package/invariantErrorCodes.js +1 -1
- package/package.json +7 -7
- package/utilities/globals/global.d.ts +2 -8
- package/utilities/globals/global.d.ts.map +1 -1
- package/utilities/globals/global.js.map +1 -1
- package/version.js +1 -1
package/apollo-client.cjs
CHANGED
|
@@ -1291,7 +1291,7 @@ var concat = ApolloLink.concat;
|
|
|
1291
1291
|
|
|
1292
1292
|
var execute = ApolloLink.execute;
|
|
1293
1293
|
|
|
1294
|
-
var version = '3.6.0-beta.
|
|
1294
|
+
var version = '3.6.0-beta.6';
|
|
1295
1295
|
|
|
1296
1296
|
var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
|
|
1297
1297
|
function parseAndCheckHttpResponse(operations) {
|
|
@@ -1726,7 +1726,7 @@ function fieldNameFromStoreName(storeFieldName) {
|
|
|
1726
1726
|
}
|
|
1727
1727
|
function selectionSetMatchesResult(selectionSet, result, variables) {
|
|
1728
1728
|
if (isNonNullObject(result)) {
|
|
1729
|
-
return
|
|
1729
|
+
return isArray(result)
|
|
1730
1730
|
? result.every(function (item) { return selectionSetMatchesResult(selectionSet, item, variables); })
|
|
1731
1731
|
: selectionSet.selections.every(function (field) {
|
|
1732
1732
|
if (isField(field) && shouldInclude(field, variables)) {
|
|
@@ -1743,11 +1743,12 @@ function selectionSetMatchesResult(selectionSet, result, variables) {
|
|
|
1743
1743
|
function storeValueIsStoreObject(value) {
|
|
1744
1744
|
return isNonNullObject(value) &&
|
|
1745
1745
|
!isReference(value) &&
|
|
1746
|
-
!
|
|
1746
|
+
!isArray(value);
|
|
1747
1747
|
}
|
|
1748
1748
|
function makeProcessedFieldsMerger() {
|
|
1749
1749
|
return new DeepMerger;
|
|
1750
1750
|
}
|
|
1751
|
+
var isArray = function (a) { return Array.isArray(a); };
|
|
1751
1752
|
|
|
1752
1753
|
var DELETE = Object.create(null);
|
|
1753
1754
|
var delModifier = function () { return DELETE; };
|
|
@@ -2210,7 +2211,7 @@ function supportsResultCaching(store) {
|
|
|
2210
2211
|
|
|
2211
2212
|
function shallowCopy(value) {
|
|
2212
2213
|
if (isNonNullObject(value)) {
|
|
2213
|
-
return
|
|
2214
|
+
return isArray(value)
|
|
2214
2215
|
? value.slice(0)
|
|
2215
2216
|
: tslib.__assign({ __proto__: Object.getPrototypeOf(value) }, value);
|
|
2216
2217
|
}
|
|
@@ -2473,7 +2474,7 @@ var StoreReader = (function () {
|
|
|
2473
2474
|
_a));
|
|
2474
2475
|
}
|
|
2475
2476
|
}
|
|
2476
|
-
else if (
|
|
2477
|
+
else if (isArray(fieldValue)) {
|
|
2477
2478
|
fieldValue = handleMissing(_this.executeSubSelectedArray({
|
|
2478
2479
|
field: selection,
|
|
2479
2480
|
array: fieldValue,
|
|
@@ -2532,7 +2533,7 @@ var StoreReader = (function () {
|
|
|
2532
2533
|
if (item === null) {
|
|
2533
2534
|
return null;
|
|
2534
2535
|
}
|
|
2535
|
-
if (
|
|
2536
|
+
if (isArray(item)) {
|
|
2536
2537
|
return handleMissing(_this.executeSubSelectedArray({
|
|
2537
2538
|
field: field,
|
|
2538
2539
|
array: item,
|
|
@@ -2726,13 +2727,13 @@ function getSpecifierPaths(spec) {
|
|
|
2726
2727
|
var paths_1 = info.paths = [];
|
|
2727
2728
|
var currentPath_1 = [];
|
|
2728
2729
|
spec.forEach(function (s, i) {
|
|
2729
|
-
if (
|
|
2730
|
+
if (isArray(s)) {
|
|
2730
2731
|
getSpecifierPaths(s).forEach(function (p) { return paths_1.push(currentPath_1.concat(p)); });
|
|
2731
2732
|
currentPath_1.length = 0;
|
|
2732
2733
|
}
|
|
2733
2734
|
else {
|
|
2734
2735
|
currentPath_1.push(s);
|
|
2735
|
-
if (!
|
|
2736
|
+
if (!isArray(spec[i + 1])) {
|
|
2736
2737
|
paths_1.push(currentPath_1.slice(0));
|
|
2737
2738
|
currentPath_1.length = 0;
|
|
2738
2739
|
}
|
|
@@ -2747,14 +2748,14 @@ function extractKey(object, key) {
|
|
|
2747
2748
|
function extractKeyPath(object, path, extract) {
|
|
2748
2749
|
extract = extract || extractKey;
|
|
2749
2750
|
return normalize(path.reduce(function reducer(obj, key) {
|
|
2750
|
-
return
|
|
2751
|
+
return isArray(obj)
|
|
2751
2752
|
? obj.map(function (child) { return reducer(child, key); })
|
|
2752
2753
|
: obj && extract(obj, key);
|
|
2753
2754
|
}, object));
|
|
2754
2755
|
}
|
|
2755
2756
|
function normalize(value) {
|
|
2756
2757
|
if (isNonNullObject(value)) {
|
|
2757
|
-
if (
|
|
2758
|
+
if (isArray(value)) {
|
|
2758
2759
|
return value.map(normalize);
|
|
2759
2760
|
}
|
|
2760
2761
|
return collectSpecifierPaths(Object.keys(value).sort(), function (path) { return extractKeyPath(value, path); });
|
|
@@ -2817,7 +2818,7 @@ var Policies = (function () {
|
|
|
2817
2818
|
var keyFn = policy && policy.keyFn || this.config.dataIdFromObject;
|
|
2818
2819
|
while (keyFn) {
|
|
2819
2820
|
var specifierOrId = keyFn(object, context);
|
|
2820
|
-
if (
|
|
2821
|
+
if (isArray(specifierOrId)) {
|
|
2821
2822
|
keyFn = keyFieldsFnFromSpecifier(specifierOrId);
|
|
2822
2823
|
}
|
|
2823
2824
|
else {
|
|
@@ -2860,7 +2861,7 @@ var Policies = (function () {
|
|
|
2860
2861
|
setMerge(existing, incoming.merge);
|
|
2861
2862
|
existing.keyFn =
|
|
2862
2863
|
keyFields === false ? nullKeyFieldsFn :
|
|
2863
|
-
|
|
2864
|
+
isArray(keyFields) ? keyFieldsFnFromSpecifier(keyFields) :
|
|
2864
2865
|
typeof keyFields === "function" ? keyFields :
|
|
2865
2866
|
existing.keyFn;
|
|
2866
2867
|
if (fields) {
|
|
@@ -2874,7 +2875,7 @@ var Policies = (function () {
|
|
|
2874
2875
|
var keyArgs = incoming.keyArgs, read = incoming.read, merge = incoming.merge;
|
|
2875
2876
|
existing.keyFn =
|
|
2876
2877
|
keyArgs === false ? simpleKeyArgsFn :
|
|
2877
|
-
|
|
2878
|
+
isArray(keyArgs) ? keyArgsFnFromSpecifier(keyArgs) :
|
|
2878
2879
|
typeof keyArgs === "function" ? keyArgs :
|
|
2879
2880
|
existing.keyFn;
|
|
2880
2881
|
if (typeof read === "function") {
|
|
@@ -3019,7 +3020,7 @@ var Policies = (function () {
|
|
|
3019
3020
|
var args = argsFromFieldSpecifier(fieldSpec);
|
|
3020
3021
|
while (keyFn) {
|
|
3021
3022
|
var specifierOrString = keyFn(args, context);
|
|
3022
|
-
if (
|
|
3023
|
+
if (isArray(specifierOrString)) {
|
|
3023
3024
|
keyFn = keyArgsFnFromSpecifier(specifierOrString);
|
|
3024
3025
|
}
|
|
3025
3026
|
else {
|
|
@@ -3140,7 +3141,7 @@ function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables)
|
|
|
3140
3141
|
}
|
|
3141
3142
|
function makeMergeObjectsFunction(store) {
|
|
3142
3143
|
return function mergeObjects(existing, incoming) {
|
|
3143
|
-
if (
|
|
3144
|
+
if (isArray(existing) || isArray(incoming)) {
|
|
3144
3145
|
throw __DEV__ ? new tsInvariant.InvariantError("Cannot automatically merge arrays") : new tsInvariant.InvariantError(4);
|
|
3145
3146
|
}
|
|
3146
3147
|
if (isNonNullObject(existing) &&
|
|
@@ -3369,7 +3370,7 @@ var StoreWriter = (function () {
|
|
|
3369
3370
|
if (!field.selectionSet || value === null) {
|
|
3370
3371
|
return __DEV__ ? cloneDeep(value) : value;
|
|
3371
3372
|
}
|
|
3372
|
-
if (
|
|
3373
|
+
if (isArray(value)) {
|
|
3373
3374
|
return value.map(function (item, i) {
|
|
3374
3375
|
var value = _this.processFieldValue(item, field, context, getChildMergeTree(mergeTree, i));
|
|
3375
3376
|
maybeRecycleChildMergeTree(mergeTree, i);
|
|
@@ -3434,7 +3435,7 @@ var StoreWriter = (function () {
|
|
|
3434
3435
|
var _a;
|
|
3435
3436
|
var _this = this;
|
|
3436
3437
|
if (mergeTree.map.size && !isReference(incoming)) {
|
|
3437
|
-
var e_1 = (!
|
|
3438
|
+
var e_1 = (!isArray(incoming) &&
|
|
3438
3439
|
(isReference(existing) || storeValueIsStoreObject(existing))) ? existing : void 0;
|
|
3439
3440
|
var i_1 = incoming;
|
|
3440
3441
|
if (e_1 && !getStorageArgs) {
|
|
@@ -3442,7 +3443,7 @@ var StoreWriter = (function () {
|
|
|
3442
3443
|
}
|
|
3443
3444
|
var changedFields_1;
|
|
3444
3445
|
var getValue_1 = function (from, name) {
|
|
3445
|
-
return
|
|
3446
|
+
return isArray(from)
|
|
3446
3447
|
? (typeof name === "number" ? from[name] : void 0)
|
|
3447
3448
|
: context.store.getFieldValue(from, String(name));
|
|
3448
3449
|
};
|
|
@@ -3464,7 +3465,7 @@ var StoreWriter = (function () {
|
|
|
3464
3465
|
}
|
|
3465
3466
|
});
|
|
3466
3467
|
if (changedFields_1) {
|
|
3467
|
-
incoming = (
|
|
3468
|
+
incoming = (isArray(i_1) ? i_1.slice(0) : tslib.__assign({}, i_1));
|
|
3468
3469
|
changedFields_1.forEach(function (value, name) {
|
|
3469
3470
|
incoming[name] = value;
|
|
3470
3471
|
});
|
|
@@ -3545,8 +3546,8 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
|
|
|
3545
3546
|
return;
|
|
3546
3547
|
warnings.add(typeDotName);
|
|
3547
3548
|
var childTypenames = [];
|
|
3548
|
-
if (!
|
|
3549
|
-
!
|
|
3549
|
+
if (!isArray(existing) &&
|
|
3550
|
+
!isArray(incoming)) {
|
|
3550
3551
|
[existing, incoming].forEach(function (child) {
|
|
3551
3552
|
var typename = store.getFieldValue(child, "__typename");
|
|
3552
3553
|
if (typeof typename === "string" &&
|