@apollo/client 3.12.0-alpha.0 → 3.12.0-rc.1
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/brown-readers-smash.md +5 -0
- 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/gorgeous-zebras-confess.md +5 -0
- package/.changeset/kind-toys-tie.md +5 -0
- package/.changeset/long-zoos-ring.md +5 -0
- package/.changeset/nervous-owls-hear.md +5 -0
- package/.changeset/nice-countries-share.md +5 -0
- package/.changeset/pre.json +13 -2
- package/.changeset/slimy-points-end.md +5 -0
- package/.changeset/small-bears-confess.md +5 -0
- package/CHANGELOG.md +52 -0
- package/apollo-client.cjs +187 -93
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +59 -25
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +59 -25
- 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 +86 -25
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +86 -25
- package/core/masking.d.ts +6 -0
- package/core/masking.js +62 -20
- 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/internal/types.d.ts +2 -2
- package/masking/internal/types.js.map +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 +34 -20
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +34 -20
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useFragment.d.ts +1 -1
- package/react/hooks/useFragment.js +33 -19
- package/react/hooks/useFragment.js.map +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/apollo-client.cjs
CHANGED
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
6
|
var tsInvariant = require('ts-invariant');
|
|
7
7
|
var equal = require('@wry/equality');
|
|
8
|
-
var caches = require('@wry/caches');
|
|
9
8
|
var graphql = require('graphql');
|
|
9
|
+
var caches = require('@wry/caches');
|
|
10
10
|
var zenObservableTs = require('zen-observable-ts');
|
|
11
11
|
require('symbol-observable');
|
|
12
12
|
var trie = require('@wry/trie');
|
|
@@ -31,7 +31,7 @@ function _interopNamespace(e) {
|
|
|
31
31
|
var equal__default = /*#__PURE__*/_interopDefaultLegacy(equal);
|
|
32
32
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
33
33
|
|
|
34
|
-
var version = "3.12.0-
|
|
34
|
+
var version = "3.12.0-rc.1";
|
|
35
35
|
|
|
36
36
|
function maybe(thunk) {
|
|
37
37
|
try {
|
|
@@ -145,7 +145,7 @@ function shouldInclude(_a, variables) {
|
|
|
145
145
|
if (ifArgument.value.kind === "Variable") {
|
|
146
146
|
evaledValue =
|
|
147
147
|
variables && variables[ifArgument.value.name.value];
|
|
148
|
-
invariant(evaledValue !== void 0,
|
|
148
|
+
invariant(evaledValue !== void 0, 78, directive.name.value);
|
|
149
149
|
}
|
|
150
150
|
else {
|
|
151
151
|
evaledValue = ifArgument.value.value;
|
|
@@ -180,12 +180,12 @@ function getInclusionDirectives(directives) {
|
|
|
180
180
|
return;
|
|
181
181
|
var directiveArguments = directive.arguments;
|
|
182
182
|
var directiveName = directive.name.value;
|
|
183
|
-
invariant(directiveArguments && directiveArguments.length === 1,
|
|
183
|
+
invariant(directiveArguments && directiveArguments.length === 1, 79, directiveName);
|
|
184
184
|
var ifArgument = directiveArguments[0];
|
|
185
|
-
invariant(ifArgument.name && ifArgument.name.value === "if",
|
|
185
|
+
invariant(ifArgument.name && ifArgument.name.value === "if", 80, directiveName);
|
|
186
186
|
var ifValue = ifArgument.value;
|
|
187
187
|
invariant(ifValue &&
|
|
188
|
-
(ifValue.kind === "Variable" || ifValue.kind === "BooleanValue"),
|
|
188
|
+
(ifValue.kind === "Variable" || ifValue.kind === "BooleanValue"), 81, directiveName);
|
|
189
189
|
result.push({ directive: directive, ifArgument: ifArgument });
|
|
190
190
|
});
|
|
191
191
|
}
|
|
@@ -207,13 +207,13 @@ function getFragmentMaskMode(fragment) {
|
|
|
207
207
|
if (globalThis.__DEV__ !== false) {
|
|
208
208
|
if (modeArg) {
|
|
209
209
|
if (modeArg.value.kind === graphql.Kind.VARIABLE) {
|
|
210
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
210
|
+
globalThis.__DEV__ !== false && invariant.warn(82);
|
|
211
211
|
}
|
|
212
212
|
else if (modeArg.value.kind !== graphql.Kind.STRING) {
|
|
213
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
213
|
+
globalThis.__DEV__ !== false && invariant.warn(83);
|
|
214
214
|
}
|
|
215
215
|
else if (modeArg.value.value !== "migrate") {
|
|
216
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
216
|
+
globalThis.__DEV__ !== false && invariant.warn(84, modeArg.value.value);
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
}
|
|
@@ -246,7 +246,7 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
246
246
|
document.definitions.forEach(function (definition) {
|
|
247
247
|
if (definition.kind === "OperationDefinition") {
|
|
248
248
|
throw newInvariantError(
|
|
249
|
-
|
|
249
|
+
85,
|
|
250
250
|
definition.operation,
|
|
251
251
|
definition.name ? " named '".concat(definition.name.value, "'") : ""
|
|
252
252
|
);
|
|
@@ -256,7 +256,7 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
256
256
|
}
|
|
257
257
|
});
|
|
258
258
|
if (typeof actualFragmentName === "undefined") {
|
|
259
|
-
invariant(fragments.length === 1,
|
|
259
|
+
invariant(fragments.length === 1, 86, fragments.length);
|
|
260
260
|
actualFragmentName = fragments[0].name.value;
|
|
261
261
|
}
|
|
262
262
|
var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
|
|
@@ -297,13 +297,27 @@ function getFragmentFromSelection(selection, fragmentMap) {
|
|
|
297
297
|
return fragmentMap(fragmentName);
|
|
298
298
|
}
|
|
299
299
|
var fragment = fragmentMap && fragmentMap[fragmentName];
|
|
300
|
-
invariant(fragment,
|
|
300
|
+
invariant(fragment, 87, fragmentName);
|
|
301
301
|
return fragment || null;
|
|
302
302
|
}
|
|
303
303
|
default:
|
|
304
304
|
return null;
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
|
+
function isFullyUnmaskedOperation(document) {
|
|
308
|
+
var isUnmasked = true;
|
|
309
|
+
graphql.visit(document, {
|
|
310
|
+
FragmentSpread: function (node) {
|
|
311
|
+
isUnmasked =
|
|
312
|
+
!!node.directives &&
|
|
313
|
+
node.directives.some(function (directive) { return directive.name.value === "unmask"; });
|
|
314
|
+
if (!isUnmasked) {
|
|
315
|
+
return graphql.BREAK;
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
});
|
|
319
|
+
return isUnmasked;
|
|
320
|
+
}
|
|
307
321
|
|
|
308
322
|
var scheduledCleanup = new WeakSet();
|
|
309
323
|
function schedule(cache) {
|
|
@@ -548,7 +562,7 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
|
|
|
548
562
|
argObj[name.value] = null;
|
|
549
563
|
}
|
|
550
564
|
else {
|
|
551
|
-
throw newInvariantError(
|
|
565
|
+
throw newInvariantError(96, name.value, value.kind);
|
|
552
566
|
}
|
|
553
567
|
}
|
|
554
568
|
function storeKeyNameFromField(field, variables) {
|
|
@@ -682,16 +696,16 @@ function isInlineFragment(selection) {
|
|
|
682
696
|
}
|
|
683
697
|
|
|
684
698
|
function checkDocument(doc) {
|
|
685
|
-
invariant(doc && doc.kind === "Document",
|
|
699
|
+
invariant(doc && doc.kind === "Document", 88);
|
|
686
700
|
var operations = doc.definitions
|
|
687
701
|
.filter(function (d) { return d.kind !== "FragmentDefinition"; })
|
|
688
702
|
.map(function (definition) {
|
|
689
703
|
if (definition.kind !== "OperationDefinition") {
|
|
690
|
-
throw newInvariantError(
|
|
704
|
+
throw newInvariantError(89, definition.kind);
|
|
691
705
|
}
|
|
692
706
|
return definition;
|
|
693
707
|
});
|
|
694
|
-
invariant(operations.length <= 1,
|
|
708
|
+
invariant(operations.length <= 1, 90, operations.length);
|
|
695
709
|
return doc;
|
|
696
710
|
}
|
|
697
711
|
function getOperationDefinition(doc) {
|
|
@@ -714,14 +728,14 @@ function getFragmentDefinitions(doc) {
|
|
|
714
728
|
}
|
|
715
729
|
function getQueryDefinition(doc) {
|
|
716
730
|
var queryDef = getOperationDefinition(doc);
|
|
717
|
-
invariant(queryDef && queryDef.operation === "query",
|
|
731
|
+
invariant(queryDef && queryDef.operation === "query", 91);
|
|
718
732
|
return queryDef;
|
|
719
733
|
}
|
|
720
734
|
function getFragmentDefinition(doc) {
|
|
721
|
-
invariant(doc.kind === "Document",
|
|
722
|
-
invariant(doc.definitions.length <= 1,
|
|
735
|
+
invariant(doc.kind === "Document", 92);
|
|
736
|
+
invariant(doc.definitions.length <= 1, 93);
|
|
723
737
|
var fragmentDef = doc.definitions[0];
|
|
724
|
-
invariant(fragmentDef.kind === "FragmentDefinition",
|
|
738
|
+
invariant(fragmentDef.kind === "FragmentDefinition", 94);
|
|
725
739
|
return fragmentDef;
|
|
726
740
|
}
|
|
727
741
|
function getMainDefinition(queryDoc) {
|
|
@@ -744,7 +758,7 @@ function getMainDefinition(queryDoc) {
|
|
|
744
758
|
if (fragmentDefinition) {
|
|
745
759
|
return fragmentDefinition;
|
|
746
760
|
}
|
|
747
|
-
throw newInvariantError(
|
|
761
|
+
throw newInvariantError(95);
|
|
748
762
|
}
|
|
749
763
|
function getDefaultValues(definition) {
|
|
750
764
|
var defaultValues = Object.create(null);
|
|
@@ -795,7 +809,7 @@ var DocumentTransform = (function () {
|
|
|
795
809
|
makeCacheKey: function (document) {
|
|
796
810
|
var cacheKeys = _this.getCacheKey(document);
|
|
797
811
|
if (cacheKeys) {
|
|
798
|
-
invariant(Array.isArray(cacheKeys),
|
|
812
|
+
invariant(Array.isArray(cacheKeys), 77);
|
|
799
813
|
return stableCacheKeys_1.lookupArray(cacheKeys);
|
|
800
814
|
}
|
|
801
815
|
},
|
|
@@ -925,7 +939,7 @@ function removeDirectivesFromDocument(directives, doc) {
|
|
|
925
939
|
return getInUseByFragmentName(ancestor.name.value);
|
|
926
940
|
}
|
|
927
941
|
}
|
|
928
|
-
globalThis.__DEV__ !== false && invariant.error(
|
|
942
|
+
globalThis.__DEV__ !== false && invariant.error(97);
|
|
929
943
|
return null;
|
|
930
944
|
};
|
|
931
945
|
var operationCount = 0;
|
|
@@ -1138,6 +1152,10 @@ function addNonReactiveToNamedFragments(document) {
|
|
|
1138
1152
|
checkDocument(document);
|
|
1139
1153
|
return graphql.visit(document, {
|
|
1140
1154
|
FragmentSpread: function (node) {
|
|
1155
|
+
var _a;
|
|
1156
|
+
if ((_a = node.directives) === null || _a === void 0 ? void 0 : _a.some(function (directive) { return directive.name.value === "unmask"; })) {
|
|
1157
|
+
return;
|
|
1158
|
+
}
|
|
1141
1159
|
return tslib.__assign(tslib.__assign({}, node), { directives: tslib.__spreadArray(tslib.__spreadArray([], (node.directives || []), true), [
|
|
1142
1160
|
{
|
|
1143
1161
|
kind: graphql.Kind.DIRECTIVE,
|
|
@@ -1597,7 +1615,7 @@ function toPromise(observable) {
|
|
|
1597
1615
|
observable.subscribe({
|
|
1598
1616
|
next: function (data) {
|
|
1599
1617
|
if (completed) {
|
|
1600
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
1618
|
+
globalThis.__DEV__ !== false && invariant.warn(51);
|
|
1601
1619
|
}
|
|
1602
1620
|
else {
|
|
1603
1621
|
completed = true;
|
|
@@ -1640,7 +1658,7 @@ function validateOperation(operation) {
|
|
|
1640
1658
|
for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {
|
|
1641
1659
|
var key = _a[_i];
|
|
1642
1660
|
if (OPERATION_FIELDS.indexOf(key) < 0) {
|
|
1643
|
-
throw newInvariantError(
|
|
1661
|
+
throw newInvariantError(52, key);
|
|
1644
1662
|
}
|
|
1645
1663
|
}
|
|
1646
1664
|
return operation;
|
|
@@ -1749,7 +1767,7 @@ var ApolloLink = (function () {
|
|
|
1749
1767
|
ApolloLink.concat = function (first, second) {
|
|
1750
1768
|
var firstLink = toLink(first);
|
|
1751
1769
|
if (isTerminating(firstLink)) {
|
|
1752
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
1770
|
+
globalThis.__DEV__ !== false && invariant.warn(44, firstLink);
|
|
1753
1771
|
return firstLink;
|
|
1754
1772
|
}
|
|
1755
1773
|
var nextLink = toLink(second);
|
|
@@ -1775,7 +1793,7 @@ var ApolloLink = (function () {
|
|
|
1775
1793
|
return ApolloLink.concat(this, next);
|
|
1776
1794
|
};
|
|
1777
1795
|
ApolloLink.prototype.request = function (operation, forward) {
|
|
1778
|
-
throw newInvariantError(
|
|
1796
|
+
throw newInvariantError(45);
|
|
1779
1797
|
};
|
|
1780
1798
|
ApolloLink.prototype.onError = function (error, observer) {
|
|
1781
1799
|
if (observer && observer.error) {
|
|
@@ -2157,7 +2175,7 @@ var serializeFetchParameter = function (p, label) {
|
|
|
2157
2175
|
serialized = JSON.stringify(p);
|
|
2158
2176
|
}
|
|
2159
2177
|
catch (e) {
|
|
2160
|
-
var parseError = newInvariantError(
|
|
2178
|
+
var parseError = newInvariantError(48, label, e.message);
|
|
2161
2179
|
parseError.parseError = e;
|
|
2162
2180
|
throw parseError;
|
|
2163
2181
|
}
|
|
@@ -2243,7 +2261,7 @@ function removeDuplicateHeaders(headers, preserveHeaderCase) {
|
|
|
2243
2261
|
|
|
2244
2262
|
var checkFetcher = function (fetcher) {
|
|
2245
2263
|
if (!fetcher && typeof fetch === "undefined") {
|
|
2246
|
-
throw newInvariantError(
|
|
2264
|
+
throw newInvariantError(46);
|
|
2247
2265
|
}
|
|
2248
2266
|
};
|
|
2249
2267
|
|
|
@@ -2377,7 +2395,7 @@ var createHttpLink = function (linkOptions) {
|
|
|
2377
2395
|
options.headers = options.headers || {};
|
|
2378
2396
|
var acceptHeader = "multipart/mixed;";
|
|
2379
2397
|
if (isSubscription && hasDefer) {
|
|
2380
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
2398
|
+
globalThis.__DEV__ !== false && invariant.warn(47);
|
|
2381
2399
|
}
|
|
2382
2400
|
if (isSubscription) {
|
|
2383
2401
|
acceptHeader +=
|
|
@@ -2511,6 +2529,7 @@ function directiveIsNonreactive(dir) {
|
|
|
2511
2529
|
return dir.name.value === "nonreactive";
|
|
2512
2530
|
}
|
|
2513
2531
|
|
|
2532
|
+
var disableWarningsSlot = new optimism.Slot();
|
|
2514
2533
|
function maskOperation(data, document, cache) {
|
|
2515
2534
|
var _a;
|
|
2516
2535
|
if (!cache.fragmentMatches) {
|
|
@@ -2520,7 +2539,7 @@ function maskOperation(data, document, cache) {
|
|
|
2520
2539
|
return data;
|
|
2521
2540
|
}
|
|
2522
2541
|
var definition = getOperationDefinition(document);
|
|
2523
|
-
invariant(definition,
|
|
2542
|
+
invariant(definition, 38);
|
|
2524
2543
|
if (data == null) {
|
|
2525
2544
|
return data;
|
|
2526
2545
|
}
|
|
@@ -2532,9 +2551,7 @@ function maskOperation(data, document, cache) {
|
|
|
2532
2551
|
};
|
|
2533
2552
|
var _b = maskSelectionSet(data, definition.selectionSet, context), masked = _b[0], changed = _b[1];
|
|
2534
2553
|
if (Object.isFrozen(data)) {
|
|
2535
|
-
|
|
2536
|
-
maybeDeepFreeze(masked);
|
|
2537
|
-
context.disableWarnings = false;
|
|
2554
|
+
disableWarningsSlot.withValue(true, maybeDeepFreeze, [masked]);
|
|
2538
2555
|
}
|
|
2539
2556
|
return changed ? masked : data;
|
|
2540
2557
|
}
|
|
@@ -2549,14 +2566,17 @@ function maskFragment(data, document, cache, fragmentName) {
|
|
|
2549
2566
|
return node.kind === graphql.Kind.FRAGMENT_DEFINITION;
|
|
2550
2567
|
});
|
|
2551
2568
|
if (typeof fragmentName === "undefined") {
|
|
2552
|
-
invariant(fragments.length === 1,
|
|
2569
|
+
invariant(fragments.length === 1, 39, fragments.length);
|
|
2553
2570
|
fragmentName = fragments[0].name.value;
|
|
2554
2571
|
}
|
|
2555
2572
|
var fragment = fragments.find(function (fragment) { return fragment.name.value === fragmentName; });
|
|
2556
|
-
invariant(!!fragment,
|
|
2573
|
+
invariant(!!fragment, 40, fragmentName);
|
|
2557
2574
|
if (data == null) {
|
|
2558
2575
|
return data;
|
|
2559
2576
|
}
|
|
2577
|
+
if (equal.equal(data, {})) {
|
|
2578
|
+
return data;
|
|
2579
|
+
}
|
|
2560
2580
|
var context = {
|
|
2561
2581
|
operationType: "fragment",
|
|
2562
2582
|
operationName: fragment.name.value,
|
|
@@ -2565,9 +2585,7 @@ function maskFragment(data, document, cache, fragmentName) {
|
|
|
2565
2585
|
};
|
|
2566
2586
|
var _a = maskSelectionSet(data, fragment.selectionSet, context), masked = _a[0], changed = _a[1];
|
|
2567
2587
|
if (Object.isFrozen(data)) {
|
|
2568
|
-
|
|
2569
|
-
maybeDeepFreeze(masked);
|
|
2570
|
-
context.disableWarnings = false;
|
|
2588
|
+
disableWarningsSlot.withValue(true, maybeDeepFreeze, [masked]);
|
|
2571
2589
|
}
|
|
2572
2590
|
return changed ? masked : data;
|
|
2573
2591
|
}
|
|
@@ -2584,14 +2602,22 @@ function maskSelectionSet(data, selectionSet, context, path) {
|
|
|
2584
2602
|
});
|
|
2585
2603
|
return [changed_1 ? masked : data, changed_1];
|
|
2586
2604
|
}
|
|
2587
|
-
var result = selectionSet.selections
|
|
2605
|
+
var result = selectionSet.selections
|
|
2606
|
+
.concat()
|
|
2607
|
+
.sort(sortFragmentsLast)
|
|
2608
|
+
.reduce(function (_a, selection) {
|
|
2588
2609
|
var memo = _a[0], changed = _a[1];
|
|
2589
2610
|
switch (selection.kind) {
|
|
2590
2611
|
case graphql.Kind.FIELD: {
|
|
2591
2612
|
var keyName = resultKeyNameFromField(selection);
|
|
2592
2613
|
var childSelectionSet = selection.selectionSet;
|
|
2593
2614
|
memo[keyName] = data[keyName];
|
|
2594
|
-
if (
|
|
2615
|
+
if (memo[keyName] === void 0) {
|
|
2616
|
+
delete memo[keyName];
|
|
2617
|
+
}
|
|
2618
|
+
if (keyName in memo &&
|
|
2619
|
+
childSelectionSet &&
|
|
2620
|
+
data[keyName] !== null) {
|
|
2595
2621
|
var _b = maskSelectionSet(data[keyName], childSelectionSet, context, globalThis.__DEV__ !== false ? "".concat(path || "", ".").concat(keyName) : void 0), masked = _b[0], childChanged = _b[1];
|
|
2596
2622
|
if (childChanged ||
|
|
2597
2623
|
Object.keys(masked).length !== Object.keys(data[keyName]).length) {
|
|
@@ -2617,7 +2643,7 @@ function maskSelectionSet(data, selectionSet, context, path) {
|
|
|
2617
2643
|
var fragment = context.fragmentMap[fragmentName] ||
|
|
2618
2644
|
(context.fragmentMap[fragmentName] =
|
|
2619
2645
|
context.cache.lookupFragment(fragmentName));
|
|
2620
|
-
invariant(fragment,
|
|
2646
|
+
invariant(fragment, 41, fragmentName);
|
|
2621
2647
|
var mode = getFragmentMaskMode(selection);
|
|
2622
2648
|
if (mode === "mask") {
|
|
2623
2649
|
return [memo, true];
|
|
@@ -2635,7 +2661,7 @@ function maskSelectionSet(data, selectionSet, context, path) {
|
|
|
2635
2661
|
}
|
|
2636
2662
|
}
|
|
2637
2663
|
}, [Object.create(null), false]);
|
|
2638
|
-
if ("__typename" in data && !("__typename" in result[0])) {
|
|
2664
|
+
if (data && "__typename" in data && !("__typename" in result[0])) {
|
|
2639
2665
|
result[0].__typename = data.__typename;
|
|
2640
2666
|
}
|
|
2641
2667
|
return result;
|
|
@@ -2646,20 +2672,29 @@ function addFieldAccessorWarnings(memo, data, selectionSetNode, path, context) {
|
|
|
2646
2672
|
return addFieldAccessorWarnings(memo[index] || Object.create(null), item, selectionSetNode, "".concat(path, "[").concat(index, "]"), context);
|
|
2647
2673
|
});
|
|
2648
2674
|
}
|
|
2649
|
-
return selectionSetNode.selections
|
|
2675
|
+
return selectionSetNode.selections
|
|
2676
|
+
.concat()
|
|
2677
|
+
.sort(sortFragmentsLast)
|
|
2678
|
+
.reduce(function (memo, selection) {
|
|
2650
2679
|
switch (selection.kind) {
|
|
2651
2680
|
case graphql.Kind.FIELD: {
|
|
2652
2681
|
var keyName = resultKeyNameFromField(selection);
|
|
2653
2682
|
var childSelectionSet = selection.selectionSet;
|
|
2654
|
-
if (keyName in memo) {
|
|
2683
|
+
if (keyName in memo && !childSelectionSet) {
|
|
2655
2684
|
return memo;
|
|
2656
2685
|
}
|
|
2657
2686
|
var value = data[keyName];
|
|
2658
2687
|
if (childSelectionSet) {
|
|
2659
|
-
value = addFieldAccessorWarnings(memo[keyName] ||
|
|
2688
|
+
value = addFieldAccessorWarnings(memo[keyName] ||
|
|
2689
|
+
(Array.isArray(data[keyName]) ? [] : Object.create(null)), data[keyName], childSelectionSet, "".concat(path, ".").concat(keyName), context);
|
|
2660
2690
|
}
|
|
2661
2691
|
if (globalThis.__DEV__ !== false) {
|
|
2662
|
-
|
|
2692
|
+
if (keyName in memo) {
|
|
2693
|
+
memo[keyName] = value;
|
|
2694
|
+
}
|
|
2695
|
+
else {
|
|
2696
|
+
addAccessorWarning(memo, value, keyName, path, context);
|
|
2697
|
+
}
|
|
2663
2698
|
}
|
|
2664
2699
|
if (!(globalThis.__DEV__ !== false)) {
|
|
2665
2700
|
memo[keyName] = data[keyName];
|
|
@@ -2667,6 +2702,10 @@ function addFieldAccessorWarnings(memo, data, selectionSetNode, path, context) {
|
|
|
2667
2702
|
return memo;
|
|
2668
2703
|
}
|
|
2669
2704
|
case graphql.Kind.INLINE_FRAGMENT: {
|
|
2705
|
+
if (selection.typeCondition &&
|
|
2706
|
+
!context.cache.fragmentMatches(selection, data.__typename)) {
|
|
2707
|
+
return memo;
|
|
2708
|
+
}
|
|
2670
2709
|
return addFieldAccessorWarnings(memo, data, selection.selectionSet, path, context);
|
|
2671
2710
|
}
|
|
2672
2711
|
case graphql.Kind.FRAGMENT_SPREAD: {
|
|
@@ -2685,11 +2724,14 @@ function addFieldAccessorWarnings(memo, data, selectionSetNode, path, context) {
|
|
|
2685
2724
|
}, memo);
|
|
2686
2725
|
}
|
|
2687
2726
|
function addAccessorWarning(data, value, fieldName, path, context) {
|
|
2727
|
+
if (value === void 0) {
|
|
2728
|
+
return;
|
|
2729
|
+
}
|
|
2688
2730
|
var getValue = function () {
|
|
2689
|
-
if (
|
|
2731
|
+
if (disableWarningsSlot.getValue()) {
|
|
2690
2732
|
return value;
|
|
2691
2733
|
}
|
|
2692
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
2734
|
+
globalThis.__DEV__ !== false && invariant.warn(42, context.operationName ?
|
|
2693
2735
|
"".concat(context.operationType, " '").concat(context.operationName, "'")
|
|
2694
2736
|
: "anonymous ".concat(context.operationType), "".concat(path, ".").concat(fieldName).replace(/^\./, ""));
|
|
2695
2737
|
getValue = function () { return value; };
|
|
@@ -2710,8 +2752,14 @@ var issuedWarning = false;
|
|
|
2710
2752
|
function warnOnImproperCacheImplementation() {
|
|
2711
2753
|
if (!issuedWarning) {
|
|
2712
2754
|
issuedWarning = true;
|
|
2713
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
2755
|
+
globalThis.__DEV__ !== false && invariant.warn(43);
|
|
2756
|
+
}
|
|
2757
|
+
}
|
|
2758
|
+
function sortFragmentsLast(a, b) {
|
|
2759
|
+
if (a.kind === b.kind) {
|
|
2760
|
+
return 0;
|
|
2714
2761
|
}
|
|
2762
|
+
return a.kind === graphql.Kind.FRAGMENT_SPREAD ? 1 : -1;
|
|
2715
2763
|
}
|
|
2716
2764
|
|
|
2717
2765
|
var ApolloCache = (function () {
|
|
@@ -4060,16 +4108,18 @@ var Policies = (function () {
|
|
|
4060
4108
|
var id;
|
|
4061
4109
|
var policy = typename && this.getTypePolicy(typename);
|
|
4062
4110
|
var keyFn = (policy && policy.keyFn) || this.config.dataIdFromObject;
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4111
|
+
disableWarningsSlot.withValue(true, function () {
|
|
4112
|
+
while (keyFn) {
|
|
4113
|
+
var specifierOrId = keyFn(tslib.__assign(tslib.__assign({}, object), storeObject), context);
|
|
4114
|
+
if (isArray(specifierOrId)) {
|
|
4115
|
+
keyFn = keyFieldsFnFromSpecifier(specifierOrId);
|
|
4116
|
+
}
|
|
4117
|
+
else {
|
|
4118
|
+
id = specifierOrId;
|
|
4119
|
+
break;
|
|
4120
|
+
}
|
|
4071
4121
|
}
|
|
4072
|
-
}
|
|
4122
|
+
});
|
|
4073
4123
|
id = id ? String(id) : void 0;
|
|
4074
4124
|
return context.keyObject ? [id, context.keyObject] : [id];
|
|
4075
4125
|
};
|
|
@@ -5724,6 +5774,8 @@ var ObservableQuery = (function (_super) {
|
|
|
5724
5774
|
return result && "data" in result ? tslib.__assign(tslib.__assign({}, result), { data: this.queryManager.maskOperation({
|
|
5725
5775
|
document: this.query,
|
|
5726
5776
|
data: result.data,
|
|
5777
|
+
fetchPolicy: this.options.fetchPolicy,
|
|
5778
|
+
id: this.queryId,
|
|
5727
5779
|
}) }) : result;
|
|
5728
5780
|
};
|
|
5729
5781
|
return ObservableQuery;
|
|
@@ -6051,6 +6103,7 @@ var QueryManager = (function () {
|
|
|
6051
6103
|
this.requestIdCounter = 1;
|
|
6052
6104
|
this.mutationIdCounter = 1;
|
|
6053
6105
|
this.inFlightLinkObservables = new trie.Trie(false);
|
|
6106
|
+
this.noCacheWarningsByQueryId = new Set();
|
|
6054
6107
|
var defaultDocumentTransform = new DocumentTransform(function (document) { return _this.cache.transformDocument(document); },
|
|
6055
6108
|
{ cache: false });
|
|
6056
6109
|
this.cache = options.cache;
|
|
@@ -6167,6 +6220,8 @@ var QueryManager = (function () {
|
|
|
6167
6220
|
resolve(tslib.__assign(tslib.__assign({}, storeResult), { data: self.maskOperation({
|
|
6168
6221
|
document: mutation,
|
|
6169
6222
|
data: storeResult.data,
|
|
6223
|
+
fetchPolicy: fetchPolicy,
|
|
6224
|
+
id: mutationId,
|
|
6170
6225
|
}) }));
|
|
6171
6226
|
}
|
|
6172
6227
|
},
|
|
@@ -6428,7 +6483,12 @@ var QueryManager = (function () {
|
|
|
6428
6483
|
var query = this.transform(options.query);
|
|
6429
6484
|
return this.fetchQuery(queryId, tslib.__assign(tslib.__assign({}, options), { query: query }))
|
|
6430
6485
|
.then(function (result) {
|
|
6431
|
-
return result && tslib.__assign(tslib.__assign({}, result), { data: _this.maskOperation({
|
|
6486
|
+
return result && tslib.__assign(tslib.__assign({}, result), { data: _this.maskOperation({
|
|
6487
|
+
document: query,
|
|
6488
|
+
data: result.data,
|
|
6489
|
+
fetchPolicy: options.fetchPolicy,
|
|
6490
|
+
id: queryId,
|
|
6491
|
+
}) });
|
|
6432
6492
|
})
|
|
6433
6493
|
.finally(function () { return _this.stopQuery(queryId); });
|
|
6434
6494
|
};
|
|
@@ -6841,7 +6901,23 @@ var QueryManager = (function () {
|
|
|
6841
6901
|
return results;
|
|
6842
6902
|
};
|
|
6843
6903
|
QueryManager.prototype.maskOperation = function (options) {
|
|
6904
|
+
var _a, _b, _c;
|
|
6844
6905
|
var document = options.document, data = options.data;
|
|
6906
|
+
if (globalThis.__DEV__ !== false) {
|
|
6907
|
+
var fetchPolicy = options.fetchPolicy, id = options.id;
|
|
6908
|
+
var operationType = (_a = getOperationDefinition(document)) === null || _a === void 0 ? void 0 : _a.operation;
|
|
6909
|
+
var operationId = ((_b = operationType === null || operationType === void 0 ? void 0 : operationType[0]) !== null && _b !== void 0 ? _b : "o") + id;
|
|
6910
|
+
if (this.dataMasking &&
|
|
6911
|
+
fetchPolicy === "no-cache" &&
|
|
6912
|
+
!isFullyUnmaskedOperation(document) &&
|
|
6913
|
+
!this.noCacheWarningsByQueryId.has(operationId)) {
|
|
6914
|
+
this.noCacheWarningsByQueryId.add(operationId);
|
|
6915
|
+
globalThis.__DEV__ !== false && invariant.warn(
|
|
6916
|
+
37,
|
|
6917
|
+
(_c = getOperationName(document)) !== null && _c !== void 0 ? _c : "Unnamed ".concat(operationType !== null && operationType !== void 0 ? operationType : "operation")
|
|
6918
|
+
);
|
|
6919
|
+
}
|
|
6920
|
+
}
|
|
6845
6921
|
return (this.dataMasking ?
|
|
6846
6922
|
maskOperation(data, document, this.cache)
|
|
6847
6923
|
: data);
|
|
@@ -7293,13 +7369,14 @@ var hasSuggestedDevtools = false;
|
|
|
7293
7369
|
var ApolloClient = (function () {
|
|
7294
7370
|
function ApolloClient(options) {
|
|
7295
7371
|
var _this = this;
|
|
7372
|
+
var _a;
|
|
7296
7373
|
this.resetStoreCallbacks = [];
|
|
7297
7374
|
this.clearStoreCallbacks = [];
|
|
7298
7375
|
if (!options.cache) {
|
|
7299
7376
|
throw newInvariantError(16);
|
|
7300
7377
|
}
|
|
7301
|
-
var uri = options.uri, credentials = options.credentials, headers = options.headers, cache = options.cache, documentTransform = options.documentTransform,
|
|
7302
|
-
connectToDevTools = options.connectToDevTools,
|
|
7378
|
+
var uri = options.uri, credentials = options.credentials, headers = options.headers, cache = options.cache, documentTransform = options.documentTransform, _b = options.ssrMode, ssrMode = _b === void 0 ? false : _b, _c = options.ssrForceFetchDelay, ssrForceFetchDelay = _c === void 0 ? 0 : _c,
|
|
7379
|
+
connectToDevTools = options.connectToDevTools, _d = options.queryDeduplication, queryDeduplication = _d === void 0 ? true : _d, defaultOptions = options.defaultOptions, defaultContext = options.defaultContext, _e = options.assumeImmutableResults, assumeImmutableResults = _e === void 0 ? cache.assumeImmutableResults : _e, resolvers = options.resolvers, typeDefs = options.typeDefs, fragmentMatcher = options.fragmentMatcher, clientAwarenessName = options.name, clientAwarenessVersion = options.version, devtools = options.devtools, dataMasking = options.dataMasking;
|
|
7303
7380
|
var link = options.link;
|
|
7304
7381
|
if (!link) {
|
|
7305
7382
|
link =
|
|
@@ -7311,7 +7388,7 @@ var ApolloClient = (function () {
|
|
|
7311
7388
|
this.queryDeduplication = queryDeduplication;
|
|
7312
7389
|
this.defaultOptions = defaultOptions || Object.create(null);
|
|
7313
7390
|
this.typeDefs = typeDefs;
|
|
7314
|
-
this.devtoolsConfig = tslib.__assign(tslib.__assign({}, devtools), { enabled: (devtools === null || devtools === void 0 ? void 0 : devtools.enabled)
|
|
7391
|
+
this.devtoolsConfig = tslib.__assign(tslib.__assign({}, devtools), { enabled: (_a = devtools === null || devtools === void 0 ? void 0 : devtools.enabled) !== null && _a !== void 0 ? _a : connectToDevTools });
|
|
7315
7392
|
if (this.devtoolsConfig.enabled === undefined) {
|
|
7316
7393
|
this.devtoolsConfig.enabled = globalThis.__DEV__ !== false;
|
|
7317
7394
|
}
|
|
@@ -7442,11 +7519,14 @@ var ApolloClient = (function () {
|
|
|
7442
7519
|
};
|
|
7443
7520
|
ApolloClient.prototype.subscribe = function (options) {
|
|
7444
7521
|
var _this = this;
|
|
7522
|
+
var id = this.queryManager.generateQueryId();
|
|
7445
7523
|
return this.queryManager
|
|
7446
7524
|
.startGraphQLSubscription(options)
|
|
7447
7525
|
.map(function (result) { return (tslib.__assign(tslib.__assign({}, result), { data: _this.queryManager.maskOperation({
|
|
7448
7526
|
document: options.query,
|
|
7449
7527
|
data: result.data,
|
|
7528
|
+
fetchPolicy: options.fetchPolicy,
|
|
7529
|
+
id: id,
|
|
7450
7530
|
}) })); });
|
|
7451
7531
|
};
|
|
7452
7532
|
ApolloClient.prototype.readQuery = function (options, optimistic) {
|
|
@@ -7575,7 +7655,7 @@ if (globalThis.__DEV__ !== false) {
|
|
|
7575
7655
|
|
|
7576
7656
|
var contextKey = canUseSymbol ? Symbol.for("__APOLLO_CONTEXT__") : "__APOLLO_CONTEXT__";
|
|
7577
7657
|
function getApolloContext() {
|
|
7578
|
-
invariant("createContext" in React__namespace,
|
|
7658
|
+
invariant("createContext" in React__namespace, 54);
|
|
7579
7659
|
var context = React__namespace.createContext[contextKey];
|
|
7580
7660
|
if (!context) {
|
|
7581
7661
|
Object.defineProperty(React__namespace.createContext, contextKey, {
|
|
@@ -7593,7 +7673,7 @@ var resetApolloContext = getApolloContext;
|
|
|
7593
7673
|
var ApolloConsumer = function (props) {
|
|
7594
7674
|
var ApolloContext = getApolloContext();
|
|
7595
7675
|
return (React__namespace.createElement(ApolloContext.Consumer, null, function (context) {
|
|
7596
|
-
invariant(context && context.client,
|
|
7676
|
+
invariant(context && context.client, 53);
|
|
7597
7677
|
return props.children(context.client);
|
|
7598
7678
|
}));
|
|
7599
7679
|
};
|
|
@@ -7605,14 +7685,14 @@ var ApolloProvider = function (_a) {
|
|
|
7605
7685
|
var context = React__namespace.useMemo(function () {
|
|
7606
7686
|
return tslib.__assign(tslib.__assign({}, parentContext), { client: client || parentContext.client });
|
|
7607
7687
|
}, [parentContext, client]);
|
|
7608
|
-
invariant(context.client,
|
|
7688
|
+
invariant(context.client, 55);
|
|
7609
7689
|
return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children));
|
|
7610
7690
|
};
|
|
7611
7691
|
|
|
7612
7692
|
function useApolloClient(override) {
|
|
7613
7693
|
var context = React__namespace.useContext(getApolloContext());
|
|
7614
7694
|
var client = override || context.client;
|
|
7615
|
-
invariant(!!client,
|
|
7695
|
+
invariant(!!client, 58);
|
|
7616
7696
|
return client;
|
|
7617
7697
|
}
|
|
7618
7698
|
|
|
@@ -7627,7 +7707,7 @@ var useSyncExternalStore = realHook$1 ||
|
|
|
7627
7707
|
!didWarnUncachedGetSnapshot &&
|
|
7628
7708
|
value !== getSnapshot()) {
|
|
7629
7709
|
didWarnUncachedGetSnapshot = true;
|
|
7630
|
-
globalThis.__DEV__ !== false && invariant.error(
|
|
7710
|
+
globalThis.__DEV__ !== false && invariant.error(68);
|
|
7631
7711
|
}
|
|
7632
7712
|
var _a = React__namespace.useState({
|
|
7633
7713
|
inst: { value: value, getSnapshot: getSnapshot },
|
|
@@ -7695,7 +7775,7 @@ function parser(document) {
|
|
|
7695
7775
|
if (cached)
|
|
7696
7776
|
return cached;
|
|
7697
7777
|
var variables, type, name;
|
|
7698
|
-
invariant(!!document && !!document.kind,
|
|
7778
|
+
invariant(!!document && !!document.kind, 70, document);
|
|
7699
7779
|
var fragments = [];
|
|
7700
7780
|
var queries = [];
|
|
7701
7781
|
var mutations = [];
|
|
@@ -7723,10 +7803,10 @@ function parser(document) {
|
|
|
7723
7803
|
invariant(!fragments.length ||
|
|
7724
7804
|
queries.length ||
|
|
7725
7805
|
mutations.length ||
|
|
7726
|
-
subscriptions.length,
|
|
7806
|
+
subscriptions.length, 71);
|
|
7727
7807
|
invariant(
|
|
7728
7808
|
queries.length + mutations.length + subscriptions.length <= 1,
|
|
7729
|
-
|
|
7809
|
+
72,
|
|
7730
7810
|
document,
|
|
7731
7811
|
queries.length,
|
|
7732
7812
|
subscriptions.length,
|
|
@@ -7738,7 +7818,7 @@ function parser(document) {
|
|
|
7738
7818
|
var definitions = queries.length ? queries
|
|
7739
7819
|
: mutations.length ? mutations
|
|
7740
7820
|
: subscriptions;
|
|
7741
|
-
invariant(definitions.length === 1,
|
|
7821
|
+
invariant(definitions.length === 1, 73, document, definitions.length);
|
|
7742
7822
|
var definition = definitions[0];
|
|
7743
7823
|
variables = definition.variableDefinitions || [];
|
|
7744
7824
|
if (definition.name && definition.name.kind === "Name") {
|
|
@@ -7763,7 +7843,7 @@ function verifyDocumentType(document, type) {
|
|
|
7763
7843
|
var usedOperationName = operationName(operation.type);
|
|
7764
7844
|
invariant(
|
|
7765
7845
|
operation.type === type,
|
|
7766
|
-
|
|
7846
|
+
74,
|
|
7767
7847
|
requiredOperationName,
|
|
7768
7848
|
requiredOperationName,
|
|
7769
7849
|
usedOperationName
|
|
@@ -8336,10 +8416,10 @@ function useSubscription(subscription, options) {
|
|
|
8336
8416
|
if (!hasIssuedDeprecationWarningRef.current) {
|
|
8337
8417
|
hasIssuedDeprecationWarningRef.current = true;
|
|
8338
8418
|
if (options.onSubscriptionData) {
|
|
8339
|
-
globalThis.__DEV__ !== false && invariant.warn(options.onData ?
|
|
8419
|
+
globalThis.__DEV__ !== false && invariant.warn(options.onData ? 61 : 62);
|
|
8340
8420
|
}
|
|
8341
8421
|
if (options.onSubscriptionComplete) {
|
|
8342
|
-
globalThis.__DEV__ !== false && invariant.warn(options.onComplete ?
|
|
8422
|
+
globalThis.__DEV__ !== false && invariant.warn(options.onComplete ? 63 : 64);
|
|
8343
8423
|
}
|
|
8344
8424
|
}
|
|
8345
8425
|
var skip = options.skip, fetchPolicy = options.fetchPolicy, errorPolicy = options.errorPolicy, shouldResubscribe = options.shouldResubscribe, context = options.context, extensions = options.extensions, ignoreResults = options.ignoreResults;
|
|
@@ -8460,7 +8540,7 @@ function useSubscription(subscription, options) {
|
|
|
8460
8540
|
: fallbackResult;
|
|
8461
8541
|
}, function () { return fallbackResult; });
|
|
8462
8542
|
var restart = React__namespace.useCallback(function () {
|
|
8463
|
-
invariant(!optionsRef.current.skip,
|
|
8543
|
+
invariant(!optionsRef.current.skip, 65);
|
|
8464
8544
|
setObservable(recreateRef.current());
|
|
8465
8545
|
}, [optionsRef, recreateRef]);
|
|
8466
8546
|
return React__namespace.useMemo(function () { return (tslib.__assign(tslib.__assign({}, ret), { restart: restart })); }, [ret, restart]);
|
|
@@ -8510,10 +8590,22 @@ function _useFragment(options) {
|
|
|
8510
8590
|
var client = useApolloClient(options.client);
|
|
8511
8591
|
var cache = client.cache;
|
|
8512
8592
|
var from = options.from, rest = tslib.__rest(options, ["from"]);
|
|
8513
|
-
var id = React__namespace.useMemo(function () {
|
|
8593
|
+
var id = React__namespace.useMemo(function () {
|
|
8594
|
+
return typeof from === "string" ? from
|
|
8595
|
+
: from === null ? null
|
|
8596
|
+
: cache.identify(from);
|
|
8597
|
+
}, [cache, from]);
|
|
8514
8598
|
var stableOptions = useDeepMemo(function () { return (tslib.__assign(tslib.__assign({}, rest), { from: id })); }, [rest, id]);
|
|
8515
8599
|
var diff = React__namespace.useMemo(function () {
|
|
8516
8600
|
var fragment = stableOptions.fragment, fragmentName = stableOptions.fragmentName, from = stableOptions.from, _a = stableOptions.optimistic, optimistic = _a === void 0 ? true : _a;
|
|
8601
|
+
if (from === null) {
|
|
8602
|
+
return {
|
|
8603
|
+
result: diffToResult({
|
|
8604
|
+
result: {},
|
|
8605
|
+
complete: false,
|
|
8606
|
+
}),
|
|
8607
|
+
};
|
|
8608
|
+
}
|
|
8517
8609
|
var cache = client.cache;
|
|
8518
8610
|
var diff = cache.diff(tslib.__assign(tslib.__assign({}, stableOptions), { returnPartialData: true, id: from, query: cache["getFragmentDoc"](fragment, fragmentName), optimistic: optimistic }));
|
|
8519
8611
|
return {
|
|
@@ -8527,17 +8619,19 @@ function _useFragment(options) {
|
|
|
8527
8619
|
var getSnapshot = React__namespace.useCallback(function () { return diff.result; }, [diff]);
|
|
8528
8620
|
return useSyncExternalStore(React__namespace.useCallback(function (forceUpdate) {
|
|
8529
8621
|
var lastTimeout = 0;
|
|
8530
|
-
var subscription =
|
|
8531
|
-
|
|
8532
|
-
|
|
8533
|
-
|
|
8534
|
-
|
|
8535
|
-
|
|
8536
|
-
|
|
8537
|
-
|
|
8538
|
-
|
|
8622
|
+
var subscription = stableOptions.from === null ?
|
|
8623
|
+
null
|
|
8624
|
+
: client.watchFragment(stableOptions).subscribe({
|
|
8625
|
+
next: function (result) {
|
|
8626
|
+
if (equal__default(result, diff.result))
|
|
8627
|
+
return;
|
|
8628
|
+
diff.result = result;
|
|
8629
|
+
clearTimeout(lastTimeout);
|
|
8630
|
+
lastTimeout = setTimeout(forceUpdate);
|
|
8631
|
+
},
|
|
8632
|
+
});
|
|
8539
8633
|
return function () {
|
|
8540
|
-
subscription.unsubscribe();
|
|
8634
|
+
subscription === null || subscription === void 0 ? void 0 : subscription.unsubscribe();
|
|
8541
8635
|
clearTimeout(lastTimeout);
|
|
8542
8636
|
};
|
|
8543
8637
|
}, [client, stableOptions, diff]), getSnapshot, getSnapshot);
|
|
@@ -8568,7 +8662,7 @@ function wrapQueryRef(internalQueryRef) {
|
|
|
8568
8662
|
return ref;
|
|
8569
8663
|
}
|
|
8570
8664
|
function assertWrappedQueryRef(queryRef) {
|
|
8571
|
-
invariant(!queryRef || QUERY_REFERENCE_SYMBOL in queryRef,
|
|
8665
|
+
invariant(!queryRef || QUERY_REFERENCE_SYMBOL in queryRef, 69);
|
|
8572
8666
|
}
|
|
8573
8667
|
function getWrappedPromise(queryRef) {
|
|
8574
8668
|
var internalQueryRef = unwrapQueryRef(queryRef);
|
|
@@ -8785,7 +8879,7 @@ var InternalQueryReference = (function () {
|
|
|
8785
8879
|
}
|
|
8786
8880
|
});
|
|
8787
8881
|
})
|
|
8788
|
-
.catch(function () { });
|
|
8882
|
+
.catch(function (error) { var _a; return (_a = _this.reject) === null || _a === void 0 ? void 0 : _a.call(_this, error); });
|
|
8789
8883
|
return returnedPromise;
|
|
8790
8884
|
};
|
|
8791
8885
|
InternalQueryReference.prototype.subscribeToQuery = function () {
|
|
@@ -8939,11 +9033,11 @@ function validateFetchPolicy(fetchPolicy) {
|
|
|
8939
9033
|
"no-cache",
|
|
8940
9034
|
"cache-and-network",
|
|
8941
9035
|
];
|
|
8942
|
-
invariant(supportedFetchPolicies.includes(fetchPolicy),
|
|
9036
|
+
invariant(supportedFetchPolicies.includes(fetchPolicy), 66, fetchPolicy);
|
|
8943
9037
|
}
|
|
8944
9038
|
function validatePartialDataReturn(fetchPolicy, returnPartialData) {
|
|
8945
9039
|
if (fetchPolicy === "no-cache" && returnPartialData) {
|
|
8946
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
9040
|
+
globalThis.__DEV__ !== false && invariant.warn(67);
|
|
8947
9041
|
}
|
|
8948
9042
|
}
|
|
8949
9043
|
function toApolloError(result) {
|
|
@@ -9063,7 +9157,7 @@ function useLoadableQuery(query, options) {
|
|
|
9063
9157
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
9064
9158
|
args[_i] = arguments[_i];
|
|
9065
9159
|
}
|
|
9066
|
-
invariant(!calledDuringRender(),
|
|
9160
|
+
invariant(!calledDuringRender(), 59);
|
|
9067
9161
|
var variables = args[0];
|
|
9068
9162
|
var cacheKey = tslib.__spreadArray([
|
|
9069
9163
|
query,
|
|
@@ -9082,7 +9176,7 @@ function useLoadableQuery(query, options) {
|
|
|
9082
9176
|
client,
|
|
9083
9177
|
]);
|
|
9084
9178
|
var subscribeToMore = React__namespace.useCallback(function (options) {
|
|
9085
|
-
invariant(internalQueryRef,
|
|
9179
|
+
invariant(internalQueryRef, 60);
|
|
9086
9180
|
return internalQueryRef.observable.subscribeToMore(options);
|
|
9087
9181
|
}, [internalQueryRef]);
|
|
9088
9182
|
var reset = React__namespace.useCallback(function () {
|