@apollo/client 3.5.0-rc.3 → 3.6.0-beta.0
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 -1
- package/apollo-client.cjs +69 -53
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/core/cache.js +2 -2
- package/cache/inmemory/entityStore.js +4 -4
- package/cache/inmemory/inMemoryCache.js +3 -3
- package/cache/inmemory/object-canon.js +2 -2
- package/cache/inmemory/policies.js +1 -1
- package/cache/inmemory/reactiveVars.js +2 -2
- package/cache/inmemory/readFromStore.js +2 -2
- package/cache/inmemory/writeToStore.js +3 -3
- package/config/jest/setup.js +1 -1
- package/core/ApolloClient.js +1 -1
- package/core/LocalState.js +2 -2
- package/core/ObservableQuery.js +2 -2
- package/core/QueryInfo.js +2 -2
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js +2 -2
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +1 -1
- package/core/core.cjs.map +1 -1
- package/core/index.js +2 -2
- package/errors/index.js +1 -1
- package/invariantErrorCodes.js +1 -1
- package/link/batch/batchLink.js +1 -1
- package/link/batch/batching.js +1 -1
- package/link/batch-http/batchHttpLink.js +1 -1
- package/link/context/index.js +1 -1
- package/link/core/ApolloLink.js +1 -1
- package/link/core/types.d.ts +4 -6
- package/link/core/types.d.ts.map +1 -1
- package/link/core/types.js.map +1 -1
- package/link/error/index.js +1 -1
- package/link/http/HttpLink.js +1 -1
- package/link/http/createHttpLink.js +2 -2
- package/link/http/selectHttpOptionsAndBody.js +2 -2
- package/link/persisted-queries/index.js +2 -2
- package/link/retry/retryLink.js +1 -1
- package/link/schema/index.js +10 -3
- package/link/schema/index.js.map +1 -1
- package/link/schema/schema.cjs +8 -1
- package/link/schema/schema.cjs.map +1 -1
- package/link/utils/createOperation.js +1 -1
- package/link/ws/index.js +2 -2
- package/package.json +13 -13
- package/react/components/Mutation.js +1 -1
- package/react/components/Query.js +2 -2
- package/react/components/Subscription.js +1 -1
- package/react/context/ApolloConsumer.js +1 -1
- package/react/context/ApolloContext.js +1 -1
- package/react/context/ApolloProvider.js +1 -1
- package/react/hoc/hoc-utils.js +2 -2
- package/react/hoc/mutation-hoc.js +3 -3
- package/react/hoc/query-hoc.js +3 -3
- package/react/hoc/subscription-hoc.js +3 -3
- package/react/hoc/withApollo.js +3 -3
- package/react/hooks/hooks.cjs +67 -51
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useLazyQuery.js +2 -2
- package/react/hooks/useMutation.d.ts.map +1 -1
- package/react/hooks/useMutation.js +70 -54
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.js +3 -3
- package/react/hooks/useReactiveVar.js +1 -1
- package/react/hooks/useSubscription.js +2 -2
- package/react/ssr/getDataFromTree.js +2 -2
- package/testing/core/mocking/mockFetch.js +2 -2
- package/testing/core/mocking/mockLink.js +3 -3
- package/testing/core/mocking/mockSubscriptionLink.d.ts +1 -3
- package/testing/core/mocking/mockSubscriptionLink.d.ts.map +1 -1
- package/testing/core/mocking/mockSubscriptionLink.js +1 -1
- package/testing/core/mocking/mockWatchQuery.js +1 -1
- package/testing/core/observableToPromise.js +1 -1
- package/testing/react/MockedProvider.js +2 -2
- package/utilities/common/errorHandling.d.ts +1 -1
- package/utilities/common/errorHandling.d.ts.map +1 -1
- package/utilities/common/errorHandling.js.map +1 -1
- package/utilities/common/mergeDeep.js +1 -1
- package/utilities/globals/fix-graphql.js +2 -2
- package/utilities/globals/index.js +1 -1
- package/utilities/graphql/directives.js +1 -1
- package/utilities/graphql/fragments.d.ts.map +1 -1
- package/utilities/graphql/fragments.js +1 -1
- package/utilities/graphql/fragments.js.map +1 -1
- package/utilities/graphql/transform.d.ts.map +1 -1
- package/utilities/graphql/transform.js +2 -2
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/observables/Concast.js +1 -1
- package/utilities/observables/Observable.js +2 -2
- package/utilities/policies/pagination.js +2 -2
- package/version.js +1 -1
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ Learn how to use Apollo Client with self-paced hands-on training on Odyssey, Apo
|
|
|
31
31
|
[Apollo](https://apollographql.com/) builds open-source software and a graph platform to unify GraphQL across your apps and services. We help you ship faster with:
|
|
32
32
|
|
|
33
33
|
* [Apollo Studio](https://www.apollographql.com/studio/develop/) – A free, end-to-end platform for managing your GraphQL lifecycle. Track your GraphQL schemas in a hosted registry to create a source of truth for everything in your graph. Studio provides an IDE (Apollo Explorer) so you can explore data, collaborate on queries, observe usage, and safely make schema changes.
|
|
34
|
-
* [Apollo Federation](https://www.apollographql.com/apollo-federation) – The industry-standard open architecture for building a distributed graph. Use Apollo’s
|
|
34
|
+
* [Apollo Federation](https://www.apollographql.com/apollo-federation) – The industry-standard open architecture for building a distributed graph. Use Apollo’s gateway to compose a unified graph from multiple subgraphs, determine a query plan, and route requests across your services.
|
|
35
35
|
* [Apollo Client](https://www.apollographql.com/apollo-client/) – The most popular GraphQL client for the web. Apollo also builds and maintains [Apollo iOS](https://github.com/apollographql/apollo-ios) and [Apollo Android](https://github.com/apollographql/apollo-android).
|
|
36
36
|
* [Apollo Server](https://www.apollographql.com/docs/apollo-server/) – A production-ready JavaScript GraphQL server that connects to any microservice, API, or database. Compatible with all popular JavaScript frameworks and deployable in serverless environments.
|
|
37
37
|
|
package/apollo-client.cjs
CHANGED
|
@@ -1291,7 +1291,7 @@ var concat = ApolloLink.concat;
|
|
|
1291
1291
|
|
|
1292
1292
|
var execute = ApolloLink.execute;
|
|
1293
1293
|
|
|
1294
|
-
var version = '3.
|
|
1294
|
+
var version = '3.6.0-beta.0';
|
|
1295
1295
|
|
|
1296
1296
|
var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
|
|
1297
1297
|
function parseAndCheckHttpResponse(operations) {
|
|
@@ -6323,63 +6323,79 @@ function useMutation(mutation, options) {
|
|
|
6323
6323
|
result: result,
|
|
6324
6324
|
mutationId: 0,
|
|
6325
6325
|
isMounted: true,
|
|
6326
|
+
execute: null,
|
|
6327
|
+
client: client,
|
|
6328
|
+
mutation: mutation,
|
|
6329
|
+
options: options,
|
|
6326
6330
|
});
|
|
6327
|
-
var execute = React.
|
|
6328
|
-
if (
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
|
|
6334
|
-
|
|
6335
|
-
|
|
6336
|
-
|
|
6337
|
-
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
var error = errors && errors.length > 0
|
|
6345
|
-
? new ApolloError({ graphQLErrors: errors })
|
|
6346
|
-
: void 0;
|
|
6347
|
-
if (mutationId === ref.current.mutationId &&
|
|
6348
|
-
!baseOptions.ignoreResults) {
|
|
6349
|
-
var result_1 = {
|
|
6350
|
-
called: true,
|
|
6351
|
-
loading: false,
|
|
6352
|
-
data: data,
|
|
6353
|
-
error: error,
|
|
6354
|
-
client: client,
|
|
6355
|
-
};
|
|
6356
|
-
if (ref.current.isMounted && !equality.equal(ref.current.result, result_1)) {
|
|
6357
|
-
setResult(ref.current.result = result_1);
|
|
6358
|
-
}
|
|
6359
|
-
}
|
|
6360
|
-
(_a = baseOptions.onCompleted) === null || _a === void 0 ? void 0 : _a.call(baseOptions, response.data);
|
|
6361
|
-
return response;
|
|
6362
|
-
}).catch(function (error) {
|
|
6363
|
-
if (mutationId === ref.current.mutationId &&
|
|
6364
|
-
ref.current.isMounted) {
|
|
6365
|
-
var result_2 = {
|
|
6366
|
-
loading: false,
|
|
6367
|
-
error: error,
|
|
6331
|
+
var execute = React.useMemo(function () {
|
|
6332
|
+
if (ref.current.execute != null &&
|
|
6333
|
+
ref.current.client === client &&
|
|
6334
|
+
equality.equal(options, ref.current.options) &&
|
|
6335
|
+
equality.equal(mutation, ref.current.mutation)) {
|
|
6336
|
+
return ref.current.execute;
|
|
6337
|
+
}
|
|
6338
|
+
ref.current.client = client;
|
|
6339
|
+
ref.current.options = options;
|
|
6340
|
+
ref.current.mutation = mutation;
|
|
6341
|
+
ref.current.execute = function (executeOptions) {
|
|
6342
|
+
if (executeOptions === void 0) { executeOptions = {}; }
|
|
6343
|
+
var baseOptions = tslib.__assign(tslib.__assign({}, options), { mutation: mutation });
|
|
6344
|
+
if (!ref.current.result.loading && !baseOptions.ignoreResults) {
|
|
6345
|
+
setResult(ref.current.result = {
|
|
6346
|
+
loading: true,
|
|
6347
|
+
error: void 0,
|
|
6368
6348
|
data: void 0,
|
|
6369
6349
|
called: true,
|
|
6370
6350
|
client: client,
|
|
6371
|
-
};
|
|
6372
|
-
if (!equality.equal(ref.current.result, result_2)) {
|
|
6373
|
-
setResult(ref.current.result = result_2);
|
|
6374
|
-
}
|
|
6375
|
-
}
|
|
6376
|
-
if (baseOptions.onError) {
|
|
6377
|
-
baseOptions.onError(error);
|
|
6378
|
-
return { data: void 0, errors: error };
|
|
6351
|
+
});
|
|
6379
6352
|
}
|
|
6380
|
-
|
|
6381
|
-
|
|
6382
|
-
|
|
6353
|
+
var mutationId = ++ref.current.mutationId;
|
|
6354
|
+
var clientOptions = mergeOptions(baseOptions, executeOptions);
|
|
6355
|
+
return client.mutate(clientOptions).then(function (response) {
|
|
6356
|
+
var _a;
|
|
6357
|
+
var data = response.data, errors = response.errors;
|
|
6358
|
+
var error = errors && errors.length > 0
|
|
6359
|
+
? new ApolloError({ graphQLErrors: errors })
|
|
6360
|
+
: void 0;
|
|
6361
|
+
if (mutationId === ref.current.mutationId &&
|
|
6362
|
+
!baseOptions.ignoreResults) {
|
|
6363
|
+
var result_1 = {
|
|
6364
|
+
called: true,
|
|
6365
|
+
loading: false,
|
|
6366
|
+
data: data,
|
|
6367
|
+
error: error,
|
|
6368
|
+
client: client,
|
|
6369
|
+
};
|
|
6370
|
+
if (ref.current.isMounted && !equality.equal(ref.current.result, result_1)) {
|
|
6371
|
+
setResult(ref.current.result = result_1);
|
|
6372
|
+
}
|
|
6373
|
+
}
|
|
6374
|
+
(_a = baseOptions.onCompleted) === null || _a === void 0 ? void 0 : _a.call(baseOptions, response.data);
|
|
6375
|
+
return response;
|
|
6376
|
+
}).catch(function (error) {
|
|
6377
|
+
if (mutationId === ref.current.mutationId &&
|
|
6378
|
+
ref.current.isMounted) {
|
|
6379
|
+
var result_2 = {
|
|
6380
|
+
loading: false,
|
|
6381
|
+
error: error,
|
|
6382
|
+
data: void 0,
|
|
6383
|
+
called: true,
|
|
6384
|
+
client: client,
|
|
6385
|
+
};
|
|
6386
|
+
if (!equality.equal(ref.current.result, result_2)) {
|
|
6387
|
+
setResult(ref.current.result = result_2);
|
|
6388
|
+
}
|
|
6389
|
+
}
|
|
6390
|
+
if (baseOptions.onError) {
|
|
6391
|
+
baseOptions.onError(error);
|
|
6392
|
+
return { data: void 0, errors: error };
|
|
6393
|
+
}
|
|
6394
|
+
throw error;
|
|
6395
|
+
});
|
|
6396
|
+
};
|
|
6397
|
+
return ref.current.execute;
|
|
6398
|
+
}, [client, mutation, options]);
|
|
6383
6399
|
var reset = React.useCallback(function () {
|
|
6384
6400
|
setResult({ called: false, loading: false, client: client });
|
|
6385
6401
|
}, []);
|