@sanity/client 6.1.0-perspective.0 → 6.1.0-perspective.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/dist/index.d.ts CHANGED
@@ -283,7 +283,7 @@ export declare interface ClientConfig {
283
283
  /** @defaultValue true */
284
284
  useCdn?: boolean
285
285
  token?: string
286
- perspective?: 'published' | 'previewDrafts'
286
+ perspective?: 'previewDrafts' | 'published' | 'all'
287
287
  apiHost?: string
288
288
  apiVersion?: string
289
289
  proxy?: string
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ export { adapter as unstable__adapter, environment as unstable__environment } fr
4
4
  import { Observable, lastValueFrom } from 'rxjs';
5
5
  import { map, filter } from 'rxjs/operators';
6
6
  var name = "@sanity/client";
7
- var version = "6.1.0-perspective.0";
7
+ var version = "6.1.0-perspective.2";
8
8
  const middleware = [debug({
9
9
  verbose: true,
10
10
  namespace: "sanity:client"
@@ -837,17 +837,19 @@ function _requestObservable(client, httpRequest, options) {
837
837
  ...options.query
838
838
  };
839
839
  }
840
- if (config.perspective === "previewDrafts") {
841
- options.query = {
842
- perspective: config.perspective,
843
- ...options.query
844
- };
845
- }
846
- if (config.resultSourceMap) {
847
- options.query = {
848
- resultSourceMap: true,
849
- ...options.query
850
- };
840
+ if (["GET", "HEAD"].indexOf(options.method || "GET") >= 0 && uri.indexOf("/data/query/") === 0) {
841
+ if (config.resultSourceMap) {
842
+ options.query = {
843
+ resultSourceMap: true,
844
+ ...options.query
845
+ };
846
+ }
847
+ if (typeof config.perspective === "string" && config.perspective !== "all") {
848
+ options.query = {
849
+ perspective: config.perspective,
850
+ ...options.query
851
+ };
852
+ }
851
853
  }
852
854
  const reqOptions = requestOptions(config, Object.assign({}, options, {
853
855
  url: _getUrl(client, uri, useCdn)