@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.
@@ -671,9 +671,23 @@ const indexBy = (docs, attr) => docs.reduce((indexed, doc) => {
671
671
  return indexed;
672
672
  }, /* @__PURE__ */Object.create(null));
673
673
  const getQuerySizeLimit = 11264;
674
- function _fetch(client, httpRequest, query, params) {
674
+ function _fetch(client, httpRequest, query, _params) {
675
675
  let options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
676
676
  const mapResponse = options.filterResponse === false ? res => res : res => res.result;
677
+ let params = _params;
678
+ const {
679
+ unstable_overlayDrafts,
680
+ apiVersion
681
+ } = client.config();
682
+ if (unstable_overlayDrafts) {
683
+ if (apiVersion !== "X") {
684
+ console.error("You need to set `apiVersion` to `X` to use `unstable_overlayDrafts");
685
+ }
686
+ params = {
687
+ ...params,
688
+ draftMode: true
689
+ };
690
+ }
677
691
  return _dataRequest(client, httpRequest, "query", {
678
692
  query,
679
693
  params
@@ -794,18 +808,6 @@ function _requestObservable(client, httpRequest, options) {
794
808
  ...options.query
795
809
  };
796
810
  }
797
- if (config.unstable_overlayDrafts) {
798
- if (config.apiVersion !== "X") {
799
- console.error("You need to set `apiVersion` to `X` to use `unstable_overlayDrafts");
800
- }
801
- options.query = {
802
- ...options.query,
803
- params: {
804
- ...(options.query.params || {}),
805
- draftMode: true
806
- }
807
- };
808
- }
809
811
  const reqOptions = requestOptions(config, Object.assign({}, options, {
810
812
  url: _getUrl(client, uri, useCdn)
811
813
  }));