@apollo/client 3.7.5 → 3.7.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 +108 -56
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- 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/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.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.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/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.map +1 -1
- package/core/ApolloClient.d.ts +5 -5
- package/core/ApolloClient.d.ts.map +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 +64 -14
- 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 +1 -1
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +1 -1
- package/core/QueryInfo.d.ts.map +1 -1
- package/core/QueryManager.d.ts +7 -7
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js +12 -9
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +77 -24
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +77 -24
- package/core/types.d.ts +16 -16
- package/core/types.d.ts.map +1 -1
- package/core/watchQueryOptions.d.ts +9 -9
- 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 +48 -43
- 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 +1 -1
- package/link/context/index.d.ts.map +1 -1
- package/link/core/ApolloLink.js +1 -1
- package/link/core/core.cjs +1 -1
- package/link/core/core.cjs.map +1 -1
- package/link/core/core.cjs.native.js +1 -1
- package/link/core/types.d.ts +6 -6
- package/link/core/types.d.ts.map +1 -1
- package/link/http/checkFetcher.js +1 -1
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/http.cjs +2 -2
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +2 -2
- 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/serializeFetchParameter.d.ts +1 -1
- package/link/http/serializeFetchParameter.d.ts.map +1 -1
- package/link/http/serializeFetchParameter.js +1 -1
- 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 +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/throwServerError.d.ts +1 -1
- package/link/utils/throwServerError.d.ts.map +1 -1
- package/link/utils/utils.cjs +1 -1
- package/link/utils/utils.cjs.map +1 -1
- package/link/utils/utils.cjs.native.js +1 -1
- package/link/utils/validateOperation.js +1 -1
- package/package.json +9 -9
- 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 +1 -1
- package/react/context/ApolloProvider.js +1 -1
- package/react/context/context.cjs +2 -2
- package/react/context/context.cjs.map +1 -1
- package/react/context/context.cjs.native.js +2 -2
- 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 +1 -1
- package/react/hoc/hoc.cjs +2 -2
- package/react/hoc/hoc.cjs.map +1 -1
- package/react/hoc/hoc.cjs.native.js +2 -2
- package/react/hoc/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 +1 -1
- package/react/hooks/hooks.cjs +4 -5
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +4 -5
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useLazyQuery.d.ts +1 -1
- 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/useQuery.d.ts +3 -3
- package/react/hooks/useQuery.d.ts.map +1 -1
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useSubscription.d.ts +1 -1
- package/react/hooks/useSubscription.d.ts.map +1 -1
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSyncExternalStore.d.ts +1 -1
- package/react/hooks/useSyncExternalStore.d.ts.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 +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 +17 -17
- 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 +6 -2
- package/testing/core/mocking/mockLink.d.ts.map +1 -1
- package/testing/core/mocking/mockLink.js +13 -3
- 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/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/globals.cjs +1 -1
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +1 -1
- package/utilities/globals/index.js +1 -1
- package/utilities/graphql/directives.d.ts +2 -2
- package/utilities/graphql/directives.d.ts.map +1 -1
- package/utilities/graphql/directives.js +4 -4
- 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 +3 -3
- package/utilities/graphql/getFromAST.js +8 -8
- 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.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 +16 -16
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +16 -16
- 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
|
@@ -45,7 +45,7 @@ function shouldInclude(_a, variables) {
|
|
|
45
45
|
var evaledValue = false;
|
|
46
46
|
if (ifArgument.value.kind === 'Variable') {
|
|
47
47
|
evaledValue = variables && variables[ifArgument.value.name.value];
|
|
48
|
-
__DEV__ ? tsInvariant.invariant(evaledValue !== void 0, "Invalid variable referenced in @".concat(directive.name.value, " directive.")) : tsInvariant.invariant(evaledValue !== void 0,
|
|
48
|
+
__DEV__ ? tsInvariant.invariant(evaledValue !== void 0, "Invalid variable referenced in @".concat(directive.name.value, " directive.")) : tsInvariant.invariant(evaledValue !== void 0, 40);
|
|
49
49
|
}
|
|
50
50
|
else {
|
|
51
51
|
evaledValue = ifArgument.value.value;
|
|
@@ -81,13 +81,13 @@ function getInclusionDirectives(directives) {
|
|
|
81
81
|
return;
|
|
82
82
|
var directiveArguments = directive.arguments;
|
|
83
83
|
var directiveName = directive.name.value;
|
|
84
|
-
__DEV__ ? tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @".concat(directiveName, " directive.")) : tsInvariant.invariant(directiveArguments && directiveArguments.length === 1,
|
|
84
|
+
__DEV__ ? tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @".concat(directiveName, " directive.")) : tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, 41);
|
|
85
85
|
var ifArgument = directiveArguments[0];
|
|
86
|
-
__DEV__ ? tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @".concat(directiveName, " directive.")) : tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if',
|
|
86
|
+
__DEV__ ? tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @".concat(directiveName, " directive.")) : tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', 42);
|
|
87
87
|
var ifValue = ifArgument.value;
|
|
88
88
|
__DEV__ ? tsInvariant.invariant(ifValue &&
|
|
89
89
|
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @".concat(directiveName, " directive must be a variable or a boolean value.")) : tsInvariant.invariant(ifValue &&
|
|
90
|
-
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'),
|
|
90
|
+
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 43);
|
|
91
91
|
result.push({ directive: directive, ifArgument: ifArgument });
|
|
92
92
|
});
|
|
93
93
|
}
|
|
@@ -100,14 +100,14 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
100
100
|
document.definitions.forEach(function (definition) {
|
|
101
101
|
if (definition.kind === 'OperationDefinition') {
|
|
102
102
|
throw __DEV__ ? new tsInvariant.InvariantError("Found a ".concat(definition.operation, " operation").concat(definition.name ? " named '".concat(definition.name.value, "'") : '', ". ") +
|
|
103
|
-
'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new tsInvariant.InvariantError(
|
|
103
|
+
'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new tsInvariant.InvariantError(44);
|
|
104
104
|
}
|
|
105
105
|
if (definition.kind === 'FragmentDefinition') {
|
|
106
106
|
fragments.push(definition);
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
109
|
if (typeof actualFragmentName === 'undefined') {
|
|
110
|
-
__DEV__ ? tsInvariant.invariant(fragments.length === 1, "Found ".concat(fragments.length, " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")) : tsInvariant.invariant(fragments.length === 1,
|
|
110
|
+
__DEV__ ? tsInvariant.invariant(fragments.length === 1, "Found ".concat(fragments.length, " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")) : tsInvariant.invariant(fragments.length === 1, 45);
|
|
111
111
|
actualFragmentName = fragments[0].name.value;
|
|
112
112
|
}
|
|
113
113
|
var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
|
|
@@ -148,7 +148,7 @@ function getFragmentFromSelection(selection, fragmentMap) {
|
|
|
148
148
|
return fragmentMap(fragmentName);
|
|
149
149
|
}
|
|
150
150
|
var fragment = fragmentMap && fragmentMap[fragmentName];
|
|
151
|
-
__DEV__ ? tsInvariant.invariant(fragment, "No fragment named ".concat(fragmentName)) : tsInvariant.invariant(fragment,
|
|
151
|
+
__DEV__ ? tsInvariant.invariant(fragment, "No fragment named ".concat(fragmentName)) : tsInvariant.invariant(fragment, 46);
|
|
152
152
|
return fragment || null;
|
|
153
153
|
}
|
|
154
154
|
default:
|
|
@@ -232,7 +232,7 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
|
|
|
232
232
|
else {
|
|
233
233
|
throw __DEV__ ? new tsInvariant.InvariantError("The inline argument \"".concat(name.value, "\" of kind \"").concat(value.kind, "\"") +
|
|
234
234
|
'is not supported. Use variables instead of inline arguments to ' +
|
|
235
|
-
'overcome this limitation.') : new tsInvariant.InvariantError(
|
|
235
|
+
'overcome this limitation.') : new tsInvariant.InvariantError(55);
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
238
|
function storeKeyNameFromField(field, variables) {
|
|
@@ -366,16 +366,16 @@ function isInlineFragment(selection) {
|
|
|
366
366
|
}
|
|
367
367
|
|
|
368
368
|
function checkDocument(doc) {
|
|
369
|
-
__DEV__ ? tsInvariant.invariant(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : tsInvariant.invariant(doc && doc.kind === 'Document',
|
|
369
|
+
__DEV__ ? tsInvariant.invariant(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : tsInvariant.invariant(doc && doc.kind === 'Document', 47);
|
|
370
370
|
var operations = doc.definitions
|
|
371
371
|
.filter(function (d) { return d.kind !== 'FragmentDefinition'; })
|
|
372
372
|
.map(function (definition) {
|
|
373
373
|
if (definition.kind !== 'OperationDefinition') {
|
|
374
|
-
throw __DEV__ ? new tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"".concat(definition.kind, "\"")) : new tsInvariant.InvariantError(
|
|
374
|
+
throw __DEV__ ? new tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"".concat(definition.kind, "\"")) : new tsInvariant.InvariantError(48);
|
|
375
375
|
}
|
|
376
376
|
return definition;
|
|
377
377
|
});
|
|
378
|
-
__DEV__ ? tsInvariant.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains ".concat(operations.length, " operations")) : tsInvariant.invariant(operations.length <= 1,
|
|
378
|
+
__DEV__ ? tsInvariant.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains ".concat(operations.length, " operations")) : tsInvariant.invariant(operations.length <= 1, 49);
|
|
379
379
|
return doc;
|
|
380
380
|
}
|
|
381
381
|
function getOperationDefinition(doc) {
|
|
@@ -394,14 +394,14 @@ function getFragmentDefinitions(doc) {
|
|
|
394
394
|
}
|
|
395
395
|
function getQueryDefinition(doc) {
|
|
396
396
|
var queryDef = getOperationDefinition(doc);
|
|
397
|
-
__DEV__ ? tsInvariant.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : tsInvariant.invariant(queryDef && queryDef.operation === 'query',
|
|
397
|
+
__DEV__ ? tsInvariant.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : tsInvariant.invariant(queryDef && queryDef.operation === 'query', 50);
|
|
398
398
|
return queryDef;
|
|
399
399
|
}
|
|
400
400
|
function getFragmentDefinition(doc) {
|
|
401
|
-
__DEV__ ? tsInvariant.invariant(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : tsInvariant.invariant(doc.kind === 'Document',
|
|
402
|
-
__DEV__ ? tsInvariant.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : tsInvariant.invariant(doc.definitions.length <= 1,
|
|
401
|
+
__DEV__ ? tsInvariant.invariant(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : tsInvariant.invariant(doc.kind === 'Document', 51);
|
|
402
|
+
__DEV__ ? tsInvariant.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : tsInvariant.invariant(doc.definitions.length <= 1, 52);
|
|
403
403
|
var fragmentDef = doc.definitions[0];
|
|
404
|
-
__DEV__ ? tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition',
|
|
404
|
+
__DEV__ ? tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 53);
|
|
405
405
|
return fragmentDef;
|
|
406
406
|
}
|
|
407
407
|
function getMainDefinition(queryDoc) {
|
|
@@ -424,7 +424,7 @@ function getMainDefinition(queryDoc) {
|
|
|
424
424
|
if (fragmentDefinition) {
|
|
425
425
|
return fragmentDefinition;
|
|
426
426
|
}
|
|
427
|
-
throw __DEV__ ? new tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new tsInvariant.InvariantError(
|
|
427
|
+
throw __DEV__ ? new tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new tsInvariant.InvariantError(54);
|
|
428
428
|
}
|
|
429
429
|
function getDefaultValues(definition) {
|
|
430
430
|
var defaultValues = Object.create(null);
|
|
@@ -1196,7 +1196,7 @@ function validateOperation(operation) {
|
|
|
1196
1196
|
for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {
|
|
1197
1197
|
var key = _a[_i];
|
|
1198
1198
|
if (OPERATION_FIELDS.indexOf(key) < 0) {
|
|
1199
|
-
throw __DEV__ ? new tsInvariant.InvariantError("illegal argument: ".concat(key)) : new tsInvariant.InvariantError(
|
|
1199
|
+
throw __DEV__ ? new tsInvariant.InvariantError("illegal argument: ".concat(key)) : new tsInvariant.InvariantError(27);
|
|
1200
1200
|
}
|
|
1201
1201
|
}
|
|
1202
1202
|
return operation;
|
|
@@ -1319,7 +1319,7 @@ var ApolloLink = (function () {
|
|
|
1319
1319
|
return ApolloLink.concat(this, next);
|
|
1320
1320
|
};
|
|
1321
1321
|
ApolloLink.prototype.request = function (operation, forward) {
|
|
1322
|
-
throw __DEV__ ? new tsInvariant.InvariantError('request is not implemented') : new tsInvariant.InvariantError(
|
|
1322
|
+
throw __DEV__ ? new tsInvariant.InvariantError('request is not implemented') : new tsInvariant.InvariantError(22);
|
|
1323
1323
|
};
|
|
1324
1324
|
ApolloLink.prototype.onError = function (error, observer) {
|
|
1325
1325
|
if (observer && observer.error) {
|
|
@@ -1345,7 +1345,7 @@ var concat = ApolloLink.concat;
|
|
|
1345
1345
|
|
|
1346
1346
|
var execute = ApolloLink.execute;
|
|
1347
1347
|
|
|
1348
|
-
var version = '3.7.
|
|
1348
|
+
var version = '3.7.7';
|
|
1349
1349
|
|
|
1350
1350
|
function isNodeResponse(value) {
|
|
1351
1351
|
return !!value.body;
|
|
@@ -1661,7 +1661,7 @@ var serializeFetchParameter = function (p, label) {
|
|
|
1661
1661
|
serialized = JSON.stringify(p);
|
|
1662
1662
|
}
|
|
1663
1663
|
catch (e) {
|
|
1664
|
-
var parseError = __DEV__ ? new tsInvariant.InvariantError("Network request failed. ".concat(label, " is not serializable: ").concat(e.message)) : new tsInvariant.InvariantError(
|
|
1664
|
+
var parseError = __DEV__ ? new tsInvariant.InvariantError("Network request failed. ".concat(label, " is not serializable: ").concat(e.message)) : new tsInvariant.InvariantError(24);
|
|
1665
1665
|
parseError.parseError = e;
|
|
1666
1666
|
throw parseError;
|
|
1667
1667
|
}
|
|
@@ -1744,7 +1744,7 @@ function removeDuplicateHeaders(headers, preserveHeaderCase) {
|
|
|
1744
1744
|
|
|
1745
1745
|
var checkFetcher = function (fetcher) {
|
|
1746
1746
|
if (!fetcher && typeof fetch === 'undefined') {
|
|
1747
|
-
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(
|
|
1747
|
+
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);
|
|
1748
1748
|
}
|
|
1749
1749
|
};
|
|
1750
1750
|
|
|
@@ -4622,7 +4622,7 @@ var ObservableQuery = (function (_super) {
|
|
|
4622
4622
|
pollingInfo.interval === pollInterval) {
|
|
4623
4623
|
return;
|
|
4624
4624
|
}
|
|
4625
|
-
__DEV__ ? tsInvariant.invariant(pollInterval, 'Attempted to start a polling query without a polling interval.') : tsInvariant.invariant(pollInterval,
|
|
4625
|
+
__DEV__ ? tsInvariant.invariant(pollInterval, 'Attempted to start a polling query without a polling interval.') : tsInvariant.invariant(pollInterval, 13);
|
|
4626
4626
|
var info = pollingInfo || (this.pollingInfo = {});
|
|
4627
4627
|
info.interval = pollInterval;
|
|
4628
4628
|
var maybeFetch = function () {
|
|
@@ -4768,6 +4768,7 @@ function logMissingFieldErrors(missing) {
|
|
|
4768
4768
|
var LocalState = (function () {
|
|
4769
4769
|
function LocalState(_a) {
|
|
4770
4770
|
var cache = _a.cache, client = _a.client, resolvers = _a.resolvers, fragmentMatcher = _a.fragmentMatcher;
|
|
4771
|
+
this.selectionsToResolveCache = new WeakMap();
|
|
4771
4772
|
this.cache = cache;
|
|
4772
4773
|
if (client) {
|
|
4773
4774
|
this.client = client;
|
|
@@ -4878,13 +4879,13 @@ var LocalState = (function () {
|
|
|
4878
4879
|
if (fragmentMatcher === void 0) { fragmentMatcher = function () { return true; }; }
|
|
4879
4880
|
if (onlyRunForcedResolvers === void 0) { onlyRunForcedResolvers = false; }
|
|
4880
4881
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
4881
|
-
var mainDefinition, fragments, fragmentMap, definitionOperation, defaultOperationType, _a, cache, client, execContext;
|
|
4882
|
+
var mainDefinition, fragments, fragmentMap, selectionsToResolve, definitionOperation, defaultOperationType, _a, cache, client, execContext, isClientFieldDescendant;
|
|
4882
4883
|
return tslib.__generator(this, function (_b) {
|
|
4883
4884
|
mainDefinition = getMainDefinition(document);
|
|
4884
4885
|
fragments = getFragmentDefinitions(document);
|
|
4885
4886
|
fragmentMap = createFragmentMap(fragments);
|
|
4886
|
-
|
|
4887
|
-
|
|
4887
|
+
selectionsToResolve = this.collectSelectionsToResolve(mainDefinition, fragmentMap);
|
|
4888
|
+
definitionOperation = mainDefinition.operation;
|
|
4888
4889
|
defaultOperationType = definitionOperation
|
|
4889
4890
|
? definitionOperation.charAt(0).toUpperCase() +
|
|
4890
4891
|
definitionOperation.slice(1)
|
|
@@ -4897,16 +4898,18 @@ var LocalState = (function () {
|
|
|
4897
4898
|
fragmentMatcher: fragmentMatcher,
|
|
4898
4899
|
defaultOperationType: defaultOperationType,
|
|
4899
4900
|
exportedVariables: {},
|
|
4901
|
+
selectionsToResolve: selectionsToResolve,
|
|
4900
4902
|
onlyRunForcedResolvers: onlyRunForcedResolvers,
|
|
4901
4903
|
};
|
|
4902
|
-
|
|
4904
|
+
isClientFieldDescendant = false;
|
|
4905
|
+
return [2, this.resolveSelectionSet(mainDefinition.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (result) { return ({
|
|
4903
4906
|
result: result,
|
|
4904
4907
|
exportedVariables: execContext.exportedVariables,
|
|
4905
4908
|
}); })];
|
|
4906
4909
|
});
|
|
4907
4910
|
});
|
|
4908
4911
|
};
|
|
4909
|
-
LocalState.prototype.resolveSelectionSet = function (selectionSet, rootValue, execContext) {
|
|
4912
|
+
LocalState.prototype.resolveSelectionSet = function (selectionSet, isClientFieldDescendant, rootValue, execContext) {
|
|
4910
4913
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
4911
4914
|
var fragmentMap, context, variables, resultsToMerge, execute;
|
|
4912
4915
|
var _this = this;
|
|
@@ -4916,11 +4919,14 @@ var LocalState = (function () {
|
|
|
4916
4919
|
execute = function (selection) { return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
4917
4920
|
var fragment, typeCondition;
|
|
4918
4921
|
return tslib.__generator(this, function (_a) {
|
|
4922
|
+
if (!isClientFieldDescendant && !execContext.selectionsToResolve.has(selection)) {
|
|
4923
|
+
return [2];
|
|
4924
|
+
}
|
|
4919
4925
|
if (!shouldInclude(selection, variables)) {
|
|
4920
4926
|
return [2];
|
|
4921
4927
|
}
|
|
4922
4928
|
if (isField(selection)) {
|
|
4923
|
-
return [2, this.resolveField(selection, rootValue, execContext).then(function (fieldResult) {
|
|
4929
|
+
return [2, this.resolveField(selection, isClientFieldDescendant, rootValue, execContext).then(function (fieldResult) {
|
|
4924
4930
|
var _a;
|
|
4925
4931
|
if (typeof fieldResult !== 'undefined') {
|
|
4926
4932
|
resultsToMerge.push((_a = {},
|
|
@@ -4939,7 +4945,7 @@ var LocalState = (function () {
|
|
|
4939
4945
|
if (fragment && fragment.typeCondition) {
|
|
4940
4946
|
typeCondition = fragment.typeCondition.name.value;
|
|
4941
4947
|
if (execContext.fragmentMatcher(rootValue, typeCondition, context)) {
|
|
4942
|
-
return [2, this.resolveSelectionSet(fragment.selectionSet, rootValue, execContext).then(function (fragmentResult) {
|
|
4948
|
+
return [2, this.resolveSelectionSet(fragment.selectionSet, isClientFieldDescendant, rootValue, execContext).then(function (fragmentResult) {
|
|
4943
4949
|
resultsToMerge.push(fragmentResult);
|
|
4944
4950
|
})];
|
|
4945
4951
|
}
|
|
@@ -4953,11 +4959,14 @@ var LocalState = (function () {
|
|
|
4953
4959
|
});
|
|
4954
4960
|
});
|
|
4955
4961
|
};
|
|
4956
|
-
LocalState.prototype.resolveField = function (field, rootValue, execContext) {
|
|
4962
|
+
LocalState.prototype.resolveField = function (field, isClientFieldDescendant, rootValue, execContext) {
|
|
4957
4963
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
4958
4964
|
var variables, fieldName, aliasedFieldName, aliasUsed, defaultResult, resultPromise, resolverType, resolverMap, resolve;
|
|
4959
4965
|
var _this = this;
|
|
4960
4966
|
return tslib.__generator(this, function (_a) {
|
|
4967
|
+
if (!rootValue) {
|
|
4968
|
+
return [2, null];
|
|
4969
|
+
}
|
|
4961
4970
|
variables = execContext.variables;
|
|
4962
4971
|
fieldName = field.name.value;
|
|
4963
4972
|
aliasedFieldName = resultKeyNameFromField(field);
|
|
@@ -4981,6 +4990,7 @@ var LocalState = (function () {
|
|
|
4981
4990
|
}
|
|
4982
4991
|
}
|
|
4983
4992
|
return [2, resultPromise.then(function (result) {
|
|
4993
|
+
var _a, _b;
|
|
4984
4994
|
if (result === void 0) { result = defaultResult; }
|
|
4985
4995
|
if (field.directives) {
|
|
4986
4996
|
field.directives.forEach(function (directive) {
|
|
@@ -4999,30 +5009,70 @@ var LocalState = (function () {
|
|
|
4999
5009
|
if (result == null) {
|
|
5000
5010
|
return result;
|
|
5001
5011
|
}
|
|
5012
|
+
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;
|
|
5002
5013
|
if (Array.isArray(result)) {
|
|
5003
|
-
return _this.resolveSubSelectedArray(field, result, execContext);
|
|
5014
|
+
return _this.resolveSubSelectedArray(field, isClientFieldDescendant || isClientField, result, execContext);
|
|
5004
5015
|
}
|
|
5005
5016
|
if (field.selectionSet) {
|
|
5006
|
-
return _this.resolveSelectionSet(field.selectionSet, result, execContext);
|
|
5017
|
+
return _this.resolveSelectionSet(field.selectionSet, isClientFieldDescendant || isClientField, result, execContext);
|
|
5007
5018
|
}
|
|
5008
5019
|
})];
|
|
5009
5020
|
});
|
|
5010
5021
|
});
|
|
5011
5022
|
};
|
|
5012
|
-
LocalState.prototype.resolveSubSelectedArray = function (field, result, execContext) {
|
|
5023
|
+
LocalState.prototype.resolveSubSelectedArray = function (field, isClientFieldDescendant, result, execContext) {
|
|
5013
5024
|
var _this = this;
|
|
5014
5025
|
return Promise.all(result.map(function (item) {
|
|
5015
5026
|
if (item === null) {
|
|
5016
5027
|
return null;
|
|
5017
5028
|
}
|
|
5018
5029
|
if (Array.isArray(item)) {
|
|
5019
|
-
return _this.resolveSubSelectedArray(field, item, execContext);
|
|
5030
|
+
return _this.resolveSubSelectedArray(field, isClientFieldDescendant, item, execContext);
|
|
5020
5031
|
}
|
|
5021
5032
|
if (field.selectionSet) {
|
|
5022
|
-
return _this.resolveSelectionSet(field.selectionSet, item, execContext);
|
|
5033
|
+
return _this.resolveSelectionSet(field.selectionSet, isClientFieldDescendant, item, execContext);
|
|
5023
5034
|
}
|
|
5024
5035
|
}));
|
|
5025
5036
|
};
|
|
5037
|
+
LocalState.prototype.collectSelectionsToResolve = function (mainDefinition, fragmentMap) {
|
|
5038
|
+
var isSingleASTNode = function (node) { return !Array.isArray(node); };
|
|
5039
|
+
var selectionsToResolveCache = this.selectionsToResolveCache;
|
|
5040
|
+
function collectByDefinition(definitionNode) {
|
|
5041
|
+
if (!selectionsToResolveCache.has(definitionNode)) {
|
|
5042
|
+
var matches_1 = new Set();
|
|
5043
|
+
selectionsToResolveCache.set(definitionNode, matches_1);
|
|
5044
|
+
graphql.visit(definitionNode, {
|
|
5045
|
+
Directive: function (node, _, __, ___, ancestors) {
|
|
5046
|
+
if (node.name.value === 'client') {
|
|
5047
|
+
ancestors.forEach(function (node) {
|
|
5048
|
+
if (isSingleASTNode(node) && graphql.isSelectionNode(node)) {
|
|
5049
|
+
matches_1.add(node);
|
|
5050
|
+
}
|
|
5051
|
+
});
|
|
5052
|
+
}
|
|
5053
|
+
},
|
|
5054
|
+
FragmentSpread: function (spread, _, __, ___, ancestors) {
|
|
5055
|
+
var fragment = fragmentMap[spread.name.value];
|
|
5056
|
+
__DEV__ ? tsInvariant.invariant(fragment, "No fragment named ".concat(spread.name.value)) : tsInvariant.invariant(fragment, 12);
|
|
5057
|
+
var fragmentSelections = collectByDefinition(fragment);
|
|
5058
|
+
if (fragmentSelections.size > 0) {
|
|
5059
|
+
ancestors.forEach(function (node) {
|
|
5060
|
+
if (isSingleASTNode(node) && graphql.isSelectionNode(node)) {
|
|
5061
|
+
matches_1.add(node);
|
|
5062
|
+
}
|
|
5063
|
+
});
|
|
5064
|
+
matches_1.add(spread);
|
|
5065
|
+
fragmentSelections.forEach(function (selection) {
|
|
5066
|
+
matches_1.add(selection);
|
|
5067
|
+
});
|
|
5068
|
+
}
|
|
5069
|
+
}
|
|
5070
|
+
});
|
|
5071
|
+
}
|
|
5072
|
+
return selectionsToResolveCache.get(definitionNode);
|
|
5073
|
+
}
|
|
5074
|
+
return collectByDefinition(mainDefinition);
|
|
5075
|
+
};
|
|
5026
5076
|
return LocalState;
|
|
5027
5077
|
}());
|
|
5028
5078
|
|
|
@@ -5333,7 +5383,7 @@ var QueryManager = (function () {
|
|
|
5333
5383
|
this.queries.forEach(function (_info, queryId) {
|
|
5334
5384
|
_this.stopQueryNoBroadcast(queryId);
|
|
5335
5385
|
});
|
|
5336
|
-
this.cancelPendingFetches(__DEV__ ? new tsInvariant.InvariantError('QueryManager stopped while query was in flight') : new tsInvariant.InvariantError(
|
|
5386
|
+
this.cancelPendingFetches(__DEV__ ? new tsInvariant.InvariantError('QueryManager stopped while query was in flight') : new tsInvariant.InvariantError(14));
|
|
5337
5387
|
};
|
|
5338
5388
|
QueryManager.prototype.cancelPendingFetches = function (error) {
|
|
5339
5389
|
this.fetchCancelFns.forEach(function (cancel) { return cancel(error); });
|
|
@@ -5347,10 +5397,10 @@ var QueryManager = (function () {
|
|
|
5347
5397
|
return tslib.__generator(this, function (_j) {
|
|
5348
5398
|
switch (_j.label) {
|
|
5349
5399
|
case 0:
|
|
5350
|
-
__DEV__ ? tsInvariant.invariant(mutation, 'mutation option is required. You must specify your GraphQL document in the mutation option.') : tsInvariant.invariant(mutation,
|
|
5400
|
+
__DEV__ ? tsInvariant.invariant(mutation, 'mutation option is required. You must specify your GraphQL document in the mutation option.') : tsInvariant.invariant(mutation, 15);
|
|
5351
5401
|
__DEV__ ? tsInvariant.invariant(fetchPolicy === 'network-only' ||
|
|
5352
5402
|
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' ||
|
|
5353
|
-
fetchPolicy === 'no-cache',
|
|
5403
|
+
fetchPolicy === 'no-cache', 16);
|
|
5354
5404
|
mutationId = this.generateMutationId();
|
|
5355
5405
|
_h = this.transform(mutation), document = _h.document, hasClientExports = _h.hasClientExports;
|
|
5356
5406
|
mutation = this.cache.transformForLink(document);
|
|
@@ -5467,7 +5517,10 @@ var QueryManager = (function () {
|
|
|
5467
5517
|
optimistic: false,
|
|
5468
5518
|
returnPartialData: true,
|
|
5469
5519
|
});
|
|
5470
|
-
var mergedData =
|
|
5520
|
+
var mergedData = void 0;
|
|
5521
|
+
if (diff.result) {
|
|
5522
|
+
mergedData = mergeIncrementalData(diff.result, result);
|
|
5523
|
+
}
|
|
5471
5524
|
if (typeof mergedData !== 'undefined') {
|
|
5472
5525
|
result.data = mergedData;
|
|
5473
5526
|
cacheWrites.push({
|
|
@@ -5669,10 +5722,10 @@ var QueryManager = (function () {
|
|
|
5669
5722
|
var _this = this;
|
|
5670
5723
|
if (queryId === void 0) { queryId = this.generateQueryId(); }
|
|
5671
5724
|
__DEV__ ? tsInvariant.invariant(options.query, 'query option is required. You must specify your GraphQL document ' +
|
|
5672
|
-
'in the query option.') : tsInvariant.invariant(options.query,
|
|
5673
|
-
__DEV__ ? tsInvariant.invariant(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.') : tsInvariant.invariant(options.query.kind === 'Document',
|
|
5674
|
-
__DEV__ ? tsInvariant.invariant(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.') : tsInvariant.invariant(!options.returnPartialData,
|
|
5675
|
-
__DEV__ ? tsInvariant.invariant(!options.pollInterval, 'pollInterval option only supported on watchQuery.') : tsInvariant.invariant(!options.pollInterval,
|
|
5725
|
+
'in the query option.') : tsInvariant.invariant(options.query, 17);
|
|
5726
|
+
__DEV__ ? tsInvariant.invariant(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.') : tsInvariant.invariant(options.query.kind === 'Document', 18);
|
|
5727
|
+
__DEV__ ? tsInvariant.invariant(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.') : tsInvariant.invariant(!options.returnPartialData, 19);
|
|
5728
|
+
__DEV__ ? tsInvariant.invariant(!options.pollInterval, 'pollInterval option only supported on watchQuery.') : tsInvariant.invariant(!options.pollInterval, 20);
|
|
5676
5729
|
return this.fetchQuery(queryId, options).finally(function () { return _this.stopQuery(queryId); });
|
|
5677
5730
|
};
|
|
5678
5731
|
QueryManager.prototype.generateQueryId = function () {
|
|
@@ -5697,7 +5750,7 @@ var QueryManager = (function () {
|
|
|
5697
5750
|
if (options === void 0) { options = {
|
|
5698
5751
|
discardWatches: true,
|
|
5699
5752
|
}; }
|
|
5700
|
-
this.cancelPendingFetches(__DEV__ ? new tsInvariant.InvariantError('Store reset while query was in flight (not completed in link chain)') : new tsInvariant.InvariantError(
|
|
5753
|
+
this.cancelPendingFetches(__DEV__ ? new tsInvariant.InvariantError('Store reset while query was in flight (not completed in link chain)') : new tsInvariant.InvariantError(21));
|
|
5701
5754
|
this.queries.forEach(function (queryInfo) {
|
|
5702
5755
|
if (queryInfo.observableQuery) {
|
|
5703
5756
|
queryInfo.networkStatus = exports.NetworkStatus.loading;
|
|
@@ -6426,7 +6479,7 @@ var ApolloConsumer = function (props) {
|
|
|
6426
6479
|
var ApolloContext = getApolloContext();
|
|
6427
6480
|
return (React__namespace.createElement(ApolloContext.Consumer, null, function (context) {
|
|
6428
6481
|
__DEV__ ? tsInvariant.invariant(context && context.client, 'Could not find "client" in the context of ApolloConsumer. ' +
|
|
6429
|
-
'Wrap the root component in an <ApolloProvider>.') : tsInvariant.invariant(context && context.client,
|
|
6482
|
+
'Wrap the root component in an <ApolloProvider>.') : tsInvariant.invariant(context && context.client, 28);
|
|
6430
6483
|
return props.children(context.client);
|
|
6431
6484
|
}));
|
|
6432
6485
|
};
|
|
@@ -6440,7 +6493,7 @@ var ApolloProvider = function (_a) {
|
|
|
6440
6493
|
context = Object.assign({}, context, { client: client });
|
|
6441
6494
|
}
|
|
6442
6495
|
__DEV__ ? tsInvariant.invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +
|
|
6443
|
-
'sure you pass in your client via the "client" prop.') : tsInvariant.invariant(context.client,
|
|
6496
|
+
'sure you pass in your client via the "client" prop.') : tsInvariant.invariant(context.client, 29);
|
|
6444
6497
|
return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children));
|
|
6445
6498
|
}));
|
|
6446
6499
|
};
|
|
@@ -6450,7 +6503,7 @@ function useApolloClient(override) {
|
|
|
6450
6503
|
var client = override || context.client;
|
|
6451
6504
|
__DEV__ ? tsInvariant.invariant(!!client, 'Could not find "client" in the context or passed in as an option. ' +
|
|
6452
6505
|
'Wrap the root component in an <ApolloProvider>, or pass an ApolloClient ' +
|
|
6453
|
-
'instance in via options.') : tsInvariant.invariant(!!client,
|
|
6506
|
+
'instance in via options.') : tsInvariant.invariant(!!client, 32);
|
|
6454
6507
|
return client;
|
|
6455
6508
|
}
|
|
6456
6509
|
|
|
@@ -6528,7 +6581,7 @@ function parser(document) {
|
|
|
6528
6581
|
var variables, type, name;
|
|
6529
6582
|
__DEV__ ? tsInvariant.invariant(!!document && !!document.kind, "Argument of ".concat(document, " passed to parser was not a valid GraphQL ") +
|
|
6530
6583
|
"DocumentNode. You may need to use 'graphql-tag' or another method " +
|
|
6531
|
-
"to convert your operation into a document") : tsInvariant.invariant(!!document && !!document.kind,
|
|
6584
|
+
"to convert your operation into a document") : tsInvariant.invariant(!!document && !!document.kind, 33);
|
|
6532
6585
|
var fragments = [];
|
|
6533
6586
|
var queries = [];
|
|
6534
6587
|
var mutations = [];
|
|
@@ -6556,11 +6609,11 @@ function parser(document) {
|
|
|
6556
6609
|
__DEV__ ? tsInvariant.invariant(!fragments.length ||
|
|
6557
6610
|
(queries.length || mutations.length || subscriptions.length), "Passing only a fragment to 'graphql' is not yet supported. " +
|
|
6558
6611
|
"You must include a query, subscription or mutation as well") : tsInvariant.invariant(!fragments.length ||
|
|
6559
|
-
(queries.length || mutations.length || subscriptions.length),
|
|
6612
|
+
(queries.length || mutations.length || subscriptions.length), 34);
|
|
6560
6613
|
__DEV__ ? tsInvariant.invariant(queries.length + mutations.length + subscriptions.length <= 1, "react-apollo only supports a query, subscription, or a mutation per HOC. " +
|
|
6561
6614
|
"".concat(document, " had ").concat(queries.length, " queries, ").concat(subscriptions.length, " ") +
|
|
6562
6615
|
"subscriptions and ".concat(mutations.length, " mutations. ") +
|
|
6563
|
-
"You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(queries.length + mutations.length + subscriptions.length <= 1,
|
|
6616
|
+
"You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(queries.length + mutations.length + subscriptions.length <= 1, 35);
|
|
6564
6617
|
type = queries.length ? exports.DocumentType.Query : exports.DocumentType.Mutation;
|
|
6565
6618
|
if (!queries.length && !mutations.length)
|
|
6566
6619
|
type = exports.DocumentType.Subscription;
|
|
@@ -6571,7 +6624,7 @@ function parser(document) {
|
|
|
6571
6624
|
: subscriptions;
|
|
6572
6625
|
__DEV__ ? tsInvariant.invariant(definitions.length === 1, "react-apollo only supports one definition per HOC. ".concat(document, " had ") +
|
|
6573
6626
|
"".concat(definitions.length, " definitions. ") +
|
|
6574
|
-
"You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(definitions.length === 1,
|
|
6627
|
+
"You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(definitions.length === 1, 36);
|
|
6575
6628
|
var definition = definitions[0];
|
|
6576
6629
|
variables = definition.variableDefinitions || [];
|
|
6577
6630
|
if (definition.name && definition.name.kind === 'Name') {
|
|
@@ -6589,7 +6642,7 @@ function verifyDocumentType(document, type) {
|
|
|
6589
6642
|
var requiredOperationName = operationName(type);
|
|
6590
6643
|
var usedOperationName = operationName(operation.type);
|
|
6591
6644
|
__DEV__ ? tsInvariant.invariant(operation.type === type, "Running a ".concat(requiredOperationName, " requires a graphql ") +
|
|
6592
|
-
"".concat(requiredOperationName, ", but a ").concat(usedOperationName, " was used instead.")) : tsInvariant.invariant(operation.type === type,
|
|
6645
|
+
"".concat(requiredOperationName, ", but a ").concat(usedOperationName, " was used instead.")) : tsInvariant.invariant(operation.type === type, 37);
|
|
6593
6646
|
}
|
|
6594
6647
|
|
|
6595
6648
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
@@ -6889,12 +6942,11 @@ var EAGER_METHODS = [
|
|
|
6889
6942
|
'subscribeToMore',
|
|
6890
6943
|
];
|
|
6891
6944
|
function useLazyQuery(query, options) {
|
|
6945
|
+
var _a;
|
|
6892
6946
|
var abortControllersRef = React.useRef(new Set());
|
|
6893
|
-
var internalState = useInternalState(useApolloClient(options && options.client), query);
|
|
6894
6947
|
var execOptionsRef = React.useRef();
|
|
6895
|
-
var merged = execOptionsRef.current
|
|
6896
|
-
|
|
6897
|
-
: options;
|
|
6948
|
+
var merged = execOptionsRef.current ? mergeOptions(options, execOptionsRef.current) : options;
|
|
6949
|
+
var internalState = useInternalState(useApolloClient(options && options.client), (_a = merged === null || merged === void 0 ? void 0 : merged.query) !== null && _a !== void 0 ? _a : query);
|
|
6898
6950
|
var useQueryResult = internalState.useQuery(tslib.__assign(tslib.__assign({}, merged), { skip: !execOptionsRef.current }));
|
|
6899
6951
|
var initialFetchPolicy = useQueryResult.observable.options.initialFetchPolicy ||
|
|
6900
6952
|
internalState.getDefaultFetchPolicy();
|