@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/README.md
CHANGED
|
@@ -37,7 +37,7 @@ Learn how to use Apollo Client with self-paced hands-on training on Odyssey, Apo
|
|
|
37
37
|
|
|
38
38
|
- [Apollo Studio](https://www.apollographql.com/studio/develop/) – A free, end-to-end platform for managing your GraphQL lifecycle. Track your GraphQL schemas in a hosted registry to create a source of truth for everything in your graph. Studio provides an IDE (Apollo Explorer) so you can explore data, collaborate on queries, observe usage, and safely make schema changes.
|
|
39
39
|
- [Apollo Federation](https://www.apollographql.com/apollo-federation) – The industry-standard open architecture for building a distributed graph. Use Apollo’s gateway to compose a unified graph from multiple subgraphs, determine a query plan, and route requests across your services.
|
|
40
|
-
- [Apollo Client](https://www.apollographql.com/apollo-client/) – The most popular GraphQL client for the web. Apollo also builds and maintains [Apollo iOS](https://github.com/apollographql/apollo-ios) and [Apollo
|
|
40
|
+
- [Apollo Client](https://www.apollographql.com/apollo-client/) – The most popular GraphQL client for the web. Apollo also builds and maintains [Apollo iOS](https://github.com/apollographql/apollo-ios) and [Apollo Kotlin](https://github.com/apollographql/apollo-kotlin).
|
|
41
41
|
- [Apollo Server](https://www.apollographql.com/docs/apollo-server/) – A production-ready JavaScript GraphQL server that connects to any microservice, API, or database. Compatible with all popular JavaScript frameworks and deployable in serverless environments.
|
|
42
42
|
|
|
43
43
|
## Learn how to build with Apollo
|
package/apollo-client.cjs
CHANGED
|
@@ -380,17 +380,21 @@ function checkDocument(doc) {
|
|
|
380
380
|
}
|
|
381
381
|
function getOperationDefinition(doc) {
|
|
382
382
|
checkDocument(doc);
|
|
383
|
-
return doc.definitions.filter(function (definition) {
|
|
383
|
+
return doc.definitions.filter(function (definition) {
|
|
384
|
+
return definition.kind === 'OperationDefinition';
|
|
385
|
+
})[0];
|
|
384
386
|
}
|
|
385
387
|
function getOperationName(doc) {
|
|
386
388
|
return (doc.definitions
|
|
387
389
|
.filter(function (definition) {
|
|
388
|
-
return definition.kind === 'OperationDefinition' && definition.name;
|
|
390
|
+
return definition.kind === 'OperationDefinition' && !!definition.name;
|
|
389
391
|
})
|
|
390
392
|
.map(function (x) { return x.name.value; })[0] || null);
|
|
391
393
|
}
|
|
392
394
|
function getFragmentDefinitions(doc) {
|
|
393
|
-
return doc.definitions.filter(function (definition) {
|
|
395
|
+
return doc.definitions.filter(function (definition) {
|
|
396
|
+
return definition.kind === 'FragmentDefinition';
|
|
397
|
+
});
|
|
394
398
|
}
|
|
395
399
|
function getQueryDefinition(doc) {
|
|
396
400
|
var queryDef = getOperationDefinition(doc);
|
|
@@ -439,26 +443,20 @@ function getDefaultValues(definition) {
|
|
|
439
443
|
return defaultValues;
|
|
440
444
|
}
|
|
441
445
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
if (test.call(this, elem, i, array)) {
|
|
446
|
-
array[target++] = elem;
|
|
447
|
-
}
|
|
448
|
-
}, context);
|
|
449
|
-
array.length = target;
|
|
450
|
-
return array;
|
|
446
|
+
var isArray = Array.isArray;
|
|
447
|
+
function isNonEmptyArray(value) {
|
|
448
|
+
return Array.isArray(value) && value.length > 0;
|
|
451
449
|
}
|
|
452
450
|
|
|
453
451
|
var TYPENAME_FIELD = {
|
|
454
|
-
kind:
|
|
452
|
+
kind: graphql.Kind.FIELD,
|
|
455
453
|
name: {
|
|
456
|
-
kind:
|
|
454
|
+
kind: graphql.Kind.NAME,
|
|
457
455
|
value: '__typename',
|
|
458
456
|
},
|
|
459
457
|
};
|
|
460
458
|
function isEmpty(op, fragmentMap) {
|
|
461
|
-
return !op || op.selectionSet.selections.every(function (selection) { return selection.kind ===
|
|
459
|
+
return !op || op.selectionSet.selections.every(function (selection) { return selection.kind === graphql.Kind.FRAGMENT_SPREAD &&
|
|
462
460
|
isEmpty(fragmentMap[selection.name.value], fragmentMap); });
|
|
463
461
|
}
|
|
464
462
|
function nullIfDocIsEmpty(doc) {
|
|
@@ -467,84 +465,190 @@ function nullIfDocIsEmpty(doc) {
|
|
|
467
465
|
: doc;
|
|
468
466
|
}
|
|
469
467
|
function getDirectiveMatcher(directives) {
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
468
|
+
var nameSet = new Set();
|
|
469
|
+
var tests = [];
|
|
470
|
+
directives.forEach(function (directive) {
|
|
471
|
+
if (directive.name) {
|
|
472
|
+
nameSet.add(directive.name);
|
|
473
|
+
}
|
|
474
|
+
else if (directive.test) {
|
|
475
|
+
tests.push(directive.test);
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
return function (directive) { return (nameSet.has(directive.name.value) ||
|
|
479
|
+
tests.some(function (test) { return test(directive); })); };
|
|
480
|
+
}
|
|
481
|
+
function makeInUseGetterFunction(defaultKey) {
|
|
482
|
+
var map = new Map();
|
|
483
|
+
return function inUseGetterFunction(key) {
|
|
484
|
+
if (key === void 0) { key = defaultKey; }
|
|
485
|
+
var inUse = map.get(key);
|
|
486
|
+
if (!inUse) {
|
|
487
|
+
map.set(key, inUse = {
|
|
488
|
+
variables: new Set,
|
|
489
|
+
fragmentSpreads: new Set,
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
return inUse;
|
|
475
493
|
};
|
|
476
494
|
}
|
|
477
495
|
function removeDirectivesFromDocument(directives, doc) {
|
|
478
|
-
var
|
|
479
|
-
var
|
|
480
|
-
var
|
|
481
|
-
|
|
482
|
-
|
|
496
|
+
var getInUseByOperationName = makeInUseGetterFunction("");
|
|
497
|
+
var getInUseByFragmentName = makeInUseGetterFunction("");
|
|
498
|
+
var getInUse = function (ancestors) {
|
|
499
|
+
for (var p = 0, ancestor = void 0; p < ancestors.length && (ancestor = ancestors[p]); ++p) {
|
|
500
|
+
if (isArray(ancestor))
|
|
501
|
+
continue;
|
|
502
|
+
if (ancestor.kind === graphql.Kind.OPERATION_DEFINITION) {
|
|
503
|
+
return getInUseByOperationName(ancestor.name && ancestor.name.value);
|
|
504
|
+
}
|
|
505
|
+
if (ancestor.kind === graphql.Kind.FRAGMENT_DEFINITION) {
|
|
506
|
+
return getInUseByFragmentName(ancestor.name.value);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
__DEV__ && tsInvariant.invariant.error("Could not find operation or fragment");
|
|
510
|
+
return null;
|
|
511
|
+
};
|
|
512
|
+
var operationCount = 0;
|
|
513
|
+
for (var i = doc.definitions.length - 1; i >= 0; --i) {
|
|
514
|
+
if (doc.definitions[i].kind === graphql.Kind.OPERATION_DEFINITION) {
|
|
515
|
+
++operationCount;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
var directiveMatcher = getDirectiveMatcher(directives);
|
|
519
|
+
var hasRemoveDirective = directives.some(function (directive) { return directive.remove; });
|
|
520
|
+
var shouldRemoveField = function (nodeDirectives) { return (hasRemoveDirective &&
|
|
521
|
+
nodeDirectives &&
|
|
522
|
+
nodeDirectives.some(directiveMatcher)); };
|
|
523
|
+
var originalFragmentDefsByPath = new Map();
|
|
524
|
+
var firstVisitMadeChanges = false;
|
|
525
|
+
var fieldOrInlineFragmentVisitor = {
|
|
526
|
+
enter: function (node) {
|
|
527
|
+
if (shouldRemoveField(node.directives)) {
|
|
528
|
+
firstVisitMadeChanges = true;
|
|
529
|
+
return null;
|
|
530
|
+
}
|
|
531
|
+
},
|
|
532
|
+
};
|
|
533
|
+
var docWithoutDirectiveSubtrees = graphql.visit(doc, {
|
|
534
|
+
Field: fieldOrInlineFragmentVisitor,
|
|
535
|
+
InlineFragment: fieldOrInlineFragmentVisitor,
|
|
536
|
+
VariableDefinition: {
|
|
537
|
+
enter: function () {
|
|
538
|
+
return false;
|
|
539
|
+
},
|
|
540
|
+
},
|
|
483
541
|
Variable: {
|
|
484
|
-
enter: function (node, _key,
|
|
485
|
-
|
|
486
|
-
|
|
542
|
+
enter: function (node, _key, _parent, _path, ancestors) {
|
|
543
|
+
var inUse = getInUse(ancestors);
|
|
544
|
+
if (inUse) {
|
|
545
|
+
inUse.variables.add(node.name.value);
|
|
487
546
|
}
|
|
488
547
|
},
|
|
489
548
|
},
|
|
490
|
-
|
|
491
|
-
enter: function (node) {
|
|
492
|
-
if (
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
if (arg.value.kind === 'Variable') {
|
|
500
|
-
variablesToRemove.push({
|
|
501
|
-
name: arg.value.name.value,
|
|
502
|
-
});
|
|
503
|
-
}
|
|
504
|
-
});
|
|
505
|
-
}
|
|
506
|
-
if (node.selectionSet) {
|
|
507
|
-
getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(function (frag) {
|
|
508
|
-
fragmentSpreadsToRemove.push({
|
|
509
|
-
name: frag.name.value,
|
|
510
|
-
});
|
|
511
|
-
});
|
|
512
|
-
}
|
|
513
|
-
return null;
|
|
514
|
-
}
|
|
549
|
+
FragmentSpread: {
|
|
550
|
+
enter: function (node, _key, _parent, _path, ancestors) {
|
|
551
|
+
if (shouldRemoveField(node.directives)) {
|
|
552
|
+
firstVisitMadeChanges = true;
|
|
553
|
+
return null;
|
|
554
|
+
}
|
|
555
|
+
var inUse = getInUse(ancestors);
|
|
556
|
+
if (inUse) {
|
|
557
|
+
inUse.fragmentSpreads.add(node.name.value);
|
|
515
558
|
}
|
|
516
559
|
},
|
|
517
560
|
},
|
|
518
|
-
|
|
519
|
-
enter: function (node) {
|
|
520
|
-
|
|
561
|
+
FragmentDefinition: {
|
|
562
|
+
enter: function (node, _key, _parent, path) {
|
|
563
|
+
originalFragmentDefsByPath.set(JSON.stringify(path), node);
|
|
564
|
+
},
|
|
565
|
+
leave: function (node, _key, _parent, path) {
|
|
566
|
+
var originalNode = originalFragmentDefsByPath.get(JSON.stringify(path));
|
|
567
|
+
if (node === originalNode) {
|
|
568
|
+
return node;
|
|
569
|
+
}
|
|
570
|
+
if (operationCount > 0 &&
|
|
571
|
+
node.selectionSet.selections.every(function (selection) { return (selection.kind === graphql.Kind.FIELD &&
|
|
572
|
+
selection.name.value === '__typename'); })) {
|
|
573
|
+
getInUseByFragmentName(node.name.value).removed = true;
|
|
574
|
+
firstVisitMadeChanges = true;
|
|
575
|
+
return null;
|
|
576
|
+
}
|
|
521
577
|
},
|
|
522
578
|
},
|
|
523
579
|
Directive: {
|
|
524
|
-
|
|
525
|
-
if (
|
|
580
|
+
leave: function (node) {
|
|
581
|
+
if (directiveMatcher(node)) {
|
|
582
|
+
firstVisitMadeChanges = true;
|
|
526
583
|
return null;
|
|
527
584
|
}
|
|
528
585
|
},
|
|
529
586
|
},
|
|
587
|
+
});
|
|
588
|
+
if (!firstVisitMadeChanges) {
|
|
589
|
+
return doc;
|
|
590
|
+
}
|
|
591
|
+
var populateTransitiveVars = function (inUse) {
|
|
592
|
+
if (!inUse.transitiveVars) {
|
|
593
|
+
inUse.transitiveVars = new Set(inUse.variables);
|
|
594
|
+
if (!inUse.removed) {
|
|
595
|
+
inUse.fragmentSpreads.forEach(function (childFragmentName) {
|
|
596
|
+
populateTransitiveVars(getInUseByFragmentName(childFragmentName)).transitiveVars.forEach(function (varName) {
|
|
597
|
+
inUse.transitiveVars.add(varName);
|
|
598
|
+
});
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
return inUse;
|
|
603
|
+
};
|
|
604
|
+
var allFragmentNamesUsed = new Set();
|
|
605
|
+
docWithoutDirectiveSubtrees.definitions.forEach(function (def) {
|
|
606
|
+
if (def.kind === graphql.Kind.OPERATION_DEFINITION) {
|
|
607
|
+
populateTransitiveVars(getInUseByOperationName(def.name && def.name.value)).fragmentSpreads.forEach(function (childFragmentName) {
|
|
608
|
+
allFragmentNamesUsed.add(childFragmentName);
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
else if (def.kind === graphql.Kind.FRAGMENT_DEFINITION &&
|
|
612
|
+
operationCount === 0 &&
|
|
613
|
+
!getInUseByFragmentName(def.name.value).removed) {
|
|
614
|
+
allFragmentNamesUsed.add(def.name.value);
|
|
615
|
+
}
|
|
616
|
+
});
|
|
617
|
+
allFragmentNamesUsed.forEach(function (fragmentName) {
|
|
618
|
+
populateTransitiveVars(getInUseByFragmentName(fragmentName)).fragmentSpreads.forEach(function (childFragmentName) {
|
|
619
|
+
allFragmentNamesUsed.add(childFragmentName);
|
|
620
|
+
});
|
|
621
|
+
});
|
|
622
|
+
var fragmentWillBeRemoved = function (fragmentName) { return !!(!allFragmentNamesUsed.has(fragmentName) ||
|
|
623
|
+
getInUseByFragmentName(fragmentName).removed); };
|
|
624
|
+
var enterVisitor = {
|
|
625
|
+
enter: function (node) {
|
|
626
|
+
if (fragmentWillBeRemoved(node.name.value)) {
|
|
627
|
+
return null;
|
|
628
|
+
}
|
|
629
|
+
},
|
|
630
|
+
};
|
|
631
|
+
return nullIfDocIsEmpty(graphql.visit(docWithoutDirectiveSubtrees, {
|
|
632
|
+
FragmentSpread: enterVisitor,
|
|
633
|
+
FragmentDefinition: enterVisitor,
|
|
634
|
+
OperationDefinition: {
|
|
635
|
+
leave: function (node) {
|
|
636
|
+
if (node.variableDefinitions) {
|
|
637
|
+
var usedVariableNames_1 = populateTransitiveVars(getInUseByOperationName(node.name && node.name.value)).transitiveVars;
|
|
638
|
+
if (usedVariableNames_1.size < node.variableDefinitions.length) {
|
|
639
|
+
return tslib.__assign(tslib.__assign({}, node), { variableDefinitions: node.variableDefinitions.filter(function (varDef) { return usedVariableNames_1.has(varDef.variable.name.value); }) });
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
},
|
|
643
|
+
},
|
|
530
644
|
}));
|
|
531
|
-
if (modifiedDoc &&
|
|
532
|
-
filterInPlace(variablesToRemove, function (v) { return !!v.name && !variablesInUse[v.name]; }).length) {
|
|
533
|
-
modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc);
|
|
534
|
-
}
|
|
535
|
-
if (modifiedDoc &&
|
|
536
|
-
filterInPlace(fragmentSpreadsToRemove, function (fs) { return !!fs.name && !fragmentSpreadsInUse[fs.name]; })
|
|
537
|
-
.length) {
|
|
538
|
-
modifiedDoc = removeFragmentSpreadFromDocument(fragmentSpreadsToRemove, modifiedDoc);
|
|
539
|
-
}
|
|
540
|
-
return modifiedDoc;
|
|
541
645
|
}
|
|
542
646
|
var addTypenameToDocument = Object.assign(function (doc) {
|
|
543
647
|
return graphql.visit(doc, {
|
|
544
648
|
SelectionSet: {
|
|
545
649
|
enter: function (node, _key, parent) {
|
|
546
650
|
if (parent &&
|
|
547
|
-
parent.kind ===
|
|
651
|
+
parent.kind === graphql.Kind.OPERATION_DEFINITION) {
|
|
548
652
|
return;
|
|
549
653
|
}
|
|
550
654
|
var selections = node.selections;
|
|
@@ -590,78 +694,6 @@ var connectionRemoveConfig = {
|
|
|
590
694
|
function removeConnectionDirectiveFromDocument(doc) {
|
|
591
695
|
return removeDirectivesFromDocument([connectionRemoveConfig], checkDocument(doc));
|
|
592
696
|
}
|
|
593
|
-
function getArgumentMatcher(config) {
|
|
594
|
-
return function argumentMatcher(argument) {
|
|
595
|
-
return config.some(function (aConfig) {
|
|
596
|
-
return argument.value &&
|
|
597
|
-
argument.value.kind === 'Variable' &&
|
|
598
|
-
argument.value.name &&
|
|
599
|
-
(aConfig.name === argument.value.name.value ||
|
|
600
|
-
(aConfig.test && aConfig.test(argument)));
|
|
601
|
-
});
|
|
602
|
-
};
|
|
603
|
-
}
|
|
604
|
-
function removeArgumentsFromDocument(config, doc) {
|
|
605
|
-
var argMatcher = getArgumentMatcher(config);
|
|
606
|
-
return nullIfDocIsEmpty(graphql.visit(doc, {
|
|
607
|
-
OperationDefinition: {
|
|
608
|
-
enter: function (node) {
|
|
609
|
-
return tslib.__assign(tslib.__assign({}, node), { variableDefinitions: node.variableDefinitions ? node.variableDefinitions.filter(function (varDef) {
|
|
610
|
-
return !config.some(function (arg) { return arg.name === varDef.variable.name.value; });
|
|
611
|
-
}) : [] });
|
|
612
|
-
},
|
|
613
|
-
},
|
|
614
|
-
Field: {
|
|
615
|
-
enter: function (node) {
|
|
616
|
-
var shouldRemoveField = config.some(function (argConfig) { return argConfig.remove; });
|
|
617
|
-
if (shouldRemoveField) {
|
|
618
|
-
var argMatchCount_1 = 0;
|
|
619
|
-
if (node.arguments) {
|
|
620
|
-
node.arguments.forEach(function (arg) {
|
|
621
|
-
if (argMatcher(arg)) {
|
|
622
|
-
argMatchCount_1 += 1;
|
|
623
|
-
}
|
|
624
|
-
});
|
|
625
|
-
}
|
|
626
|
-
if (argMatchCount_1 === 1) {
|
|
627
|
-
return null;
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
},
|
|
631
|
-
},
|
|
632
|
-
Argument: {
|
|
633
|
-
enter: function (node) {
|
|
634
|
-
if (argMatcher(node)) {
|
|
635
|
-
return null;
|
|
636
|
-
}
|
|
637
|
-
},
|
|
638
|
-
},
|
|
639
|
-
}));
|
|
640
|
-
}
|
|
641
|
-
function removeFragmentSpreadFromDocument(config, doc) {
|
|
642
|
-
function enter(node) {
|
|
643
|
-
if (config.some(function (def) { return def.name === node.name.value; })) {
|
|
644
|
-
return null;
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
return nullIfDocIsEmpty(graphql.visit(doc, {
|
|
648
|
-
FragmentSpread: { enter: enter },
|
|
649
|
-
FragmentDefinition: { enter: enter },
|
|
650
|
-
}));
|
|
651
|
-
}
|
|
652
|
-
function getAllFragmentSpreadsFromSelectionSet(selectionSet) {
|
|
653
|
-
var allFragments = [];
|
|
654
|
-
selectionSet.selections.forEach(function (selection) {
|
|
655
|
-
if ((isField(selection) || isInlineFragment(selection)) &&
|
|
656
|
-
selection.selectionSet) {
|
|
657
|
-
getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(function (frag) { return allFragments.push(frag); });
|
|
658
|
-
}
|
|
659
|
-
else if (selection.kind === 'FragmentSpread') {
|
|
660
|
-
allFragments.push(selection);
|
|
661
|
-
}
|
|
662
|
-
});
|
|
663
|
-
return allFragments;
|
|
664
|
-
}
|
|
665
697
|
function buildQueryFromSelectionSet(document) {
|
|
666
698
|
var definition = getMainDefinition(document);
|
|
667
699
|
var definitionOperation = definition.operation;
|
|
@@ -685,22 +717,6 @@ function removeClientSetsFromDocument(document) {
|
|
|
685
717
|
remove: true,
|
|
686
718
|
},
|
|
687
719
|
], document);
|
|
688
|
-
if (modifiedDoc) {
|
|
689
|
-
modifiedDoc = graphql.visit(modifiedDoc, {
|
|
690
|
-
FragmentDefinition: {
|
|
691
|
-
enter: function (node) {
|
|
692
|
-
if (node.selectionSet) {
|
|
693
|
-
var isTypenameOnly = node.selectionSet.selections.every(function (selection) {
|
|
694
|
-
return isField(selection) && selection.name.value === '__typename';
|
|
695
|
-
});
|
|
696
|
-
if (isTypenameOnly) {
|
|
697
|
-
return null;
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
},
|
|
701
|
-
},
|
|
702
|
-
});
|
|
703
|
-
}
|
|
704
720
|
return modifiedDoc;
|
|
705
721
|
}
|
|
706
722
|
|
|
@@ -1049,10 +1065,6 @@ var Concast = (function (_super) {
|
|
|
1049
1065
|
}(zenObservableTs.Observable));
|
|
1050
1066
|
fixObservableSubclass(Concast);
|
|
1051
1067
|
|
|
1052
|
-
function isNonEmptyArray(value) {
|
|
1053
|
-
return Array.isArray(value) && value.length > 0;
|
|
1054
|
-
}
|
|
1055
|
-
|
|
1056
1068
|
function isExecutionPatchIncrementalResult(value) {
|
|
1057
1069
|
return "incremental" in value;
|
|
1058
1070
|
}
|
|
@@ -1345,7 +1357,7 @@ var concat = ApolloLink.concat;
|
|
|
1345
1357
|
|
|
1346
1358
|
var execute = ApolloLink.execute;
|
|
1347
1359
|
|
|
1348
|
-
var version = '3.7.
|
|
1360
|
+
var version = '3.7.10';
|
|
1349
1361
|
|
|
1350
1362
|
function isNodeResponse(value) {
|
|
1351
1363
|
return !!value.body;
|
|
@@ -2041,7 +2053,6 @@ var hasOwn = Object.prototype.hasOwnProperty;
|
|
|
2041
2053
|
function isNullish(value) {
|
|
2042
2054
|
return value === null || value === void 0;
|
|
2043
2055
|
}
|
|
2044
|
-
var isArray = Array.isArray;
|
|
2045
2056
|
function defaultDataIdFromObject(_a, context) {
|
|
2046
2057
|
var __typename = _a.__typename, id = _a.id, _id = _a._id;
|
|
2047
2058
|
if (typeof __typename === "string") {
|
|
@@ -6367,12 +6378,18 @@ var ApolloClient = (function () {
|
|
|
6367
6378
|
return this.cache.readFragment(options, optimistic);
|
|
6368
6379
|
};
|
|
6369
6380
|
ApolloClient.prototype.writeQuery = function (options) {
|
|
6370
|
-
this.cache.writeQuery(options);
|
|
6371
|
-
|
|
6381
|
+
var ref = this.cache.writeQuery(options);
|
|
6382
|
+
if (options.broadcast !== false) {
|
|
6383
|
+
this.queryManager.broadcastQueries();
|
|
6384
|
+
}
|
|
6385
|
+
return ref;
|
|
6372
6386
|
};
|
|
6373
6387
|
ApolloClient.prototype.writeFragment = function (options) {
|
|
6374
|
-
this.cache.writeFragment(options);
|
|
6375
|
-
|
|
6388
|
+
var ref = this.cache.writeFragment(options);
|
|
6389
|
+
if (options.broadcast !== false) {
|
|
6390
|
+
this.queryManager.broadcastQueries();
|
|
6391
|
+
}
|
|
6392
|
+
return ref;
|
|
6376
6393
|
};
|
|
6377
6394
|
ApolloClient.prototype.__actionHookForDevTools = function (cb) {
|
|
6378
6395
|
this.devToolsHookCb = cb;
|
|
@@ -7020,8 +7037,9 @@ function useMutation(mutation, options) {
|
|
|
7020
7037
|
}
|
|
7021
7038
|
var execute = React.useCallback(function (executeOptions) {
|
|
7022
7039
|
if (executeOptions === void 0) { executeOptions = {}; }
|
|
7023
|
-
var _a = ref.current,
|
|
7040
|
+
var _a = ref.current, options = _a.options, mutation = _a.mutation;
|
|
7024
7041
|
var baseOptions = tslib.__assign(tslib.__assign({}, options), { mutation: mutation });
|
|
7042
|
+
var client = executeOptions.client || ref.current.client;
|
|
7025
7043
|
if (!ref.current.result.loading && !baseOptions.ignoreResults && ref.current.isMounted) {
|
|
7026
7044
|
setResult(ref.current.result = {
|
|
7027
7045
|
loading: true,
|