@sanity/client 6.0.0 → 6.1.0-perspective.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/dist/index.d.ts CHANGED
@@ -283,6 +283,7 @@ export declare interface ClientConfig {
283
283
  /** @defaultValue true */
284
284
  useCdn?: boolean
285
285
  token?: string
286
+ perspective?: 'published' | 'previewDrafts'
286
287
  apiHost?: string
287
288
  apiVersion?: string
288
289
  proxy?: string
@@ -310,6 +311,9 @@ export declare interface ClientConfig {
310
311
  * @deprecated Don't use
311
312
  */
312
313
  requester?: Requester
314
+ /**
315
+ * Adds a `resultSourceMap` key to the API response, with the type `ContentSourceMap`
316
+ */
313
317
  resultSourceMap?: boolean
314
318
  }
315
319
 
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.0.0";
7
+ var version = "6.1.0-perspective.0";
8
8
  const middleware = [debug({
9
9
  verbose: true,
10
10
  namespace: "sanity:client"
@@ -837,6 +837,12 @@ 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
+ }
840
846
  if (config.resultSourceMap) {
841
847
  options.query = {
842
848
  resultSourceMap: true,