@apollo/client 3.8.4 → 3.8.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 +168 -149
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +46 -11
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +46 -11
- package/cache/core/types/common.d.ts +2 -2
- package/cache/core/types/common.d.ts.map +1 -1
- package/cache/core/types/common.js.map +1 -1
- package/cache/inmemory/entityStore.d.ts.map +1 -1
- package/cache/inmemory/entityStore.js +35 -0
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/key-extractor.js +1 -1
- package/cache/inmemory/policies.js +4 -4
- package/cache/inmemory/readFromStore.js +2 -2
- package/cache/inmemory/writeToStore.js +4 -4
- package/core/ApolloClient.js +3 -3
- package/core/LocalState.js +2 -2
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +10 -11
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +0 -2
- package/core/QueryInfo.d.ts.map +1 -1
- package/core/QueryInfo.js +0 -2
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.js +11 -11
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +27 -30
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +27 -30
- package/dev/dev.cjs +124 -100
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +124 -100
- package/dev/loadErrorMessageHandler.js +2 -2
- package/dev/loadErrorMessageHandler.js.map +1 -1
- package/invariantErrorCodes.js +95 -80
- package/link/core/ApolloLink.js +2 -2
- package/link/core/core.cjs +2 -2
- package/link/core/core.cjs.map +1 -1
- package/link/core/core.cjs.native.js +2 -2
- package/link/http/checkFetcher.js +1 -1
- package/link/http/createHttpLink.js +1 -1
- package/link/http/http.cjs +3 -3
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +3 -3
- package/link/http/serializeFetchParameter.js +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/toPromise.js +1 -1
- package/link/utils/utils.cjs +2 -2
- package/link/utils/utils.cjs.map +1 -1
- package/link/utils/utils.cjs.native.js +2 -2
- package/link/utils/validateOperation.js +1 -1
- package/package.json +22 -22
- package/react/cache/QueryReference.d.ts.map +1 -1
- package/react/cache/QueryReference.js +7 -2
- package/react/cache/QueryReference.js.map +1 -1
- package/react/cache/index.d.ts +0 -4
- package/react/cache/index.d.ts.map +1 -1
- package/react/cache/index.js +0 -14
- package/react/cache/index.js.map +1 -1
- 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/context/context.cjs.map +1 -1
- package/react/context/context.cjs.native.js +3 -3
- 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/withApollo.js +1 -1
- package/react/hooks/hooks.cjs +15 -10
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +15 -10
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useQuery.js +1 -1
- package/react/hooks/useReadQuery.js +1 -1
- package/react/hooks/useSubscription.js +2 -2
- package/react/hooks/useSuspenseQuery.js +2 -2
- package/react/hooks/useSyncExternalStore.js +1 -1
- package/react/index.d.ts +0 -1
- package/react/index.d.ts.map +1 -1
- package/react/index.js +0 -1
- package/react/index.js.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/react.cjs +1 -218
- package/react/react.cjs.map +1 -1
- package/react/react.cjs.native.js +1 -218
- package/react/types/types.d.ts +0 -3
- package/react/types/types.d.ts.map +1 -1
- package/react/types/types.js.map +1 -1
- package/testing/core/core.cjs +1 -1
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +1 -1
- package/testing/core/mocking/mockLink.js +1 -1
- package/testing/internal/ObservableStream.d.ts +26 -0
- package/testing/internal/ObservableStream.d.ts.map +1 -0
- package/testing/internal/ObservableStream.js +101 -0
- package/testing/internal/ObservableStream.js.map +1 -0
- package/testing/internal/index.d.ts +1 -0
- package/testing/internal/index.d.ts.map +1 -1
- package/testing/internal/index.js +1 -0
- package/testing/internal/index.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 -1
- package/testing/react/MockedProvider.js.map +1 -1
- package/testing/testing.cjs +2 -1
- package/testing/testing.cjs.map +1 -1
- package/testing/testing.cjs.native.js +2 -1
- package/utilities/globals/globals.cjs +29 -19
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +29 -19
- package/utilities/globals/invariantWrappers.d.ts.map +1 -1
- package/utilities/globals/invariantWrappers.js +28 -18
- package/utilities/globals/invariantWrappers.js.map +1 -1
- package/utilities/graphql/DocumentTransform.js +1 -1
- package/utilities/graphql/directives.js +4 -4
- package/utilities/graphql/fragments.js +3 -3
- package/utilities/graphql/getFromAST.js +8 -8
- package/utilities/graphql/storeUtils.d.ts +5 -0
- 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.js +2 -2
- package/utilities/index.d.ts +1 -1
- package/utilities/index.d.ts.map +1 -1
- package/utilities/index.js.map +1 -1
- package/utilities/observables/asyncMap.d.ts.map +1 -1
- package/utilities/observables/asyncMap.js +17 -34
- package/utilities/observables/asyncMap.js.map +1 -1
- package/utilities/utilities.cjs +36 -53
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +36 -53
- package/version.js +1 -1
package/cache/cache.cjs
CHANGED
|
@@ -370,6 +370,41 @@ exports.EntityStore = (function () {
|
|
|
370
370
|
changedFields_1[storeFieldName] = newValue;
|
|
371
371
|
needToMerge_1 = true;
|
|
372
372
|
fieldValue = newValue;
|
|
373
|
+
if (globalThis.__DEV__ !== false) {
|
|
374
|
+
var checkReference = function (ref) {
|
|
375
|
+
if (_this.lookup(ref.__ref) === undefined) {
|
|
376
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(2, ref);
|
|
377
|
+
return true;
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
if (utilities.isReference(newValue)) {
|
|
381
|
+
checkReference(newValue);
|
|
382
|
+
}
|
|
383
|
+
else if (Array.isArray(newValue)) {
|
|
384
|
+
var seenReference = false;
|
|
385
|
+
var someNonReference = void 0;
|
|
386
|
+
for (var _i = 0, newValue_1 = newValue; _i < newValue_1.length; _i++) {
|
|
387
|
+
var value = newValue_1[_i];
|
|
388
|
+
if (utilities.isReference(value)) {
|
|
389
|
+
seenReference = true;
|
|
390
|
+
if (checkReference(value))
|
|
391
|
+
break;
|
|
392
|
+
}
|
|
393
|
+
else {
|
|
394
|
+
if (typeof value === "object" && !!value) {
|
|
395
|
+
var id = _this.policies.identify(value)[0];
|
|
396
|
+
if (id) {
|
|
397
|
+
someNonReference = value;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
if (seenReference && someNonReference !== undefined) {
|
|
402
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(3, someNonReference);
|
|
403
|
+
break;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
373
408
|
}
|
|
374
409
|
}
|
|
375
410
|
}
|
|
@@ -961,7 +996,7 @@ var StoreReader = (function () {
|
|
|
961
996
|
else {
|
|
962
997
|
var fragment = utilities.getFragmentFromSelection(selection, context.lookupFragment);
|
|
963
998
|
if (!fragment && selection.kind === graphql.Kind.FRAGMENT_SPREAD) {
|
|
964
|
-
throw globals.newInvariantError(
|
|
999
|
+
throw globals.newInvariantError(9, selection.name.value);
|
|
965
1000
|
}
|
|
966
1001
|
if (fragment && policies.fragmentMatches(fragment, typename)) {
|
|
967
1002
|
fragment.selectionSet.selections.forEach(workSet.add, workSet);
|
|
@@ -1045,7 +1080,7 @@ function assertSelectionSetForIdValue(store, field, fieldValue) {
|
|
|
1045
1080
|
if (utilities.isNonNullObject(value)) {
|
|
1046
1081
|
globals.invariant(
|
|
1047
1082
|
!utilities.isReference(value),
|
|
1048
|
-
|
|
1083
|
+
10,
|
|
1049
1084
|
getTypenameFromStoreObject(store, value),
|
|
1050
1085
|
field.name.value
|
|
1051
1086
|
);
|
|
@@ -1137,7 +1172,7 @@ function keyFieldsFnFromSpecifier(specifier) {
|
|
|
1137
1172
|
hasOwn.call(object, schemaKeyPath[0])) {
|
|
1138
1173
|
extracted = extractKeyPath(object, schemaKeyPath, extractKey);
|
|
1139
1174
|
}
|
|
1140
|
-
globals.invariant(extracted !== void 0,
|
|
1175
|
+
globals.invariant(extracted !== void 0, 4, schemaKeyPath.join("."), object);
|
|
1141
1176
|
return extracted;
|
|
1142
1177
|
}));
|
|
1143
1178
|
return "".concat(context.typename, ":").concat(JSON.stringify(keyObject));
|
|
@@ -1392,7 +1427,7 @@ var Policies = (function () {
|
|
|
1392
1427
|
var rootId = "ROOT_" + which.toUpperCase();
|
|
1393
1428
|
var old = this.rootTypenamesById[rootId];
|
|
1394
1429
|
if (typename !== old) {
|
|
1395
|
-
globals.invariant(!old || old === which,
|
|
1430
|
+
globals.invariant(!old || old === which, 5, which);
|
|
1396
1431
|
if (old)
|
|
1397
1432
|
delete this.rootIdsByTypename[old];
|
|
1398
1433
|
this.rootIdsByTypename[typename] = rootId;
|
|
@@ -1489,7 +1524,7 @@ var Policies = (function () {
|
|
|
1489
1524
|
if (supertypeSet.has(supertype)) {
|
|
1490
1525
|
if (!typenameSupertypeSet.has(supertype)) {
|
|
1491
1526
|
if (checkingFuzzySubtypes) {
|
|
1492
|
-
globalThis.__DEV__ !== false && globals.invariant.warn(
|
|
1527
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(6, typename, supertype);
|
|
1493
1528
|
}
|
|
1494
1529
|
typenameSupertypeSet.add(supertype);
|
|
1495
1530
|
}
|
|
@@ -1651,7 +1686,7 @@ function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables)
|
|
|
1651
1686
|
}
|
|
1652
1687
|
}
|
|
1653
1688
|
if (globalThis.__DEV__ !== false && options.from === void 0) {
|
|
1654
|
-
globalThis.__DEV__ !== false && globals.invariant.warn(
|
|
1689
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(7, utilities.stringifyForDisplay(Array.from(readFieldArgs)));
|
|
1655
1690
|
}
|
|
1656
1691
|
if (void 0 === options.variables) {
|
|
1657
1692
|
options.variables = variables;
|
|
@@ -1661,7 +1696,7 @@ function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables)
|
|
|
1661
1696
|
function makeMergeObjectsFunction(store) {
|
|
1662
1697
|
return function mergeObjects(existing, incoming) {
|
|
1663
1698
|
if (utilities.isArray(existing) || utilities.isArray(incoming)) {
|
|
1664
|
-
throw globals.newInvariantError(
|
|
1699
|
+
throw globals.newInvariantError(8);
|
|
1665
1700
|
}
|
|
1666
1701
|
if (utilities.isNonNullObject(existing) && utilities.isNonNullObject(incoming)) {
|
|
1667
1702
|
var eType = store.getFieldValue(existing, "__typename");
|
|
@@ -1721,7 +1756,7 @@ var StoreWriter = (function () {
|
|
|
1721
1756
|
context: context,
|
|
1722
1757
|
});
|
|
1723
1758
|
if (!utilities.isReference(ref)) {
|
|
1724
|
-
throw globals.newInvariantError(
|
|
1759
|
+
throw globals.newInvariantError(11, result);
|
|
1725
1760
|
}
|
|
1726
1761
|
context.incomingById.forEach(function (_a, dataId) {
|
|
1727
1762
|
var storeObject = _a.storeObject, mergeTree = _a.mergeTree, fieldNodeSet = _a.fieldNodeSet;
|
|
@@ -1826,7 +1861,7 @@ var StoreWriter = (function () {
|
|
|
1826
1861
|
!context.deferred &&
|
|
1827
1862
|
!utilities.addTypenameToDocument.added(field) &&
|
|
1828
1863
|
!policies.getReadFunction(typename, field.name.value)) {
|
|
1829
|
-
globalThis.__DEV__ !== false && globals.invariant.error(
|
|
1864
|
+
globalThis.__DEV__ !== false && globals.invariant.error(12, utilities.resultKeyNameFromField(field), result);
|
|
1830
1865
|
}
|
|
1831
1866
|
});
|
|
1832
1867
|
try {
|
|
@@ -1931,7 +1966,7 @@ var StoreWriter = (function () {
|
|
|
1931
1966
|
else {
|
|
1932
1967
|
var fragment = utilities.getFragmentFromSelection(selection, context.lookupFragment);
|
|
1933
1968
|
if (!fragment && selection.kind === graphql.Kind.FRAGMENT_SPREAD) {
|
|
1934
|
-
throw globals.newInvariantError(
|
|
1969
|
+
throw globals.newInvariantError(13, selection.name.value);
|
|
1935
1970
|
}
|
|
1936
1971
|
if (fragment &&
|
|
1937
1972
|
policies.fragmentMatches(fragment, typename, result, context.variables)) {
|
|
@@ -2073,7 +2108,7 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
|
|
|
2073
2108
|
}
|
|
2074
2109
|
});
|
|
2075
2110
|
}
|
|
2076
|
-
globalThis.__DEV__ !== false && globals.invariant.warn(
|
|
2111
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(14, fieldName, parentType, childTypenames.length
|
|
2077
2112
|
? "either ensure all objects of type " +
|
|
2078
2113
|
childTypenames.join(" and ") +
|
|
2079
2114
|
" have an ID or a custom merge function, or "
|