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