@apollo/client 3.11.2 → 3.11.4
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/CHANGELOG.md +33 -0
- package/apollo-client.cjs +109 -87
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/core/types/common.d.ts +5 -3
- package/cache/core/types/common.js.map +1 -1
- package/cache/inmemory/entityStore.js.map +1 -1
- package/core/ObservableQuery.d.ts +1 -1
- package/core/ObservableQuery.js +79 -43
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryManager.js +19 -11
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +65 -43
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +65 -43
- package/dev/dev.cjs +72 -67
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +72 -67
- package/invariantErrorCodes.js +72 -66
- 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 +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 +9 -9
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +9 -9
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useLoadableQuery.js +2 -2
- package/react/hooks/useSubscription.js +3 -3
- package/react/hooks/useSuspenseQuery.js +2 -2
- package/react/hooks/useSyncExternalStore.js +1 -1
- package/react/internal/cache/QueryReference.js +1 -1
- package/react/internal/internal.cjs +2 -2
- package/react/internal/internal.cjs.map +1 -1
- package/react/internal/internal.cjs.native.js +2 -2
- 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/testing/core/core.cjs +2 -2
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +2 -2
- package/testing/core/mocking/mockLink.js +2 -2
- package/testing/internal/scenarios/index.d.ts +5 -0
- package/testing/internal/scenarios/index.js +1 -1
- package/testing/internal/scenarios/index.js.map +1 -1
- package/utilities/globals/globals.cjs +1 -1
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +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.js +1 -1
- package/utilities/graphql/transform.js +2 -2
- package/utilities/observables/Concast.js +1 -1
- package/utilities/observables/Concast.js.map +1 -1
- package/utilities/utilities.cjs +20 -20
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +20 -20
- package/version.js +1 -1
package/utilities/utilities.cjs
CHANGED
|
@@ -22,7 +22,7 @@ function shouldInclude(_a, variables) {
|
|
|
22
22
|
if (ifArgument.value.kind === "Variable") {
|
|
23
23
|
evaledValue =
|
|
24
24
|
variables && variables[ifArgument.value.name.value];
|
|
25
|
-
globals.invariant(evaledValue !== void 0,
|
|
25
|
+
globals.invariant(evaledValue !== void 0, 70, directive.name.value);
|
|
26
26
|
}
|
|
27
27
|
else {
|
|
28
28
|
evaledValue = ifArgument.value.value;
|
|
@@ -72,12 +72,12 @@ function getInclusionDirectives(directives) {
|
|
|
72
72
|
return;
|
|
73
73
|
var directiveArguments = directive.arguments;
|
|
74
74
|
var directiveName = directive.name.value;
|
|
75
|
-
globals.invariant(directiveArguments && directiveArguments.length === 1,
|
|
75
|
+
globals.invariant(directiveArguments && directiveArguments.length === 1, 71, directiveName);
|
|
76
76
|
var ifArgument = directiveArguments[0];
|
|
77
|
-
globals.invariant(ifArgument.name && ifArgument.name.value === "if",
|
|
77
|
+
globals.invariant(ifArgument.name && ifArgument.name.value === "if", 72, directiveName);
|
|
78
78
|
var ifValue = ifArgument.value;
|
|
79
79
|
globals.invariant(ifValue &&
|
|
80
|
-
(ifValue.kind === "Variable" || ifValue.kind === "BooleanValue"),
|
|
80
|
+
(ifValue.kind === "Variable" || ifValue.kind === "BooleanValue"), 73, directiveName);
|
|
81
81
|
result.push({ directive: directive, ifArgument: ifArgument });
|
|
82
82
|
});
|
|
83
83
|
}
|
|
@@ -111,7 +111,7 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
111
111
|
document.definitions.forEach(function (definition) {
|
|
112
112
|
if (definition.kind === "OperationDefinition") {
|
|
113
113
|
throw globals.newInvariantError(
|
|
114
|
-
|
|
114
|
+
74,
|
|
115
115
|
definition.operation,
|
|
116
116
|
definition.name ? " named '".concat(definition.name.value, "'") : ""
|
|
117
117
|
);
|
|
@@ -121,7 +121,7 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
121
121
|
}
|
|
122
122
|
});
|
|
123
123
|
if (typeof actualFragmentName === "undefined") {
|
|
124
|
-
globals.invariant(fragments.length === 1,
|
|
124
|
+
globals.invariant(fragments.length === 1, 75, fragments.length);
|
|
125
125
|
actualFragmentName = fragments[0].name.value;
|
|
126
126
|
}
|
|
127
127
|
var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
|
|
@@ -162,7 +162,7 @@ function getFragmentFromSelection(selection, fragmentMap) {
|
|
|
162
162
|
return fragmentMap(fragmentName);
|
|
163
163
|
}
|
|
164
164
|
var fragment = fragmentMap && fragmentMap[fragmentName];
|
|
165
|
-
globals.invariant(fragment,
|
|
165
|
+
globals.invariant(fragment, 76, fragmentName);
|
|
166
166
|
return fragment || null;
|
|
167
167
|
}
|
|
168
168
|
default:
|
|
@@ -321,7 +321,7 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
|
|
|
321
321
|
argObj[name.value] = null;
|
|
322
322
|
}
|
|
323
323
|
else {
|
|
324
|
-
throw globals.newInvariantError(
|
|
324
|
+
throw globals.newInvariantError(85, name.value, value.kind);
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
327
|
function storeKeyNameFromField(field, variables) {
|
|
@@ -455,16 +455,16 @@ function isInlineFragment(selection) {
|
|
|
455
455
|
}
|
|
456
456
|
|
|
457
457
|
function checkDocument(doc) {
|
|
458
|
-
globals.invariant(doc && doc.kind === "Document",
|
|
458
|
+
globals.invariant(doc && doc.kind === "Document", 77);
|
|
459
459
|
var operations = doc.definitions
|
|
460
460
|
.filter(function (d) { return d.kind !== "FragmentDefinition"; })
|
|
461
461
|
.map(function (definition) {
|
|
462
462
|
if (definition.kind !== "OperationDefinition") {
|
|
463
|
-
throw globals.newInvariantError(
|
|
463
|
+
throw globals.newInvariantError(78, definition.kind);
|
|
464
464
|
}
|
|
465
465
|
return definition;
|
|
466
466
|
});
|
|
467
|
-
globals.invariant(operations.length <= 1,
|
|
467
|
+
globals.invariant(operations.length <= 1, 79, operations.length);
|
|
468
468
|
return doc;
|
|
469
469
|
}
|
|
470
470
|
function getOperationDefinition(doc) {
|
|
@@ -487,14 +487,14 @@ function getFragmentDefinitions(doc) {
|
|
|
487
487
|
}
|
|
488
488
|
function getQueryDefinition(doc) {
|
|
489
489
|
var queryDef = getOperationDefinition(doc);
|
|
490
|
-
globals.invariant(queryDef && queryDef.operation === "query",
|
|
490
|
+
globals.invariant(queryDef && queryDef.operation === "query", 80);
|
|
491
491
|
return queryDef;
|
|
492
492
|
}
|
|
493
493
|
function getFragmentDefinition(doc) {
|
|
494
|
-
globals.invariant(doc.kind === "Document",
|
|
495
|
-
globals.invariant(doc.definitions.length <= 1,
|
|
494
|
+
globals.invariant(doc.kind === "Document", 81);
|
|
495
|
+
globals.invariant(doc.definitions.length <= 1, 82);
|
|
496
496
|
var fragmentDef = doc.definitions[0];
|
|
497
|
-
globals.invariant(fragmentDef.kind === "FragmentDefinition",
|
|
497
|
+
globals.invariant(fragmentDef.kind === "FragmentDefinition", 83);
|
|
498
498
|
return fragmentDef;
|
|
499
499
|
}
|
|
500
500
|
function getMainDefinition(queryDoc) {
|
|
@@ -517,7 +517,7 @@ function getMainDefinition(queryDoc) {
|
|
|
517
517
|
if (fragmentDefinition) {
|
|
518
518
|
return fragmentDefinition;
|
|
519
519
|
}
|
|
520
|
-
throw globals.newInvariantError(
|
|
520
|
+
throw globals.newInvariantError(84);
|
|
521
521
|
}
|
|
522
522
|
function getDefaultValues(definition) {
|
|
523
523
|
var defaultValues = Object.create(null);
|
|
@@ -568,7 +568,7 @@ var DocumentTransform = (function () {
|
|
|
568
568
|
makeCacheKey: function (document) {
|
|
569
569
|
var cacheKeys = _this.getCacheKey(document);
|
|
570
570
|
if (cacheKeys) {
|
|
571
|
-
globals.invariant(Array.isArray(cacheKeys),
|
|
571
|
+
globals.invariant(Array.isArray(cacheKeys), 69);
|
|
572
572
|
return stableCacheKeys_1.lookupArray(cacheKeys);
|
|
573
573
|
}
|
|
574
574
|
},
|
|
@@ -698,7 +698,7 @@ function removeDirectivesFromDocument(directives, doc) {
|
|
|
698
698
|
return getInUseByFragmentName(ancestor.name.value);
|
|
699
699
|
}
|
|
700
700
|
}
|
|
701
|
-
globalThis.__DEV__ !== false && globals.invariant.error(
|
|
701
|
+
globalThis.__DEV__ !== false && globals.invariant.error(86);
|
|
702
702
|
return null;
|
|
703
703
|
};
|
|
704
704
|
var operationCount = 0;
|
|
@@ -888,7 +888,7 @@ var connectionRemoveConfig = {
|
|
|
888
888
|
if (willRemove) {
|
|
889
889
|
if (!directive.arguments ||
|
|
890
890
|
!directive.arguments.some(function (arg) { return arg.name.value === "key"; })) {
|
|
891
|
-
globalThis.__DEV__ !== false && globals.invariant.warn(
|
|
891
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(87);
|
|
892
892
|
}
|
|
893
893
|
}
|
|
894
894
|
return willRemove;
|
|
@@ -1447,7 +1447,7 @@ var Concast = (function (_super) {
|
|
|
1447
1447
|
_this.cancel = function (reason) {
|
|
1448
1448
|
_this.reject(reason);
|
|
1449
1449
|
_this.sources = [];
|
|
1450
|
-
_this.handlers.
|
|
1450
|
+
_this.handlers.error(reason);
|
|
1451
1451
|
};
|
|
1452
1452
|
_this.promise.catch(function (_) { });
|
|
1453
1453
|
if (typeof sources === "function") {
|