@apollo/client 3.7.0-beta.8 → 3.7.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 -0
- package/apollo-client.cjs +44 -6
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/core/core.cjs +1 -1
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +1 -1
- package/invariantErrorCodes.js +1 -1
- package/link/http/http.cjs +11 -0
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +11 -0
- package/link/http/parseAndCheckHttpResponse.d.ts.map +1 -1
- package/link/http/parseAndCheckHttpResponse.js +11 -0
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/package.json +8 -7
- package/react/components/Subscription.js +2 -0
- package/react/components/Subscription.js.map +1 -1
- package/react/components/components.cjs +2 -0
- package/react/components/components.cjs.map +1 -1
- package/react/components/components.cjs.native.js +2 -0
- package/react/hooks/hooks.cjs +32 -5
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +32 -5
- package/react/hooks/useSubscription.d.ts.map +1 -1
- package/react/hooks/useSubscription.js +33 -5
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/ssr/getDataFromTree.d.ts.map +1 -1
- package/react/ssr/getDataFromTree.js +3 -2
- package/react/ssr/getDataFromTree.js.map +1 -1
- package/react/ssr/renderToStringWithData.d.ts.map +1 -1
- package/react/ssr/renderToStringWithData.js +2 -1
- package/react/ssr/renderToStringWithData.js.map +1 -1
- package/react/ssr/ssr.cjs +4 -3
- package/react/ssr/ssr.cjs.map +1 -1
- package/react/ssr/ssr.cjs.native.js +4 -3
- package/react/types/types.d.ts +6 -0
- package/react/types/types.d.ts.map +1 -1
- package/react/types/types.js.map +1 -1
- package/version.js +1 -1
package/README.md
CHANGED
|
@@ -27,6 +27,7 @@ Learn how to use Apollo Client with self-paced hands-on training on Odyssey, Apo
|
|
|
27
27
|
- [@hwillson](https://github.com/hwillson)
|
|
28
28
|
- [@jpvajda](https://github.com/jpvajda)
|
|
29
29
|
- [@mrdoombringer](https://github.com/mrdoombringer)
|
|
30
|
+
- [@jerelmiller](https://github.com/jerelmiller)
|
|
30
31
|
|
|
31
32
|
## Who is Apollo?
|
|
32
33
|
|
package/apollo-client.cjs
CHANGED
|
@@ -1300,7 +1300,7 @@ var concat = ApolloLink.concat;
|
|
|
1300
1300
|
|
|
1301
1301
|
var execute = ApolloLink.execute;
|
|
1302
1302
|
|
|
1303
|
-
var version = '3.7.0
|
|
1303
|
+
var version = '3.7.0';
|
|
1304
1304
|
|
|
1305
1305
|
function isNodeResponse(value) {
|
|
1306
1306
|
return !!value.body;
|
|
@@ -1548,6 +1548,17 @@ function parseHeaders(headerText) {
|
|
|
1548
1548
|
return headersInit;
|
|
1549
1549
|
}
|
|
1550
1550
|
function parseJsonBody(response, bodyText) {
|
|
1551
|
+
if (response.status >= 300) {
|
|
1552
|
+
var getResult = function () {
|
|
1553
|
+
try {
|
|
1554
|
+
return JSON.parse(bodyText);
|
|
1555
|
+
}
|
|
1556
|
+
catch (err) {
|
|
1557
|
+
return bodyText;
|
|
1558
|
+
}
|
|
1559
|
+
};
|
|
1560
|
+
throwServerError(response, getResult(), "Response not successful: Received status code ".concat(response.status));
|
|
1561
|
+
}
|
|
1551
1562
|
try {
|
|
1552
1563
|
return JSON.parse(bodyText);
|
|
1553
1564
|
}
|
|
@@ -6936,6 +6947,7 @@ function useMutation(mutation, options) {
|
|
|
6936
6947
|
}
|
|
6937
6948
|
|
|
6938
6949
|
function useSubscription(subscription, options) {
|
|
6950
|
+
var hasIssuedDeprecationWarningRef = React.useRef(false);
|
|
6939
6951
|
var client = useApolloClient(options === null || options === void 0 ? void 0 : options.client);
|
|
6940
6952
|
verifyDocumentType(subscription, exports.DocumentType.Subscription);
|
|
6941
6953
|
var _a = React.useState({
|
|
@@ -6944,6 +6956,19 @@ function useSubscription(subscription, options) {
|
|
|
6944
6956
|
data: void 0,
|
|
6945
6957
|
variables: options === null || options === void 0 ? void 0 : options.variables,
|
|
6946
6958
|
}), result = _a[0], setResult = _a[1];
|
|
6959
|
+
if (!hasIssuedDeprecationWarningRef.current) {
|
|
6960
|
+
hasIssuedDeprecationWarningRef.current = true;
|
|
6961
|
+
if (options === null || options === void 0 ? void 0 : options.onSubscriptionData) {
|
|
6962
|
+
__DEV__ && tsInvariant.invariant.warn(options.onData
|
|
6963
|
+
? "'useSubscription' supports only the 'onSubscriptionData' or 'onData' option, but not both. Only the 'onData' option will be used."
|
|
6964
|
+
: "'onSubscriptionData' is deprecated and will be removed in a future major version. Please use the 'onData' option instead.");
|
|
6965
|
+
}
|
|
6966
|
+
if (options === null || options === void 0 ? void 0 : options.onSubscriptionComplete) {
|
|
6967
|
+
__DEV__ && tsInvariant.invariant.warn(options.onComplete
|
|
6968
|
+
? "'useSubscription' supports only the 'onSubscriptionComplete' or 'onComplete' option, but not both. Only the 'onComplete' option will be used."
|
|
6969
|
+
: "'onSubscriptionComplete' is deprecated and will be removed in a future major version. Please use the 'onComplete' option instead.");
|
|
6970
|
+
}
|
|
6971
|
+
}
|
|
6947
6972
|
var _b = React.useState(function () {
|
|
6948
6973
|
if (options === null || options === void 0 ? void 0 : options.skip) {
|
|
6949
6974
|
return null;
|
|
@@ -7017,10 +7042,18 @@ function useSubscription(subscription, options) {
|
|
|
7017
7042
|
variables: options === null || options === void 0 ? void 0 : options.variables,
|
|
7018
7043
|
};
|
|
7019
7044
|
setResult(result);
|
|
7020
|
-
|
|
7021
|
-
|
|
7022
|
-
|
|
7023
|
-
|
|
7045
|
+
if ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onData) {
|
|
7046
|
+
ref.current.options.onData({
|
|
7047
|
+
client: client,
|
|
7048
|
+
data: result
|
|
7049
|
+
});
|
|
7050
|
+
}
|
|
7051
|
+
else if ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onSubscriptionData) {
|
|
7052
|
+
ref.current.options.onSubscriptionData({
|
|
7053
|
+
client: client,
|
|
7054
|
+
subscriptionData: result
|
|
7055
|
+
});
|
|
7056
|
+
}
|
|
7024
7057
|
},
|
|
7025
7058
|
error: function (error) {
|
|
7026
7059
|
var _a, _b;
|
|
@@ -7034,7 +7067,12 @@ function useSubscription(subscription, options) {
|
|
|
7034
7067
|
},
|
|
7035
7068
|
complete: function () {
|
|
7036
7069
|
var _a, _b;
|
|
7037
|
-
|
|
7070
|
+
if ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onComplete) {
|
|
7071
|
+
ref.current.options.onComplete();
|
|
7072
|
+
}
|
|
7073
|
+
else if ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onSubscriptionComplete) {
|
|
7074
|
+
ref.current.options.onSubscriptionComplete();
|
|
7075
|
+
}
|
|
7038
7076
|
},
|
|
7039
7077
|
});
|
|
7040
7078
|
return function () {
|