@apollo/client 3.8.0-alpha.5 → 3.8.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/apollo-client.cjs +151 -72
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +20 -20
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +20 -20
- package/cache/core/cache.d.ts +1 -1
- package/cache/core/cache.d.ts.map +1 -1
- package/cache/core/cache.js.map +1 -1
- package/cache/core/types/common.d.ts +7 -7
- package/cache/core/types/common.d.ts.map +1 -1
- package/cache/inmemory/entityStore.d.ts +1 -1
- package/cache/inmemory/entityStore.d.ts.map +1 -1
- package/cache/inmemory/entityStore.js +1 -1
- package/cache/inmemory/helpers.js.map +1 -1
- package/cache/inmemory/inMemoryCache.d.ts +3 -2
- package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
- package/cache/inmemory/inMemoryCache.js +1 -1
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/key-extractor.js +1 -1
- package/cache/inmemory/object-canon.d.ts +0 -1
- package/cache/inmemory/object-canon.d.ts.map +1 -1
- package/cache/inmemory/object-canon.js +1 -1
- package/cache/inmemory/object-canon.js.map +1 -1
- package/cache/inmemory/policies.d.ts +12 -12
- package/cache/inmemory/policies.d.ts.map +1 -1
- package/cache/inmemory/policies.js +1 -1
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/reactiveVars.d.ts +1 -1
- package/cache/inmemory/reactiveVars.d.ts.map +1 -1
- package/cache/inmemory/readFromStore.d.ts +2 -2
- package/cache/inmemory/readFromStore.d.ts.map +1 -1
- package/cache/inmemory/readFromStore.js +1 -1
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.d.ts +4 -4
- package/cache/inmemory/types.d.ts.map +1 -1
- package/cache/inmemory/writeToStore.d.ts +1 -1
- package/cache/inmemory/writeToStore.d.ts.map +1 -1
- package/cache/inmemory/writeToStore.js +1 -1
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/ApolloClient.d.ts +5 -5
- package/core/ApolloClient.d.ts.map +1 -1
- package/core/ApolloClient.js +1 -1
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.d.ts +9 -6
- package/core/LocalState.d.ts.map +1 -1
- package/core/LocalState.js +65 -15
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.d.ts +5 -5
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +2 -2
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +1 -1
- package/core/QueryInfo.d.ts.map +1 -1
- package/core/QueryInfo.js +1 -1
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +7 -7
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js +19 -11
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +113 -62
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +113 -62
- package/core/index.js +2 -2
- package/core/index.js.map +1 -1
- package/core/types.d.ts +18 -17
- package/core/types.d.ts.map +1 -1
- package/core/types.js +1 -0
- package/core/types.js.map +1 -1
- package/core/watchQueryOptions.d.ts +11 -11
- package/core/watchQueryOptions.d.ts.map +1 -1
- package/core/watchQueryOptions.js.map +1 -1
- package/errors/index.d.ts +2 -2
- package/errors/index.d.ts.map +1 -1
- package/invariantErrorCodes.js +33 -33
- package/link/batch/batch.cjs +5 -3
- package/link/batch/batch.cjs.map +1 -1
- package/link/batch/batch.cjs.native.js +5 -3
- package/link/batch/batching.d.ts +2 -2
- package/link/batch/batching.d.ts.map +1 -1
- package/link/batch/batching.js +5 -3
- package/link/batch/batching.js.map +1 -1
- package/link/context/index.d.ts +2 -1
- package/link/context/index.d.ts.map +1 -1
- package/link/context/index.js.map +1 -1
- 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/core/types.d.ts +13 -12
- package/link/core/types.d.ts.map +1 -1
- package/link/core/types.js.map +1 -1
- package/link/http/checkFetcher.js +2 -2
- package/link/http/createHttpLink.d.ts +0 -1
- package/link/http/createHttpLink.d.ts.map +1 -1
- package/link/http/createHttpLink.js +2 -1
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/http.cjs +13 -38
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +13 -38
- package/link/http/iterators/async.js.map +1 -1
- package/link/http/iterators/nodeStream.js.map +1 -1
- package/link/http/iterators/promise.js.map +1 -1
- package/link/http/iterators/reader.js.map +1 -1
- package/link/http/parseAndCheckHttpResponse.d.ts +2 -2
- package/link/http/parseAndCheckHttpResponse.d.ts.map +1 -1
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/link/http/responseIterator.js +1 -1
- package/link/http/responseIterator.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.d.ts +2 -2
- package/link/http/selectHttpOptionsAndBody.d.ts.map +1 -1
- package/link/http/selectHttpOptionsAndBody.js +3 -1
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/link/http/serializeFetchParameter.d.ts +1 -1
- package/link/http/serializeFetchParameter.d.ts.map +1 -1
- package/link/http/serializeFetchParameter.js +2 -2
- package/link/persisted-queries/index.d.ts +2 -2
- package/link/persisted-queries/index.d.ts.map +1 -1
- package/link/persisted-queries/index.js +3 -3
- package/link/persisted-queries/persisted-queries.cjs +3 -3
- package/link/persisted-queries/persisted-queries.cjs.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.native.js +3 -3
- package/link/utils/throwServerError.d.ts +1 -1
- package/link/utils/throwServerError.d.ts.map +1 -1
- 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 +2 -2
- package/package.json +15 -15
- package/react/cache/SuspenseCache.d.ts +1 -1
- package/react/cache/SuspenseCache.d.ts.map +1 -1
- package/react/cache/SuspenseCache.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 +2 -2
- package/react/components/types.d.ts.map +1 -1
- package/react/components/types.js.map +1 -1
- package/react/context/ApolloConsumer.js +2 -2
- package/react/context/ApolloProvider.js +2 -2
- 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 -1
- package/react/hoc/graphql.d.ts.map +1 -1
- package/react/hoc/graphql.js.map +1 -1
- package/react/hoc/hoc-utils.d.ts +1 -1
- package/react/hoc/hoc-utils.d.ts.map +1 -1
- package/react/hoc/hoc-utils.js +2 -2
- package/react/hoc/hoc.cjs +4 -4
- package/react/hoc/hoc.cjs.map +1 -1
- package/react/hoc/hoc.cjs.native.js +4 -4
- 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.map +1 -1
- package/react/hoc/query-hoc.d.ts +1 -1
- package/react/hoc/query-hoc.d.ts.map +1 -1
- package/react/hoc/query-hoc.js.map +1 -1
- package/react/hoc/subscription-hoc.d.ts +1 -1
- package/react/hoc/subscription-hoc.d.ts.map +1 -1
- package/react/hoc/subscription-hoc.js.map +1 -1
- package/react/hoc/types.d.ts +6 -6
- package/react/hoc/types.d.ts.map +1 -1
- package/react/hoc/types.js.map +1 -1
- package/react/hoc/withApollo.js +2 -2
- package/react/hooks/hooks.cjs +26 -32
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +26 -32
- 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/useFragment.d.ts +4 -2
- package/react/hooks/useFragment.d.ts.map +1 -1
- package/react/hooks/useFragment.js +9 -8
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useLazyQuery.d.ts +2 -2
- package/react/hooks/useLazyQuery.d.ts.map +1 -1
- package/react/hooks/useLazyQuery.js +3 -4
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useMutation.d.ts +2 -2
- package/react/hooks/useMutation.d.ts.map +1 -1
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.d.ts +4 -4
- package/react/hooks/useQuery.d.ts.map +1 -1
- package/react/hooks/useQuery.js +1 -1
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useSubscription.d.ts +2 -3
- package/react/hooks/useSubscription.d.ts.map +1 -1
- package/react/hooks/useSubscription.js +1 -2
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseCache.js +2 -2
- package/react/hooks/useSuspenseQuery.d.ts +1 -1
- package/react/hooks/useSuspenseQuery.d.ts.map +1 -1
- package/react/hooks/useSuspenseQuery.js +2 -2
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/hooks/useSyncExternalStore.d.ts +1 -1
- package/react/hooks/useSyncExternalStore.d.ts.map +1 -1
- package/react/hooks/useSyncExternalStore.js +1 -1
- package/react/hooks/useSyncExternalStore.js.map +1 -1
- package/react/parser/index.js +6 -6
- package/react/parser/parser.cjs +10 -10
- package/react/parser/parser.cjs.map +1 -1
- package/react/parser/parser.cjs.native.js +10 -10
- package/react/ssr/RenderPromises.d.ts +4 -4
- package/react/ssr/RenderPromises.d.ts.map +1 -1
- package/react/ssr/RenderPromises.js.map +1 -1
- package/react/ssr/getDataFromTree.d.ts +1 -1
- package/react/ssr/getDataFromTree.d.ts.map +1 -1
- package/react/types/types.d.ts +24 -23
- package/react/types/types.d.ts.map +1 -1
- package/react/types/types.js.map +1 -1
- package/testing/core/core.cjs +13 -3
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +13 -3
- package/testing/core/index.d.ts +1 -1
- package/testing/core/index.d.ts.map +1 -1
- package/testing/core/index.js.map +1 -1
- package/testing/core/mocking/mockFetch.js.map +1 -1
- package/testing/core/mocking/mockLink.d.ts +8 -4
- package/testing/core/mocking/mockLink.d.ts.map +1 -1
- package/testing/core/mocking/mockLink.js +14 -4
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/testing/core/mocking/mockQueryManager.d.ts +1 -1
- package/testing/core/mocking/mockQueryManager.d.ts.map +1 -1
- package/testing/core/mocking/mockQueryManager.js +3 -3
- package/testing/core/mocking/mockQueryManager.js.map +1 -1
- package/testing/core/mocking/mockWatchQuery.d.ts +1 -1
- package/testing/core/mocking/mockWatchQuery.d.ts.map +1 -1
- package/testing/core/mocking/mockWatchQuery.js +4 -5
- package/testing/core/mocking/mockWatchQuery.js.map +1 -1
- package/testing/core/observableToPromise.d.ts +2 -2
- package/testing/core/observableToPromise.d.ts.map +1 -1
- package/testing/core/observableToPromise.js.map +1 -1
- package/testing/react/MockedProvider.d.ts +1 -0
- package/testing/react/MockedProvider.d.ts.map +1 -1
- package/testing/react/MockedProvider.js +2 -2
- package/testing/react/MockedProvider.js.map +1 -1
- package/testing/testing.cjs +2 -2
- package/testing/testing.cjs.map +1 -1
- package/testing/testing.cjs.native.js +2 -2
- package/utilities/common/cloneDeep.js.map +1 -1
- package/utilities/common/errorHandling.d.ts +2 -2
- package/utilities/common/errorHandling.d.ts.map +1 -1
- package/utilities/common/errorHandling.js.map +1 -1
- package/utilities/common/incrementalResult.d.ts +4 -4
- package/utilities/common/incrementalResult.d.ts.map +1 -1
- package/utilities/common/incrementalResult.js.map +1 -1
- package/utilities/common/maybeDeepFreeze.d.ts +0 -1
- package/utilities/common/maybeDeepFreeze.d.ts.map +1 -1
- package/utilities/common/maybeDeepFreeze.js +1 -1
- package/utilities/common/maybeDeepFreeze.js.map +1 -1
- package/utilities/common/mergeDeep.d.ts +2 -2
- package/utilities/common/mergeDeep.d.ts.map +1 -1
- package/utilities/common/mergeOptions.d.ts +3 -3
- package/utilities/common/mergeOptions.d.ts.map +1 -1
- package/utilities/common/mergeOptions.js.map +1 -1
- package/utilities/globals/DEV.d.ts +1 -1
- package/utilities/globals/DEV.d.ts.map +1 -1
- package/utilities/globals/DEV.js +1 -17
- package/utilities/globals/DEV.js.map +1 -1
- package/utilities/globals/global.d.ts +5 -2
- package/utilities/globals/global.d.ts.map +1 -1
- package/utilities/globals/global.js.map +1 -1
- package/utilities/globals/globals.cjs +5 -22
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +5 -22
- package/utilities/globals/index.d.ts +1 -1
- package/utilities/globals/index.d.ts.map +1 -1
- package/utilities/globals/index.js +1 -4
- package/utilities/globals/index.js.map +1 -1
- package/utilities/graphql/directives.d.ts +2 -2
- package/utilities/graphql/directives.d.ts.map +1 -1
- package/utilities/graphql/directives.js +1 -1
- package/utilities/graphql/directives.js.map +1 -1
- package/utilities/graphql/fragments.d.ts +1 -1
- package/utilities/graphql/fragments.d.ts.map +1 -1
- package/utilities/graphql/fragments.js +1 -1
- package/utilities/graphql/getFromAST.js +1 -1
- package/utilities/graphql/storeUtils.d.ts +3 -3
- 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.d.ts +9 -9
- package/utilities/graphql/transform.d.ts.map +1 -1
- package/utilities/graphql/transform.js +1 -1
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/index.d.ts +2 -0
- package/utilities/index.d.ts.map +1 -1
- package/utilities/index.js +2 -0
- package/utilities/index.js.map +1 -1
- package/utilities/observables/Concast.d.ts +5 -5
- package/utilities/observables/Concast.d.ts.map +1 -1
- package/utilities/observables/asyncMap.js.map +1 -1
- package/utilities/policies/pagination.d.ts +7 -7
- package/utilities/policies/pagination.d.ts.map +1 -1
- package/utilities/policies/pagination.js.map +1 -1
- package/utilities/types/IsStrictlyAny.d.ts +3 -3
- package/utilities/types/IsStrictlyAny.d.ts.map +1 -1
- package/utilities/utilities.cjs +75 -19
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +75 -19
- package/version.js +1 -1
package/README.md
CHANGED
|
@@ -29,6 +29,7 @@ Learn how to use Apollo Client with self-paced hands-on training on Odyssey, Apo
|
|
|
29
29
|
|Jeff Auriemma|[@bignimbus](https://github.com/bignimbus)|
|
|
30
30
|
|Hugh Willson|[@hwillson](https://github.com/hwillson)|
|
|
31
31
|
|Jerel Miller|[@jerelmiller](https://github.com/jerelmiller)|
|
|
32
|
+
|Lenz Weber-Tronic|[@phryneas](https://github.com/phryneas)|
|
|
32
33
|
|
|
33
34
|
## Who is Apollo?
|
|
34
35
|
|
package/apollo-client.cjs
CHANGED
|
@@ -4,10 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
6
|
var tsInvariant = require('ts-invariant');
|
|
7
|
+
var process$1 = require('ts-invariant/process');
|
|
8
|
+
var graphql = require('graphql');
|
|
7
9
|
var equality = require('@wry/equality');
|
|
8
10
|
var zenObservableTs = require('zen-observable-ts');
|
|
9
11
|
require('symbol-observable');
|
|
10
|
-
var graphql = require('graphql');
|
|
11
12
|
var optimism = require('optimism');
|
|
12
13
|
var context = require('@wry/context');
|
|
13
14
|
var trie = require('@wry/trie');
|
|
@@ -35,6 +36,23 @@ function maybe(thunk) {
|
|
|
35
36
|
catch (_a) { }
|
|
36
37
|
}
|
|
37
38
|
|
|
39
|
+
var global$1 = (maybe(function () { return globalThis; }) ||
|
|
40
|
+
maybe(function () { return window; }) ||
|
|
41
|
+
maybe(function () { return self; }) ||
|
|
42
|
+
maybe(function () { return global; }) ||
|
|
43
|
+
maybe(function () { return maybe.constructor("return this")(); }));
|
|
44
|
+
|
|
45
|
+
var DEV = ("__DEV__" in global$1
|
|
46
|
+
? Boolean(global$1.__DEV__)
|
|
47
|
+
: maybe(function () { return process.env.NODE_ENV; }) !== "production");
|
|
48
|
+
|
|
49
|
+
function removeTemporaryGlobals() {
|
|
50
|
+
return typeof graphql.Source === "function" ? process$1.remove() : process$1.remove();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
var __DEV__ = DEV;
|
|
54
|
+
removeTemporaryGlobals();
|
|
55
|
+
|
|
38
56
|
function shouldInclude(_a, variables) {
|
|
39
57
|
var directives = _a.directives;
|
|
40
58
|
if (!directives || !directives.length) {
|
|
@@ -1141,6 +1159,26 @@ function mergeOptions(defaults, options) {
|
|
|
1141
1159
|
});
|
|
1142
1160
|
}
|
|
1143
1161
|
|
|
1162
|
+
function isNodeResponse(value) {
|
|
1163
|
+
return !!value.body;
|
|
1164
|
+
}
|
|
1165
|
+
function isReadableStream(value) {
|
|
1166
|
+
return !!value.getReader;
|
|
1167
|
+
}
|
|
1168
|
+
function isAsyncIterableIterator(value) {
|
|
1169
|
+
return !!(canUseAsyncIteratorSymbol &&
|
|
1170
|
+
value[Symbol.asyncIterator]);
|
|
1171
|
+
}
|
|
1172
|
+
function isStreamableBlob(value) {
|
|
1173
|
+
return !!value.stream;
|
|
1174
|
+
}
|
|
1175
|
+
function isBlob(value) {
|
|
1176
|
+
return !!value.arrayBuffer;
|
|
1177
|
+
}
|
|
1178
|
+
function isNodeReadableStream(value) {
|
|
1179
|
+
return !!value.pipe;
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1144
1182
|
function fromError(errorValue) {
|
|
1145
1183
|
return new zenObservableTs.Observable(function (observer) {
|
|
1146
1184
|
observer.error(errorValue);
|
|
@@ -1196,7 +1234,7 @@ function validateOperation(operation) {
|
|
|
1196
1234
|
for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {
|
|
1197
1235
|
var key = _a[_i];
|
|
1198
1236
|
if (OPERATION_FIELDS.indexOf(key) < 0) {
|
|
1199
|
-
throw __DEV__ ? new tsInvariant.InvariantError("illegal argument: ".concat(key)) : new tsInvariant.InvariantError(
|
|
1237
|
+
throw __DEV__ ? new tsInvariant.InvariantError("illegal argument: ".concat(key)) : new tsInvariant.InvariantError(27);
|
|
1200
1238
|
}
|
|
1201
1239
|
}
|
|
1202
1240
|
return operation;
|
|
@@ -1319,7 +1357,7 @@ var ApolloLink = (function () {
|
|
|
1319
1357
|
return ApolloLink.concat(this, next);
|
|
1320
1358
|
};
|
|
1321
1359
|
ApolloLink.prototype.request = function (operation, forward) {
|
|
1322
|
-
throw __DEV__ ? new tsInvariant.InvariantError('request is not implemented') : new tsInvariant.InvariantError(
|
|
1360
|
+
throw __DEV__ ? new tsInvariant.InvariantError('request is not implemented') : new tsInvariant.InvariantError(22);
|
|
1323
1361
|
};
|
|
1324
1362
|
ApolloLink.prototype.onError = function (error, observer) {
|
|
1325
1363
|
if (observer && observer.error) {
|
|
@@ -1345,27 +1383,7 @@ var concat = ApolloLink.concat;
|
|
|
1345
1383
|
|
|
1346
1384
|
var execute = ApolloLink.execute;
|
|
1347
1385
|
|
|
1348
|
-
var version = '3.8.0-alpha.
|
|
1349
|
-
|
|
1350
|
-
function isNodeResponse(value) {
|
|
1351
|
-
return !!value.body;
|
|
1352
|
-
}
|
|
1353
|
-
function isReadableStream(value) {
|
|
1354
|
-
return !!value.getReader;
|
|
1355
|
-
}
|
|
1356
|
-
function isAsyncIterableIterator(value) {
|
|
1357
|
-
return !!(canUseAsyncIteratorSymbol &&
|
|
1358
|
-
value[Symbol.asyncIterator]);
|
|
1359
|
-
}
|
|
1360
|
-
function isStreamableBlob(value) {
|
|
1361
|
-
return !!value.stream;
|
|
1362
|
-
}
|
|
1363
|
-
function isBlob(value) {
|
|
1364
|
-
return !!value.arrayBuffer;
|
|
1365
|
-
}
|
|
1366
|
-
function isNodeReadableStream(value) {
|
|
1367
|
-
return !!value.pipe;
|
|
1368
|
-
}
|
|
1386
|
+
var version = '3.8.0-alpha.7';
|
|
1369
1387
|
|
|
1370
1388
|
function asyncIterator(source) {
|
|
1371
1389
|
var _a;
|
|
@@ -1661,7 +1679,7 @@ var serializeFetchParameter = function (p, label) {
|
|
|
1661
1679
|
serialized = JSON.stringify(p);
|
|
1662
1680
|
}
|
|
1663
1681
|
catch (e) {
|
|
1664
|
-
var parseError = __DEV__ ? new tsInvariant.InvariantError("Network request failed. ".concat(label, " is not serializable: ").concat(e.message)) : new tsInvariant.InvariantError(
|
|
1682
|
+
var parseError = __DEV__ ? new tsInvariant.InvariantError("Network request failed. ".concat(label, " is not serializable: ").concat(e.message)) : new tsInvariant.InvariantError(24);
|
|
1665
1683
|
parseError.parseError = e;
|
|
1666
1684
|
throw parseError;
|
|
1667
1685
|
}
|
|
@@ -1709,7 +1727,9 @@ function selectHttpOptionsAndBodyInternal(operation, printer) {
|
|
|
1709
1727
|
}
|
|
1710
1728
|
http = tslib.__assign(tslib.__assign({}, http), config.http);
|
|
1711
1729
|
});
|
|
1712
|
-
|
|
1730
|
+
if (options.headers) {
|
|
1731
|
+
options.headers = removeDuplicateHeaders(options.headers, http.preserveHeaderCase);
|
|
1732
|
+
}
|
|
1713
1733
|
var operationName = operation.operationName, extensions = operation.extensions, variables = operation.variables, query = operation.query;
|
|
1714
1734
|
var body = { operationName: operationName, variables: variables };
|
|
1715
1735
|
if (http.includeExtensions)
|
|
@@ -1742,7 +1762,7 @@ function removeDuplicateHeaders(headers, preserveHeaderCase) {
|
|
|
1742
1762
|
|
|
1743
1763
|
var checkFetcher = function (fetcher) {
|
|
1744
1764
|
if (!fetcher && typeof fetch === 'undefined') {
|
|
1745
|
-
throw __DEV__ ? new tsInvariant.InvariantError("\n\"fetch\" has not been found globally and no fetcher has been configured. To fix this, install a fetch package (like https://www.npmjs.com/package/cross-fetch), instantiate the fetcher, and pass it into your HttpLink constructor. For example:\n\nimport fetch from 'cross-fetch';\nimport { ApolloClient, HttpLink } from '@apollo/client';\nconst client = new ApolloClient({\n link: new HttpLink({ uri: '/graphql', fetch })\n});\n ") : new tsInvariant.InvariantError(
|
|
1765
|
+
throw __DEV__ ? new tsInvariant.InvariantError("\n\"fetch\" has not been found globally and no fetcher has been configured. To fix this, install a fetch package (like https://www.npmjs.com/package/cross-fetch), instantiate the fetcher, and pass it into your HttpLink constructor. For example:\n\nimport fetch from 'cross-fetch';\nimport { ApolloClient, HttpLink } from '@apollo/client';\nconst client = new ApolloClient({\n link: new HttpLink({ uri: '/graphql', fetch })\n});\n ") : new tsInvariant.InvariantError(23);
|
|
1746
1766
|
}
|
|
1747
1767
|
};
|
|
1748
1768
|
|
|
@@ -1882,6 +1902,7 @@ var createHttpLink = function (linkOptions) {
|
|
|
1882
1902
|
options.method = 'GET';
|
|
1883
1903
|
}
|
|
1884
1904
|
if (hasDirectives(['defer'], operation.query)) {
|
|
1905
|
+
options.headers = options.headers || {};
|
|
1885
1906
|
options.headers.accept = "multipart/mixed; deferSpec=20220824, application/json";
|
|
1886
1907
|
}
|
|
1887
1908
|
if (options.method === 'GET') {
|
|
@@ -4627,7 +4648,7 @@ var ObservableQuery = (function (_super) {
|
|
|
4627
4648
|
pollingInfo.interval === pollInterval) {
|
|
4628
4649
|
return;
|
|
4629
4650
|
}
|
|
4630
|
-
__DEV__ ? tsInvariant.invariant(pollInterval, 'Attempted to start a polling query without a polling interval.') : tsInvariant.invariant(pollInterval,
|
|
4651
|
+
__DEV__ ? tsInvariant.invariant(pollInterval, 'Attempted to start a polling query without a polling interval.') : tsInvariant.invariant(pollInterval, 13);
|
|
4631
4652
|
var info = pollingInfo || (this.pollingInfo = {});
|
|
4632
4653
|
info.interval = pollInterval;
|
|
4633
4654
|
var maybeFetch = function () {
|
|
@@ -4776,6 +4797,7 @@ function logMissingFieldErrors(missing) {
|
|
|
4776
4797
|
var LocalState = (function () {
|
|
4777
4798
|
function LocalState(_a) {
|
|
4778
4799
|
var cache = _a.cache, client = _a.client, resolvers = _a.resolvers, fragmentMatcher = _a.fragmentMatcher;
|
|
4800
|
+
this.selectionsToResolveCache = new WeakMap();
|
|
4779
4801
|
this.cache = cache;
|
|
4780
4802
|
if (client) {
|
|
4781
4803
|
this.client = client;
|
|
@@ -4890,13 +4912,13 @@ var LocalState = (function () {
|
|
|
4890
4912
|
if (fragmentMatcher === void 0) { fragmentMatcher = function () { return true; }; }
|
|
4891
4913
|
if (onlyRunForcedResolvers === void 0) { onlyRunForcedResolvers = false; }
|
|
4892
4914
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
4893
|
-
var mainDefinition, fragments, fragmentMap, definitionOperation, defaultOperationType, _a, cache, client, execContext;
|
|
4915
|
+
var mainDefinition, fragments, fragmentMap, selectionsToResolve, definitionOperation, defaultOperationType, _a, cache, client, execContext, isClientFieldDescendant;
|
|
4894
4916
|
return tslib.__generator(this, function (_b) {
|
|
4895
4917
|
mainDefinition = getMainDefinition(document);
|
|
4896
4918
|
fragments = getFragmentDefinitions(document);
|
|
4897
4919
|
fragmentMap = createFragmentMap(fragments);
|
|
4898
|
-
|
|
4899
|
-
|
|
4920
|
+
selectionsToResolve = this.collectSelectionsToResolve(mainDefinition, fragmentMap);
|
|
4921
|
+
definitionOperation = mainDefinition.operation;
|
|
4900
4922
|
defaultOperationType = definitionOperation
|
|
4901
4923
|
? definitionOperation.charAt(0).toUpperCase() +
|
|
4902
4924
|
definitionOperation.slice(1)
|
|
@@ -4909,16 +4931,18 @@ var LocalState = (function () {
|
|
|
4909
4931
|
fragmentMatcher: fragmentMatcher,
|
|
4910
4932
|
defaultOperationType: defaultOperationType,
|
|
4911
4933
|
exportedVariables: {},
|
|
4934
|
+
selectionsToResolve: selectionsToResolve,
|
|
4912
4935
|
onlyRunForcedResolvers: onlyRunForcedResolvers,
|
|
4913
4936
|
};
|
|
4914
|
-
|
|
4937
|
+
isClientFieldDescendant = false;
|
|
4938
|
+
return [2, this.resolveSelectionSet(mainDefinition.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (result) { return ({
|
|
4915
4939
|
result: result,
|
|
4916
4940
|
exportedVariables: execContext.exportedVariables,
|
|
4917
4941
|
}); })];
|
|
4918
4942
|
});
|
|
4919
4943
|
});
|
|
4920
4944
|
};
|
|
4921
|
-
LocalState.prototype.resolveSelectionSet = function (selectionSet, rootValue, execContext) {
|
|
4945
|
+
LocalState.prototype.resolveSelectionSet = function (selectionSet, isClientFieldDescendant, rootValue, execContext) {
|
|
4922
4946
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
4923
4947
|
var fragmentMap, context, variables, resultsToMerge, execute;
|
|
4924
4948
|
var _this = this;
|
|
@@ -4928,11 +4952,14 @@ var LocalState = (function () {
|
|
|
4928
4952
|
execute = function (selection) { return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
4929
4953
|
var fragment, typeCondition;
|
|
4930
4954
|
return tslib.__generator(this, function (_a) {
|
|
4955
|
+
if (!isClientFieldDescendant && !execContext.selectionsToResolve.has(selection)) {
|
|
4956
|
+
return [2];
|
|
4957
|
+
}
|
|
4931
4958
|
if (!shouldInclude(selection, variables)) {
|
|
4932
4959
|
return [2];
|
|
4933
4960
|
}
|
|
4934
4961
|
if (isField(selection)) {
|
|
4935
|
-
return [2, this.resolveField(selection, rootValue, execContext).then(function (fieldResult) {
|
|
4962
|
+
return [2, this.resolveField(selection, isClientFieldDescendant, rootValue, execContext).then(function (fieldResult) {
|
|
4936
4963
|
var _a;
|
|
4937
4964
|
if (typeof fieldResult !== 'undefined') {
|
|
4938
4965
|
resultsToMerge.push((_a = {},
|
|
@@ -4951,7 +4978,7 @@ var LocalState = (function () {
|
|
|
4951
4978
|
if (fragment && fragment.typeCondition) {
|
|
4952
4979
|
typeCondition = fragment.typeCondition.name.value;
|
|
4953
4980
|
if (execContext.fragmentMatcher(rootValue, typeCondition, context)) {
|
|
4954
|
-
return [2, this.resolveSelectionSet(fragment.selectionSet, rootValue, execContext).then(function (fragmentResult) {
|
|
4981
|
+
return [2, this.resolveSelectionSet(fragment.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (fragmentResult) {
|
|
4955
4982
|
resultsToMerge.push(fragmentResult);
|
|
4956
4983
|
})];
|
|
4957
4984
|
}
|
|
@@ -4965,11 +4992,14 @@ var LocalState = (function () {
|
|
|
4965
4992
|
});
|
|
4966
4993
|
});
|
|
4967
4994
|
};
|
|
4968
|
-
LocalState.prototype.resolveField = function (field, rootValue, execContext) {
|
|
4995
|
+
LocalState.prototype.resolveField = function (field, isClientFieldDescendant, rootValue, execContext) {
|
|
4969
4996
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
4970
4997
|
var variables, fieldName, aliasedFieldName, aliasUsed, defaultResult, resultPromise, resolverType, resolverMap, resolve;
|
|
4971
4998
|
var _this = this;
|
|
4972
4999
|
return tslib.__generator(this, function (_a) {
|
|
5000
|
+
if (!rootValue) {
|
|
5001
|
+
return [2, null];
|
|
5002
|
+
}
|
|
4973
5003
|
variables = execContext.variables;
|
|
4974
5004
|
fieldName = field.name.value;
|
|
4975
5005
|
aliasedFieldName = resultKeyNameFromField(field);
|
|
@@ -4993,6 +5023,7 @@ var LocalState = (function () {
|
|
|
4993
5023
|
}
|
|
4994
5024
|
}
|
|
4995
5025
|
return [2, resultPromise.then(function (result) {
|
|
5026
|
+
var _a, _b;
|
|
4996
5027
|
if (result === void 0) { result = defaultResult; }
|
|
4997
5028
|
if (field.directives) {
|
|
4998
5029
|
field.directives.forEach(function (directive) {
|
|
@@ -5011,30 +5042,70 @@ var LocalState = (function () {
|
|
|
5011
5042
|
if (result == null) {
|
|
5012
5043
|
return result;
|
|
5013
5044
|
}
|
|
5045
|
+
var isClientField = (_b = (_a = field.directives) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d.name.value === 'client'; })) !== null && _b !== void 0 ? _b : false;
|
|
5014
5046
|
if (Array.isArray(result)) {
|
|
5015
|
-
return _this.resolveSubSelectedArray(field, result, execContext);
|
|
5047
|
+
return _this.resolveSubSelectedArray(field, isClientFieldDescendant || isClientField, result, execContext);
|
|
5016
5048
|
}
|
|
5017
5049
|
if (field.selectionSet) {
|
|
5018
|
-
return _this.resolveSelectionSet(field.selectionSet, result, execContext);
|
|
5050
|
+
return _this.resolveSelectionSet(field.selectionSet, isClientFieldDescendant || isClientField, result, execContext);
|
|
5019
5051
|
}
|
|
5020
5052
|
})];
|
|
5021
5053
|
});
|
|
5022
5054
|
});
|
|
5023
5055
|
};
|
|
5024
|
-
LocalState.prototype.resolveSubSelectedArray = function (field, result, execContext) {
|
|
5056
|
+
LocalState.prototype.resolveSubSelectedArray = function (field, isClientFieldDescendant, result, execContext) {
|
|
5025
5057
|
var _this = this;
|
|
5026
5058
|
return Promise.all(result.map(function (item) {
|
|
5027
5059
|
if (item === null) {
|
|
5028
5060
|
return null;
|
|
5029
5061
|
}
|
|
5030
5062
|
if (Array.isArray(item)) {
|
|
5031
|
-
return _this.resolveSubSelectedArray(field, item, execContext);
|
|
5063
|
+
return _this.resolveSubSelectedArray(field, isClientFieldDescendant, item, execContext);
|
|
5032
5064
|
}
|
|
5033
5065
|
if (field.selectionSet) {
|
|
5034
|
-
return _this.resolveSelectionSet(field.selectionSet, item, execContext);
|
|
5066
|
+
return _this.resolveSelectionSet(field.selectionSet, isClientFieldDescendant, item, execContext);
|
|
5035
5067
|
}
|
|
5036
5068
|
}));
|
|
5037
5069
|
};
|
|
5070
|
+
LocalState.prototype.collectSelectionsToResolve = function (mainDefinition, fragmentMap) {
|
|
5071
|
+
var isSingleASTNode = function (node) { return !Array.isArray(node); };
|
|
5072
|
+
var selectionsToResolveCache = this.selectionsToResolveCache;
|
|
5073
|
+
function collectByDefinition(definitionNode) {
|
|
5074
|
+
if (!selectionsToResolveCache.has(definitionNode)) {
|
|
5075
|
+
var matches_1 = new Set();
|
|
5076
|
+
selectionsToResolveCache.set(definitionNode, matches_1);
|
|
5077
|
+
graphql.visit(definitionNode, {
|
|
5078
|
+
Directive: function (node, _, __, ___, ancestors) {
|
|
5079
|
+
if (node.name.value === 'client') {
|
|
5080
|
+
ancestors.forEach(function (node) {
|
|
5081
|
+
if (isSingleASTNode(node) && graphql.isSelectionNode(node)) {
|
|
5082
|
+
matches_1.add(node);
|
|
5083
|
+
}
|
|
5084
|
+
});
|
|
5085
|
+
}
|
|
5086
|
+
},
|
|
5087
|
+
FragmentSpread: function (spread, _, __, ___, ancestors) {
|
|
5088
|
+
var fragment = fragmentMap[spread.name.value];
|
|
5089
|
+
__DEV__ ? tsInvariant.invariant(fragment, "No fragment named ".concat(spread.name.value)) : tsInvariant.invariant(fragment, 12);
|
|
5090
|
+
var fragmentSelections = collectByDefinition(fragment);
|
|
5091
|
+
if (fragmentSelections.size > 0) {
|
|
5092
|
+
ancestors.forEach(function (node) {
|
|
5093
|
+
if (isSingleASTNode(node) && graphql.isSelectionNode(node)) {
|
|
5094
|
+
matches_1.add(node);
|
|
5095
|
+
}
|
|
5096
|
+
});
|
|
5097
|
+
matches_1.add(spread);
|
|
5098
|
+
fragmentSelections.forEach(function (selection) {
|
|
5099
|
+
matches_1.add(selection);
|
|
5100
|
+
});
|
|
5101
|
+
}
|
|
5102
|
+
}
|
|
5103
|
+
});
|
|
5104
|
+
}
|
|
5105
|
+
return selectionsToResolveCache.get(definitionNode);
|
|
5106
|
+
}
|
|
5107
|
+
return collectByDefinition(mainDefinition);
|
|
5108
|
+
};
|
|
5038
5109
|
return LocalState;
|
|
5039
5110
|
}());
|
|
5040
5111
|
|
|
@@ -5345,7 +5416,7 @@ var QueryManager = (function () {
|
|
|
5345
5416
|
this.queries.forEach(function (_info, queryId) {
|
|
5346
5417
|
_this.stopQueryNoBroadcast(queryId);
|
|
5347
5418
|
});
|
|
5348
|
-
this.cancelPendingFetches(__DEV__ ? new tsInvariant.InvariantError('QueryManager stopped while query was in flight') : new tsInvariant.InvariantError(
|
|
5419
|
+
this.cancelPendingFetches(__DEV__ ? new tsInvariant.InvariantError('QueryManager stopped while query was in flight') : new tsInvariant.InvariantError(14));
|
|
5349
5420
|
};
|
|
5350
5421
|
QueryManager.prototype.cancelPendingFetches = function (error) {
|
|
5351
5422
|
this.fetchCancelFns.forEach(function (cancel) { return cancel(error); });
|
|
@@ -5359,10 +5430,10 @@ var QueryManager = (function () {
|
|
|
5359
5430
|
return tslib.__generator(this, function (_j) {
|
|
5360
5431
|
switch (_j.label) {
|
|
5361
5432
|
case 0:
|
|
5362
|
-
__DEV__ ? tsInvariant.invariant(mutation, 'mutation option is required. You must specify your GraphQL document in the mutation option.') : tsInvariant.invariant(mutation,
|
|
5433
|
+
__DEV__ ? tsInvariant.invariant(mutation, 'mutation option is required. You must specify your GraphQL document in the mutation option.') : tsInvariant.invariant(mutation, 15);
|
|
5363
5434
|
__DEV__ ? tsInvariant.invariant(fetchPolicy === 'network-only' ||
|
|
5364
5435
|
fetchPolicy === 'no-cache', "Mutations support only 'network-only' or 'no-cache' fetchPolicy strings. The default `network-only` behavior automatically writes mutation results to the cache. Passing `no-cache` skips the cache write.") : tsInvariant.invariant(fetchPolicy === 'network-only' ||
|
|
5365
|
-
fetchPolicy === 'no-cache',
|
|
5436
|
+
fetchPolicy === 'no-cache', 16);
|
|
5366
5437
|
mutationId = this.generateMutationId();
|
|
5367
5438
|
_h = this.transform(mutation), document = _h.document, hasClientExports = _h.hasClientExports;
|
|
5368
5439
|
mutation = this.cache.transformForLink(document);
|
|
@@ -5479,7 +5550,10 @@ var QueryManager = (function () {
|
|
|
5479
5550
|
optimistic: false,
|
|
5480
5551
|
returnPartialData: true,
|
|
5481
5552
|
});
|
|
5482
|
-
var mergedData =
|
|
5553
|
+
var mergedData = void 0;
|
|
5554
|
+
if (diff.result) {
|
|
5555
|
+
mergedData = mergeIncrementalData(diff.result, result);
|
|
5556
|
+
}
|
|
5483
5557
|
if (typeof mergedData !== 'undefined') {
|
|
5484
5558
|
result.data = mergedData;
|
|
5485
5559
|
cacheWrites.push({
|
|
@@ -5683,10 +5757,10 @@ var QueryManager = (function () {
|
|
|
5683
5757
|
var _this = this;
|
|
5684
5758
|
if (queryId === void 0) { queryId = this.generateQueryId(); }
|
|
5685
5759
|
__DEV__ ? tsInvariant.invariant(options.query, 'query option is required. You must specify your GraphQL document ' +
|
|
5686
|
-
'in the query option.') : tsInvariant.invariant(options.query,
|
|
5687
|
-
__DEV__ ? tsInvariant.invariant(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.') : tsInvariant.invariant(options.query.kind === 'Document',
|
|
5688
|
-
__DEV__ ? tsInvariant.invariant(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.') : tsInvariant.invariant(!options.returnPartialData,
|
|
5689
|
-
__DEV__ ? tsInvariant.invariant(!options.pollInterval, 'pollInterval option only supported on watchQuery.') : tsInvariant.invariant(!options.pollInterval,
|
|
5760
|
+
'in the query option.') : tsInvariant.invariant(options.query, 17);
|
|
5761
|
+
__DEV__ ? tsInvariant.invariant(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.') : tsInvariant.invariant(options.query.kind === 'Document', 18);
|
|
5762
|
+
__DEV__ ? tsInvariant.invariant(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.') : tsInvariant.invariant(!options.returnPartialData, 19);
|
|
5763
|
+
__DEV__ ? tsInvariant.invariant(!options.pollInterval, 'pollInterval option only supported on watchQuery.') : tsInvariant.invariant(!options.pollInterval, 20);
|
|
5690
5764
|
return this.fetchQuery(queryId, options).finally(function () { return _this.stopQuery(queryId); });
|
|
5691
5765
|
};
|
|
5692
5766
|
QueryManager.prototype.generateQueryId = function () {
|
|
@@ -5711,7 +5785,7 @@ var QueryManager = (function () {
|
|
|
5711
5785
|
if (options === void 0) { options = {
|
|
5712
5786
|
discardWatches: true,
|
|
5713
5787
|
}; }
|
|
5714
|
-
this.cancelPendingFetches(__DEV__ ? new tsInvariant.InvariantError('Store reset while query was in flight (not completed in link chain)') : new tsInvariant.InvariantError(
|
|
5788
|
+
this.cancelPendingFetches(__DEV__ ? new tsInvariant.InvariantError('Store reset while query was in flight (not completed in link chain)') : new tsInvariant.InvariantError(21));
|
|
5715
5789
|
this.queries.forEach(function (queryInfo) {
|
|
5716
5790
|
if (queryInfo.observableQuery) {
|
|
5717
5791
|
queryInfo.networkStatus = exports.NetworkStatus.loading;
|
|
@@ -6099,6 +6173,11 @@ var QueryManager = (function () {
|
|
|
6099
6173
|
onlyRunForcedResolvers: true,
|
|
6100
6174
|
}).then(function (resolved) { return fromData(resolved.data || void 0); });
|
|
6101
6175
|
}
|
|
6176
|
+
if (errorPolicy === 'none' &&
|
|
6177
|
+
networkStatus === exports.NetworkStatus.refetch &&
|
|
6178
|
+
Array.isArray(diff.missing)) {
|
|
6179
|
+
return fromData(void 0);
|
|
6180
|
+
}
|
|
6102
6181
|
return fromData(data);
|
|
6103
6182
|
};
|
|
6104
6183
|
var cacheWriteBehavior = fetchPolicy === "no-cache" ? 0 :
|
|
@@ -6435,7 +6514,7 @@ var ApolloConsumer = function (props) {
|
|
|
6435
6514
|
var ApolloContext = getApolloContext();
|
|
6436
6515
|
return (React__namespace.createElement(ApolloContext.Consumer, null, function (context) {
|
|
6437
6516
|
__DEV__ ? tsInvariant.invariant(context && context.client, 'Could not find "client" in the context of ApolloConsumer. ' +
|
|
6438
|
-
'Wrap the root component in an <ApolloProvider>.') : tsInvariant.invariant(context && context.client,
|
|
6517
|
+
'Wrap the root component in an <ApolloProvider>.') : tsInvariant.invariant(context && context.client, 28);
|
|
6439
6518
|
return props.children(context.client);
|
|
6440
6519
|
}));
|
|
6441
6520
|
};
|
|
@@ -6452,7 +6531,7 @@ var ApolloProvider = function (_a) {
|
|
|
6452
6531
|
context = Object.assign({}, context, { suspenseCache: suspenseCache });
|
|
6453
6532
|
}
|
|
6454
6533
|
__DEV__ ? tsInvariant.invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +
|
|
6455
|
-
'sure you pass in your client via the "client" prop.') : tsInvariant.invariant(context.client,
|
|
6534
|
+
'sure you pass in your client via the "client" prop.') : tsInvariant.invariant(context.client, 29);
|
|
6456
6535
|
return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children));
|
|
6457
6536
|
}));
|
|
6458
6537
|
};
|
|
@@ -6462,7 +6541,7 @@ function useApolloClient(override) {
|
|
|
6462
6541
|
var client = override || context.client;
|
|
6463
6542
|
__DEV__ ? tsInvariant.invariant(!!client, 'Could not find "client" in the context or passed in as an option. ' +
|
|
6464
6543
|
'Wrap the root component in an <ApolloProvider>, or pass an ApolloClient ' +
|
|
6465
|
-
'instance in via options.') : tsInvariant.invariant(!!client,
|
|
6544
|
+
'instance in via options.') : tsInvariant.invariant(!!client, 32);
|
|
6466
6545
|
return client;
|
|
6467
6546
|
}
|
|
6468
6547
|
|
|
@@ -6540,7 +6619,7 @@ function parser(document) {
|
|
|
6540
6619
|
var variables, type, name;
|
|
6541
6620
|
__DEV__ ? tsInvariant.invariant(!!document && !!document.kind, "Argument of ".concat(document, " passed to parser was not a valid GraphQL ") +
|
|
6542
6621
|
"DocumentNode. You may need to use 'graphql-tag' or another method " +
|
|
6543
|
-
"to convert your operation into a document") : tsInvariant.invariant(!!document && !!document.kind,
|
|
6622
|
+
"to convert your operation into a document") : tsInvariant.invariant(!!document && !!document.kind, 35);
|
|
6544
6623
|
var fragments = [];
|
|
6545
6624
|
var queries = [];
|
|
6546
6625
|
var mutations = [];
|
|
@@ -6568,11 +6647,11 @@ function parser(document) {
|
|
|
6568
6647
|
__DEV__ ? tsInvariant.invariant(!fragments.length ||
|
|
6569
6648
|
(queries.length || mutations.length || subscriptions.length), "Passing only a fragment to 'graphql' is not yet supported. " +
|
|
6570
6649
|
"You must include a query, subscription or mutation as well") : tsInvariant.invariant(!fragments.length ||
|
|
6571
|
-
(queries.length || mutations.length || subscriptions.length),
|
|
6650
|
+
(queries.length || mutations.length || subscriptions.length), 36);
|
|
6572
6651
|
__DEV__ ? tsInvariant.invariant(queries.length + mutations.length + subscriptions.length <= 1, "react-apollo only supports a query, subscription, or a mutation per HOC. " +
|
|
6573
6652
|
"".concat(document, " had ").concat(queries.length, " queries, ").concat(subscriptions.length, " ") +
|
|
6574
6653
|
"subscriptions and ".concat(mutations.length, " mutations. ") +
|
|
6575
|
-
"You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(queries.length + mutations.length + subscriptions.length <= 1,
|
|
6654
|
+
"You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(queries.length + mutations.length + subscriptions.length <= 1, 37);
|
|
6576
6655
|
type = queries.length ? exports.DocumentType.Query : exports.DocumentType.Mutation;
|
|
6577
6656
|
if (!queries.length && !mutations.length)
|
|
6578
6657
|
type = exports.DocumentType.Subscription;
|
|
@@ -6583,7 +6662,7 @@ function parser(document) {
|
|
|
6583
6662
|
: subscriptions;
|
|
6584
6663
|
__DEV__ ? tsInvariant.invariant(definitions.length === 1, "react-apollo only supports one definition per HOC. ".concat(document, " had ") +
|
|
6585
6664
|
"".concat(definitions.length, " definitions. ") +
|
|
6586
|
-
"You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(definitions.length === 1,
|
|
6665
|
+
"You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(definitions.length === 1, 38);
|
|
6587
6666
|
var definition = definitions[0];
|
|
6588
6667
|
variables = definition.variableDefinitions || [];
|
|
6589
6668
|
if (definition.name && definition.name.kind === 'Name') {
|
|
@@ -6601,7 +6680,7 @@ function verifyDocumentType(document, type) {
|
|
|
6601
6680
|
var requiredOperationName = operationName(type);
|
|
6602
6681
|
var usedOperationName = operationName(operation.type);
|
|
6603
6682
|
__DEV__ ? tsInvariant.invariant(operation.type === type, "Running a ".concat(requiredOperationName, " requires a graphql ") +
|
|
6604
|
-
"".concat(requiredOperationName, ", but a ").concat(usedOperationName, " was used instead.")) : tsInvariant.invariant(operation.type === type,
|
|
6683
|
+
"".concat(requiredOperationName, ", but a ").concat(usedOperationName, " was used instead.")) : tsInvariant.invariant(operation.type === type, 39);
|
|
6605
6684
|
}
|
|
6606
6685
|
|
|
6607
6686
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
@@ -6903,12 +6982,11 @@ var EAGER_METHODS = [
|
|
|
6903
6982
|
'subscribeToMore',
|
|
6904
6983
|
];
|
|
6905
6984
|
function useLazyQuery(query, options) {
|
|
6985
|
+
var _a, _b;
|
|
6906
6986
|
var abortControllersRef = React.useRef(new Set());
|
|
6907
|
-
var internalState = useInternalState(useApolloClient(options && options.client), query);
|
|
6908
6987
|
var execOptionsRef = React.useRef();
|
|
6909
|
-
var merged = execOptionsRef.current
|
|
6910
|
-
|
|
6911
|
-
: options;
|
|
6988
|
+
var merged = execOptionsRef.current ? mergeOptions(options, execOptionsRef.current) : options;
|
|
6989
|
+
var internalState = useInternalState(useApolloClient(options && options.client), (_b = (_a = execOptionsRef.current) === null || _a === void 0 ? void 0 : _a.query) !== null && _b !== void 0 ? _b : query);
|
|
6912
6990
|
var useQueryResult = internalState.useQuery(tslib.__assign(tslib.__assign({}, merged), { skip: !execOptionsRef.current }));
|
|
6913
6991
|
var initialFetchPolicy = useQueryResult.observable.options.initialFetchPolicy ||
|
|
6914
6992
|
internalState.getDefaultFetchPolicy();
|
|
@@ -7211,20 +7289,21 @@ function useFragment_experimental(options) {
|
|
|
7211
7289
|
var diffOptions = tslib.__assign(tslib.__assign({}, rest), { id: typeof from === "string" ? from : cache.identify(from), query: cache["getFragmentDoc"](fragment, fragmentName), optimistic: optimistic });
|
|
7212
7290
|
var resultRef = React.useRef();
|
|
7213
7291
|
var latestDiff = cache.diff(diffOptions);
|
|
7292
|
+
var getSnapshot = function () {
|
|
7293
|
+
var latestDiffToResult = diffToResult(latestDiff);
|
|
7294
|
+
return resultRef.current &&
|
|
7295
|
+
equality.equal(resultRef.current.data, latestDiffToResult.data)
|
|
7296
|
+
? resultRef.current
|
|
7297
|
+
: (resultRef.current = latestDiffToResult);
|
|
7298
|
+
};
|
|
7214
7299
|
return useSyncExternalStore(function (forceUpdate) {
|
|
7215
7300
|
return cache.watch(tslib.__assign(tslib.__assign({}, diffOptions), { immediate: true, callback: function (diff) {
|
|
7216
7301
|
if (!equality.equal(diff, latestDiff)) {
|
|
7217
|
-
resultRef.current = diffToResult(latestDiff = diff);
|
|
7302
|
+
resultRef.current = diffToResult((latestDiff = diff));
|
|
7218
7303
|
forceUpdate();
|
|
7219
7304
|
}
|
|
7220
7305
|
} }));
|
|
7221
|
-
},
|
|
7222
|
-
var latestDiffToResult = diffToResult(latestDiff);
|
|
7223
|
-
return resultRef.current &&
|
|
7224
|
-
equality.equal(resultRef.current.data, latestDiffToResult.data)
|
|
7225
|
-
? resultRef.current
|
|
7226
|
-
: (resultRef.current = latestDiffToResult);
|
|
7227
|
-
});
|
|
7306
|
+
}, getSnapshot, getSnapshot);
|
|
7228
7307
|
}
|
|
7229
7308
|
function diffToResult(diff) {
|
|
7230
7309
|
var result = {
|
|
@@ -7252,7 +7331,7 @@ var useIsomorphicLayoutEffect = canUseLayoutEffect
|
|
|
7252
7331
|
function useSuspenseCache() {
|
|
7253
7332
|
var suspenseCache = React.useContext(getApolloContext()).suspenseCache;
|
|
7254
7333
|
__DEV__ ? tsInvariant.invariant(suspenseCache, 'Could not find a "suspenseCache" in the context. Wrap the root component ' +
|
|
7255
|
-
'in an <ApolloProvider> and provide a suspenseCache.') : tsInvariant.invariant(suspenseCache,
|
|
7334
|
+
'in an <ApolloProvider> and provide a suspenseCache.') : tsInvariant.invariant(suspenseCache, 33);
|
|
7256
7335
|
return suspenseCache;
|
|
7257
7336
|
}
|
|
7258
7337
|
|
|
@@ -7348,7 +7427,7 @@ function validateOptions(options) {
|
|
|
7348
7427
|
validatePartialDataReturn(fetchPolicy, returnPartialData);
|
|
7349
7428
|
}
|
|
7350
7429
|
function validateFetchPolicy(fetchPolicy) {
|
|
7351
|
-
__DEV__ ? tsInvariant.invariant(SUPPORTED_FETCH_POLICIES.includes(fetchPolicy), "The fetch policy `".concat(fetchPolicy, "` is not supported with suspense.")) : tsInvariant.invariant(SUPPORTED_FETCH_POLICIES.includes(fetchPolicy),
|
|
7430
|
+
__DEV__ ? tsInvariant.invariant(SUPPORTED_FETCH_POLICIES.includes(fetchPolicy), "The fetch policy `".concat(fetchPolicy, "` is not supported with suspense.")) : tsInvariant.invariant(SUPPORTED_FETCH_POLICIES.includes(fetchPolicy), 34);
|
|
7352
7431
|
}
|
|
7353
7432
|
function validatePartialDataReturn(fetchPolicy, returnPartialData) {
|
|
7354
7433
|
if (fetchPolicy === 'no-cache' && returnPartialData) {
|