@apollo/client 3.4.6 → 3.4.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apollo-client.cjs.js +155 -156
- package/apollo-client.cjs.js.map +1 -1
- package/apollo-core.cjs.js +136 -103
- package/apollo-core.cjs.js.map +1 -1
- package/apollo-core.cjs.min.js +1 -1
- package/cache/cache.cjs.js +32 -31
- package/cache/cache.cjs.js.map +1 -1
- package/cache/index.d.ts +1 -0
- package/cache/index.d.ts.map +1 -1
- package/cache/index.js +1 -3
- package/cache/index.js.map +1 -1
- package/cache/inmemory/entityStore.js +2 -2
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/object-canon.d.ts +1 -0
- package/cache/inmemory/object-canon.d.ts.map +1 -1
- package/cache/inmemory/object-canon.js +1 -0
- package/cache/inmemory/object-canon.js.map +1 -1
- package/cache/inmemory/policies.d.ts.map +1 -1
- package/cache/inmemory/policies.js +13 -10
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/readFromStore.d.ts.map +1 -1
- package/cache/inmemory/readFromStore.js +4 -4
- package/cache/inmemory/readFromStore.js.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 +5 -5
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/ApolloClient.d.ts.map +1 -1
- package/core/ApolloClient.js +3 -3
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.d.ts.map +1 -1
- package/core/LocalState.js +2 -2
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.d.ts +7 -6
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +79 -46
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js +10 -10
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs.js +109 -75
- package/core/core.cjs.js.map +1 -1
- package/core/index.js +1 -1
- package/core/index.js.map +1 -1
- package/errors/errors.cjs.js +1 -2
- package/errors/errors.cjs.js.map +1 -1
- package/errors/index.d.ts +1 -0
- package/errors/index.d.ts.map +1 -1
- package/errors/index.js +1 -3
- package/errors/index.js.map +1 -1
- package/invariantErrorCodes.js +56 -81
- package/link/core/ApolloLink.js +2 -2
- package/link/core/ApolloLink.js.map +1 -1
- package/link/core/core.cjs.js +4 -6
- package/link/core/core.cjs.js.map +1 -1
- package/link/core/index.d.ts +1 -0
- package/link/core/index.d.ts.map +1 -1
- package/link/core/index.js +1 -3
- package/link/core/index.js.map +1 -1
- package/link/http/checkFetcher.js +2 -2
- package/link/http/checkFetcher.js.map +1 -1
- package/link/http/createHttpLink.d.ts +1 -0
- package/link/http/createHttpLink.d.ts.map +1 -1
- package/link/http/createHttpLink.js +1 -0
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/http.cjs.js +3 -3
- package/link/http/http.cjs.js.map +1 -1
- package/link/http/index.d.ts +1 -0
- package/link/http/index.d.ts.map +1 -1
- package/link/http/index.js +1 -0
- package/link/http/index.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/http/serializeFetchParameter.js.map +1 -1
- package/link/persisted-queries/index.d.ts.map +1 -1
- package/link/persisted-queries/index.js +3 -3
- package/link/persisted-queries/index.js.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.js +5 -5
- package/link/persisted-queries/persisted-queries.cjs.js.map +1 -1
- package/link/utils/index.d.ts +1 -0
- package/link/utils/index.d.ts.map +1 -1
- package/link/utils/index.js +1 -0
- package/link/utils/index.js.map +1 -1
- package/link/utils/toPromise.d.ts.map +1 -1
- package/link/utils/toPromise.js +1 -1
- package/link/utils/toPromise.js.map +1 -1
- package/link/utils/utils.cjs.js +3 -3
- package/link/utils/utils.cjs.js.map +1 -1
- package/link/utils/validateOperation.d.ts.map +1 -1
- package/link/utils/validateOperation.js +2 -2
- package/link/utils/validateOperation.js.map +1 -1
- package/package.json +6 -6
- package/react/context/ApolloConsumer.d.ts.map +1 -1
- package/react/context/ApolloConsumer.js +2 -2
- package/react/context/ApolloConsumer.js.map +1 -1
- package/react/context/ApolloProvider.d.ts.map +1 -1
- package/react/context/ApolloProvider.js +2 -2
- package/react/context/ApolloProvider.js.map +1 -1
- package/react/context/context.cjs.js +5 -5
- package/react/context/context.cjs.js.map +1 -1
- package/react/context/index.d.ts +1 -0
- package/react/context/index.d.ts.map +1 -1
- package/react/context/index.js +1 -0
- package/react/context/index.js.map +1 -1
- package/react/data/OperationData.d.ts.map +1 -1
- package/react/data/OperationData.js +3 -3
- package/react/data/OperationData.js.map +1 -1
- package/react/data/QueryData.d.ts.map +1 -1
- package/react/data/QueryData.js +9 -11
- package/react/data/QueryData.js.map +1 -1
- package/react/data/data.cjs.js +14 -16
- package/react/data/data.cjs.js.map +1 -1
- package/react/data/index.d.ts +1 -0
- package/react/data/index.d.ts.map +1 -1
- package/react/data/index.js +1 -0
- package/react/data/index.js.map +1 -1
- package/react/hoc/hoc-utils.d.ts.map +1 -1
- package/react/hoc/hoc-utils.js +2 -2
- package/react/hoc/hoc-utils.js.map +1 -1
- package/react/hoc/hoc.cjs.js +5 -5
- package/react/hoc/hoc.cjs.js.map +1 -1
- package/react/hoc/index.d.ts +1 -0
- package/react/hoc/index.d.ts.map +1 -1
- package/react/hoc/index.js +1 -0
- package/react/hoc/index.js.map +1 -1
- package/react/hoc/withApollo.d.ts.map +1 -1
- package/react/hoc/withApollo.js +2 -2
- package/react/hoc/withApollo.js.map +1 -1
- package/react/hooks/hooks.cjs.js +3 -3
- package/react/hooks/hooks.cjs.js.map +1 -1
- package/react/hooks/index.d.ts +1 -0
- package/react/hooks/index.d.ts.map +1 -1
- package/react/hooks/index.js +1 -0
- package/react/hooks/index.js.map +1 -1
- package/react/hooks/useApolloClient.d.ts.map +1 -1
- package/react/hooks/useApolloClient.js +2 -2
- package/react/hooks/useApolloClient.js.map +1 -1
- package/react/hooks/useSubscription.d.ts +1 -0
- package/react/hooks/useSubscription.d.ts.map +1 -1
- package/react/hooks/useSubscription.js +1 -0
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/utils/useAfterFastRefresh.d.ts +1 -0
- package/react/hooks/utils/useAfterFastRefresh.d.ts.map +1 -1
- package/react/hooks/utils/useAfterFastRefresh.js +1 -0
- package/react/hooks/utils/useAfterFastRefresh.js.map +1 -1
- package/react/hooks/utils/useBaseQuery.d.ts +1 -0
- package/react/hooks/utils/useBaseQuery.d.ts.map +1 -1
- package/react/hooks/utils/useBaseQuery.js +1 -0
- package/react/hooks/utils/useBaseQuery.js.map +1 -1
- package/react/index.d.ts +1 -0
- package/react/index.d.ts.map +1 -1
- package/react/index.js +1 -3
- package/react/index.js.map +1 -1
- package/react/parser/index.d.ts.map +1 -1
- package/react/parser/index.js +5 -5
- package/react/parser/index.js.map +1 -1
- package/react/parser/parser.cjs.js +10 -10
- package/react/parser/parser.cjs.js.map +1 -1
- package/react/react.cjs.js +2 -3
- package/react/react.cjs.js.map +1 -1
- package/testing/index.d.ts +1 -0
- package/testing/index.d.ts.map +1 -1
- package/testing/index.js +1 -3
- package/testing/index.js.map +1 -1
- package/testing/testing.cjs.js +3 -5
- package/testing/testing.cjs.js.map +1 -1
- package/utilities/globals/DEV.js +2 -2
- package/utilities/globals/DEV.js.map +1 -1
- package/utilities/{common → globals}/global.d.ts +0 -0
- package/utilities/globals/global.d.ts.map +1 -0
- package/utilities/{common → globals}/global.js +0 -0
- package/utilities/globals/global.js.map +1 -0
- package/utilities/globals/globals.cjs.js +56 -0
- package/utilities/globals/globals.cjs.js.map +1 -0
- package/utilities/globals/index.d.ts +5 -2
- package/utilities/globals/index.d.ts.map +1 -1
- package/utilities/globals/index.js +7 -1
- package/utilities/globals/index.js.map +1 -1
- package/utilities/{common → globals}/maybe.d.ts +0 -0
- package/utilities/globals/maybe.d.ts.map +1 -0
- package/utilities/{common → globals}/maybe.js +0 -0
- package/utilities/globals/maybe.js.map +1 -0
- package/utilities/globals/package.json +7 -0
- package/utilities/graphql/directives.d.ts.map +1 -1
- package/utilities/graphql/directives.js +5 -5
- package/utilities/graphql/directives.js.map +1 -1
- package/utilities/graphql/fragments.d.ts.map +1 -1
- package/utilities/graphql/fragments.js +4 -4
- package/utilities/graphql/fragments.js.map +1 -1
- package/utilities/graphql/getFromAST.d.ts.map +1 -1
- package/utilities/graphql/getFromAST.js +9 -9
- package/utilities/graphql/getFromAST.js.map +1 -1
- package/utilities/graphql/storeUtils.d.ts.map +1 -1
- package/utilities/graphql/storeUtils.js +2 -2
- package/utilities/graphql/storeUtils.js.map +1 -1
- 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 +1 -3
- package/utilities/index.d.ts.map +1 -1
- package/utilities/index.js +1 -5
- package/utilities/index.js.map +1 -1
- package/utilities/observables/Concast.js +1 -1
- package/utilities/observables/Concast.js.map +1 -1
- package/utilities/package.json +1 -3
- package/utilities/testing/mocking/mockLink.d.ts.map +1 -1
- package/utilities/testing/mocking/mockLink.js +2 -2
- package/utilities/testing/mocking/mockLink.js.map +1 -1
- package/utilities/utilities.cjs.js +25 -66
- package/utilities/utilities.cjs.js.map +1 -1
- package/version.js +1 -1
- package/utilities/common/global.d.ts.map +0 -1
- package/utilities/common/global.js.map +0 -1
- package/utilities/common/maybe.d.ts.map +0 -1
- package/utilities/common/maybe.js.map +0 -1
package/apollo-core.cjs.js
CHANGED
|
@@ -62,7 +62,7 @@ function shouldInclude(_a, variables) {
|
|
|
62
62
|
var evaledValue = false;
|
|
63
63
|
if (ifArgument.value.kind === 'Variable') {
|
|
64
64
|
evaledValue = variables && variables[ifArgument.value.name.value];
|
|
65
|
-
__DEV__ ? tsInvariant.invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive.") : tsInvariant.invariant(evaledValue !== void 0,
|
|
65
|
+
__DEV__ ? tsInvariant.invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive.") : tsInvariant.invariant(evaledValue !== void 0, 39);
|
|
66
66
|
}
|
|
67
67
|
else {
|
|
68
68
|
evaledValue = ifArgument.value.value;
|
|
@@ -99,13 +99,13 @@ function getInclusionDirectives(directives) {
|
|
|
99
99
|
return;
|
|
100
100
|
var directiveArguments = directive.arguments;
|
|
101
101
|
var directiveName = directive.name.value;
|
|
102
|
-
__DEV__ ? tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive.") : tsInvariant.invariant(directiveArguments && directiveArguments.length === 1,
|
|
102
|
+
__DEV__ ? tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive.") : tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, 40);
|
|
103
103
|
var ifArgument = directiveArguments[0];
|
|
104
|
-
__DEV__ ? tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive.") : tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if',
|
|
104
|
+
__DEV__ ? tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive.") : tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', 41);
|
|
105
105
|
var ifValue = ifArgument.value;
|
|
106
106
|
__DEV__ ? tsInvariant.invariant(ifValue &&
|
|
107
107
|
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value.") : tsInvariant.invariant(ifValue &&
|
|
108
|
-
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'),
|
|
108
|
+
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 42);
|
|
109
109
|
result.push({ directive: directive, ifArgument: ifArgument });
|
|
110
110
|
});
|
|
111
111
|
}
|
|
@@ -118,14 +118,14 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
118
118
|
document.definitions.forEach(function (definition) {
|
|
119
119
|
if (definition.kind === 'OperationDefinition') {
|
|
120
120
|
throw __DEV__ ? new tsInvariant.InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " +
|
|
121
|
-
'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new tsInvariant.InvariantError(
|
|
121
|
+
'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new tsInvariant.InvariantError(43);
|
|
122
122
|
}
|
|
123
123
|
if (definition.kind === 'FragmentDefinition') {
|
|
124
124
|
fragments.push(definition);
|
|
125
125
|
}
|
|
126
126
|
});
|
|
127
127
|
if (typeof actualFragmentName === 'undefined') {
|
|
128
|
-
__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,
|
|
128
|
+
__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);
|
|
129
129
|
actualFragmentName = fragments[0].name.value;
|
|
130
130
|
}
|
|
131
131
|
var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
|
|
@@ -162,7 +162,7 @@ function getFragmentFromSelection(selection, fragmentMap) {
|
|
|
162
162
|
return selection;
|
|
163
163
|
case 'FragmentSpread': {
|
|
164
164
|
var fragment = fragmentMap && fragmentMap[selection.name.value];
|
|
165
|
-
__DEV__ ? tsInvariant.invariant(fragment, "No fragment named " + selection.name.value + ".") : tsInvariant.invariant(fragment,
|
|
165
|
+
__DEV__ ? tsInvariant.invariant(fragment, "No fragment named " + selection.name.value + ".") : tsInvariant.invariant(fragment, 45);
|
|
166
166
|
return fragment;
|
|
167
167
|
}
|
|
168
168
|
default:
|
|
@@ -246,7 +246,7 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
|
|
|
246
246
|
else {
|
|
247
247
|
throw __DEV__ ? new tsInvariant.InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" +
|
|
248
248
|
'is not supported. Use variables instead of inline arguments to ' +
|
|
249
|
-
'overcome this limitation.') : new tsInvariant.InvariantError(
|
|
249
|
+
'overcome this limitation.') : new tsInvariant.InvariantError(54);
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
252
|
function storeKeyNameFromField(field, variables) {
|
|
@@ -380,16 +380,16 @@ function isInlineFragment(selection) {
|
|
|
380
380
|
}
|
|
381
381
|
|
|
382
382
|
function checkDocument(doc) {
|
|
383
|
-
__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',
|
|
383
|
+
__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);
|
|
384
384
|
var operations = doc.definitions
|
|
385
385
|
.filter(function (d) { return d.kind !== 'FragmentDefinition'; })
|
|
386
386
|
.map(function (definition) {
|
|
387
387
|
if (definition.kind !== 'OperationDefinition') {
|
|
388
|
-
throw __DEV__ ? new tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\"") : new tsInvariant.InvariantError(
|
|
388
|
+
throw __DEV__ ? new tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\"") : new tsInvariant.InvariantError(47);
|
|
389
389
|
}
|
|
390
390
|
return definition;
|
|
391
391
|
});
|
|
392
|
-
__DEV__ ? tsInvariant.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations") : tsInvariant.invariant(operations.length <= 1,
|
|
392
|
+
__DEV__ ? tsInvariant.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations") : tsInvariant.invariant(operations.length <= 1, 48);
|
|
393
393
|
return doc;
|
|
394
394
|
}
|
|
395
395
|
function getOperationDefinition(doc) {
|
|
@@ -408,14 +408,14 @@ function getFragmentDefinitions(doc) {
|
|
|
408
408
|
}
|
|
409
409
|
function getQueryDefinition(doc) {
|
|
410
410
|
var queryDef = getOperationDefinition(doc);
|
|
411
|
-
__DEV__ ? tsInvariant.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : tsInvariant.invariant(queryDef && queryDef.operation === 'query',
|
|
411
|
+
__DEV__ ? tsInvariant.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : tsInvariant.invariant(queryDef && queryDef.operation === 'query', 49);
|
|
412
412
|
return queryDef;
|
|
413
413
|
}
|
|
414
414
|
function getFragmentDefinition(doc) {
|
|
415
|
-
__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',
|
|
416
|
-
__DEV__ ? tsInvariant.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : tsInvariant.invariant(doc.definitions.length <= 1,
|
|
415
|
+
__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);
|
|
416
|
+
__DEV__ ? tsInvariant.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : tsInvariant.invariant(doc.definitions.length <= 1, 51);
|
|
417
417
|
var fragmentDef = doc.definitions[0];
|
|
418
|
-
__DEV__ ? tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition',
|
|
418
|
+
__DEV__ ? tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 52);
|
|
419
419
|
return fragmentDef;
|
|
420
420
|
}
|
|
421
421
|
function getMainDefinition(queryDoc) {
|
|
@@ -438,7 +438,7 @@ function getMainDefinition(queryDoc) {
|
|
|
438
438
|
if (fragmentDefinition) {
|
|
439
439
|
return fragmentDefinition;
|
|
440
440
|
}
|
|
441
|
-
throw __DEV__ ? new tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new tsInvariant.InvariantError(
|
|
441
|
+
throw __DEV__ ? new tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new tsInvariant.InvariantError(53);
|
|
442
442
|
}
|
|
443
443
|
function getDefaultValues(definition) {
|
|
444
444
|
var defaultValues = Object.create(null);
|
|
@@ -720,7 +720,7 @@ function removeClientSetsFromDocument(document) {
|
|
|
720
720
|
return modifiedDoc;
|
|
721
721
|
}
|
|
722
722
|
|
|
723
|
-
var hasOwnProperty$
|
|
723
|
+
var hasOwnProperty$3 = Object.prototype.hasOwnProperty;
|
|
724
724
|
function mergeDeep() {
|
|
725
725
|
var sources = [];
|
|
726
726
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -757,7 +757,7 @@ var DeepMerger = (function () {
|
|
|
757
757
|
}
|
|
758
758
|
if (isNonNullObject(source) && isNonNullObject(target)) {
|
|
759
759
|
Object.keys(source).forEach(function (sourceKey) {
|
|
760
|
-
if (hasOwnProperty$
|
|
760
|
+
if (hasOwnProperty$3.call(target, sourceKey)) {
|
|
761
761
|
var targetValue = target[sourceKey];
|
|
762
762
|
if (source[sourceKey] !== targetValue) {
|
|
763
763
|
var result = _this.reconciler.apply(_this, tslib.__spreadArray([target, source, sourceKey], context));
|
|
@@ -937,7 +937,7 @@ var Concast = (function (_super) {
|
|
|
937
937
|
var sub = _this.sub;
|
|
938
938
|
if (sub !== null) {
|
|
939
939
|
if (sub)
|
|
940
|
-
|
|
940
|
+
setTimeout(function () { return sub.unsubscribe(); });
|
|
941
941
|
_this.sub = null;
|
|
942
942
|
_this.latest = ["error", error];
|
|
943
943
|
_this.reject(error);
|
|
@@ -1086,8 +1086,6 @@ function stringifyForDisplay(value) {
|
|
|
1086
1086
|
}).split(JSON.stringify(undefId)).join("<undefined>");
|
|
1087
1087
|
}
|
|
1088
1088
|
|
|
1089
|
-
__DEV__ ? tsInvariant.invariant("boolean" === typeof DEV, DEV) : tsInvariant.invariant("boolean" === typeof DEV, 59);
|
|
1090
|
-
|
|
1091
1089
|
function fromError(errorValue) {
|
|
1092
1090
|
return new zenObservableTs.Observable(function (observer) {
|
|
1093
1091
|
observer.error(errorValue);
|
|
@@ -1143,7 +1141,7 @@ function validateOperation(operation) {
|
|
|
1143
1141
|
for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {
|
|
1144
1142
|
var key = _a[_i];
|
|
1145
1143
|
if (OPERATION_FIELDS.indexOf(key) < 0) {
|
|
1146
|
-
throw __DEV__ ? new tsInvariant.InvariantError("illegal argument: " + key) : new tsInvariant.InvariantError(
|
|
1144
|
+
throw __DEV__ ? new tsInvariant.InvariantError("illegal argument: " + key) : new tsInvariant.InvariantError(26);
|
|
1147
1145
|
}
|
|
1148
1146
|
}
|
|
1149
1147
|
return operation;
|
|
@@ -1266,7 +1264,7 @@ var ApolloLink = (function () {
|
|
|
1266
1264
|
return ApolloLink.concat(this, next);
|
|
1267
1265
|
};
|
|
1268
1266
|
ApolloLink.prototype.request = function (operation, forward) {
|
|
1269
|
-
throw __DEV__ ? new tsInvariant.InvariantError('request is not implemented') : new tsInvariant.InvariantError(
|
|
1267
|
+
throw __DEV__ ? new tsInvariant.InvariantError('request is not implemented') : new tsInvariant.InvariantError(21);
|
|
1270
1268
|
};
|
|
1271
1269
|
ApolloLink.prototype.onError = function (error, observer) {
|
|
1272
1270
|
if (observer && observer.error) {
|
|
@@ -1292,9 +1290,9 @@ var concat = ApolloLink.concat;
|
|
|
1292
1290
|
|
|
1293
1291
|
var execute = ApolloLink.execute;
|
|
1294
1292
|
|
|
1295
|
-
var version = '3.4.
|
|
1293
|
+
var version = '3.4.10';
|
|
1296
1294
|
|
|
1297
|
-
var hasOwnProperty$
|
|
1295
|
+
var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
|
|
1298
1296
|
function parseAndCheckHttpResponse(operations) {
|
|
1299
1297
|
return function (response) { return response
|
|
1300
1298
|
.text()
|
|
@@ -1316,8 +1314,8 @@ function parseAndCheckHttpResponse(operations) {
|
|
|
1316
1314
|
throwServerError(response, result, "Response not successful: Received status code " + response.status);
|
|
1317
1315
|
}
|
|
1318
1316
|
if (!Array.isArray(result) &&
|
|
1319
|
-
!hasOwnProperty$
|
|
1320
|
-
!hasOwnProperty$
|
|
1317
|
+
!hasOwnProperty$2.call(result, 'data') &&
|
|
1318
|
+
!hasOwnProperty$2.call(result, 'errors')) {
|
|
1321
1319
|
throwServerError(response, result, "Server response was missing for query '" + (Array.isArray(operations)
|
|
1322
1320
|
? operations.map(function (op) { return op.operationName; })
|
|
1323
1321
|
: operations.operationName) + "'.");
|
|
@@ -1332,7 +1330,7 @@ var serializeFetchParameter = function (p, label) {
|
|
|
1332
1330
|
serialized = JSON.stringify(p);
|
|
1333
1331
|
}
|
|
1334
1332
|
catch (e) {
|
|
1335
|
-
var parseError = __DEV__ ? new tsInvariant.InvariantError("Network request failed. " + label + " is not serializable: " + e.message) : new tsInvariant.InvariantError(
|
|
1333
|
+
var parseError = __DEV__ ? new tsInvariant.InvariantError("Network request failed. " + label + " is not serializable: " + e.message) : new tsInvariant.InvariantError(23);
|
|
1336
1334
|
parseError.parseError = e;
|
|
1337
1335
|
throw parseError;
|
|
1338
1336
|
}
|
|
@@ -1392,7 +1390,7 @@ function headersToLowerCase(headers) {
|
|
|
1392
1390
|
|
|
1393
1391
|
var checkFetcher = function (fetcher) {
|
|
1394
1392
|
if (!fetcher && typeof fetch === 'undefined') {
|
|
1395
|
-
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(
|
|
1393
|
+
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(22);
|
|
1396
1394
|
}
|
|
1397
1395
|
};
|
|
1398
1396
|
|
|
@@ -1772,7 +1770,7 @@ var EntityStore = (function () {
|
|
|
1772
1770
|
: newer;
|
|
1773
1771
|
if (!incoming)
|
|
1774
1772
|
return;
|
|
1775
|
-
__DEV__ ? tsInvariant.invariant(typeof dataId === "string", "store.merge expects a string ID") : tsInvariant.invariant(typeof dataId === "string",
|
|
1773
|
+
__DEV__ ? tsInvariant.invariant(typeof dataId === "string", "store.merge expects a string ID") : tsInvariant.invariant(typeof dataId === "string", 1);
|
|
1776
1774
|
var merged = new DeepMerger(storeObjectReconciler).merge(existing, incoming);
|
|
1777
1775
|
this.data[dataId] = merged;
|
|
1778
1776
|
if (merged !== existing) {
|
|
@@ -2363,7 +2361,7 @@ var StoreReader = (function () {
|
|
|
2363
2361
|
!context.store.has(objectOrReference.__ref)) {
|
|
2364
2362
|
return {
|
|
2365
2363
|
result: this.canon.empty,
|
|
2366
|
-
missing: [missingFromInvariant(__DEV__ ? new tsInvariant.InvariantError("Dangling reference to missing " + objectOrReference.__ref + " object") : new tsInvariant.InvariantError(
|
|
2364
|
+
missing: [missingFromInvariant(__DEV__ ? new tsInvariant.InvariantError("Dangling reference to missing " + objectOrReference.__ref + " object") : new tsInvariant.InvariantError(5), context)],
|
|
2367
2365
|
};
|
|
2368
2366
|
}
|
|
2369
2367
|
var variables = context.variables, policies = context.policies, store = context.store;
|
|
@@ -2402,7 +2400,7 @@ var StoreReader = (function () {
|
|
|
2402
2400
|
if (!addTypenameToDocument.added(selection)) {
|
|
2403
2401
|
getMissing().push(missingFromInvariant(__DEV__ ? new tsInvariant.InvariantError("Can't find field '" + selection.name.value + "' on " + (isReference(objectOrReference)
|
|
2404
2402
|
? objectOrReference.__ref + " object"
|
|
2405
|
-
: "object " + JSON.stringify(objectOrReference, null, 2))) : new tsInvariant.InvariantError(
|
|
2403
|
+
: "object " + JSON.stringify(objectOrReference, null, 2))) : new tsInvariant.InvariantError(6), context));
|
|
2406
2404
|
}
|
|
2407
2405
|
}
|
|
2408
2406
|
else if (Array.isArray(fieldValue)) {
|
|
@@ -2499,7 +2497,7 @@ function assertSelectionSetForIdValue(store, field, fieldValue) {
|
|
|
2499
2497
|
var workSet_1 = new Set([fieldValue]);
|
|
2500
2498
|
workSet_1.forEach(function (value) {
|
|
2501
2499
|
if (isNonNullObject(value)) {
|
|
2502
|
-
__DEV__ ? tsInvariant.invariant(!isReference(value), "Missing selection set for object of type " + getTypenameFromStoreObject(store, value) + " returned for query field " + field.name.value) : tsInvariant.invariant(!isReference(value),
|
|
2500
|
+
__DEV__ ? tsInvariant.invariant(!isReference(value), "Missing selection set for object of type " + getTypenameFromStoreObject(store, value) + " returned for query field " + field.name.value) : tsInvariant.invariant(!isReference(value), 7);
|
|
2503
2501
|
Object.values(value).forEach(workSet_1.add, workSet_1);
|
|
2504
2502
|
}
|
|
2505
2503
|
});
|
|
@@ -2538,12 +2536,12 @@ var StoreWriter = (function () {
|
|
|
2538
2536
|
context: context,
|
|
2539
2537
|
});
|
|
2540
2538
|
if (!isReference(ref)) {
|
|
2541
|
-
throw __DEV__ ? new tsInvariant.InvariantError("Could not identify object " + JSON.stringify(result)) : new tsInvariant.InvariantError(
|
|
2539
|
+
throw __DEV__ ? new tsInvariant.InvariantError("Could not identify object " + JSON.stringify(result)) : new tsInvariant.InvariantError(8);
|
|
2542
2540
|
}
|
|
2543
2541
|
context.incomingById.forEach(function (_a, dataId) {
|
|
2544
2542
|
var fields = _a.fields, mergeTree = _a.mergeTree, selections = _a.selections;
|
|
2545
2543
|
var entityRef = makeReference(dataId);
|
|
2546
|
-
if (mergeTree.map.size) {
|
|
2544
|
+
if (mergeTree && mergeTree.map.size) {
|
|
2547
2545
|
var applied = _this.applyMerges(mergeTree, entityRef, fields, context);
|
|
2548
2546
|
if (isReference(applied)) {
|
|
2549
2547
|
return;
|
|
@@ -2561,7 +2559,7 @@ var StoreWriter = (function () {
|
|
|
2561
2559
|
}
|
|
2562
2560
|
});
|
|
2563
2561
|
var hasMergeFunction_1 = function (storeFieldName) {
|
|
2564
|
-
var childTree = mergeTree.map.get(storeFieldName);
|
|
2562
|
+
var childTree = mergeTree && mergeTree.map.get(storeFieldName);
|
|
2565
2563
|
return Boolean(childTree && childTree.info && childTree.info.merge);
|
|
2566
2564
|
};
|
|
2567
2565
|
Object.keys(fields).forEach(function (storeFieldName) {
|
|
@@ -2670,7 +2668,7 @@ var StoreWriter = (function () {
|
|
|
2670
2668
|
else {
|
|
2671
2669
|
context.incomingById.set(dataId, {
|
|
2672
2670
|
fields: incomingFields,
|
|
2673
|
-
mergeTree: mergeTree,
|
|
2671
|
+
mergeTree: mergeTreeIsEmpty(mergeTree) ? void 0 : mergeTree,
|
|
2674
2672
|
selections: selections,
|
|
2675
2673
|
});
|
|
2676
2674
|
}
|
|
@@ -3035,7 +3033,7 @@ var Policies = (function () {
|
|
|
3035
3033
|
var rootId = "ROOT_" + which.toUpperCase();
|
|
3036
3034
|
var old = this.rootTypenamesById[rootId];
|
|
3037
3035
|
if (typename !== old) {
|
|
3038
|
-
__DEV__ ? tsInvariant.invariant(!old || old === which, "Cannot change root " + which + " __typename more than once") : tsInvariant.invariant(!old || old === which,
|
|
3036
|
+
__DEV__ ? tsInvariant.invariant(!old || old === which, "Cannot change root " + which + " __typename more than once") : tsInvariant.invariant(!old || old === which, 2);
|
|
3039
3037
|
if (old)
|
|
3040
3038
|
delete this.rootIdsByTypename[old];
|
|
3041
3039
|
this.rootIdsByTypename[typename] = rootId;
|
|
@@ -3279,7 +3277,7 @@ function makeFieldFunctionOptions(policies, objectOrReference, fieldSpec, contex
|
|
|
3279
3277
|
function makeMergeObjectsFunction(store) {
|
|
3280
3278
|
return function mergeObjects(existing, incoming) {
|
|
3281
3279
|
if (Array.isArray(existing) || Array.isArray(incoming)) {
|
|
3282
|
-
throw __DEV__ ? new tsInvariant.InvariantError("Cannot automatically merge arrays") : new tsInvariant.InvariantError(
|
|
3280
|
+
throw __DEV__ ? new tsInvariant.InvariantError("Cannot automatically merge arrays") : new tsInvariant.InvariantError(3);
|
|
3283
3281
|
}
|
|
3284
3282
|
if (isNonNullObject(existing) &&
|
|
3285
3283
|
isNonNullObject(incoming)) {
|
|
@@ -3360,24 +3358,27 @@ function makeAliasMap(selectionSet, fragmentMap) {
|
|
|
3360
3358
|
}
|
|
3361
3359
|
function computeKeyObject(response, specifier, strict, aliasMap) {
|
|
3362
3360
|
var keyObj = Object.create(null);
|
|
3363
|
-
var
|
|
3361
|
+
var lastResponseKey;
|
|
3362
|
+
var lastActualKey;
|
|
3364
3363
|
specifier.forEach(function (s) {
|
|
3365
3364
|
if (Array.isArray(s)) {
|
|
3366
|
-
if (typeof
|
|
3365
|
+
if (typeof lastActualKey === "string" &&
|
|
3366
|
+
typeof lastResponseKey === "string") {
|
|
3367
3367
|
var subsets = aliasMap && aliasMap.subsets;
|
|
3368
|
-
var subset = subsets && subsets[
|
|
3369
|
-
keyObj[
|
|
3368
|
+
var subset = subsets && subsets[lastActualKey];
|
|
3369
|
+
keyObj[lastActualKey] =
|
|
3370
|
+
computeKeyObject(response[lastResponseKey], s, strict, subset);
|
|
3370
3371
|
}
|
|
3371
3372
|
}
|
|
3372
3373
|
else {
|
|
3373
3374
|
var aliases = aliasMap && aliasMap.aliases;
|
|
3374
3375
|
var responseName = aliases && aliases[s] || s;
|
|
3375
3376
|
if (hasOwn.call(response, responseName)) {
|
|
3376
|
-
keyObj[
|
|
3377
|
+
keyObj[lastActualKey = s] = response[lastResponseKey = responseName];
|
|
3377
3378
|
}
|
|
3378
3379
|
else {
|
|
3379
|
-
__DEV__ ? tsInvariant.invariant(!strict, "Missing field '" + responseName + "' while computing key fields") : tsInvariant.invariant(!strict,
|
|
3380
|
-
|
|
3380
|
+
__DEV__ ? tsInvariant.invariant(!strict, "Missing field '" + responseName + "' while computing key fields") : tsInvariant.invariant(!strict, 4);
|
|
3381
|
+
lastResponseKey = lastActualKey = void 0;
|
|
3381
3382
|
}
|
|
3382
3383
|
}
|
|
3383
3384
|
});
|
|
@@ -3669,7 +3670,6 @@ var InMemoryCache = (function (_super) {
|
|
|
3669
3670
|
return InMemoryCache;
|
|
3670
3671
|
}(ApolloCache));
|
|
3671
3672
|
|
|
3672
|
-
__DEV__ ? tsInvariant.invariant("boolean" === typeof DEV, DEV) : tsInvariant.invariant("boolean" === typeof DEV, 22);
|
|
3673
3673
|
function isApolloError(err) {
|
|
3674
3674
|
return err.hasOwnProperty('graphQLErrors');
|
|
3675
3675
|
}
|
|
@@ -3721,6 +3721,7 @@ function isNetworkRequestInFlight(networkStatus) {
|
|
|
3721
3721
|
return networkStatus ? networkStatus < 7 : false;
|
|
3722
3722
|
}
|
|
3723
3723
|
|
|
3724
|
+
var assign = Object.assign, hasOwnProperty$1 = Object.hasOwnProperty;
|
|
3724
3725
|
var warnedAboutUpdateQuery = false;
|
|
3725
3726
|
var ObservableQuery = (function (_super) {
|
|
3726
3727
|
tslib.__extends(ObservableQuery, _super);
|
|
@@ -3736,11 +3737,12 @@ var ObservableQuery = (function (_super) {
|
|
|
3736
3737
|
catch (_a) { }
|
|
3737
3738
|
var first = !_this.observers.size;
|
|
3738
3739
|
_this.observers.add(observer);
|
|
3739
|
-
|
|
3740
|
-
|
|
3740
|
+
var last = _this.last;
|
|
3741
|
+
if (last && last.error) {
|
|
3742
|
+
observer.error && observer.error(last.error);
|
|
3741
3743
|
}
|
|
3742
|
-
else if (
|
|
3743
|
-
observer.next && observer.next(
|
|
3744
|
+
else if (last && last.result) {
|
|
3745
|
+
observer.next && observer.next(last.result);
|
|
3744
3746
|
}
|
|
3745
3747
|
if (first) {
|
|
3746
3748
|
_this.reobserve().catch(function () { });
|
|
@@ -3753,18 +3755,6 @@ var ObservableQuery = (function (_super) {
|
|
|
3753
3755
|
}) || this;
|
|
3754
3756
|
_this.observers = new Set();
|
|
3755
3757
|
_this.subscriptions = new Set();
|
|
3756
|
-
_this.observer = {
|
|
3757
|
-
next: function (result) {
|
|
3758
|
-
if (_this.lastError || _this.isDifferentFromLastResult(result)) {
|
|
3759
|
-
_this.updateLastResult(result);
|
|
3760
|
-
iterateObserversSafely(_this.observers, 'next', result);
|
|
3761
|
-
}
|
|
3762
|
-
},
|
|
3763
|
-
error: function (error) {
|
|
3764
|
-
_this.updateLastResult(tslib.__assign(tslib.__assign({}, _this.lastResult), { error: error, errors: error.graphQLErrors, networkStatus: exports.NetworkStatus.error, loading: false }));
|
|
3765
|
-
iterateObserversSafely(_this.observers, 'error', _this.lastError = error);
|
|
3766
|
-
},
|
|
3767
|
-
};
|
|
3768
3758
|
_this.isTornDown = false;
|
|
3769
3759
|
_this.options = options;
|
|
3770
3760
|
_this.queryId = queryInfo.queryId || queryManager.generateQueryId();
|
|
@@ -3803,15 +3793,24 @@ var ObservableQuery = (function (_super) {
|
|
|
3803
3793
|
};
|
|
3804
3794
|
ObservableQuery.prototype.getCurrentResult = function (saveAsLastResult) {
|
|
3805
3795
|
if (saveAsLastResult === void 0) { saveAsLastResult = true; }
|
|
3806
|
-
var
|
|
3796
|
+
var lastResult = this.getLastResult(true);
|
|
3807
3797
|
var networkStatus = this.queryInfo.networkStatus ||
|
|
3808
3798
|
(lastResult && lastResult.networkStatus) ||
|
|
3809
3799
|
exports.NetworkStatus.ready;
|
|
3810
3800
|
var result = tslib.__assign(tslib.__assign({}, lastResult), { loading: isNetworkRequestInFlight(networkStatus), networkStatus: networkStatus });
|
|
3811
|
-
|
|
3801
|
+
var _a = this.options.fetchPolicy, fetchPolicy = _a === void 0 ? "cache-first" : _a;
|
|
3802
|
+
var shouldReturnCachedData = lastResult || (fetchPolicy !== 'network-only' &&
|
|
3803
|
+
fetchPolicy !== 'no-cache' &&
|
|
3804
|
+
fetchPolicy !== 'standby');
|
|
3805
|
+
if (shouldReturnCachedData &&
|
|
3806
|
+
!this.queryManager.transform(this.options.query).hasForcedResolvers) {
|
|
3812
3807
|
var diff = this.queryInfo.getDiff();
|
|
3813
|
-
|
|
3814
|
-
|
|
3808
|
+
if (diff.complete || this.options.returnPartialData) {
|
|
3809
|
+
result.data = diff.result;
|
|
3810
|
+
}
|
|
3811
|
+
if (equality.equal(result.data, {})) {
|
|
3812
|
+
result.data = void 0;
|
|
3813
|
+
}
|
|
3815
3814
|
if (diff.complete) {
|
|
3816
3815
|
if (result.networkStatus === exports.NetworkStatus.loading &&
|
|
3817
3816
|
(fetchPolicy === 'cache-first' ||
|
|
@@ -3839,24 +3838,31 @@ var ObservableQuery = (function (_super) {
|
|
|
3839
3838
|
return result;
|
|
3840
3839
|
};
|
|
3841
3840
|
ObservableQuery.prototype.isDifferentFromLastResult = function (newResult) {
|
|
3842
|
-
return !equality.equal(this.
|
|
3841
|
+
return !this.last || !equality.equal(this.last.result, newResult);
|
|
3843
3842
|
};
|
|
3844
|
-
ObservableQuery.prototype.
|
|
3845
|
-
|
|
3843
|
+
ObservableQuery.prototype.getLast = function (key, variablesMustMatch) {
|
|
3844
|
+
var last = this.last;
|
|
3845
|
+
if (last &&
|
|
3846
|
+
last[key] &&
|
|
3847
|
+
(!variablesMustMatch || equality.equal(last.variables, this.variables))) {
|
|
3848
|
+
return last[key];
|
|
3849
|
+
}
|
|
3850
|
+
};
|
|
3851
|
+
ObservableQuery.prototype.getLastResult = function (variablesMustMatch) {
|
|
3852
|
+
return this.getLast("result", variablesMustMatch);
|
|
3846
3853
|
};
|
|
3847
|
-
ObservableQuery.prototype.getLastError = function () {
|
|
3848
|
-
return this.
|
|
3854
|
+
ObservableQuery.prototype.getLastError = function (variablesMustMatch) {
|
|
3855
|
+
return this.getLast("error", variablesMustMatch);
|
|
3849
3856
|
};
|
|
3850
3857
|
ObservableQuery.prototype.resetLastResults = function () {
|
|
3851
|
-
delete this.
|
|
3852
|
-
delete this.lastResultSnapshot;
|
|
3853
|
-
delete this.lastError;
|
|
3858
|
+
delete this.last;
|
|
3854
3859
|
this.isTornDown = false;
|
|
3855
3860
|
};
|
|
3856
3861
|
ObservableQuery.prototype.resetQueryStoreErrors = function () {
|
|
3857
3862
|
this.queryManager.resetErrors(this.queryId);
|
|
3858
3863
|
};
|
|
3859
3864
|
ObservableQuery.prototype.refetch = function (variables) {
|
|
3865
|
+
var _a;
|
|
3860
3866
|
var reobserveOptions = {
|
|
3861
3867
|
pollInterval: 0,
|
|
3862
3868
|
};
|
|
@@ -3867,6 +3873,13 @@ var ObservableQuery = (function (_super) {
|
|
|
3867
3873
|
else if (fetchPolicy !== 'cache-and-network') {
|
|
3868
3874
|
reobserveOptions.fetchPolicy = 'network-only';
|
|
3869
3875
|
}
|
|
3876
|
+
if (__DEV__ && variables && hasOwnProperty$1.call(variables, "variables")) {
|
|
3877
|
+
var queryDef = getQueryDefinition(this.options.query);
|
|
3878
|
+
var vars = queryDef.variableDefinitions;
|
|
3879
|
+
if (!vars || !vars.some(function (v) { return v.variable.name.value === "variables"; })) {
|
|
3880
|
+
__DEV__ && tsInvariant.invariant.warn("Called refetch(" + JSON.stringify(variables) + ") for query " + (((_a = queryDef.name) === null || _a === void 0 ? void 0 : _a.value) || JSON.stringify(queryDef)) + ", which does not declare a $variables variable.\nDid you mean to call refetch(variables) instead of refetch({ variables })?");
|
|
3881
|
+
}
|
|
3882
|
+
}
|
|
3870
3883
|
if (variables && !equality.equal(this.options.variables, variables)) {
|
|
3871
3884
|
reobserveOptions.variables = this.options.variables = tslib.__assign(tslib.__assign({}, this.options.variables), variables);
|
|
3872
3885
|
}
|
|
@@ -3963,12 +3976,10 @@ var ObservableQuery = (function (_super) {
|
|
|
3963
3976
|
}, exports.NetworkStatus.setVariables);
|
|
3964
3977
|
};
|
|
3965
3978
|
ObservableQuery.prototype.updateQuery = function (mapFn) {
|
|
3966
|
-
var _a;
|
|
3967
3979
|
var queryManager = this.queryManager;
|
|
3968
3980
|
var result = queryManager.cache.diff({
|
|
3969
3981
|
query: this.options.query,
|
|
3970
3982
|
variables: this.variables,
|
|
3971
|
-
previousResult: (_a = this.lastResult) === null || _a === void 0 ? void 0 : _a.data,
|
|
3972
3983
|
returnPartialData: true,
|
|
3973
3984
|
optimistic: false,
|
|
3974
3985
|
}).result;
|
|
@@ -4013,7 +4024,7 @@ var ObservableQuery = (function (_super) {
|
|
|
4013
4024
|
pollingInfo.interval === pollInterval) {
|
|
4014
4025
|
return;
|
|
4015
4026
|
}
|
|
4016
|
-
__DEV__ ? tsInvariant.invariant(pollInterval, 'Attempted to start a polling query without a polling interval.') : tsInvariant.invariant(pollInterval,
|
|
4027
|
+
__DEV__ ? tsInvariant.invariant(pollInterval, 'Attempted to start a polling query without a polling interval.') : tsInvariant.invariant(pollInterval, 12);
|
|
4017
4028
|
var info = pollingInfo || (this.pollingInfo = {});
|
|
4018
4029
|
info.interval = pollInterval;
|
|
4019
4030
|
var maybeFetch = function () {
|
|
@@ -4037,18 +4048,18 @@ var ObservableQuery = (function (_super) {
|
|
|
4037
4048
|
};
|
|
4038
4049
|
poll();
|
|
4039
4050
|
};
|
|
4040
|
-
ObservableQuery.prototype.updateLastResult = function (newResult) {
|
|
4041
|
-
|
|
4042
|
-
this.
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
: cloneDeep(newResult);
|
|
4051
|
+
ObservableQuery.prototype.updateLastResult = function (newResult, variables) {
|
|
4052
|
+
if (variables === void 0) { variables = this.variables; }
|
|
4053
|
+
this.last = tslib.__assign(tslib.__assign({}, this.last), { result: this.queryManager.assumeImmutableResults
|
|
4054
|
+
? newResult
|
|
4055
|
+
: cloneDeep(newResult), variables: variables });
|
|
4046
4056
|
if (!isNonEmptyArray(newResult.errors)) {
|
|
4047
|
-
delete this.
|
|
4057
|
+
delete this.last.error;
|
|
4048
4058
|
}
|
|
4049
|
-
return
|
|
4059
|
+
return this.last;
|
|
4050
4060
|
};
|
|
4051
4061
|
ObservableQuery.prototype.reobserve = function (newOptions, newNetworkStatus) {
|
|
4062
|
+
var _this = this;
|
|
4052
4063
|
this.isTornDown = false;
|
|
4053
4064
|
var useDisposableConcast = newNetworkStatus === exports.NetworkStatus.refetch ||
|
|
4054
4065
|
newNetworkStatus === exports.NetworkStatus.fetchMore ||
|
|
@@ -4056,7 +4067,7 @@ var ObservableQuery = (function (_super) {
|
|
|
4056
4067
|
var oldVariables = this.options.variables;
|
|
4057
4068
|
var options = useDisposableConcast
|
|
4058
4069
|
? compact(this.options, newOptions)
|
|
4059
|
-
:
|
|
4070
|
+
: assign(this.options, compact(newOptions));
|
|
4060
4071
|
if (!useDisposableConcast) {
|
|
4061
4072
|
this.updatePolling();
|
|
4062
4073
|
if (newOptions &&
|
|
@@ -4069,18 +4080,39 @@ var ObservableQuery = (function (_super) {
|
|
|
4069
4080
|
}
|
|
4070
4081
|
}
|
|
4071
4082
|
}
|
|
4083
|
+
var variables = options.variables && tslib.__assign({}, options.variables);
|
|
4072
4084
|
var concast = this.fetch(options, newNetworkStatus);
|
|
4085
|
+
var observer = {
|
|
4086
|
+
next: function (result) {
|
|
4087
|
+
_this.reportResult(result, variables);
|
|
4088
|
+
},
|
|
4089
|
+
error: function (error) {
|
|
4090
|
+
_this.reportError(error, variables);
|
|
4091
|
+
},
|
|
4092
|
+
};
|
|
4073
4093
|
if (!useDisposableConcast) {
|
|
4074
|
-
if (this.concast) {
|
|
4094
|
+
if (this.concast && this.observer) {
|
|
4075
4095
|
this.concast.removeObserver(this.observer, true);
|
|
4076
4096
|
}
|
|
4077
4097
|
this.concast = concast;
|
|
4098
|
+
this.observer = observer;
|
|
4078
4099
|
}
|
|
4079
|
-
concast.addObserver(
|
|
4100
|
+
concast.addObserver(observer);
|
|
4080
4101
|
return concast.promise;
|
|
4081
4102
|
};
|
|
4082
4103
|
ObservableQuery.prototype.observe = function () {
|
|
4083
|
-
this.
|
|
4104
|
+
this.reportResult(this.getCurrentResult(false), this.variables);
|
|
4105
|
+
};
|
|
4106
|
+
ObservableQuery.prototype.reportResult = function (result, variables) {
|
|
4107
|
+
if (this.getLastError() || this.isDifferentFromLastResult(result)) {
|
|
4108
|
+
this.updateLastResult(result, variables);
|
|
4109
|
+
iterateObserversSafely(this.observers, 'next', result);
|
|
4110
|
+
}
|
|
4111
|
+
};
|
|
4112
|
+
ObservableQuery.prototype.reportError = function (error, variables) {
|
|
4113
|
+
var errorResult = tslib.__assign(tslib.__assign({}, this.getLastResult()), { error: error, errors: error.graphQLErrors, networkStatus: exports.NetworkStatus.error, loading: false });
|
|
4114
|
+
this.updateLastResult(errorResult, variables);
|
|
4115
|
+
iterateObserversSafely(this.observers, 'error', this.last.error = error);
|
|
4084
4116
|
};
|
|
4085
4117
|
ObservableQuery.prototype.hasObservers = function () {
|
|
4086
4118
|
return this.observers.size > 0;
|
|
@@ -4088,9 +4120,10 @@ var ObservableQuery = (function (_super) {
|
|
|
4088
4120
|
ObservableQuery.prototype.tearDownQuery = function () {
|
|
4089
4121
|
if (this.isTornDown)
|
|
4090
4122
|
return;
|
|
4091
|
-
if (this.concast) {
|
|
4123
|
+
if (this.concast && this.observer) {
|
|
4092
4124
|
this.concast.removeObserver(this.observer);
|
|
4093
4125
|
delete this.concast;
|
|
4126
|
+
delete this.observer;
|
|
4094
4127
|
}
|
|
4095
4128
|
this.stopPolling();
|
|
4096
4129
|
this.subscriptions.forEach(function (sub) { return sub.unsubscribe(); });
|
|
@@ -4288,7 +4321,7 @@ var LocalState = (function () {
|
|
|
4288
4321
|
}
|
|
4289
4322
|
else {
|
|
4290
4323
|
fragment = fragmentMap[selection.name.value];
|
|
4291
|
-
__DEV__ ? tsInvariant.invariant(fragment, "No fragment named " + selection.name.value) : tsInvariant.invariant(fragment,
|
|
4324
|
+
__DEV__ ? tsInvariant.invariant(fragment, "No fragment named " + selection.name.value) : tsInvariant.invariant(fragment, 11);
|
|
4292
4325
|
}
|
|
4293
4326
|
if (fragment && fragment.typeCondition) {
|
|
4294
4327
|
typeCondition = fragment.typeCondition.name.value;
|
|
@@ -4674,7 +4707,7 @@ var QueryManager = (function () {
|
|
|
4674
4707
|
this.queries.forEach(function (_info, queryId) {
|
|
4675
4708
|
_this.stopQueryNoBroadcast(queryId);
|
|
4676
4709
|
});
|
|
4677
|
-
this.cancelPendingFetches(__DEV__ ? new tsInvariant.InvariantError('QueryManager stopped while query was in flight') : new tsInvariant.InvariantError(
|
|
4710
|
+
this.cancelPendingFetches(__DEV__ ? new tsInvariant.InvariantError('QueryManager stopped while query was in flight') : new tsInvariant.InvariantError(13));
|
|
4678
4711
|
};
|
|
4679
4712
|
QueryManager.prototype.cancelPendingFetches = function (error) {
|
|
4680
4713
|
this.fetchCancelFns.forEach(function (cancel) { return cancel(error); });
|
|
@@ -4687,10 +4720,10 @@ var QueryManager = (function () {
|
|
|
4687
4720
|
return tslib.__generator(this, function (_f) {
|
|
4688
4721
|
switch (_f.label) {
|
|
4689
4722
|
case 0:
|
|
4690
|
-
__DEV__ ? tsInvariant.invariant(mutation, 'mutation option is required. You must specify your GraphQL document in the mutation option.') : tsInvariant.invariant(mutation,
|
|
4723
|
+
__DEV__ ? tsInvariant.invariant(mutation, 'mutation option is required. You must specify your GraphQL document in the mutation option.') : tsInvariant.invariant(mutation, 14);
|
|
4691
4724
|
__DEV__ ? tsInvariant.invariant(fetchPolicy === 'network-only' ||
|
|
4692
4725
|
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' ||
|
|
4693
|
-
fetchPolicy === 'no-cache',
|
|
4726
|
+
fetchPolicy === 'no-cache', 15);
|
|
4694
4727
|
mutationId = this.generateMutationId();
|
|
4695
4728
|
mutation = this.transform(mutation).document;
|
|
4696
4729
|
variables = this.getVariables(mutation, variables);
|
|
@@ -4975,10 +5008,10 @@ var QueryManager = (function () {
|
|
|
4975
5008
|
var _this = this;
|
|
4976
5009
|
if (queryId === void 0) { queryId = this.generateQueryId(); }
|
|
4977
5010
|
__DEV__ ? tsInvariant.invariant(options.query, 'query option is required. You must specify your GraphQL document ' +
|
|
4978
|
-
'in the query option.') : tsInvariant.invariant(options.query,
|
|
4979
|
-
__DEV__ ? tsInvariant.invariant(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.') : tsInvariant.invariant(options.query.kind === 'Document',
|
|
4980
|
-
__DEV__ ? tsInvariant.invariant(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.') : tsInvariant.invariant(!options.returnPartialData,
|
|
4981
|
-
__DEV__ ? tsInvariant.invariant(!options.pollInterval, 'pollInterval option only supported on watchQuery.') : tsInvariant.invariant(!options.pollInterval,
|
|
5011
|
+
'in the query option.') : tsInvariant.invariant(options.query, 16);
|
|
5012
|
+
__DEV__ ? tsInvariant.invariant(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.') : tsInvariant.invariant(options.query.kind === 'Document', 17);
|
|
5013
|
+
__DEV__ ? tsInvariant.invariant(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.') : tsInvariant.invariant(!options.returnPartialData, 18);
|
|
5014
|
+
__DEV__ ? tsInvariant.invariant(!options.pollInterval, 'pollInterval option only supported on watchQuery.') : tsInvariant.invariant(!options.pollInterval, 19);
|
|
4982
5015
|
return this.fetchQuery(queryId, options).finally(function () { return _this.stopQuery(queryId); });
|
|
4983
5016
|
};
|
|
4984
5017
|
QueryManager.prototype.generateQueryId = function () {
|
|
@@ -5000,7 +5033,7 @@ var QueryManager = (function () {
|
|
|
5000
5033
|
queryInfo.stop();
|
|
5001
5034
|
};
|
|
5002
5035
|
QueryManager.prototype.clearStore = function () {
|
|
5003
|
-
this.cancelPendingFetches(__DEV__ ? new tsInvariant.InvariantError('Store reset while query was in flight (not completed in link chain)') : new tsInvariant.InvariantError(
|
|
5036
|
+
this.cancelPendingFetches(__DEV__ ? new tsInvariant.InvariantError('Store reset while query was in flight (not completed in link chain)') : new tsInvariant.InvariantError(20));
|
|
5004
5037
|
this.queries.forEach(function (queryInfo) {
|
|
5005
5038
|
if (queryInfo.observableQuery) {
|
|
5006
5039
|
queryInfo.networkStatus = exports.NetworkStatus.loading;
|
|
@@ -5275,7 +5308,7 @@ var QueryManager = (function () {
|
|
|
5275
5308
|
return _this.fetchQueryByPolicy(queryInfo, normalized, networkStatus);
|
|
5276
5309
|
};
|
|
5277
5310
|
this.fetchCancelFns.set(queryId, function (reason) {
|
|
5278
|
-
|
|
5311
|
+
setTimeout(function () { return concast.cancel(reason); });
|
|
5279
5312
|
});
|
|
5280
5313
|
var concast = new Concast(this.transform(normalized.query).hasClientExports
|
|
5281
5314
|
? this.localState.addExportedVariables(normalized.query, normalized.variables, normalized.context).then(fromVariables)
|
|
@@ -5493,7 +5526,7 @@ var ApolloClient = (function () {
|
|
|
5493
5526
|
if (!cache) {
|
|
5494
5527
|
throw __DEV__ ? new tsInvariant.InvariantError("To initialize Apollo Client, you must specify a 'cache' property " +
|
|
5495
5528
|
"in the options object. \n" +
|
|
5496
|
-
"For more information, please visit: https://go.apollo.dev/c/docs") : new tsInvariant.InvariantError(
|
|
5529
|
+
"For more information, please visit: https://go.apollo.dev/c/docs") : new tsInvariant.InvariantError(9);
|
|
5497
5530
|
}
|
|
5498
5531
|
this.link = link;
|
|
5499
5532
|
this.cache = cache;
|
|
@@ -5589,7 +5622,7 @@ var ApolloClient = (function () {
|
|
|
5589
5622
|
__DEV__ ? tsInvariant.invariant(options.fetchPolicy !== 'cache-and-network', 'The cache-and-network fetchPolicy does not work with client.query, because ' +
|
|
5590
5623
|
'client.query can only return a single result. Please use client.watchQuery ' +
|
|
5591
5624
|
'to receive multiple results from the cache and the network, or consider ' +
|
|
5592
|
-
'using a different fetchPolicy, such as cache-first or network-only.') : tsInvariant.invariant(options.fetchPolicy !== 'cache-and-network',
|
|
5625
|
+
'using a different fetchPolicy, such as cache-first or network-only.') : tsInvariant.invariant(options.fetchPolicy !== 'cache-and-network', 10);
|
|
5593
5626
|
if (this.disableNetworkFetches && options.fetchPolicy === 'network-only') {
|
|
5594
5627
|
options = tslib.__assign(tslib.__assign({}, options), { fetchPolicy: 'cache-first' });
|
|
5595
5628
|
}
|