@apollo/client 3.2.1 → 3.2.5
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.js +18 -13
- package/apollo-client.cjs.js.map +1 -1
- package/apollo-client.cjs.min.js +1 -1
- package/cache/cache.cjs.js +2 -0
- package/cache/cache.cjs.js.map +1 -1
- package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
- package/cache/inmemory/inMemoryCache.js +2 -0
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/policies.d.ts +1 -1
- package/core/LocalState.d.ts.map +1 -1
- package/core/LocalState.js +1 -1
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.d.ts +1 -0
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +3 -0
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts.map +1 -1
- package/core/QueryInfo.js +1 -0
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.js +1 -1
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs.js +8 -4
- package/core/core.cjs.js.map +1 -1
- package/invariantErrorCodes.js +1 -1
- package/link/core/types.d.ts +1 -2
- package/link/core/types.d.ts.map +1 -1
- package/link/core/types.js.map +1 -1
- package/link/http/http.cjs.js +2 -2
- package/link/http/http.cjs.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.js +1 -1
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/link/persisted-queries/index.js +1 -1
- package/link/persisted-queries/index.js.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.js +2 -2
- package/link/persisted-queries/persisted-queries.cjs.js.map +1 -1
- package/link/schema/index.d.ts +1 -1
- package/link/schema/index.d.ts.map +1 -1
- package/link/schema/index.js +1 -1
- package/link/schema/index.js.map +1 -1
- package/link/schema/schema.cjs.js +2 -2
- package/link/schema/schema.cjs.js.map +1 -1
- package/package.json +14 -14
- package/testing/testing.cjs.js +3 -3
- package/testing/testing.cjs.js.map +1 -1
- package/utilities/graphql/directives.d.ts.map +1 -1
- package/utilities/graphql/directives.js +1 -1
- package/utilities/graphql/directives.js.map +1 -1
- package/utilities/graphql/transform.d.ts.map +1 -1
- package/utilities/graphql/transform.js +1 -1
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/policies/pagination.d.ts +3 -5
- package/utilities/policies/pagination.d.ts.map +1 -1
- package/utilities/policies/pagination.js +37 -31
- package/utilities/policies/pagination.js.map +1 -1
- package/utilities/testing/mocking/mockLink.js +1 -1
- package/utilities/testing/mocking/mockLink.js.map +1 -1
- package/utilities/utilities.cjs.js +45 -39
- package/utilities/utilities.cjs.js.map +1 -1
package/apollo-client.cjs.js
CHANGED
|
@@ -6,11 +6,10 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
|
|
|
6
6
|
|
|
7
7
|
var tslib = require('tslib');
|
|
8
8
|
var tsInvariant = require('ts-invariant');
|
|
9
|
-
var
|
|
9
|
+
var graphql = require('graphql');
|
|
10
10
|
var stringify = _interopDefault(require('fast-json-stable-stringify'));
|
|
11
11
|
var Observable = _interopDefault(require('zen-observable'));
|
|
12
12
|
require('symbol-observable');
|
|
13
|
-
var printer = require('graphql/language/printer');
|
|
14
13
|
var equality = require('@wry/equality');
|
|
15
14
|
var optimism = require('optimism');
|
|
16
15
|
var context = require('@wry/context');
|
|
@@ -38,7 +37,7 @@ function shouldInclude(_a, variables) {
|
|
|
38
37
|
}
|
|
39
38
|
function getDirectiveNames(root) {
|
|
40
39
|
var names = [];
|
|
41
|
-
|
|
40
|
+
graphql.visit(root, {
|
|
42
41
|
Directive: function (node) {
|
|
43
42
|
names.push(node.name.value);
|
|
44
43
|
},
|
|
@@ -434,7 +433,7 @@ function removeDirectivesFromDocument(directives, doc) {
|
|
|
434
433
|
var variablesToRemove = [];
|
|
435
434
|
var fragmentSpreadsInUse = Object.create(null);
|
|
436
435
|
var fragmentSpreadsToRemove = [];
|
|
437
|
-
var modifiedDoc = nullIfDocIsEmpty(
|
|
436
|
+
var modifiedDoc = nullIfDocIsEmpty(graphql.visit(doc, {
|
|
438
437
|
Variable: {
|
|
439
438
|
enter: function (node, _key, parent) {
|
|
440
439
|
if (parent.kind !== 'VariableDefinition') {
|
|
@@ -495,7 +494,7 @@ function removeDirectivesFromDocument(directives, doc) {
|
|
|
495
494
|
return modifiedDoc;
|
|
496
495
|
}
|
|
497
496
|
function addTypenameToDocument(doc) {
|
|
498
|
-
return
|
|
497
|
+
return graphql.visit(checkDocument(doc), {
|
|
499
498
|
SelectionSet: {
|
|
500
499
|
enter: function (node, _key, parent) {
|
|
501
500
|
if (parent &&
|
|
@@ -557,7 +556,7 @@ function getArgumentMatcher(config) {
|
|
|
557
556
|
}
|
|
558
557
|
function removeArgumentsFromDocument(config, doc) {
|
|
559
558
|
var argMatcher = getArgumentMatcher(config);
|
|
560
|
-
return nullIfDocIsEmpty(
|
|
559
|
+
return nullIfDocIsEmpty(graphql.visit(doc, {
|
|
561
560
|
OperationDefinition: {
|
|
562
561
|
enter: function (node) {
|
|
563
562
|
return tslib.__assign(tslib.__assign({}, node), { variableDefinitions: node.variableDefinitions ? node.variableDefinitions.filter(function (varDef) {
|
|
@@ -598,7 +597,7 @@ function removeFragmentSpreadFromDocument(config, doc) {
|
|
|
598
597
|
return null;
|
|
599
598
|
}
|
|
600
599
|
}
|
|
601
|
-
return nullIfDocIsEmpty(
|
|
600
|
+
return nullIfDocIsEmpty(graphql.visit(doc, {
|
|
602
601
|
FragmentSpread: { enter: enter },
|
|
603
602
|
FragmentDefinition: { enter: enter },
|
|
604
603
|
}));
|
|
@@ -622,7 +621,7 @@ function buildQueryFromSelectionSet(document) {
|
|
|
622
621
|
if (definitionOperation === 'query') {
|
|
623
622
|
return document;
|
|
624
623
|
}
|
|
625
|
-
var modifiedDoc =
|
|
624
|
+
var modifiedDoc = graphql.visit(document, {
|
|
626
625
|
OperationDefinition: {
|
|
627
626
|
enter: function (node) {
|
|
628
627
|
return tslib.__assign(tslib.__assign({}, node), { operation: 'query' });
|
|
@@ -640,7 +639,7 @@ function removeClientSetsFromDocument(document) {
|
|
|
640
639
|
},
|
|
641
640
|
], document);
|
|
642
641
|
if (modifiedDoc) {
|
|
643
|
-
modifiedDoc =
|
|
642
|
+
modifiedDoc = graphql.visit(modifiedDoc, {
|
|
644
643
|
FragmentDefinition: {
|
|
645
644
|
enter: function (node) {
|
|
646
645
|
if (node.selectionSet) {
|
|
@@ -1291,7 +1290,7 @@ var selectHttpOptionsAndBody = function (operation, fallbackConfig) {
|
|
|
1291
1290
|
if (http.includeExtensions)
|
|
1292
1291
|
body.extensions = extensions;
|
|
1293
1292
|
if (http.includeQuery)
|
|
1294
|
-
body.query =
|
|
1293
|
+
body.query = graphql.print(query);
|
|
1295
1294
|
return {
|
|
1296
1295
|
options: options,
|
|
1297
1296
|
body: body,
|
|
@@ -1952,6 +1951,9 @@ var ObservableQuery = (function (_super) {
|
|
|
1952
1951
|
ObservableQuery.prototype.observe = function () {
|
|
1953
1952
|
this.observer.next(this.getCurrentResult(false));
|
|
1954
1953
|
};
|
|
1954
|
+
ObservableQuery.prototype.hasObservers = function () {
|
|
1955
|
+
return this.observers.size > 0;
|
|
1956
|
+
};
|
|
1955
1957
|
ObservableQuery.prototype.tearDownQuery = function () {
|
|
1956
1958
|
var queryManager = this.queryManager;
|
|
1957
1959
|
if (this.reobserver) {
|
|
@@ -3468,6 +3470,8 @@ var InMemoryCache = (function (_super) {
|
|
|
3468
3470
|
}
|
|
3469
3471
|
return function () {
|
|
3470
3472
|
_this.watches.delete(watch);
|
|
3473
|
+
_this.watchDep.dirty(watch);
|
|
3474
|
+
_this.maybeBroadcastWatch.forget(watch);
|
|
3471
3475
|
};
|
|
3472
3476
|
};
|
|
3473
3477
|
InMemoryCache.prototype.gc = function () {
|
|
@@ -3659,7 +3663,7 @@ var LocalState = (function () {
|
|
|
3659
3663
|
};
|
|
3660
3664
|
LocalState.prototype.shouldForceResolvers = function (document) {
|
|
3661
3665
|
var forceResolvers = false;
|
|
3662
|
-
|
|
3666
|
+
graphql.visit(document, {
|
|
3663
3667
|
Directive: {
|
|
3664
3668
|
enter: function (node) {
|
|
3665
3669
|
if (node.name.value === 'client' && node.arguments) {
|
|
@@ -3669,7 +3673,7 @@ var LocalState = (function () {
|
|
|
3669
3673
|
arg.value.value === true;
|
|
3670
3674
|
});
|
|
3671
3675
|
if (forceResolvers) {
|
|
3672
|
-
return
|
|
3676
|
+
return graphql.BREAK;
|
|
3673
3677
|
}
|
|
3674
3678
|
}
|
|
3675
3679
|
},
|
|
@@ -3864,6 +3868,7 @@ var QueryInfo = (function () {
|
|
|
3864
3868
|
destructiveMethodCounts.set(cache, 0);
|
|
3865
3869
|
wrapDestructiveCacheMethod(cache, "evict");
|
|
3866
3870
|
wrapDestructiveCacheMethod(cache, "modify");
|
|
3871
|
+
wrapDestructiveCacheMethod(cache, "reset");
|
|
3867
3872
|
}
|
|
3868
3873
|
}
|
|
3869
3874
|
QueryInfo.prototype.init = function (query) {
|
|
@@ -4388,7 +4393,7 @@ var QueryManager = (function () {
|
|
|
4388
4393
|
var observableQueryPromises = [];
|
|
4389
4394
|
this.queries.forEach(function (_a, queryId) {
|
|
4390
4395
|
var observableQuery = _a.observableQuery;
|
|
4391
|
-
if (observableQuery) {
|
|
4396
|
+
if (observableQuery && observableQuery.hasObservers()) {
|
|
4392
4397
|
var fetchPolicy = observableQuery.options.fetchPolicy;
|
|
4393
4398
|
observableQuery.resetLastResults();
|
|
4394
4399
|
if (fetchPolicy !== 'cache-only' &&
|