@sanity/client 6.1.0-scope.0 → 6.1.1
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/dist/index.browser.cjs +15 -12
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +15 -12
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +16 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -5
- package/dist/index.js +16 -13
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/data/dataMethods.ts +8 -6
- package/src/http/request.ts +2 -1
- package/src/types.ts +1 -6
- package/umd/sanityClient.js +21 -14
- package/umd/sanityClient.min.js +3 -3
package/dist/index.cjs
CHANGED
|
@@ -8,7 +8,7 @@ var getIt = require('get-it');
|
|
|
8
8
|
var rxjs = require('rxjs');
|
|
9
9
|
var operators = require('rxjs/operators');
|
|
10
10
|
var name = "@sanity/client";
|
|
11
|
-
var version = "6.1.
|
|
11
|
+
var version = "6.1.1";
|
|
12
12
|
const middleware = [middleware$1.debug({
|
|
13
13
|
verbose: true,
|
|
14
14
|
namespace: "sanity:client"
|
|
@@ -126,7 +126,8 @@ function defineHttpRequest(envMiddleware, _ref) {
|
|
|
126
126
|
}
|
|
127
127
|
function shouldRetry(err, attempt, options) {
|
|
128
128
|
const isSafe = options.method === "GET" || options.method === "HEAD";
|
|
129
|
-
const
|
|
129
|
+
const uri = options.uri || options.url;
|
|
130
|
+
const isQuery = uri.startsWith("/data/query");
|
|
130
131
|
const isRetriableResponse = err.response && (err.response.statusCode === 429 || err.response.statusCode === 502 || err.response.statusCode === 503);
|
|
131
132
|
if ((isSafe || isQuery) && isRetriableResponse) return true;
|
|
132
133
|
return middleware$1.retry.shouldRetry(err, attempt, options);
|
|
@@ -841,17 +842,19 @@ function _requestObservable(client, httpRequest, options) {
|
|
|
841
842
|
...options.query
|
|
842
843
|
};
|
|
843
844
|
}
|
|
844
|
-
if (
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
845
|
+
if (["GET", "HEAD"].indexOf(options.method || "GET") >= 0 && uri.indexOf("/data/query/") === 0) {
|
|
846
|
+
if (config.resultSourceMap) {
|
|
847
|
+
options.query = {
|
|
848
|
+
resultSourceMap: true,
|
|
849
|
+
...options.query
|
|
850
|
+
};
|
|
851
|
+
}
|
|
852
|
+
if (typeof config.perspective === "string" && config.perspective !== "all") {
|
|
853
|
+
options.query = {
|
|
854
|
+
perspective: config.perspective,
|
|
855
|
+
...options.query
|
|
856
|
+
};
|
|
857
|
+
}
|
|
855
858
|
}
|
|
856
859
|
const reqOptions = requestOptions(config, Object.assign({}, options, {
|
|
857
860
|
url: _getUrl(client, uri, useCdn)
|