@apollo/client 3.9.0-alpha.2 → 3.9.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apollo-client.cjs +136 -81
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +47 -11
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +47 -11
- package/cache/core/types/common.d.ts +2 -2
- package/cache/core/types/common.d.ts.map +1 -1
- package/cache/core/types/common.js.map +1 -1
- package/cache/inmemory/entityStore.d.ts.map +1 -1
- package/cache/inmemory/entityStore.js +35 -0
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
- package/cache/inmemory/inMemoryCache.js +2 -1
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/key-extractor.js +1 -1
- package/cache/inmemory/policies.js +4 -4
- package/cache/inmemory/readFromStore.js +2 -2
- package/cache/inmemory/writeToStore.js +4 -4
- package/core/ApolloClient.d.ts +2 -0
- package/core/ApolloClient.d.ts.map +1 -1
- package/core/ApolloClient.js +12 -4
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.js +2 -2
- package/core/ObservableQuery.js +5 -5
- package/core/QueryManager.d.ts +4 -2
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js +13 -12
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +32 -23
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +32 -23
- package/dev/dev.cjs +98 -83
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +98 -83
- package/dev/loadErrorMessageHandler.js +1 -1
- package/dev/loadErrorMessageHandler.js.map +1 -1
- package/invariantErrorCodes.js +96 -81
- package/link/core/ApolloLink.js +2 -2
- package/link/core/core.cjs +2 -2
- package/link/core/core.cjs.map +1 -1
- package/link/core/core.cjs.native.js +2 -2
- package/link/http/checkFetcher.js +1 -1
- package/link/http/createHttpLink.js +1 -1
- package/link/http/http.cjs +3 -3
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +3 -3
- package/link/http/serializeFetchParameter.js +1 -1
- package/link/persisted-queries/index.js +2 -2
- package/link/persisted-queries/persisted-queries.cjs +2 -2
- package/link/persisted-queries/persisted-queries.cjs.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.native.js +2 -2
- package/link/utils/toPromise.js +1 -1
- package/link/utils/utils.cjs +2 -2
- package/link/utils/utils.cjs.map +1 -1
- package/link/utils/utils.cjs.native.js +2 -2
- package/link/utils/validateOperation.js +1 -1
- package/package.json +27 -25
- package/react/cache/QueryReference.d.ts.map +1 -1
- package/react/cache/QueryReference.js +7 -2
- package/react/cache/QueryReference.js.map +1 -1
- package/react/components/Mutation.d.ts +2 -2
- package/react/components/Mutation.d.ts.map +1 -1
- package/react/components/Mutation.js.map +1 -1
- package/react/components/Query.d.ts +2 -2
- package/react/components/Query.d.ts.map +1 -1
- package/react/components/Query.js.map +1 -1
- package/react/components/Subscription.d.ts +2 -2
- package/react/components/Subscription.d.ts.map +1 -1
- package/react/components/Subscription.js.map +1 -1
- package/react/components/types.d.ts +4 -4
- package/react/components/types.d.ts.map +1 -1
- package/react/components/types.js.map +1 -1
- package/react/context/ApolloConsumer.d.ts +3 -3
- package/react/context/ApolloConsumer.d.ts.map +1 -1
- package/react/context/ApolloConsumer.js +2 -2
- package/react/context/ApolloConsumer.js.map +1 -1
- package/react/context/ApolloContext.d.ts +2 -2
- package/react/context/ApolloContext.d.ts.map +1 -1
- package/react/context/ApolloContext.js +2 -2
- package/react/context/ApolloContext.js.map +1 -1
- package/react/context/ApolloProvider.d.ts +3 -3
- package/react/context/ApolloProvider.d.ts.map +1 -1
- package/react/context/ApolloProvider.js +2 -2
- package/react/context/ApolloProvider.js.map +1 -1
- package/react/context/context.cjs +4 -4
- package/react/context/context.cjs.map +1 -1
- package/react/context/context.cjs.native.js +4 -4
- package/react/hoc/graphql.d.ts +2 -2
- package/react/hoc/graphql.d.ts.map +1 -1
- package/react/hoc/graphql.js.map +1 -1
- package/react/hoc/hoc-utils.d.ts +2 -1
- package/react/hoc/hoc-utils.d.ts.map +1 -1
- package/react/hoc/hoc-utils.js +2 -2
- package/react/hoc/hoc-utils.js.map +1 -1
- package/react/hoc/hoc.cjs +3 -3
- package/react/hoc/hoc.cjs.map +1 -1
- package/react/hoc/hoc.cjs.native.js +3 -3
- package/react/hoc/mutation-hoc.d.ts +2 -2
- package/react/hoc/mutation-hoc.d.ts.map +1 -1
- package/react/hoc/mutation-hoc.js +1 -1
- package/react/hoc/mutation-hoc.js.map +1 -1
- package/react/hoc/query-hoc.d.ts +2 -2
- package/react/hoc/query-hoc.d.ts.map +1 -1
- package/react/hoc/query-hoc.js +1 -1
- package/react/hoc/query-hoc.js.map +1 -1
- package/react/hoc/subscription-hoc.d.ts +2 -2
- package/react/hoc/subscription-hoc.d.ts.map +1 -1
- package/react/hoc/subscription-hoc.js +1 -1
- package/react/hoc/subscription-hoc.js.map +1 -1
- package/react/hoc/withApollo.d.ts +2 -2
- package/react/hoc/withApollo.d.ts.map +1 -1
- package/react/hoc/withApollo.js +2 -2
- package/react/hoc/withApollo.js.map +1 -1
- package/react/hooks/hooks.cjs +16 -11
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +16 -11
- package/react/hooks/index.d.ts +1 -0
- package/react/hooks/index.d.ts.map +1 -1
- package/react/hooks/index.js.map +1 -1
- package/react/hooks/internal/__use.js +1 -1
- package/react/hooks/internal/__use.js.map +1 -1
- package/react/hooks/internal/useDeepMemo.js +1 -1
- package/react/hooks/internal/useDeepMemo.js.map +1 -1
- package/react/hooks/internal/useIsomorphicLayoutEffect.d.ts +2 -1
- package/react/hooks/internal/useIsomorphicLayoutEffect.d.ts.map +1 -1
- package/react/hooks/internal/useIsomorphicLayoutEffect.js +1 -1
- package/react/hooks/internal/useIsomorphicLayoutEffect.js.map +1 -1
- package/react/hooks/useApolloClient.js +2 -2
- package/react/hooks/useApolloClient.js.map +1 -1
- package/react/hooks/useBackgroundQuery.js +1 -1
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useFragment.js +1 -1
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useLazyQuery.js +1 -1
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useMutation.js +1 -1
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.js +2 -2
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useReactiveVar.js +1 -1
- package/react/hooks/useReactiveVar.js.map +1 -1
- package/react/hooks/useReadQuery.d.ts +7 -4
- package/react/hooks/useReadQuery.d.ts.map +1 -1
- package/react/hooks/useReadQuery.js +2 -2
- package/react/hooks/useReadQuery.js.map +1 -1
- package/react/hooks/useSubscription.js +3 -3
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseQuery.js +3 -3
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/hooks/useSyncExternalStore.js +2 -2
- package/react/hooks/useSyncExternalStore.js.map +1 -1
- 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/react/ssr/RenderPromises.d.ts +3 -3
- package/react/ssr/RenderPromises.d.ts.map +1 -1
- package/react/ssr/RenderPromises.js.map +1 -1
- package/react/ssr/getDataFromTree.d.ts +4 -4
- package/react/ssr/getDataFromTree.d.ts.map +1 -1
- package/react/ssr/getDataFromTree.js +1 -1
- package/react/ssr/getDataFromTree.js.map +1 -1
- package/react/ssr/renderToStringWithData.d.ts +2 -2
- package/react/ssr/renderToStringWithData.d.ts.map +1 -1
- package/react/ssr/renderToStringWithData.js.map +1 -1
- package/react/ssr/ssr.cjs +1 -1
- package/react/ssr/ssr.cjs.map +1 -1
- package/react/ssr/ssr.cjs.native.js +1 -1
- package/react/types/types.d.ts +2 -2
- package/react/types/types.d.ts.map +1 -1
- package/react/types/types.js.map +1 -1
- 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/react/MockedProvider.d.ts +1 -0
- package/testing/react/MockedProvider.d.ts.map +1 -1
- package/testing/react/MockedProvider.js +2 -1
- package/testing/react/MockedProvider.js.map +1 -1
- package/testing/testing.cjs +2 -1
- package/testing/testing.cjs.map +1 -1
- package/testing/testing.cjs.native.js +2 -1
- package/utilities/globals/globals.cjs +1 -1
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +1 -1
- package/utilities/graphql/DocumentTransform.js +1 -1
- package/utilities/graphql/directives.js +4 -4
- package/utilities/graphql/fragments.js +3 -3
- package/utilities/graphql/getFromAST.js +8 -8
- package/utilities/graphql/print.d.ts +4 -2
- package/utilities/graphql/print.d.ts.map +1 -1
- package/utilities/graphql/print.js +8 -3
- package/utilities/graphql/print.js.map +1 -1
- package/utilities/graphql/storeUtils.d.ts +5 -0
- package/utilities/graphql/storeUtils.d.ts.map +1 -1
- package/utilities/graphql/storeUtils.js +1 -1
- package/utilities/graphql/storeUtils.js.map +1 -1
- package/utilities/graphql/transform.js +2 -2
- package/utilities/index.d.ts +1 -1
- package/utilities/index.d.ts.map +1 -1
- package/utilities/index.js.map +1 -1
- package/utilities/subscriptions/relay/index.d.ts +6 -0
- package/utilities/subscriptions/relay/index.d.ts.map +1 -0
- package/utilities/subscriptions/relay/index.js +43 -0
- package/utilities/subscriptions/relay/index.js.map +1 -0
- package/utilities/subscriptions/relay/package.json +8 -0
- package/utilities/subscriptions/relay/relay.cjs +368 -0
- package/utilities/subscriptions/relay/relay.cjs.map +1 -0
- package/utilities/subscriptions/relay/relay.cjs.native.js +368 -0
- package/utilities/subscriptions/shared.d.ts +9 -0
- package/utilities/subscriptions/shared.d.ts.map +1 -0
- package/utilities/subscriptions/shared.js +7 -0
- package/utilities/subscriptions/shared.js.map +1 -0
- package/utilities/subscriptions/urql/index.d.ts +7 -0
- package/utilities/subscriptions/urql/index.d.ts.map +1 -0
- package/utilities/subscriptions/urql/index.js +40 -0
- package/utilities/subscriptions/urql/index.js.map +1 -0
- package/utilities/subscriptions/urql/package.json +8 -0
- package/utilities/subscriptions/urql/urql.cjs +364 -0
- package/utilities/subscriptions/urql/urql.cjs.map +1 -0
- package/utilities/subscriptions/urql/urql.cjs.native.js +364 -0
- package/utilities/utilities.cjs +27 -22
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +27 -22
- package/version.js +1 -1
package/apollo-client.cjs
CHANGED
|
@@ -12,7 +12,7 @@ var optimism = require('optimism');
|
|
|
12
12
|
var context = require('@wry/context');
|
|
13
13
|
var trie = require('@wry/trie');
|
|
14
14
|
var graphqlTag = require('graphql-tag');
|
|
15
|
-
var React = require('
|
|
15
|
+
var React = require('rehackt');
|
|
16
16
|
|
|
17
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
|
|
18
18
|
|
|
@@ -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.9.0-alpha.
|
|
34
|
+
var version = "3.9.0-alpha.4";
|
|
35
35
|
|
|
36
36
|
function maybe(thunk) {
|
|
37
37
|
try {
|
|
@@ -138,7 +138,7 @@ function shouldInclude(_a, variables) {
|
|
|
138
138
|
if (ifArgument.value.kind === "Variable") {
|
|
139
139
|
evaledValue =
|
|
140
140
|
variables && variables[ifArgument.value.name.value];
|
|
141
|
-
invariant(evaledValue !== void 0,
|
|
141
|
+
invariant(evaledValue !== void 0, 67, directive.name.value);
|
|
142
142
|
}
|
|
143
143
|
else {
|
|
144
144
|
evaledValue = ifArgument.value.value;
|
|
@@ -173,12 +173,12 @@ function getInclusionDirectives(directives) {
|
|
|
173
173
|
return;
|
|
174
174
|
var directiveArguments = directive.arguments;
|
|
175
175
|
var directiveName = directive.name.value;
|
|
176
|
-
invariant(directiveArguments && directiveArguments.length === 1,
|
|
176
|
+
invariant(directiveArguments && directiveArguments.length === 1, 68, directiveName);
|
|
177
177
|
var ifArgument = directiveArguments[0];
|
|
178
|
-
invariant(ifArgument.name && ifArgument.name.value === "if",
|
|
178
|
+
invariant(ifArgument.name && ifArgument.name.value === "if", 69, directiveName);
|
|
179
179
|
var ifValue = ifArgument.value;
|
|
180
180
|
invariant(ifValue &&
|
|
181
|
-
(ifValue.kind === "Variable" || ifValue.kind === "BooleanValue"),
|
|
181
|
+
(ifValue.kind === "Variable" || ifValue.kind === "BooleanValue"), 70, directiveName);
|
|
182
182
|
result.push({ directive: directive, ifArgument: ifArgument });
|
|
183
183
|
});
|
|
184
184
|
}
|
|
@@ -204,7 +204,7 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
204
204
|
document.definitions.forEach(function (definition) {
|
|
205
205
|
if (definition.kind === "OperationDefinition") {
|
|
206
206
|
throw newInvariantError(
|
|
207
|
-
|
|
207
|
+
71,
|
|
208
208
|
definition.operation,
|
|
209
209
|
definition.name ? " named '".concat(definition.name.value, "'") : ""
|
|
210
210
|
);
|
|
@@ -214,7 +214,7 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
214
214
|
}
|
|
215
215
|
});
|
|
216
216
|
if (typeof actualFragmentName === "undefined") {
|
|
217
|
-
invariant(fragments.length === 1,
|
|
217
|
+
invariant(fragments.length === 1, 72, fragments.length);
|
|
218
218
|
actualFragmentName = fragments[0].name.value;
|
|
219
219
|
}
|
|
220
220
|
var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
|
|
@@ -255,7 +255,7 @@ function getFragmentFromSelection(selection, fragmentMap) {
|
|
|
255
255
|
return fragmentMap(fragmentName);
|
|
256
256
|
}
|
|
257
257
|
var fragment = fragmentMap && fragmentMap[fragmentName];
|
|
258
|
-
invariant(fragment,
|
|
258
|
+
invariant(fragment, 73, fragmentName);
|
|
259
259
|
return fragment || null;
|
|
260
260
|
}
|
|
261
261
|
default:
|
|
@@ -370,7 +370,7 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
|
|
|
370
370
|
argObj[name.value] = null;
|
|
371
371
|
}
|
|
372
372
|
else {
|
|
373
|
-
throw newInvariantError(
|
|
373
|
+
throw newInvariantError(82, name.value, value.kind);
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
376
|
function storeKeyNameFromField(field, variables) {
|
|
@@ -504,16 +504,16 @@ function isInlineFragment(selection) {
|
|
|
504
504
|
}
|
|
505
505
|
|
|
506
506
|
function checkDocument(doc) {
|
|
507
|
-
invariant(doc && doc.kind === "Document",
|
|
507
|
+
invariant(doc && doc.kind === "Document", 74);
|
|
508
508
|
var operations = doc.definitions
|
|
509
509
|
.filter(function (d) { return d.kind !== "FragmentDefinition"; })
|
|
510
510
|
.map(function (definition) {
|
|
511
511
|
if (definition.kind !== "OperationDefinition") {
|
|
512
|
-
throw newInvariantError(
|
|
512
|
+
throw newInvariantError(75, definition.kind);
|
|
513
513
|
}
|
|
514
514
|
return definition;
|
|
515
515
|
});
|
|
516
|
-
invariant(operations.length <= 1,
|
|
516
|
+
invariant(operations.length <= 1, 76, operations.length);
|
|
517
517
|
return doc;
|
|
518
518
|
}
|
|
519
519
|
function getOperationDefinition(doc) {
|
|
@@ -536,14 +536,14 @@ function getFragmentDefinitions(doc) {
|
|
|
536
536
|
}
|
|
537
537
|
function getQueryDefinition(doc) {
|
|
538
538
|
var queryDef = getOperationDefinition(doc);
|
|
539
|
-
invariant(queryDef && queryDef.operation === "query",
|
|
539
|
+
invariant(queryDef && queryDef.operation === "query", 77);
|
|
540
540
|
return queryDef;
|
|
541
541
|
}
|
|
542
542
|
function getFragmentDefinition(doc) {
|
|
543
|
-
invariant(doc.kind === "Document",
|
|
544
|
-
invariant(doc.definitions.length <= 1,
|
|
543
|
+
invariant(doc.kind === "Document", 78);
|
|
544
|
+
invariant(doc.definitions.length <= 1, 79);
|
|
545
545
|
var fragmentDef = doc.definitions[0];
|
|
546
|
-
invariant(fragmentDef.kind === "FragmentDefinition",
|
|
546
|
+
invariant(fragmentDef.kind === "FragmentDefinition", 80);
|
|
547
547
|
return fragmentDef;
|
|
548
548
|
}
|
|
549
549
|
function getMainDefinition(queryDoc) {
|
|
@@ -566,7 +566,7 @@ function getMainDefinition(queryDoc) {
|
|
|
566
566
|
if (fragmentDefinition) {
|
|
567
567
|
return fragmentDefinition;
|
|
568
568
|
}
|
|
569
|
-
throw newInvariantError(
|
|
569
|
+
throw newInvariantError(81);
|
|
570
570
|
}
|
|
571
571
|
function getDefaultValues(definition) {
|
|
572
572
|
var defaultValues = Object.create(null);
|
|
@@ -638,15 +638,15 @@ var DocumentTransform = (function () {
|
|
|
638
638
|
return;
|
|
639
639
|
var cacheKeys = this.getCacheKey(document);
|
|
640
640
|
if (cacheKeys) {
|
|
641
|
-
invariant(Array.isArray(cacheKeys),
|
|
641
|
+
invariant(Array.isArray(cacheKeys), 66);
|
|
642
642
|
return this.stableCacheKeys.lookupArray(cacheKeys);
|
|
643
643
|
}
|
|
644
644
|
};
|
|
645
645
|
return DocumentTransform;
|
|
646
646
|
}());
|
|
647
647
|
|
|
648
|
-
var printCache
|
|
649
|
-
var print = function (ast) {
|
|
648
|
+
var printCache;
|
|
649
|
+
var print = Object.assign(function (ast) {
|
|
650
650
|
var result;
|
|
651
651
|
result = printCache === null || printCache === void 0 ? void 0 : printCache.get(ast);
|
|
652
652
|
if (!result) {
|
|
@@ -654,7 +654,12 @@ var print = function (ast) {
|
|
|
654
654
|
printCache === null || printCache === void 0 ? void 0 : printCache.set(ast, result);
|
|
655
655
|
}
|
|
656
656
|
return result;
|
|
657
|
-
}
|
|
657
|
+
}, {
|
|
658
|
+
reset: function () {
|
|
659
|
+
printCache = canUseWeakMap ? new WeakMap() : undefined;
|
|
660
|
+
},
|
|
661
|
+
});
|
|
662
|
+
print.reset();
|
|
658
663
|
|
|
659
664
|
var isArray = Array.isArray;
|
|
660
665
|
function isNonEmptyArray(value) {
|
|
@@ -734,7 +739,7 @@ function removeDirectivesFromDocument(directives, doc) {
|
|
|
734
739
|
return getInUseByFragmentName(ancestor.name.value);
|
|
735
740
|
}
|
|
736
741
|
}
|
|
737
|
-
globalThis.__DEV__ !== false && invariant.error(
|
|
742
|
+
globalThis.__DEV__ !== false && invariant.error(83);
|
|
738
743
|
return null;
|
|
739
744
|
};
|
|
740
745
|
var operationCount = 0;
|
|
@@ -1387,7 +1392,7 @@ function toPromise(observable) {
|
|
|
1387
1392
|
observable.subscribe({
|
|
1388
1393
|
next: function (data) {
|
|
1389
1394
|
if (completed) {
|
|
1390
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
1395
|
+
globalThis.__DEV__ !== false && invariant.warn(42);
|
|
1391
1396
|
}
|
|
1392
1397
|
else {
|
|
1393
1398
|
completed = true;
|
|
@@ -1430,7 +1435,7 @@ function validateOperation(operation) {
|
|
|
1430
1435
|
for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {
|
|
1431
1436
|
var key = _a[_i];
|
|
1432
1437
|
if (OPERATION_FIELDS.indexOf(key) < 0) {
|
|
1433
|
-
throw newInvariantError(
|
|
1438
|
+
throw newInvariantError(43, key);
|
|
1434
1439
|
}
|
|
1435
1440
|
}
|
|
1436
1441
|
return operation;
|
|
@@ -1537,7 +1542,7 @@ var ApolloLink = (function () {
|
|
|
1537
1542
|
ApolloLink.concat = function (first, second) {
|
|
1538
1543
|
var firstLink = toLink(first);
|
|
1539
1544
|
if (isTerminating(firstLink)) {
|
|
1540
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
1545
|
+
globalThis.__DEV__ !== false && invariant.warn(35, firstLink);
|
|
1541
1546
|
return firstLink;
|
|
1542
1547
|
}
|
|
1543
1548
|
var nextLink = toLink(second);
|
|
@@ -1561,7 +1566,7 @@ var ApolloLink = (function () {
|
|
|
1561
1566
|
return ApolloLink.concat(this, next);
|
|
1562
1567
|
};
|
|
1563
1568
|
ApolloLink.prototype.request = function (operation, forward) {
|
|
1564
|
-
throw newInvariantError(
|
|
1569
|
+
throw newInvariantError(36);
|
|
1565
1570
|
};
|
|
1566
1571
|
ApolloLink.prototype.onError = function (error, observer) {
|
|
1567
1572
|
if (observer && observer.error) {
|
|
@@ -1938,7 +1943,7 @@ var serializeFetchParameter = function (p, label) {
|
|
|
1938
1943
|
serialized = JSON.stringify(p);
|
|
1939
1944
|
}
|
|
1940
1945
|
catch (e) {
|
|
1941
|
-
var parseError = newInvariantError(
|
|
1946
|
+
var parseError = newInvariantError(39, label, e.message);
|
|
1942
1947
|
parseError.parseError = e;
|
|
1943
1948
|
throw parseError;
|
|
1944
1949
|
}
|
|
@@ -2024,7 +2029,7 @@ function removeDuplicateHeaders(headers, preserveHeaderCase) {
|
|
|
2024
2029
|
|
|
2025
2030
|
var checkFetcher = function (fetcher) {
|
|
2026
2031
|
if (!fetcher && typeof fetch === "undefined") {
|
|
2027
|
-
throw newInvariantError(
|
|
2032
|
+
throw newInvariantError(37);
|
|
2028
2033
|
}
|
|
2029
2034
|
};
|
|
2030
2035
|
|
|
@@ -2157,7 +2162,7 @@ var createHttpLink = function (linkOptions) {
|
|
|
2157
2162
|
options.headers = options.headers || {};
|
|
2158
2163
|
var acceptHeader = "multipart/mixed;";
|
|
2159
2164
|
if (isSubscription && hasDefer) {
|
|
2160
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
2165
|
+
globalThis.__DEV__ !== false && invariant.warn(38);
|
|
2161
2166
|
}
|
|
2162
2167
|
if (isSubscription) {
|
|
2163
2168
|
acceptHeader +=
|
|
@@ -2584,6 +2589,41 @@ var EntityStore = (function () {
|
|
|
2584
2589
|
changedFields_1[storeFieldName] = newValue;
|
|
2585
2590
|
needToMerge_1 = true;
|
|
2586
2591
|
fieldValue = newValue;
|
|
2592
|
+
if (globalThis.__DEV__ !== false) {
|
|
2593
|
+
var checkReference = function (ref) {
|
|
2594
|
+
if (_this.lookup(ref.__ref) === undefined) {
|
|
2595
|
+
globalThis.__DEV__ !== false && invariant.warn(2, ref);
|
|
2596
|
+
return true;
|
|
2597
|
+
}
|
|
2598
|
+
};
|
|
2599
|
+
if (isReference(newValue)) {
|
|
2600
|
+
checkReference(newValue);
|
|
2601
|
+
}
|
|
2602
|
+
else if (Array.isArray(newValue)) {
|
|
2603
|
+
var seenReference = false;
|
|
2604
|
+
var someNonReference = void 0;
|
|
2605
|
+
for (var _i = 0, newValue_1 = newValue; _i < newValue_1.length; _i++) {
|
|
2606
|
+
var value = newValue_1[_i];
|
|
2607
|
+
if (isReference(value)) {
|
|
2608
|
+
seenReference = true;
|
|
2609
|
+
if (checkReference(value))
|
|
2610
|
+
break;
|
|
2611
|
+
}
|
|
2612
|
+
else {
|
|
2613
|
+
if (typeof value === "object" && !!value) {
|
|
2614
|
+
var id = _this.policies.identify(value)[0];
|
|
2615
|
+
if (id) {
|
|
2616
|
+
someNonReference = value;
|
|
2617
|
+
}
|
|
2618
|
+
}
|
|
2619
|
+
}
|
|
2620
|
+
if (seenReference && someNonReference !== undefined) {
|
|
2621
|
+
globalThis.__DEV__ !== false && invariant.warn(3, someNonReference);
|
|
2622
|
+
break;
|
|
2623
|
+
}
|
|
2624
|
+
}
|
|
2625
|
+
}
|
|
2626
|
+
}
|
|
2587
2627
|
}
|
|
2588
2628
|
}
|
|
2589
2629
|
}
|
|
@@ -3153,7 +3193,7 @@ var StoreReader = (function () {
|
|
|
3153
3193
|
else {
|
|
3154
3194
|
var fragment = getFragmentFromSelection(selection, context.lookupFragment);
|
|
3155
3195
|
if (!fragment && selection.kind === graphql.Kind.FRAGMENT_SPREAD) {
|
|
3156
|
-
throw newInvariantError(
|
|
3196
|
+
throw newInvariantError(9, selection.name.value);
|
|
3157
3197
|
}
|
|
3158
3198
|
if (fragment && policies.fragmentMatches(fragment, typename)) {
|
|
3159
3199
|
fragment.selectionSet.selections.forEach(workSet.add, workSet);
|
|
@@ -3237,7 +3277,7 @@ function assertSelectionSetForIdValue(store, field, fieldValue) {
|
|
|
3237
3277
|
if (isNonNullObject(value)) {
|
|
3238
3278
|
invariant(
|
|
3239
3279
|
!isReference(value),
|
|
3240
|
-
|
|
3280
|
+
10,
|
|
3241
3281
|
getTypenameFromStoreObject(store, value),
|
|
3242
3282
|
field.name.value
|
|
3243
3283
|
);
|
|
@@ -3329,7 +3369,7 @@ function keyFieldsFnFromSpecifier(specifier) {
|
|
|
3329
3369
|
hasOwn.call(object, schemaKeyPath[0])) {
|
|
3330
3370
|
extracted = extractKeyPath(object, schemaKeyPath, extractKey);
|
|
3331
3371
|
}
|
|
3332
|
-
invariant(extracted !== void 0,
|
|
3372
|
+
invariant(extracted !== void 0, 4, schemaKeyPath.join("."), object);
|
|
3333
3373
|
return extracted;
|
|
3334
3374
|
}));
|
|
3335
3375
|
return "".concat(context.typename, ":").concat(JSON.stringify(keyObject));
|
|
@@ -3583,7 +3623,7 @@ var Policies = (function () {
|
|
|
3583
3623
|
var rootId = "ROOT_" + which.toUpperCase();
|
|
3584
3624
|
var old = this.rootTypenamesById[rootId];
|
|
3585
3625
|
if (typename !== old) {
|
|
3586
|
-
invariant(!old || old === which,
|
|
3626
|
+
invariant(!old || old === which, 5, which);
|
|
3587
3627
|
if (old)
|
|
3588
3628
|
delete this.rootIdsByTypename[old];
|
|
3589
3629
|
this.rootIdsByTypename[typename] = rootId;
|
|
@@ -3680,7 +3720,7 @@ var Policies = (function () {
|
|
|
3680
3720
|
if (supertypeSet.has(supertype)) {
|
|
3681
3721
|
if (!typenameSupertypeSet.has(supertype)) {
|
|
3682
3722
|
if (checkingFuzzySubtypes) {
|
|
3683
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
3723
|
+
globalThis.__DEV__ !== false && invariant.warn(6, typename, supertype);
|
|
3684
3724
|
}
|
|
3685
3725
|
typenameSupertypeSet.add(supertype);
|
|
3686
3726
|
}
|
|
@@ -3842,7 +3882,7 @@ function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables)
|
|
|
3842
3882
|
}
|
|
3843
3883
|
}
|
|
3844
3884
|
if (globalThis.__DEV__ !== false && options.from === void 0) {
|
|
3845
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
3885
|
+
globalThis.__DEV__ !== false && invariant.warn(7, stringifyForDisplay(Array.from(readFieldArgs)));
|
|
3846
3886
|
}
|
|
3847
3887
|
if (void 0 === options.variables) {
|
|
3848
3888
|
options.variables = variables;
|
|
@@ -3852,7 +3892,7 @@ function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables)
|
|
|
3852
3892
|
function makeMergeObjectsFunction(store) {
|
|
3853
3893
|
return function mergeObjects(existing, incoming) {
|
|
3854
3894
|
if (isArray(existing) || isArray(incoming)) {
|
|
3855
|
-
throw newInvariantError(
|
|
3895
|
+
throw newInvariantError(8);
|
|
3856
3896
|
}
|
|
3857
3897
|
if (isNonNullObject(existing) && isNonNullObject(incoming)) {
|
|
3858
3898
|
var eType = store.getFieldValue(existing, "__typename");
|
|
@@ -3912,7 +3952,7 @@ var StoreWriter = (function () {
|
|
|
3912
3952
|
context: context,
|
|
3913
3953
|
});
|
|
3914
3954
|
if (!isReference(ref)) {
|
|
3915
|
-
throw newInvariantError(
|
|
3955
|
+
throw newInvariantError(11, result);
|
|
3916
3956
|
}
|
|
3917
3957
|
context.incomingById.forEach(function (_a, dataId) {
|
|
3918
3958
|
var storeObject = _a.storeObject, mergeTree = _a.mergeTree, fieldNodeSet = _a.fieldNodeSet;
|
|
@@ -4017,7 +4057,7 @@ var StoreWriter = (function () {
|
|
|
4017
4057
|
!context.deferred &&
|
|
4018
4058
|
!addTypenameToDocument.added(field) &&
|
|
4019
4059
|
!policies.getReadFunction(typename, field.name.value)) {
|
|
4020
|
-
globalThis.__DEV__ !== false && invariant.error(
|
|
4060
|
+
globalThis.__DEV__ !== false && invariant.error(12, resultKeyNameFromField(field), result);
|
|
4021
4061
|
}
|
|
4022
4062
|
});
|
|
4023
4063
|
try {
|
|
@@ -4122,7 +4162,7 @@ var StoreWriter = (function () {
|
|
|
4122
4162
|
else {
|
|
4123
4163
|
var fragment = getFragmentFromSelection(selection, context.lookupFragment);
|
|
4124
4164
|
if (!fragment && selection.kind === graphql.Kind.FRAGMENT_SPREAD) {
|
|
4125
|
-
throw newInvariantError(
|
|
4165
|
+
throw newInvariantError(13, selection.name.value);
|
|
4126
4166
|
}
|
|
4127
4167
|
if (fragment &&
|
|
4128
4168
|
policies.fragmentMatches(fragment, typename, result, context.variables)) {
|
|
@@ -4264,7 +4304,7 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
|
|
|
4264
4304
|
}
|
|
4265
4305
|
});
|
|
4266
4306
|
}
|
|
4267
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
4307
|
+
globalThis.__DEV__ !== false && invariant.warn(14, fieldName, parentType, childTypenames.length
|
|
4268
4308
|
? "either ensure all objects of type " +
|
|
4269
4309
|
childTypenames.join(" and ") +
|
|
4270
4310
|
" have an ID or a custom merge function, or "
|
|
@@ -4401,6 +4441,7 @@ var InMemoryCache = (function (_super) {
|
|
|
4401
4441
|
};
|
|
4402
4442
|
InMemoryCache.prototype.gc = function (options) {
|
|
4403
4443
|
canonicalStringify.reset();
|
|
4444
|
+
print.reset();
|
|
4404
4445
|
var ids = this.optimisticData.gc();
|
|
4405
4446
|
if (options && !this.txCount) {
|
|
4406
4447
|
if (options.resetResultCache) {
|
|
@@ -4825,7 +4866,7 @@ var ObservableQuery = (function (_super) {
|
|
|
4825
4866
|
var vars = queryDef.variableDefinitions;
|
|
4826
4867
|
if (!vars || !vars.some(function (v) { return v.variable.name.value === "variables"; })) {
|
|
4827
4868
|
globalThis.__DEV__ !== false && invariant.warn(
|
|
4828
|
-
|
|
4869
|
+
20,
|
|
4829
4870
|
variables,
|
|
4830
4871
|
((_a = queryDef.name) === null || _a === void 0 ? void 0 : _a.value) || queryDef
|
|
4831
4872
|
);
|
|
@@ -4923,7 +4964,7 @@ var ObservableQuery = (function (_super) {
|
|
|
4923
4964
|
options.onError(err);
|
|
4924
4965
|
return;
|
|
4925
4966
|
}
|
|
4926
|
-
globalThis.__DEV__ !== false && invariant.error(
|
|
4967
|
+
globalThis.__DEV__ !== false && invariant.error(21, err);
|
|
4927
4968
|
},
|
|
4928
4969
|
});
|
|
4929
4970
|
this.subscriptions.add(subscription);
|
|
@@ -5022,7 +5063,7 @@ var ObservableQuery = (function (_super) {
|
|
|
5022
5063
|
if (pollingInfo && pollingInfo.interval === pollInterval) {
|
|
5023
5064
|
return;
|
|
5024
5065
|
}
|
|
5025
|
-
invariant(pollInterval,
|
|
5066
|
+
invariant(pollInterval, 22);
|
|
5026
5067
|
var info = pollingInfo || (this.pollingInfo = {});
|
|
5027
5068
|
info.interval = pollInterval;
|
|
5028
5069
|
var maybeFetch = function () {
|
|
@@ -5187,11 +5228,11 @@ function reobserveCacheFirst(obsQuery) {
|
|
|
5187
5228
|
return obsQuery.reobserve();
|
|
5188
5229
|
}
|
|
5189
5230
|
function defaultSubscriptionObserverErrorCallback(error) {
|
|
5190
|
-
globalThis.__DEV__ !== false && invariant.error(
|
|
5231
|
+
globalThis.__DEV__ !== false && invariant.error(23, error.message, error.stack);
|
|
5191
5232
|
}
|
|
5192
5233
|
function logMissingFieldErrors(missing) {
|
|
5193
5234
|
if (globalThis.__DEV__ !== false && missing) {
|
|
5194
|
-
globalThis.__DEV__ !== false && invariant.debug(
|
|
5235
|
+
globalThis.__DEV__ !== false && invariant.debug(24, missing);
|
|
5195
5236
|
}
|
|
5196
5237
|
}
|
|
5197
5238
|
function skipCacheDataFor(fetchPolicy) {
|
|
@@ -5376,7 +5417,7 @@ var LocalState = (function () {
|
|
|
5376
5417
|
}
|
|
5377
5418
|
else {
|
|
5378
5419
|
fragment = fragmentMap[selection.name.value];
|
|
5379
|
-
invariant(fragment,
|
|
5420
|
+
invariant(fragment, 18, selection.name.value);
|
|
5380
5421
|
}
|
|
5381
5422
|
if (fragment && fragment.typeCondition) {
|
|
5382
5423
|
typeCondition = fragment.typeCondition.name.value;
|
|
@@ -5489,7 +5530,7 @@ var LocalState = (function () {
|
|
|
5489
5530
|
},
|
|
5490
5531
|
FragmentSpread: function (spread, _, __, ___, ancestors) {
|
|
5491
5532
|
var fragment = fragmentMap[spread.name.value];
|
|
5492
|
-
invariant(fragment,
|
|
5533
|
+
invariant(fragment, 19, spread.name.value);
|
|
5493
5534
|
var fragmentSelections = collectByDefinition(fragment);
|
|
5494
5535
|
if (fragmentSelections.size > 0) {
|
|
5495
5536
|
ancestors.forEach(function (node) {
|
|
@@ -5787,7 +5828,7 @@ var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
|
5787
5828
|
var QueryManager = (function () {
|
|
5788
5829
|
function QueryManager(_a) {
|
|
5789
5830
|
var _this = this;
|
|
5790
|
-
var cache = _a.cache, link = _a.link, defaultOptions = _a.defaultOptions, documentTransform = _a.documentTransform, _b = _a.queryDeduplication, queryDeduplication = _b === void 0 ? false : _b, onBroadcast = _a.onBroadcast, _c = _a.ssrMode, ssrMode = _c === void 0 ? false : _c, _d = _a.clientAwareness, clientAwareness = _d === void 0 ? {} : _d, localState = _a.localState, _e = _a.assumeImmutableResults, assumeImmutableResults = _e === void 0 ? !!cache.assumeImmutableResults : _e;
|
|
5831
|
+
var cache = _a.cache, link = _a.link, defaultOptions = _a.defaultOptions, documentTransform = _a.documentTransform, _b = _a.queryDeduplication, queryDeduplication = _b === void 0 ? false : _b, onBroadcast = _a.onBroadcast, _c = _a.ssrMode, ssrMode = _c === void 0 ? false : _c, _d = _a.clientAwareness, clientAwareness = _d === void 0 ? {} : _d, localState = _a.localState, _e = _a.assumeImmutableResults, assumeImmutableResults = _e === void 0 ? !!cache.assumeImmutableResults : _e, defaultContext = _a.defaultContext;
|
|
5791
5832
|
this.clientAwareness = {};
|
|
5792
5833
|
this.queries = new Map();
|
|
5793
5834
|
this.fetchCancelFns = new Map();
|
|
@@ -5810,6 +5851,7 @@ var QueryManager = (function () {
|
|
|
5810
5851
|
.concat(documentTransform)
|
|
5811
5852
|
.concat(defaultDocumentTransform)
|
|
5812
5853
|
: defaultDocumentTransform;
|
|
5854
|
+
this.defaultContext = defaultContext || Object.create(null);
|
|
5813
5855
|
if ((this.onBroadcast = onBroadcast)) {
|
|
5814
5856
|
this.mutationStore = Object.create(null);
|
|
5815
5857
|
}
|
|
@@ -5819,7 +5861,7 @@ var QueryManager = (function () {
|
|
|
5819
5861
|
this.queries.forEach(function (_info, queryId) {
|
|
5820
5862
|
_this.stopQueryNoBroadcast(queryId);
|
|
5821
5863
|
});
|
|
5822
|
-
this.cancelPendingFetches(newInvariantError(
|
|
5864
|
+
this.cancelPendingFetches(newInvariantError(25));
|
|
5823
5865
|
};
|
|
5824
5866
|
QueryManager.prototype.cancelPendingFetches = function (error) {
|
|
5825
5867
|
this.fetchCancelFns.forEach(function (cancel) { return cancel(error); });
|
|
@@ -5833,8 +5875,8 @@ var QueryManager = (function () {
|
|
|
5833
5875
|
return tslib.__generator(this, function (_h) {
|
|
5834
5876
|
switch (_h.label) {
|
|
5835
5877
|
case 0:
|
|
5836
|
-
invariant(mutation,
|
|
5837
|
-
invariant(fetchPolicy === "network-only" || fetchPolicy === "no-cache",
|
|
5878
|
+
invariant(mutation, 26);
|
|
5879
|
+
invariant(fetchPolicy === "network-only" || fetchPolicy === "no-cache", 27);
|
|
5838
5880
|
mutationId = this.generateMutationId();
|
|
5839
5881
|
mutation = this.cache.transformForLink(this.transform(mutation));
|
|
5840
5882
|
hasClientExports = this.getDocumentInfo(mutation).hasClientExports;
|
|
@@ -6155,10 +6197,10 @@ var QueryManager = (function () {
|
|
|
6155
6197
|
QueryManager.prototype.query = function (options, queryId) {
|
|
6156
6198
|
var _this = this;
|
|
6157
6199
|
if (queryId === void 0) { queryId = this.generateQueryId(); }
|
|
6158
|
-
invariant(options.query,
|
|
6159
|
-
invariant(options.query.kind === "Document",
|
|
6160
|
-
invariant(!options.returnPartialData,
|
|
6161
|
-
invariant(!options.pollInterval,
|
|
6200
|
+
invariant(options.query, 28);
|
|
6201
|
+
invariant(options.query.kind === "Document", 29);
|
|
6202
|
+
invariant(!options.returnPartialData, 30);
|
|
6203
|
+
invariant(!options.pollInterval, 31);
|
|
6162
6204
|
return this.fetchQuery(queryId, tslib.__assign(tslib.__assign({}, options), { query: this.transform(options.query) })).finally(function () { return _this.stopQuery(queryId); });
|
|
6163
6205
|
};
|
|
6164
6206
|
QueryManager.prototype.generateQueryId = function () {
|
|
@@ -6183,7 +6225,7 @@ var QueryManager = (function () {
|
|
|
6183
6225
|
if (options === void 0) { options = {
|
|
6184
6226
|
discardWatches: true,
|
|
6185
6227
|
}; }
|
|
6186
|
-
this.cancelPendingFetches(newInvariantError(
|
|
6228
|
+
this.cancelPendingFetches(newInvariantError(32));
|
|
6187
6229
|
this.queries.forEach(function (queryInfo) {
|
|
6188
6230
|
if (queryInfo.observableQuery) {
|
|
6189
6231
|
queryInfo.networkStatus = exports.NetworkStatus.loading;
|
|
@@ -6259,7 +6301,7 @@ var QueryManager = (function () {
|
|
|
6259
6301
|
if (globalThis.__DEV__ !== false && queryNamesAndDocs.size) {
|
|
6260
6302
|
queryNamesAndDocs.forEach(function (included, nameOrDoc) {
|
|
6261
6303
|
if (!included) {
|
|
6262
|
-
globalThis.__DEV__ !== false && invariant.warn(typeof nameOrDoc === "string" ?
|
|
6304
|
+
globalThis.__DEV__ !== false && invariant.warn(typeof nameOrDoc === "string" ? 33 : 34, nameOrDoc);
|
|
6263
6305
|
}
|
|
6264
6306
|
});
|
|
6265
6307
|
}
|
|
@@ -6415,7 +6457,7 @@ var QueryManager = (function () {
|
|
|
6415
6457
|
QueryManager.prototype.getResultsFromLink = function (queryInfo, cacheWriteBehavior, options) {
|
|
6416
6458
|
var requestId = (queryInfo.lastRequestId = this.generateRequestId());
|
|
6417
6459
|
var linkDocument = this.cache.transformForLink(options.query);
|
|
6418
|
-
return asyncMap(this.getObservableFromLink(linkDocument, options.context, options.variables), function (result) {
|
|
6460
|
+
return asyncMap(this.getObservableFromLink(linkDocument, compact(this.defaultContext, options.context), options.variables), function (result) {
|
|
6419
6461
|
var graphQLErrors = getGraphQLErrorsFromResult(result);
|
|
6420
6462
|
var hasErrors = graphQLErrors.length > 0;
|
|
6421
6463
|
if (requestId >= queryInfo.lastRequestId) {
|
|
@@ -6696,11 +6738,11 @@ var ApolloClient = (function () {
|
|
|
6696
6738
|
this.resetStoreCallbacks = [];
|
|
6697
6739
|
this.clearStoreCallbacks = [];
|
|
6698
6740
|
if (!options.cache) {
|
|
6699
|
-
throw newInvariantError(
|
|
6741
|
+
throw newInvariantError(15);
|
|
6700
6742
|
}
|
|
6701
6743
|
var uri = options.uri, credentials = options.credentials, headers = options.headers, cache = options.cache, documentTransform = options.documentTransform, _a = options.ssrMode, ssrMode = _a === void 0 ? false : _a, _b = options.ssrForceFetchDelay, ssrForceFetchDelay = _b === void 0 ? 0 : _b, _c = options.connectToDevTools, connectToDevTools = _c === void 0 ? typeof window === "object" &&
|
|
6702
6744
|
!window.__APOLLO_CLIENT__ &&
|
|
6703
|
-
globalThis.__DEV__ !== false : _c, _d = options.queryDeduplication, queryDeduplication = _d === void 0 ? true : _d, defaultOptions = options.defaultOptions, _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;
|
|
6745
|
+
globalThis.__DEV__ !== false : _c, _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;
|
|
6704
6746
|
var link = options.link;
|
|
6705
6747
|
if (!link) {
|
|
6706
6748
|
link = uri
|
|
@@ -6732,6 +6774,7 @@ var ApolloClient = (function () {
|
|
|
6732
6774
|
cache: this.cache,
|
|
6733
6775
|
link: this.link,
|
|
6734
6776
|
defaultOptions: this.defaultOptions,
|
|
6777
|
+
defaultContext: defaultContext,
|
|
6735
6778
|
documentTransform: documentTransform,
|
|
6736
6779
|
queryDeduplication: queryDeduplication,
|
|
6737
6780
|
ssrMode: ssrMode,
|
|
@@ -6821,7 +6864,7 @@ var ApolloClient = (function () {
|
|
|
6821
6864
|
if (this.defaultOptions.query) {
|
|
6822
6865
|
options = mergeOptions(this.defaultOptions.query, options);
|
|
6823
6866
|
}
|
|
6824
|
-
invariant(options.fetchPolicy !== "cache-and-network",
|
|
6867
|
+
invariant(options.fetchPolicy !== "cache-and-network", 16);
|
|
6825
6868
|
if (this.disableNetworkFetches && options.fetchPolicy === "network-only") {
|
|
6826
6869
|
options = tslib.__assign(tslib.__assign({}, options), { fetchPolicy: "cache-first" });
|
|
6827
6870
|
}
|
|
@@ -6914,7 +6957,7 @@ var ApolloClient = (function () {
|
|
|
6914
6957
|
result.queries = queries;
|
|
6915
6958
|
result.results = results;
|
|
6916
6959
|
result.catch(function (error) {
|
|
6917
|
-
globalThis.__DEV__ !== false && invariant.debug(
|
|
6960
|
+
globalThis.__DEV__ !== false && invariant.debug(17, error);
|
|
6918
6961
|
});
|
|
6919
6962
|
return result;
|
|
6920
6963
|
};
|
|
@@ -6943,6 +6986,13 @@ var ApolloClient = (function () {
|
|
|
6943
6986
|
ApolloClient.prototype.setLink = function (newLink) {
|
|
6944
6987
|
this.link = this.queryManager.link = newLink;
|
|
6945
6988
|
};
|
|
6989
|
+
Object.defineProperty(ApolloClient.prototype, "defaultContext", {
|
|
6990
|
+
get: function () {
|
|
6991
|
+
return this.queryManager.defaultContext;
|
|
6992
|
+
},
|
|
6993
|
+
enumerable: false,
|
|
6994
|
+
configurable: true
|
|
6995
|
+
});
|
|
6946
6996
|
return ApolloClient;
|
|
6947
6997
|
}());
|
|
6948
6998
|
|
|
@@ -6950,7 +7000,7 @@ var contextKey = canUseSymbol
|
|
|
6950
7000
|
? Symbol.for("__APOLLO_CONTEXT__")
|
|
6951
7001
|
: "__APOLLO_CONTEXT__";
|
|
6952
7002
|
function getApolloContext() {
|
|
6953
|
-
invariant("createContext" in React__namespace,
|
|
7003
|
+
invariant("createContext" in React__namespace, 45);
|
|
6954
7004
|
var context = React__namespace.createContext[contextKey];
|
|
6955
7005
|
if (!context) {
|
|
6956
7006
|
Object.defineProperty(React__namespace.createContext, contextKey, {
|
|
@@ -6968,7 +7018,7 @@ var resetApolloContext = getApolloContext;
|
|
|
6968
7018
|
var ApolloConsumer = function (props) {
|
|
6969
7019
|
var ApolloContext = getApolloContext();
|
|
6970
7020
|
return (React__namespace.createElement(ApolloContext.Consumer, null, function (context) {
|
|
6971
|
-
invariant(context && context.client,
|
|
7021
|
+
invariant(context && context.client, 44);
|
|
6972
7022
|
return props.children(context.client);
|
|
6973
7023
|
}));
|
|
6974
7024
|
};
|
|
@@ -6980,14 +7030,14 @@ var ApolloProvider = function (_a) {
|
|
|
6980
7030
|
var context = React__namespace.useMemo(function () {
|
|
6981
7031
|
return tslib.__assign(tslib.__assign({}, parentContext), { client: client || parentContext.client });
|
|
6982
7032
|
}, [parentContext, client]);
|
|
6983
|
-
invariant(context.client,
|
|
7033
|
+
invariant(context.client, 46);
|
|
6984
7034
|
return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children));
|
|
6985
7035
|
};
|
|
6986
7036
|
|
|
6987
7037
|
function useApolloClient(override) {
|
|
6988
7038
|
var context = React__namespace.useContext(getApolloContext());
|
|
6989
7039
|
var client = override || context.client;
|
|
6990
|
-
invariant(!!client,
|
|
7040
|
+
invariant(!!client, 49);
|
|
6991
7041
|
return client;
|
|
6992
7042
|
}
|
|
6993
7043
|
|
|
@@ -7001,7 +7051,7 @@ var useSyncExternalStore = realHook$1 ||
|
|
|
7001
7051
|
!didWarnUncachedGetSnapshot &&
|
|
7002
7052
|
value !== getSnapshot()) {
|
|
7003
7053
|
didWarnUncachedGetSnapshot = true;
|
|
7004
|
-
globalThis.__DEV__ !== false && invariant.error(
|
|
7054
|
+
globalThis.__DEV__ !== false && invariant.error(58);
|
|
7005
7055
|
}
|
|
7006
7056
|
var _a = React__namespace.useState({
|
|
7007
7057
|
inst: { value: value, getSnapshot: getSnapshot },
|
|
@@ -7066,7 +7116,7 @@ function parser(document) {
|
|
|
7066
7116
|
if (cached)
|
|
7067
7117
|
return cached;
|
|
7068
7118
|
var variables, type, name;
|
|
7069
|
-
invariant(!!document && !!document.kind,
|
|
7119
|
+
invariant(!!document && !!document.kind, 59, document);
|
|
7070
7120
|
var fragments = [];
|
|
7071
7121
|
var queries = [];
|
|
7072
7122
|
var mutations = [];
|
|
@@ -7094,10 +7144,10 @@ function parser(document) {
|
|
|
7094
7144
|
invariant(!fragments.length ||
|
|
7095
7145
|
queries.length ||
|
|
7096
7146
|
mutations.length ||
|
|
7097
|
-
subscriptions.length,
|
|
7147
|
+
subscriptions.length, 60);
|
|
7098
7148
|
invariant(
|
|
7099
7149
|
queries.length + mutations.length + subscriptions.length <= 1,
|
|
7100
|
-
|
|
7150
|
+
61,
|
|
7101
7151
|
document,
|
|
7102
7152
|
queries.length,
|
|
7103
7153
|
subscriptions.length,
|
|
@@ -7111,7 +7161,7 @@ function parser(document) {
|
|
|
7111
7161
|
: mutations.length
|
|
7112
7162
|
? mutations
|
|
7113
7163
|
: subscriptions;
|
|
7114
|
-
invariant(definitions.length === 1,
|
|
7164
|
+
invariant(definitions.length === 1, 62, document, definitions.length);
|
|
7115
7165
|
var definition = definitions[0];
|
|
7116
7166
|
variables = definition.variableDefinitions || [];
|
|
7117
7167
|
if (definition.name && definition.name.kind === "Name") {
|
|
@@ -7130,7 +7180,7 @@ function verifyDocumentType(document, type) {
|
|
|
7130
7180
|
var usedOperationName = operationName(operation.type);
|
|
7131
7181
|
invariant(
|
|
7132
7182
|
operation.type === type,
|
|
7133
|
-
|
|
7183
|
+
63,
|
|
7134
7184
|
requiredOperationName,
|
|
7135
7185
|
requiredOperationName,
|
|
7136
7186
|
usedOperationName
|
|
@@ -7180,7 +7230,7 @@ var InternalState = (function () {
|
|
|
7180
7230
|
}
|
|
7181
7231
|
}
|
|
7182
7232
|
InternalState.prototype.forceUpdateState = function () {
|
|
7183
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
7233
|
+
globalThis.__DEV__ !== false && invariant.warn(50);
|
|
7184
7234
|
};
|
|
7185
7235
|
InternalState.prototype.executeQuery = function (options) {
|
|
7186
7236
|
var _this = this;
|
|
@@ -7601,10 +7651,10 @@ function useSubscription(subscription, options) {
|
|
|
7601
7651
|
if (!hasIssuedDeprecationWarningRef.current) {
|
|
7602
7652
|
hasIssuedDeprecationWarningRef.current = true;
|
|
7603
7653
|
if (options === null || options === void 0 ? void 0 : options.onSubscriptionData) {
|
|
7604
|
-
globalThis.__DEV__ !== false && invariant.warn(options.onData ?
|
|
7654
|
+
globalThis.__DEV__ !== false && invariant.warn(options.onData ? 52 : 53);
|
|
7605
7655
|
}
|
|
7606
7656
|
if (options === null || options === void 0 ? void 0 : options.onSubscriptionComplete) {
|
|
7607
|
-
globalThis.__DEV__ !== false && invariant.warn(options.onComplete ?
|
|
7657
|
+
globalThis.__DEV__ !== false && invariant.warn(options.onComplete ? 54 : 55);
|
|
7608
7658
|
}
|
|
7609
7659
|
}
|
|
7610
7660
|
var _b = React__namespace.useState(function () {
|
|
@@ -7821,7 +7871,6 @@ var OBSERVED_CHANGED_OPTIONS = [
|
|
|
7821
7871
|
var InternalQueryReference = (function () {
|
|
7822
7872
|
function InternalQueryReference(observable, options) {
|
|
7823
7873
|
var _this = this;
|
|
7824
|
-
var _a;
|
|
7825
7874
|
this.listeners = new Set();
|
|
7826
7875
|
this.status = "loading";
|
|
7827
7876
|
this.references = 0;
|
|
@@ -7855,7 +7904,13 @@ var InternalQueryReference = (function () {
|
|
|
7855
7904
|
next: this.handleNext,
|
|
7856
7905
|
error: this.handleError,
|
|
7857
7906
|
});
|
|
7858
|
-
|
|
7907
|
+
var startDisposeTimer = function () {
|
|
7908
|
+
var _a;
|
|
7909
|
+
if (!_this.references) {
|
|
7910
|
+
_this.autoDisposeTimeoutId = setTimeout(_this.dispose, (_a = options.autoDisposeTimeoutMs) !== null && _a !== void 0 ? _a : 30000);
|
|
7911
|
+
}
|
|
7912
|
+
};
|
|
7913
|
+
this.promise.then(startDisposeTimer, startDisposeTimer);
|
|
7859
7914
|
}
|
|
7860
7915
|
Object.defineProperty(InternalQueryReference.prototype, "watchQueryOptions", {
|
|
7861
7916
|
get: function () {
|
|
@@ -8110,11 +8165,11 @@ function validateFetchPolicy(fetchPolicy) {
|
|
|
8110
8165
|
"no-cache",
|
|
8111
8166
|
"cache-and-network",
|
|
8112
8167
|
];
|
|
8113
|
-
invariant(supportedFetchPolicies.includes(fetchPolicy),
|
|
8168
|
+
invariant(supportedFetchPolicies.includes(fetchPolicy), 56, fetchPolicy);
|
|
8114
8169
|
}
|
|
8115
8170
|
function validatePartialDataReturn(fetchPolicy, returnPartialData) {
|
|
8116
8171
|
if (fetchPolicy === "no-cache" && returnPartialData) {
|
|
8117
|
-
globalThis.__DEV__ !== false && invariant.warn(
|
|
8172
|
+
globalThis.__DEV__ !== false && invariant.warn(57);
|
|
8118
8173
|
}
|
|
8119
8174
|
}
|
|
8120
8175
|
function toApolloError(result) {
|
|
@@ -8189,7 +8244,7 @@ function useBackgroundQuery(query, options) {
|
|
|
8189
8244
|
|
|
8190
8245
|
function useReadQuery(queryRef) {
|
|
8191
8246
|
var internalQueryRef = unwrapQueryRef(queryRef);
|
|
8192
|
-
invariant(internalQueryRef.promiseCache,
|
|
8247
|
+
invariant(internalQueryRef.promiseCache, 51);
|
|
8193
8248
|
var promiseCache = internalQueryRef.promiseCache, key = internalQueryRef.key;
|
|
8194
8249
|
if (!promiseCache.has(key)) {
|
|
8195
8250
|
promiseCache.set(key, internalQueryRef.promise);
|