@sanity/client 0.0.0-dev.2 → 0.0.0-dev.3

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.
@@ -660,9 +660,23 @@ const indexBy = (docs, attr) => docs.reduce((indexed, doc) => {
660
660
  return indexed;
661
661
  }, /* @__PURE__ */Object.create(null));
662
662
  const getQuerySizeLimit = 11264;
663
- function _fetch(client, httpRequest, query, params) {
663
+ function _fetch(client, httpRequest, query, _params) {
664
664
  let options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
665
665
  const mapResponse = options.filterResponse === false ? res => res : res => res.result;
666
+ let params = _params;
667
+ const {
668
+ unstable_overlayDrafts,
669
+ apiVersion
670
+ } = client.config();
671
+ if (unstable_overlayDrafts) {
672
+ if (apiVersion !== "X") {
673
+ console.error("You need to set `apiVersion` to `X` to use `unstable_overlayDrafts");
674
+ }
675
+ params = {
676
+ ...params,
677
+ draftMode: true
678
+ };
679
+ }
666
680
  return _dataRequest(client, httpRequest, "query", {
667
681
  query,
668
682
  params
@@ -783,18 +797,6 @@ function _requestObservable(client, httpRequest, options) {
783
797
  ...options.query
784
798
  };
785
799
  }
786
- if (config.unstable_overlayDrafts) {
787
- if (config.apiVersion !== "X") {
788
- console.error("You need to set `apiVersion` to `X` to use `unstable_overlayDrafts");
789
- }
790
- options.query = {
791
- ...options.query,
792
- params: {
793
- ...(options.query.params || {}),
794
- draftMode: true
795
- }
796
- };
797
- }
798
800
  const reqOptions = requestOptions(config, Object.assign({}, options, {
799
801
  url: _getUrl(client, uri, useCdn)
800
802
  }));