@apollo/client 3.5.0-beta.10 → 3.5.0-beta.14
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 +2 -2
- package/apollo-client.cjs +52 -41
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -0
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +13 -13
- package/core/ObservableQuery.js.map +1 -1
- package/core/core.cjs +14 -14
- package/core/core.cjs.map +1 -1
- package/invariantErrorCodes.js +22 -22
- package/link/batch-http/batch-http.cjs +2 -2
- package/link/batch-http/batch-http.cjs.map +1 -1
- package/link/batch-http/batchHttpLink.d.ts.map +1 -1
- package/link/batch-http/batchHttpLink.js +3 -3
- package/link/batch-http/batchHttpLink.js.map +1 -1
- package/link/http/createHttpLink.d.ts.map +1 -1
- package/link/http/createHttpLink.js +3 -3
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/http.cjs +8 -6
- package/link/http/http.cjs.map +1 -1
- package/link/http/index.d.ts +1 -1
- package/link/http/index.d.ts.map +1 -1
- package/link/http/index.js +1 -1
- package/link/http/index.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.d.ts +7 -1
- package/link/http/selectHttpOptionsAndBody.d.ts.map +1 -1
- package/link/http/selectHttpOptionsAndBody.js +6 -4
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/link/persisted-queries/index.d.ts +1 -1
- package/link/persisted-queries/index.d.ts.map +1 -1
- package/link/persisted-queries/index.js +1 -1
- package/link/persisted-queries/index.js.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs +3 -0
- package/link/persisted-queries/persisted-queries.cjs.map +1 -1
- package/package.json +8 -8
- package/react/context/ApolloContext.d.ts.map +1 -1
- package/react/context/ApolloContext.js +11 -5
- package/react/context/ApolloContext.js.map +1 -1
- package/react/context/context.cjs +10 -4
- package/react/context/context.cjs.map +1 -1
- package/react/hooks/useQuery.d.ts +1 -1
- package/react/hooks/useQuery.d.ts.map +1 -1
- package/react/hooks/useQuery.js.map +1 -1
- package/testing/core/core.cjs +288 -0
- package/testing/core/core.cjs.map +1 -0
- package/{utilities/testing → testing/core}/index.d.ts +0 -1
- package/testing/core/index.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/index.js +0 -1
- package/testing/core/index.js.map +1 -0
- package/{utilities/testing → testing/core}/itAsync.d.ts +0 -0
- package/testing/core/itAsync.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/itAsync.js +0 -0
- package/testing/core/itAsync.js.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockClient.d.ts +0 -0
- package/testing/core/mocking/mockClient.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockClient.js +0 -0
- package/testing/core/mocking/mockClient.js.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockFetch.d.ts +0 -0
- package/testing/core/mocking/mockFetch.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockFetch.js +0 -0
- package/testing/core/mocking/mockFetch.js.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockLink.d.ts +0 -0
- package/testing/core/mocking/mockLink.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockLink.js +3 -3
- package/testing/core/mocking/mockLink.js.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockQueryManager.d.ts +1 -1
- package/testing/core/mocking/mockQueryManager.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockQueryManager.js +1 -1
- package/testing/core/mocking/mockQueryManager.js.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockSubscriptionLink.d.ts +0 -0
- package/testing/core/mocking/mockSubscriptionLink.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockSubscriptionLink.js +1 -1
- package/testing/core/mocking/mockSubscriptionLink.js.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockWatchQuery.d.ts +1 -1
- package/testing/core/mocking/mockWatchQuery.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockWatchQuery.js +0 -0
- package/testing/core/mocking/mockWatchQuery.js.map +1 -0
- package/{utilities/testing → testing/core}/observableToPromise.d.ts +2 -3
- package/testing/core/observableToPromise.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/observableToPromise.js +0 -0
- package/testing/core/observableToPromise.js.map +1 -0
- package/testing/core/package.json +8 -0
- package/testing/core/subscribeAndCount.d.ts +4 -0
- package/testing/core/subscribeAndCount.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/subscribeAndCount.js +1 -1
- package/testing/core/subscribeAndCount.js.map +1 -0
- package/{utilities/testing → testing/core}/withConsoleSpy.d.ts +0 -0
- package/testing/core/withConsoleSpy.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/withConsoleSpy.js +0 -0
- package/testing/core/withConsoleSpy.js.map +1 -0
- package/{utilities/testing → testing/core}/wrap.d.ts +0 -0
- package/testing/core/wrap.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/wrap.js +0 -0
- package/testing/core/wrap.js.map +1 -0
- package/testing/index.d.ts +2 -1
- package/testing/index.d.ts.map +1 -1
- package/testing/index.js +2 -1
- package/testing/index.js.map +1 -1
- package/{utilities/testing/mocking → testing/react}/MockedProvider.d.ts +5 -5
- package/testing/react/MockedProvider.d.ts.map +1 -0
- package/{utilities/testing/mocking → testing/react}/MockedProvider.js +4 -4
- package/testing/react/MockedProvider.js.map +1 -0
- package/testing/testing.cjs +6 -330
- package/testing/testing.cjs.map +1 -1
- package/utilities/common/canUse.d.ts +1 -0
- package/utilities/common/canUse.d.ts.map +1 -1
- package/utilities/common/canUse.js +2 -0
- package/utilities/common/canUse.js.map +1 -1
- package/utilities/globals/globals.cjs +2 -1
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/index.js +2 -1
- package/utilities/globals/index.js.map +1 -1
- package/utilities/graphql/directives.js +4 -4
- package/utilities/graphql/fragments.js +3 -3
- package/utilities/graphql/getFromAST.js +8 -8
- package/utilities/graphql/storeUtils.js +1 -1
- package/utilities/observables/subclassing.d.ts.map +1 -1
- package/utilities/observables/subclassing.js +2 -1
- package/utilities/observables/subclassing.js.map +1 -1
- package/utilities/policies/pagination.d.ts +1 -1
- package/utilities/policies/pagination.d.ts.map +1 -1
- package/utilities/policies/pagination.js +7 -2
- package/utilities/policies/pagination.js.map +1 -1
- package/utilities/utilities.cjs +28 -19
- package/utilities/utilities.cjs.map +1 -1
- package/version.js +1 -1
- package/utilities/testing/index.d.ts.map +0 -1
- package/utilities/testing/index.js.map +0 -1
- package/utilities/testing/itAsync.d.ts.map +0 -1
- package/utilities/testing/itAsync.js.map +0 -1
- package/utilities/testing/mocking/MockedProvider.d.ts.map +0 -1
- package/utilities/testing/mocking/MockedProvider.js.map +0 -1
- package/utilities/testing/mocking/mockClient.d.ts.map +0 -1
- package/utilities/testing/mocking/mockClient.js.map +0 -1
- package/utilities/testing/mocking/mockFetch.d.ts.map +0 -1
- package/utilities/testing/mocking/mockFetch.js.map +0 -1
- package/utilities/testing/mocking/mockLink.d.ts.map +0 -1
- package/utilities/testing/mocking/mockLink.js.map +0 -1
- package/utilities/testing/mocking/mockQueryManager.d.ts.map +0 -1
- package/utilities/testing/mocking/mockQueryManager.js.map +0 -1
- package/utilities/testing/mocking/mockSubscriptionLink.d.ts.map +0 -1
- package/utilities/testing/mocking/mockSubscriptionLink.js.map +0 -1
- package/utilities/testing/mocking/mockWatchQuery.d.ts.map +0 -1
- package/utilities/testing/mocking/mockWatchQuery.js.map +0 -1
- package/utilities/testing/observableToPromise.d.ts.map +0 -1
- package/utilities/testing/observableToPromise.js.map +0 -1
- package/utilities/testing/subscribeAndCount.d.ts +0 -5
- package/utilities/testing/subscribeAndCount.d.ts.map +0 -1
- package/utilities/testing/subscribeAndCount.js.map +0 -1
- package/utilities/testing/withConsoleSpy.d.ts.map +0 -1
- package/utilities/testing/withConsoleSpy.js.map +0 -1
- package/utilities/testing/wrap.d.ts.map +0 -1
- package/utilities/testing/wrap.js.map +0 -1
package/README.md
CHANGED
|
@@ -22,9 +22,9 @@ Learn how to use Apollo Client with self-paced hands-on training on Odyssey, Apo
|
|
|
22
22
|
## Maintainers
|
|
23
23
|
|
|
24
24
|
- [@benjamn](https://github.com/benjamn) (Apollo)
|
|
25
|
-
- [@hwillson](https://github.com/hwillson) (Apollo)
|
|
26
|
-
- [@jcreighton](https://github.com/jcreighton) (Apollo)
|
|
27
25
|
- [@brainkim](https://github.com/brainkim) (Apollo)
|
|
26
|
+
- [@jcreighton](https://github.com/jcreighton) (Netflix)
|
|
27
|
+
- [@hwillson](https://github.com/hwillson) (Apollo)
|
|
28
28
|
|
|
29
29
|
## Who is Apollo?
|
|
30
30
|
|
package/apollo-client.cjs
CHANGED
|
@@ -7,6 +7,7 @@ var tsInvariant = require('ts-invariant');
|
|
|
7
7
|
var equality = require('@wry/equality');
|
|
8
8
|
var zenObservableTs = require('zen-observable-ts');
|
|
9
9
|
require('symbol-observable');
|
|
10
|
+
var __ = require('..');
|
|
10
11
|
var graphql = require('graphql');
|
|
11
12
|
var optimism = require('optimism');
|
|
12
13
|
var context = require('@wry/context');
|
|
@@ -45,7 +46,7 @@ function shouldInclude(_a, variables) {
|
|
|
45
46
|
var evaledValue = false;
|
|
46
47
|
if (ifArgument.value.kind === 'Variable') {
|
|
47
48
|
evaledValue = variables && variables[ifArgument.value.name.value];
|
|
48
|
-
__DEV__ ? tsInvariant.invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive.") : tsInvariant.invariant(evaledValue !== void 0,
|
|
49
|
+
__DEV__ ? tsInvariant.invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive.") : tsInvariant.invariant(evaledValue !== void 0, 39);
|
|
49
50
|
}
|
|
50
51
|
else {
|
|
51
52
|
evaledValue = ifArgument.value.value;
|
|
@@ -82,13 +83,13 @@ function getInclusionDirectives(directives) {
|
|
|
82
83
|
return;
|
|
83
84
|
var directiveArguments = directive.arguments;
|
|
84
85
|
var directiveName = directive.name.value;
|
|
85
|
-
__DEV__ ? tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive.") : tsInvariant.invariant(directiveArguments && directiveArguments.length === 1,
|
|
86
|
+
__DEV__ ? tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive.") : tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, 40);
|
|
86
87
|
var ifArgument = directiveArguments[0];
|
|
87
|
-
__DEV__ ? tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive.") : tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if',
|
|
88
|
+
__DEV__ ? tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive.") : tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', 41);
|
|
88
89
|
var ifValue = ifArgument.value;
|
|
89
90
|
__DEV__ ? tsInvariant.invariant(ifValue &&
|
|
90
91
|
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value.") : tsInvariant.invariant(ifValue &&
|
|
91
|
-
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'),
|
|
92
|
+
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 42);
|
|
92
93
|
result.push({ directive: directive, ifArgument: ifArgument });
|
|
93
94
|
});
|
|
94
95
|
}
|
|
@@ -101,14 +102,14 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
101
102
|
document.definitions.forEach(function (definition) {
|
|
102
103
|
if (definition.kind === 'OperationDefinition') {
|
|
103
104
|
throw __DEV__ ? new tsInvariant.InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " +
|
|
104
|
-
'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new tsInvariant.InvariantError(
|
|
105
|
+
'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new tsInvariant.InvariantError(43);
|
|
105
106
|
}
|
|
106
107
|
if (definition.kind === 'FragmentDefinition') {
|
|
107
108
|
fragments.push(definition);
|
|
108
109
|
}
|
|
109
110
|
});
|
|
110
111
|
if (typeof actualFragmentName === 'undefined') {
|
|
111
|
-
__DEV__ ? tsInvariant.invariant(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.") : tsInvariant.invariant(fragments.length === 1,
|
|
112
|
+
__DEV__ ? tsInvariant.invariant(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.") : tsInvariant.invariant(fragments.length === 1, 44);
|
|
112
113
|
actualFragmentName = fragments[0].name.value;
|
|
113
114
|
}
|
|
114
115
|
var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
|
|
@@ -145,7 +146,7 @@ function getFragmentFromSelection(selection, fragmentMap) {
|
|
|
145
146
|
return selection;
|
|
146
147
|
case 'FragmentSpread': {
|
|
147
148
|
var fragment = fragmentMap && fragmentMap[selection.name.value];
|
|
148
|
-
__DEV__ ? tsInvariant.invariant(fragment, "No fragment named " + selection.name.value + ".") : tsInvariant.invariant(fragment,
|
|
149
|
+
__DEV__ ? tsInvariant.invariant(fragment, "No fragment named " + selection.name.value + ".") : tsInvariant.invariant(fragment, 45);
|
|
149
150
|
return fragment;
|
|
150
151
|
}
|
|
151
152
|
default:
|
|
@@ -229,7 +230,7 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
|
|
|
229
230
|
else {
|
|
230
231
|
throw __DEV__ ? new tsInvariant.InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" +
|
|
231
232
|
'is not supported. Use variables instead of inline arguments to ' +
|
|
232
|
-
'overcome this limitation.') : new tsInvariant.InvariantError(
|
|
233
|
+
'overcome this limitation.') : new tsInvariant.InvariantError(54);
|
|
233
234
|
}
|
|
234
235
|
}
|
|
235
236
|
function storeKeyNameFromField(field, variables) {
|
|
@@ -363,16 +364,16 @@ function isInlineFragment(selection) {
|
|
|
363
364
|
}
|
|
364
365
|
|
|
365
366
|
function checkDocument(doc) {
|
|
366
|
-
__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',
|
|
367
|
+
__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', 46);
|
|
367
368
|
var operations = doc.definitions
|
|
368
369
|
.filter(function (d) { return d.kind !== 'FragmentDefinition'; })
|
|
369
370
|
.map(function (definition) {
|
|
370
371
|
if (definition.kind !== 'OperationDefinition') {
|
|
371
|
-
throw __DEV__ ? new tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\"") : new tsInvariant.InvariantError(
|
|
372
|
+
throw __DEV__ ? new tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\"") : new tsInvariant.InvariantError(47);
|
|
372
373
|
}
|
|
373
374
|
return definition;
|
|
374
375
|
});
|
|
375
|
-
__DEV__ ? tsInvariant.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations") : tsInvariant.invariant(operations.length <= 1,
|
|
376
|
+
__DEV__ ? tsInvariant.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations") : tsInvariant.invariant(operations.length <= 1, 48);
|
|
376
377
|
return doc;
|
|
377
378
|
}
|
|
378
379
|
function getOperationDefinition(doc) {
|
|
@@ -391,14 +392,14 @@ function getFragmentDefinitions(doc) {
|
|
|
391
392
|
}
|
|
392
393
|
function getQueryDefinition(doc) {
|
|
393
394
|
var queryDef = getOperationDefinition(doc);
|
|
394
|
-
__DEV__ ? tsInvariant.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : tsInvariant.invariant(queryDef && queryDef.operation === 'query',
|
|
395
|
+
__DEV__ ? tsInvariant.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : tsInvariant.invariant(queryDef && queryDef.operation === 'query', 49);
|
|
395
396
|
return queryDef;
|
|
396
397
|
}
|
|
397
398
|
function getFragmentDefinition(doc) {
|
|
398
|
-
__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',
|
|
399
|
-
__DEV__ ? tsInvariant.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : tsInvariant.invariant(doc.definitions.length <= 1,
|
|
399
|
+
__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', 50);
|
|
400
|
+
__DEV__ ? tsInvariant.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : tsInvariant.invariant(doc.definitions.length <= 1, 51);
|
|
400
401
|
var fragmentDef = doc.definitions[0];
|
|
401
|
-
__DEV__ ? tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition',
|
|
402
|
+
__DEV__ ? tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 52);
|
|
402
403
|
return fragmentDef;
|
|
403
404
|
}
|
|
404
405
|
function getMainDefinition(queryDoc) {
|
|
@@ -421,7 +422,7 @@ function getMainDefinition(queryDoc) {
|
|
|
421
422
|
if (fragmentDefinition) {
|
|
422
423
|
return fragmentDefinition;
|
|
423
424
|
}
|
|
424
|
-
throw __DEV__ ? new tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new tsInvariant.InvariantError(
|
|
425
|
+
throw __DEV__ ? new tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new tsInvariant.InvariantError(53);
|
|
425
426
|
}
|
|
426
427
|
function getDefaultValues(definition) {
|
|
427
428
|
var defaultValues = Object.create(null);
|
|
@@ -886,7 +887,7 @@ function fixObservableSubclass(subclass) {
|
|
|
886
887
|
function set(key) {
|
|
887
888
|
Object.defineProperty(subclass, key, { value: zenObservableTs.Observable });
|
|
888
889
|
}
|
|
889
|
-
if (
|
|
890
|
+
if (__.canUseSymbol && Symbol.species) {
|
|
890
891
|
set(Symbol.species);
|
|
891
892
|
}
|
|
892
893
|
set("@@species");
|
|
@@ -1035,6 +1036,8 @@ function graphQLResultHasError(result) {
|
|
|
1035
1036
|
var canUseWeakMap = typeof WeakMap === 'function' && !(typeof navigator === 'object' &&
|
|
1036
1037
|
navigator.product === 'ReactNative');
|
|
1037
1038
|
var canUseWeakSet = typeof WeakSet === 'function';
|
|
1039
|
+
var canUseSymbol = typeof Symbol === 'function' &&
|
|
1040
|
+
typeof Symbol.for === 'function';
|
|
1038
1041
|
|
|
1039
1042
|
function compact() {
|
|
1040
1043
|
var objects = [];
|
|
@@ -1273,7 +1276,7 @@ var concat = ApolloLink.concat;
|
|
|
1273
1276
|
|
|
1274
1277
|
var execute = ApolloLink.execute;
|
|
1275
1278
|
|
|
1276
|
-
var version = '3.5.0-beta.
|
|
1279
|
+
var version = '3.5.0-beta.14';
|
|
1277
1280
|
|
|
1278
1281
|
var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
|
|
1279
1282
|
function parseAndCheckHttpResponse(operations) {
|
|
@@ -1336,10 +1339,11 @@ var fallbackHttpConfig = {
|
|
|
1336
1339
|
headers: defaultHeaders,
|
|
1337
1340
|
options: defaultOptions,
|
|
1338
1341
|
};
|
|
1339
|
-
var
|
|
1342
|
+
var defaultPrinter = function (ast, printer) { return printer(ast); };
|
|
1343
|
+
var selectHttpOptionsAndBody = function (operation, printer, fallbackConfig) {
|
|
1340
1344
|
var configs = [];
|
|
1341
|
-
for (var _i =
|
|
1342
|
-
configs[_i -
|
|
1345
|
+
for (var _i = 3; _i < arguments.length; _i++) {
|
|
1346
|
+
configs[_i - 3] = arguments[_i];
|
|
1343
1347
|
}
|
|
1344
1348
|
var options = tslib.__assign(tslib.__assign({}, fallbackConfig.options), { headers: fallbackConfig.headers, credentials: fallbackConfig.credentials });
|
|
1345
1349
|
var http = fallbackConfig.http || {};
|
|
@@ -1354,7 +1358,7 @@ var selectHttpOptionsAndBody = function (operation, fallbackConfig) {
|
|
|
1354
1358
|
if (http.includeExtensions)
|
|
1355
1359
|
body.extensions = extensions;
|
|
1356
1360
|
if (http.includeQuery)
|
|
1357
|
-
body.query = graphql.print
|
|
1361
|
+
body.query = printer(query, graphql.print);
|
|
1358
1362
|
return {
|
|
1359
1363
|
options: options,
|
|
1360
1364
|
body: body,
|
|
@@ -1444,7 +1448,7 @@ function rewriteURIForGET(chosenURI, body) {
|
|
|
1444
1448
|
var backupFetch = maybe(function () { return fetch; });
|
|
1445
1449
|
var createHttpLink = function (linkOptions) {
|
|
1446
1450
|
if (linkOptions === void 0) { linkOptions = {}; }
|
|
1447
|
-
var _a = linkOptions.uri, uri = _a === void 0 ? '/graphql' : _a, preferredFetch = linkOptions.fetch, includeExtensions = linkOptions.includeExtensions, useGETForQueries = linkOptions.useGETForQueries,
|
|
1451
|
+
var _a = linkOptions.uri, uri = _a === void 0 ? '/graphql' : _a, preferredFetch = linkOptions.fetch, _b = linkOptions.print, print = _b === void 0 ? defaultPrinter : _b, includeExtensions = linkOptions.includeExtensions, useGETForQueries = linkOptions.useGETForQueries, _c = linkOptions.includeUnusedVariables, includeUnusedVariables = _c === void 0 ? false : _c, requestOptions = tslib.__rest(linkOptions, ["uri", "fetch", "print", "includeExtensions", "useGETForQueries", "includeUnusedVariables"]);
|
|
1448
1452
|
if (__DEV__) {
|
|
1449
1453
|
checkFetcher(preferredFetch || backupFetch);
|
|
1450
1454
|
}
|
|
@@ -1474,7 +1478,7 @@ var createHttpLink = function (linkOptions) {
|
|
|
1474
1478
|
credentials: context.credentials,
|
|
1475
1479
|
headers: contextHeaders,
|
|
1476
1480
|
};
|
|
1477
|
-
var _b = selectHttpOptionsAndBody(operation, fallbackHttpConfig, linkConfig, contextConfig), options = _b.options, body = _b.body;
|
|
1481
|
+
var _b = selectHttpOptionsAndBody(operation, print, fallbackHttpConfig, linkConfig, contextConfig), options = _b.options, body = _b.body;
|
|
1478
1482
|
if (body.variables && !includeUnusedVariables) {
|
|
1479
1483
|
var unusedNames_1 = new Set(Object.keys(body.variables));
|
|
1480
1484
|
graphql.visit(operation.query, {
|
|
@@ -3849,24 +3853,30 @@ var ObservableQuery = (function (_super) {
|
|
|
3849
3853
|
exports.NetworkStatus.ready;
|
|
3850
3854
|
var result = tslib.__assign(tslib.__assign({}, lastResult), { loading: isNetworkRequestInFlight(networkStatus), networkStatus: networkStatus });
|
|
3851
3855
|
var _a = this.options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a;
|
|
3852
|
-
var diff = this.queryInfo.getDiff();
|
|
3853
3856
|
if (fetchPolicy === 'network-only' ||
|
|
3854
3857
|
fetchPolicy === 'no-cache' ||
|
|
3855
3858
|
fetchPolicy === 'standby' ||
|
|
3856
3859
|
this.queryManager.transform(this.options.query).hasForcedResolvers) ;
|
|
3857
3860
|
else {
|
|
3861
|
+
var diff = this.queryInfo.getDiff();
|
|
3858
3862
|
if (diff.complete || this.options.returnPartialData) {
|
|
3859
3863
|
result.data = diff.result;
|
|
3860
3864
|
}
|
|
3861
3865
|
if (equality.equal(result.data, {})) {
|
|
3862
3866
|
result.data = void 0;
|
|
3863
3867
|
}
|
|
3864
|
-
if (diff.complete
|
|
3865
|
-
result.
|
|
3866
|
-
(
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3868
|
+
if (diff.complete) {
|
|
3869
|
+
delete result.partial;
|
|
3870
|
+
if (diff.complete &&
|
|
3871
|
+
result.networkStatus === exports.NetworkStatus.loading &&
|
|
3872
|
+
(fetchPolicy === 'cache-first' ||
|
|
3873
|
+
fetchPolicy === 'cache-only')) {
|
|
3874
|
+
result.networkStatus = exports.NetworkStatus.ready;
|
|
3875
|
+
result.loading = false;
|
|
3876
|
+
}
|
|
3877
|
+
}
|
|
3878
|
+
else {
|
|
3879
|
+
result.partial = true;
|
|
3870
3880
|
}
|
|
3871
3881
|
if (__DEV__ &&
|
|
3872
3882
|
!diff.complete &&
|
|
@@ -3877,12 +3887,6 @@ var ObservableQuery = (function (_super) {
|
|
|
3877
3887
|
logMissingFieldErrors(diff.missing);
|
|
3878
3888
|
}
|
|
3879
3889
|
}
|
|
3880
|
-
if (diff.complete) {
|
|
3881
|
-
delete result.partial;
|
|
3882
|
-
}
|
|
3883
|
-
else if (fetchPolicy !== 'no-cache') {
|
|
3884
|
-
result.partial = true;
|
|
3885
|
-
}
|
|
3886
3890
|
if (saveAsLastResult) {
|
|
3887
3891
|
this.updateLastResult(result);
|
|
3888
3892
|
}
|
|
@@ -5787,13 +5791,19 @@ var ApolloClient = (function () {
|
|
|
5787
5791
|
return ApolloClient;
|
|
5788
5792
|
}());
|
|
5789
5793
|
|
|
5790
|
-
var
|
|
5794
|
+
var contextKey = canUseSymbol
|
|
5795
|
+
? Symbol.for('__APOLLO_CONTEXT__')
|
|
5796
|
+
: '__APOLLO_CONTEXT__';
|
|
5791
5797
|
function getApolloContext() {
|
|
5792
|
-
var context =
|
|
5798
|
+
var context = React__namespace.createContext[contextKey];
|
|
5793
5799
|
if (!context) {
|
|
5794
|
-
|
|
5800
|
+
Object.defineProperty(React__namespace.createContext, contextKey, {
|
|
5801
|
+
value: context = React__namespace.createContext({}),
|
|
5802
|
+
enumerable: false,
|
|
5803
|
+
writable: false,
|
|
5804
|
+
configurable: true,
|
|
5805
|
+
});
|
|
5795
5806
|
context.displayName = 'ApolloContext';
|
|
5796
|
-
cache$1.set(React__namespace.createContext, context);
|
|
5797
5807
|
}
|
|
5798
5808
|
return context;
|
|
5799
5809
|
}
|
|
@@ -6373,6 +6383,7 @@ exports.concat = concat;
|
|
|
6373
6383
|
exports.createHttpLink = createHttpLink;
|
|
6374
6384
|
exports.createSignalIfSupported = createSignalIfSupported;
|
|
6375
6385
|
exports.defaultDataIdFromObject = defaultDataIdFromObject;
|
|
6386
|
+
exports.defaultPrinter = defaultPrinter;
|
|
6376
6387
|
exports.empty = empty;
|
|
6377
6388
|
exports.execute = execute;
|
|
6378
6389
|
exports.fallbackHttpConfig = fallbackHttpConfig;
|