@apollo/client 3.8.0-alpha.1 → 3.8.0-alpha.2
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 +17 -4
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/core/ApolloClient.d.ts +2 -1
- package/core/ApolloClient.d.ts.map +1 -1
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.d.ts +3 -1
- package/core/LocalState.d.ts.map +1 -1
- package/core/LocalState.js +6 -2
- package/core/LocalState.js.map +1 -1
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js +3 -1
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +10 -4
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +10 -4
- package/core/types.d.ts +3 -0
- package/core/types.d.ts.map +1 -1
- package/core/types.js.map +1 -1
- package/invariantErrorCodes.js +1 -1
- package/link/batch-http/batch-http.cjs +12 -2
- package/link/batch-http/batch-http.cjs.map +1 -1
- package/link/batch-http/batch-http.cjs.native.js +12 -2
- package/link/batch-http/batchHttpLink.d.ts.map +1 -1
- package/link/batch-http/batchHttpLink.js +13 -3
- package/link/batch-http/batchHttpLink.js.map +1 -1
- package/link/http/createHttpLink.d.ts.map +1 -1
- package/link/http/createHttpLink.js +8 -1
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/http.cjs +7 -0
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +7 -0
- package/package.json +1 -1
- package/version.js +1 -1
package/apollo-client.cjs
CHANGED
|
@@ -1345,7 +1345,7 @@ var concat = ApolloLink.concat;
|
|
|
1345
1345
|
|
|
1346
1346
|
var execute = ApolloLink.execute;
|
|
1347
1347
|
|
|
1348
|
-
var version = '3.8.0-alpha.
|
|
1348
|
+
var version = '3.8.0-alpha.2';
|
|
1349
1349
|
|
|
1350
1350
|
function isNodeResponse(value) {
|
|
1351
1351
|
return !!value.body;
|
|
@@ -1843,6 +1843,13 @@ var createHttpLink = function (linkOptions) {
|
|
|
1843
1843
|
credentials: context.credentials,
|
|
1844
1844
|
headers: contextHeaders,
|
|
1845
1845
|
};
|
|
1846
|
+
if (hasDirectives(['client'], operation.query)) {
|
|
1847
|
+
var transformedQuery = removeClientSetsFromDocument(operation.query);
|
|
1848
|
+
if (!transformedQuery) {
|
|
1849
|
+
return fromError(new Error('HttpLink: Trying to send a client-only query to the server. To send to the server, ensure a non-client field is added to the query or set the `transformOptions.removeClientFields` option to `true`.'));
|
|
1850
|
+
}
|
|
1851
|
+
operation.query = transformedQuery;
|
|
1852
|
+
}
|
|
1846
1853
|
var _b = selectHttpOptionsAndBodyInternal(operation, print, fallbackHttpConfig, linkConfig, contextConfig), options = _b.options, body = _b.body;
|
|
1847
1854
|
if (body.variables && !includeUnusedVariables) {
|
|
1848
1855
|
var unusedNames_1 = new Set(Object.keys(body.variables));
|
|
@@ -4824,8 +4831,12 @@ var LocalState = (function () {
|
|
|
4824
4831
|
}
|
|
4825
4832
|
return null;
|
|
4826
4833
|
};
|
|
4827
|
-
LocalState.prototype.serverQuery = function (document) {
|
|
4828
|
-
|
|
4834
|
+
LocalState.prototype.serverQuery = function (document, options) {
|
|
4835
|
+
if (options === void 0) { options = Object.create(null); }
|
|
4836
|
+
var _a = options.removeClientFields, removeClientFields = _a === void 0 ? true : _a;
|
|
4837
|
+
return removeClientFields
|
|
4838
|
+
? removeClientSetsFromDocument(document)
|
|
4839
|
+
: document;
|
|
4829
4840
|
};
|
|
4830
4841
|
LocalState.prototype.prepareContext = function (context) {
|
|
4831
4842
|
var cache = this.cache;
|
|
@@ -5612,11 +5623,13 @@ var QueryManager = (function () {
|
|
|
5612
5623
|
};
|
|
5613
5624
|
QueryManager.prototype.transform = function (document) {
|
|
5614
5625
|
var transformCache = this.transformCache;
|
|
5626
|
+
var _a = (this.defaultOptions.transformQuery || Object.create(null)).removeClientFields, removeClientFields = _a === void 0 ? true : _a;
|
|
5615
5627
|
if (!transformCache.has(document)) {
|
|
5616
5628
|
var transformed = this.cache.transformDocument(document);
|
|
5617
5629
|
var noConnection = removeConnectionDirectiveFromDocument(transformed);
|
|
5618
5630
|
var clientQuery = this.localState.clientQuery(transformed);
|
|
5619
|
-
var serverQuery = noConnection &&
|
|
5631
|
+
var serverQuery = noConnection &&
|
|
5632
|
+
this.localState.serverQuery(noConnection, { removeClientFields: removeClientFields });
|
|
5620
5633
|
var cacheEntry_1 = {
|
|
5621
5634
|
document: transformed,
|
|
5622
5635
|
hasClientExports: hasClientExports(transformed),
|