@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.
@@ -119,7 +119,8 @@ function defineHttpRequest(envMiddleware, _ref) {
119
119
  }
120
120
  function shouldRetry(err, attempt, options) {
121
121
  const isSafe = options.method === "GET" || options.method === "HEAD";
122
- const isQuery = options.uri.startsWith("/data/query");
122
+ const uri = options.uri || options.url;
123
+ const isQuery = uri.startsWith("/data/query");
123
124
  const isRetriableResponse = err.response && (err.response.statusCode === 429 || err.response.statusCode === 502 || err.response.statusCode === 503);
124
125
  if ((isSafe || isQuery) && isRetriableResponse) return true;
125
126
  return middleware.retry.shouldRetry(err, attempt, options);
@@ -834,17 +835,19 @@ function _requestObservable(client, httpRequest, options) {
834
835
  ...options.query
835
836
  };
836
837
  }
837
- if (config.resultSourceMap) {
838
- options.query = {
839
- resultSourceMap: true,
840
- ...options.query
841
- };
842
- }
843
- if (config.scope) {
844
- options.query = {
845
- scope: config.scope,
846
- ...options.query
847
- };
838
+ if (["GET", "HEAD"].indexOf(options.method || "GET") >= 0 && uri.indexOf("/data/query/") === 0) {
839
+ if (config.resultSourceMap) {
840
+ options.query = {
841
+ resultSourceMap: true,
842
+ ...options.query
843
+ };
844
+ }
845
+ if (typeof config.perspective === "string" && config.perspective !== "all") {
846
+ options.query = {
847
+ perspective: config.perspective,
848
+ ...options.query
849
+ };
850
+ }
848
851
  }
849
852
  const reqOptions = requestOptions(config, Object.assign({}, options, {
850
853
  url: _getUrl(client, uri, useCdn)