@apollo/client 3.12.0-alpha.0 → 3.12.0-rc.0
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/.changeset/cold-apes-bow.md +5 -0
- package/.changeset/early-bobcats-eat.md +5 -0
- package/.changeset/flat-beans-knock.md +15 -0
- package/.changeset/kind-toys-tie.md +5 -0
- package/.changeset/nervous-owls-hear.md +5 -0
- package/.changeset/pre.json +7 -2
- package/CHANGELOG.md +34 -0
- package/apollo-client.cjs +133 -77
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +30 -20
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +30 -20
- package/cache/inmemory/policies.js +12 -9
- package/cache/inmemory/policies.js.map +1 -1
- package/config/jest/setup.js +5 -0
- package/config/jest/setup.js.map +1 -1
- package/core/ApolloClient.js +7 -3
- package/core/ApolloClient.js.map +1 -1
- package/core/ObservableQuery.js +2 -0
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryManager.d.ts +4 -1
- package/core/QueryManager.js +26 -2
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +57 -20
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +57 -20
- package/core/masking.d.ts +6 -0
- package/core/masking.js +33 -15
- package/core/masking.js.map +1 -1
- package/dev/dev.cjs +66 -62
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +66 -62
- package/invariantErrorCodes.js +66 -61
- 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/index.js.map +1 -1
- 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/masking/types.d.ts +2 -2
- package/masking/types.js.map +1 -1
- package/package.json +4 -3
- 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 +2 -2
- package/react/internal/cache/QueryReference.js.map +1 -1
- package/react/internal/internal.cjs +3 -3
- package/react/internal/internal.cjs.map +1 -1
- package/react/internal/internal.cjs.native.js +3 -3
- 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/ObservableStream.d.ts +11 -15
- package/testing/internal/ObservableStream.js +18 -62
- package/testing/internal/ObservableStream.js.map +1 -1
- package/testing/internal/index.d.ts +1 -2
- package/testing/internal/index.js +1 -2
- package/testing/internal/index.js.map +1 -1
- package/testing/internal/renderHelpers.d.ts +13 -2
- package/testing/internal/renderHelpers.js +20 -12
- package/testing/internal/renderHelpers.js.map +1 -1
- package/testing/matchers/index.js +0 -3
- package/testing/matchers/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 +7 -7
- package/utilities/graphql/fragments.d.ts +1 -0
- package/utilities/graphql/fragments.js +18 -3
- package/utilities/graphql/fragments.js.map +1 -1
- package/utilities/graphql/getFromAST.js +8 -8
- package/utilities/graphql/storeUtils.js +1 -1
- package/utilities/graphql/transform.js +8 -2
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/index.d.ts +1 -1
- package/utilities/index.js +1 -1
- package/utilities/index.js.map +1 -1
- package/utilities/utilities.cjs +41 -22
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +41 -22
- package/version.js +1 -1
- package/testing/internal/profile/Render.d.ts +0 -69
- package/testing/internal/profile/Render.js +0 -144
- package/testing/internal/profile/Render.js.map +0 -1
- package/testing/internal/profile/context.d.ts +0 -10
- package/testing/internal/profile/context.js +0 -14
- package/testing/internal/profile/context.js.map +0 -1
- package/testing/internal/profile/index.d.ts +0 -4
- package/testing/internal/profile/index.js +0 -2
- package/testing/internal/profile/index.js.map +0 -1
- package/testing/internal/profile/profile.d.ts +0 -109
- package/testing/internal/profile/profile.js +0 -304
- package/testing/internal/profile/profile.js.map +0 -1
- package/testing/internal/profile/traces.d.ts +0 -7
- package/testing/internal/profile/traces.js +0 -30
- package/testing/internal/profile/traces.js.map +0 -1
- package/testing/matchers/ProfiledComponent.d.ts +0 -8
- package/testing/matchers/ProfiledComponent.js +0 -110
- package/testing/matchers/ProfiledComponent.js.map +0 -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, 78, 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, 79, 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", 80, 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"), 81, directiveName);
|
|
81
81
|
result.push({ directive: directive, ifArgument: ifArgument });
|
|
82
82
|
});
|
|
83
83
|
}
|
|
@@ -99,13 +99,13 @@ function getFragmentMaskMode(fragment) {
|
|
|
99
99
|
if (globalThis.__DEV__ !== false) {
|
|
100
100
|
if (modeArg) {
|
|
101
101
|
if (modeArg.value.kind === graphql.Kind.VARIABLE) {
|
|
102
|
-
globalThis.__DEV__ !== false && globals.invariant.warn(
|
|
102
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(82);
|
|
103
103
|
}
|
|
104
104
|
else if (modeArg.value.kind !== graphql.Kind.STRING) {
|
|
105
|
-
globalThis.__DEV__ !== false && globals.invariant.warn(
|
|
105
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(83);
|
|
106
106
|
}
|
|
107
107
|
else if (modeArg.value.value !== "migrate") {
|
|
108
|
-
globalThis.__DEV__ !== false && globals.invariant.warn(
|
|
108
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(84, modeArg.value.value);
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
}
|
|
@@ -144,7 +144,7 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
144
144
|
document.definitions.forEach(function (definition) {
|
|
145
145
|
if (definition.kind === "OperationDefinition") {
|
|
146
146
|
throw globals.newInvariantError(
|
|
147
|
-
|
|
147
|
+
85,
|
|
148
148
|
definition.operation,
|
|
149
149
|
definition.name ? " named '".concat(definition.name.value, "'") : ""
|
|
150
150
|
);
|
|
@@ -154,7 +154,7 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
154
154
|
}
|
|
155
155
|
});
|
|
156
156
|
if (typeof actualFragmentName === "undefined") {
|
|
157
|
-
globals.invariant(fragments.length === 1,
|
|
157
|
+
globals.invariant(fragments.length === 1, 86, fragments.length);
|
|
158
158
|
actualFragmentName = fragments[0].name.value;
|
|
159
159
|
}
|
|
160
160
|
var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
|
|
@@ -195,13 +195,27 @@ function getFragmentFromSelection(selection, fragmentMap) {
|
|
|
195
195
|
return fragmentMap(fragmentName);
|
|
196
196
|
}
|
|
197
197
|
var fragment = fragmentMap && fragmentMap[fragmentName];
|
|
198
|
-
globals.invariant(fragment,
|
|
198
|
+
globals.invariant(fragment, 87, fragmentName);
|
|
199
199
|
return fragment || null;
|
|
200
200
|
}
|
|
201
201
|
default:
|
|
202
202
|
return null;
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
+
function isFullyUnmaskedOperation(document) {
|
|
206
|
+
var isUnmasked = true;
|
|
207
|
+
graphql.visit(document, {
|
|
208
|
+
FragmentSpread: function (node) {
|
|
209
|
+
isUnmasked =
|
|
210
|
+
!!node.directives &&
|
|
211
|
+
node.directives.some(function (directive) { return directive.name.value === "unmask"; });
|
|
212
|
+
if (!isUnmasked) {
|
|
213
|
+
return graphql.BREAK;
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
});
|
|
217
|
+
return isUnmasked;
|
|
218
|
+
}
|
|
205
219
|
|
|
206
220
|
var scheduledCleanup = new WeakSet();
|
|
207
221
|
function schedule(cache) {
|
|
@@ -354,7 +368,7 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
|
|
|
354
368
|
argObj[name.value] = null;
|
|
355
369
|
}
|
|
356
370
|
else {
|
|
357
|
-
throw globals.newInvariantError(
|
|
371
|
+
throw globals.newInvariantError(96, name.value, value.kind);
|
|
358
372
|
}
|
|
359
373
|
}
|
|
360
374
|
function storeKeyNameFromField(field, variables) {
|
|
@@ -488,16 +502,16 @@ function isInlineFragment(selection) {
|
|
|
488
502
|
}
|
|
489
503
|
|
|
490
504
|
function checkDocument(doc) {
|
|
491
|
-
globals.invariant(doc && doc.kind === "Document",
|
|
505
|
+
globals.invariant(doc && doc.kind === "Document", 88);
|
|
492
506
|
var operations = doc.definitions
|
|
493
507
|
.filter(function (d) { return d.kind !== "FragmentDefinition"; })
|
|
494
508
|
.map(function (definition) {
|
|
495
509
|
if (definition.kind !== "OperationDefinition") {
|
|
496
|
-
throw globals.newInvariantError(
|
|
510
|
+
throw globals.newInvariantError(89, definition.kind);
|
|
497
511
|
}
|
|
498
512
|
return definition;
|
|
499
513
|
});
|
|
500
|
-
globals.invariant(operations.length <= 1,
|
|
514
|
+
globals.invariant(operations.length <= 1, 90, operations.length);
|
|
501
515
|
return doc;
|
|
502
516
|
}
|
|
503
517
|
function getOperationDefinition(doc) {
|
|
@@ -520,14 +534,14 @@ function getFragmentDefinitions(doc) {
|
|
|
520
534
|
}
|
|
521
535
|
function getQueryDefinition(doc) {
|
|
522
536
|
var queryDef = getOperationDefinition(doc);
|
|
523
|
-
globals.invariant(queryDef && queryDef.operation === "query",
|
|
537
|
+
globals.invariant(queryDef && queryDef.operation === "query", 91);
|
|
524
538
|
return queryDef;
|
|
525
539
|
}
|
|
526
540
|
function getFragmentDefinition(doc) {
|
|
527
|
-
globals.invariant(doc.kind === "Document",
|
|
528
|
-
globals.invariant(doc.definitions.length <= 1,
|
|
541
|
+
globals.invariant(doc.kind === "Document", 92);
|
|
542
|
+
globals.invariant(doc.definitions.length <= 1, 93);
|
|
529
543
|
var fragmentDef = doc.definitions[0];
|
|
530
|
-
globals.invariant(fragmentDef.kind === "FragmentDefinition",
|
|
544
|
+
globals.invariant(fragmentDef.kind === "FragmentDefinition", 94);
|
|
531
545
|
return fragmentDef;
|
|
532
546
|
}
|
|
533
547
|
function getMainDefinition(queryDoc) {
|
|
@@ -550,7 +564,7 @@ function getMainDefinition(queryDoc) {
|
|
|
550
564
|
if (fragmentDefinition) {
|
|
551
565
|
return fragmentDefinition;
|
|
552
566
|
}
|
|
553
|
-
throw globals.newInvariantError(
|
|
567
|
+
throw globals.newInvariantError(95);
|
|
554
568
|
}
|
|
555
569
|
function getDefaultValues(definition) {
|
|
556
570
|
var defaultValues = Object.create(null);
|
|
@@ -601,7 +615,7 @@ var DocumentTransform = (function () {
|
|
|
601
615
|
makeCacheKey: function (document) {
|
|
602
616
|
var cacheKeys = _this.getCacheKey(document);
|
|
603
617
|
if (cacheKeys) {
|
|
604
|
-
globals.invariant(Array.isArray(cacheKeys),
|
|
618
|
+
globals.invariant(Array.isArray(cacheKeys), 77);
|
|
605
619
|
return stableCacheKeys_1.lookupArray(cacheKeys);
|
|
606
620
|
}
|
|
607
621
|
},
|
|
@@ -731,7 +745,7 @@ function removeDirectivesFromDocument(directives, doc) {
|
|
|
731
745
|
return getInUseByFragmentName(ancestor.name.value);
|
|
732
746
|
}
|
|
733
747
|
}
|
|
734
|
-
globalThis.__DEV__ !== false && globals.invariant.error(
|
|
748
|
+
globalThis.__DEV__ !== false && globals.invariant.error(97);
|
|
735
749
|
return null;
|
|
736
750
|
};
|
|
737
751
|
var operationCount = 0;
|
|
@@ -921,7 +935,7 @@ var connectionRemoveConfig = {
|
|
|
921
935
|
if (willRemove) {
|
|
922
936
|
if (!directive.arguments ||
|
|
923
937
|
!directive.arguments.some(function (arg) { return arg.name.value === "key"; })) {
|
|
924
|
-
globalThis.__DEV__ !== false && globals.invariant.warn(
|
|
938
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(98);
|
|
925
939
|
}
|
|
926
940
|
}
|
|
927
941
|
return willRemove;
|
|
@@ -1021,6 +1035,10 @@ function addNonReactiveToNamedFragments(document) {
|
|
|
1021
1035
|
checkDocument(document);
|
|
1022
1036
|
return graphql.visit(document, {
|
|
1023
1037
|
FragmentSpread: function (node) {
|
|
1038
|
+
var _a;
|
|
1039
|
+
if ((_a = node.directives) === null || _a === void 0 ? void 0 : _a.some(function (directive) { return directive.name.value === "unmask"; })) {
|
|
1040
|
+
return;
|
|
1041
|
+
}
|
|
1024
1042
|
return tslib.__assign(tslib.__assign({}, node), { directives: tslib.__spreadArray(tslib.__spreadArray([], (node.directives || []), true), [
|
|
1025
1043
|
{
|
|
1026
1044
|
kind: graphql.Kind.DIRECTIVE,
|
|
@@ -1753,6 +1771,7 @@ exports.isExecutionPatchIncrementalResult = isExecutionPatchIncrementalResult;
|
|
|
1753
1771
|
exports.isExecutionPatchInitialResult = isExecutionPatchInitialResult;
|
|
1754
1772
|
exports.isExecutionPatchResult = isExecutionPatchResult;
|
|
1755
1773
|
exports.isField = isField;
|
|
1774
|
+
exports.isFullyUnmaskedOperation = isFullyUnmaskedOperation;
|
|
1756
1775
|
exports.isInlineFragment = isInlineFragment;
|
|
1757
1776
|
exports.isMutationOperation = isMutationOperation;
|
|
1758
1777
|
exports.isNonEmptyArray = isNonEmptyArray;
|