@apollo/client 3.6.0-beta.2 → 3.6.0-beta.6
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 +323 -274
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +36 -35
- package/cache/cache.cjs.map +1 -1
- package/cache/inmemory/helpers.d.ts +1 -0
- package/cache/inmemory/helpers.d.ts.map +1 -1
- package/cache/inmemory/helpers.js +4 -3
- package/cache/inmemory/helpers.js.map +1 -1
- package/cache/inmemory/key-extractor.js +7 -7
- package/cache/inmemory/key-extractor.js.map +1 -1
- package/cache/inmemory/object-canon.d.ts.map +1 -1
- package/cache/inmemory/object-canon.js +2 -1
- package/cache/inmemory/object-canon.js.map +1 -1
- package/cache/inmemory/policies.d.ts +1 -1
- package/cache/inmemory/policies.d.ts.map +1 -1
- package/cache/inmemory/policies.js +9 -9
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/readFromStore.js +6 -6
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/writeToStore.js +13 -13
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/ApolloClient.js +1 -1
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.js +1 -1
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +8 -5
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryManager.js +1 -1
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +12 -9
- package/core/core.cjs.map +1 -1
- package/errors/errors.cjs +2 -2
- package/errors/errors.cjs.map +1 -1
- package/errors/index.js +2 -2
- package/errors/index.js.map +1 -1
- package/invariantErrorCodes.js +27 -27
- package/link/batch/batch.cjs +48 -38
- package/link/batch/batch.cjs.map +1 -1
- package/link/batch/batching.d.ts +2 -6
- package/link/batch/batching.d.ts.map +1 -1
- package/link/batch/batching.js +48 -38
- package/link/batch/batching.js.map +1 -1
- package/link/batch-http/batch-http.cjs +1 -1
- package/link/batch-http/batch-http.cjs.map +1 -1
- package/link/batch-http/batchHttpLink.js +2 -2
- package/link/batch-http/batchHttpLink.js.map +1 -1
- package/link/http/createHttpLink.js +2 -2
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/http.cjs +24 -13
- 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/parseAndCheckHttpResponse.js +3 -3
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/link/http/rewriteURIForGET.js +1 -1
- package/link/http/rewriteURIForGET.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.d.ts +5 -1
- package/link/http/selectHttpOptionsAndBody.d.ts.map +1 -1
- package/link/http/selectHttpOptionsAndBody.js +19 -8
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/link/http/serializeFetchParameter.js +1 -1
- package/link/http/serializeFetchParameter.js.map +1 -1
- package/link/subscriptions/index.d.ts +9 -0
- package/link/subscriptions/index.d.ts.map +1 -0
- package/link/subscriptions/index.js +39 -0
- package/link/subscriptions/index.js.map +1 -0
- package/link/subscriptions/package.json +8 -0
- package/link/subscriptions/subscriptions.cjs +45 -0
- package/link/subscriptions/subscriptions.cjs.map +1 -0
- package/link/utils/utils.cjs +1 -1
- package/link/utils/utils.cjs.map +1 -1
- package/link/utils/validateOperation.js +1 -1
- package/link/utils/validateOperation.js.map +1 -1
- package/package.json +22 -21
- package/react/hoc/hoc.cjs +5 -5
- package/react/hoc/hoc.cjs.map +1 -1
- package/react/hoc/mutation-hoc.js +2 -2
- package/react/hoc/mutation-hoc.js.map +1 -1
- package/react/hoc/query-hoc.js +1 -1
- package/react/hoc/query-hoc.js.map +1 -1
- package/react/hoc/subscription-hoc.js +1 -1
- package/react/hoc/subscription-hoc.js.map +1 -1
- package/react/hoc/withApollo.js +1 -1
- package/react/hoc/withApollo.js.map +1 -1
- package/react/hooks/hooks.cjs +225 -191
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/useApolloClient.js +2 -2
- package/react/hooks/useApolloClient.js.map +1 -1
- package/react/hooks/useLazyQuery.d.ts.map +1 -1
- package/react/hooks/useLazyQuery.js +20 -27
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useMutation.d.ts.map +1 -1
- package/react/hooks/useMutation.js +59 -68
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.d.ts.map +1 -1
- package/react/hooks/useQuery.js +137 -88
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useSubscription.d.ts.map +1 -1
- package/react/hooks/useSubscription.js +10 -8
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/parser/index.js +7 -7
- package/react/parser/index.js.map +1 -1
- package/react/parser/parser.cjs +7 -7
- package/react/parser/parser.cjs.map +1 -1
- package/react/ssr/RenderPromises.d.ts +2 -2
- package/react/ssr/RenderPromises.d.ts.map +1 -1
- package/react/ssr/RenderPromises.js +7 -5
- package/react/ssr/RenderPromises.js.map +1 -1
- package/react/ssr/ssr.cjs +7 -5
- package/react/ssr/ssr.cjs.map +1 -1
- package/react/types/types.d.ts +1 -1
- package/react/types/types.d.ts.map +1 -1
- package/react/types/types.js.map +1 -1
- package/testing/core/core.cjs +2 -2
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/mocking/mockFetch.js +1 -1
- package/testing/core/mocking/mockFetch.js.map +1 -1
- package/testing/core/mocking/mockLink.js +2 -2
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/testing/core/observableToPromise.js +1 -1
- package/testing/core/observableToPromise.js.map +1 -1
- package/utilities/common/makeUniqueId.js +1 -1
- package/utilities/common/makeUniqueId.js.map +1 -1
- package/utilities/globals/global.d.ts +2 -8
- package/utilities/globals/global.d.ts.map +1 -1
- package/utilities/globals/global.js +1 -1
- package/utilities/globals/global.js.map +1 -1
- package/utilities/globals/globals.cjs +1 -1
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/graphql/directives.js +4 -4
- package/utilities/graphql/directives.js.map +1 -1
- package/utilities/graphql/fragments.js +3 -3
- package/utilities/graphql/fragments.js.map +1 -1
- package/utilities/graphql/getFromAST.js +2 -2
- package/utilities/graphql/getFromAST.js.map +1 -1
- package/utilities/graphql/storeUtils.js +5 -5
- package/utilities/graphql/storeUtils.js.map +1 -1
- package/utilities/utilities.cjs +15 -15
- package/utilities/utilities.cjs.map +1 -1
- package/version.js +1 -1
package/core/core.cjs
CHANGED
|
@@ -15,7 +15,7 @@ var utils = require('../link/utils');
|
|
|
15
15
|
var tsInvariant = require('ts-invariant');
|
|
16
16
|
var graphqlTag = require('graphql-tag');
|
|
17
17
|
|
|
18
|
-
var version = '3.6.0-beta.
|
|
18
|
+
var version = '3.6.0-beta.6';
|
|
19
19
|
|
|
20
20
|
exports.NetworkStatus = void 0;
|
|
21
21
|
(function (NetworkStatus) {
|
|
@@ -178,7 +178,7 @@ var ObservableQuery = (function (_super) {
|
|
|
178
178
|
pollInterval: 0,
|
|
179
179
|
};
|
|
180
180
|
var fetchPolicy = this.options.fetchPolicy;
|
|
181
|
-
if (fetchPolicy === '
|
|
181
|
+
if (fetchPolicy === 'cache-and-network') {
|
|
182
182
|
reobserveOptions.fetchPolicy = fetchPolicy;
|
|
183
183
|
}
|
|
184
184
|
else if (fetchPolicy === 'no-cache') {
|
|
@@ -191,7 +191,7 @@ var ObservableQuery = (function (_super) {
|
|
|
191
191
|
var queryDef = utilities.getQueryDefinition(this.options.query);
|
|
192
192
|
var vars = queryDef.variableDefinitions;
|
|
193
193
|
if (!vars || !vars.some(function (v) { return v.variable.name.value === "variables"; })) {
|
|
194
|
-
__DEV__ && globals.invariant.warn("Called refetch("
|
|
194
|
+
__DEV__ && globals.invariant.warn("Called refetch(".concat(JSON.stringify(variables), ") for query ").concat(((_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 })?"));
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
if (variables && !equality.equal(this.options.variables, variables)) {
|
|
@@ -418,8 +418,11 @@ var ObservableQuery = (function (_super) {
|
|
|
418
418
|
this.reportResult(this.getCurrentResult(false), this.variables);
|
|
419
419
|
};
|
|
420
420
|
ObservableQuery.prototype.reportResult = function (result, variables) {
|
|
421
|
-
|
|
422
|
-
|
|
421
|
+
var lastError = this.getLastError();
|
|
422
|
+
if (lastError || this.isDifferentFromLastResult(result)) {
|
|
423
|
+
if (lastError || !result.partial || this.options.returnPartialData) {
|
|
424
|
+
this.updateLastResult(result, variables);
|
|
425
|
+
}
|
|
423
426
|
utilities.iterateObserversSafely(this.observers, 'next', result);
|
|
424
427
|
}
|
|
425
428
|
};
|
|
@@ -454,7 +457,7 @@ function defaultSubscriptionObserverErrorCallback(error) {
|
|
|
454
457
|
}
|
|
455
458
|
function logMissingFieldErrors(missing) {
|
|
456
459
|
if (__DEV__ && missing) {
|
|
457
|
-
__DEV__ && globals.invariant.debug("Missing cache result fields: "
|
|
460
|
+
__DEV__ && globals.invariant.debug("Missing cache result fields: ".concat(JSON.stringify(missing)), missing);
|
|
458
461
|
}
|
|
459
462
|
}
|
|
460
463
|
function applyNextFetchPolicy(options) {
|
|
@@ -635,7 +638,7 @@ var LocalState = (function () {
|
|
|
635
638
|
}
|
|
636
639
|
else {
|
|
637
640
|
fragment = fragmentMap[selection.name.value];
|
|
638
|
-
__DEV__ ? globals.invariant(fragment, "No fragment named "
|
|
641
|
+
__DEV__ ? globals.invariant(fragment, "No fragment named ".concat(selection.name.value)) : globals.invariant(fragment, 9);
|
|
639
642
|
}
|
|
640
643
|
if (fragment && fragment.typeCondition) {
|
|
641
644
|
typeCondition = fragment.typeCondition.name.value;
|
|
@@ -1426,7 +1429,7 @@ var QueryManager = (function () {
|
|
|
1426
1429
|
if (__DEV__ && queryNamesAndDocs.size) {
|
|
1427
1430
|
queryNamesAndDocs.forEach(function (included, nameOrDoc) {
|
|
1428
1431
|
if (!included) {
|
|
1429
|
-
__DEV__ && globals.invariant.warn("Unknown query "
|
|
1432
|
+
__DEV__ && globals.invariant.warn("Unknown query ".concat(typeof nameOrDoc === "string" ? "named " : "").concat(JSON.stringify(nameOrDoc, null, 2), " requested in refetchQueries options.include array"));
|
|
1430
1433
|
}
|
|
1431
1434
|
});
|
|
1432
1435
|
}
|
|
@@ -2017,7 +2020,7 @@ var ApolloClient = (function () {
|
|
|
2017
2020
|
result.queries = queries;
|
|
2018
2021
|
result.results = results;
|
|
2019
2022
|
result.catch(function (error) {
|
|
2020
|
-
__DEV__ && globals.invariant.debug("In client.refetchQueries, Promise.all promise rejected with error "
|
|
2023
|
+
__DEV__ && globals.invariant.debug("In client.refetchQueries, Promise.all promise rejected with error ".concat(error));
|
|
2021
2024
|
});
|
|
2022
2025
|
return result;
|
|
2023
2026
|
};
|