@sanity/client 6.20.2 → 6.21.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.
package/README.md CHANGED
@@ -851,6 +851,8 @@ By default, the emitted update event will also contain a `result` property, whic
851
851
 
852
852
  Likewise, you can also have the client return the document _before_ the mutation was applied, by setting `includePreviousRevision` to `true` in the options, which will include a `previous` property in each emitted object.
853
853
 
854
+ If it's not relevant to know what mutations that was applied, you can also set `includeMutation` to `false` in the options, which will save some additional bandwidth by omitting the `mutation` property from the received events.
855
+
854
856
  ### Fetch a single document
855
857
 
856
858
  This will fetch a document from the [Doc endpoint](https://www.sanity.io/docs/http-doc). This endpoint cuts through any caching/indexing middleware that may involve delayed processing. As it is less scalable/performant than the other query mechanisms, it should be used sparingly. Performing a query is usually a better option.
@@ -609,13 +609,13 @@ const encodeQueryString = ({
609
609
  params = {},
610
610
  options = {}
611
611
  }) => {
612
- const searchParams = new URLSearchParams(), { tag, returnQuery, ...opts } = options;
612
+ const searchParams = new URLSearchParams(), { tag, includeMutations, returnQuery, ...opts } = options;
613
613
  tag && searchParams.append("tag", tag), searchParams.append("query", query);
614
614
  for (const [key, value] of Object.entries(params))
615
615
  searchParams.append(`$${key}`, JSON.stringify(value));
616
616
  for (const [key, value] of Object.entries(opts))
617
617
  value && searchParams.append(key, `${value}`);
618
- return returnQuery === !1 && searchParams.append("returnQuery", "false"), `?${searchParams}`;
618
+ return returnQuery === !1 && searchParams.append("returnQuery", "false"), includeMutations === !1 && searchParams.append("includeMutations", "false"), `?${searchParams}`;
619
619
  }, excludeFalsey = (param, defValue) => param === !1 ? void 0 : typeof param > "u" ? defValue : param, getMutationQuery = (options = {}) => ({
620
620
  dryRun: options.dryRun,
621
621
  returnIds: !0,
@@ -876,6 +876,7 @@ var defaults = (obj, defaults2) => Object.keys(defaults2).concat(Object.keys(obj
876
876
  const pick = (obj, props) => props.reduce((selection, prop) => (typeof obj[prop] > "u" || (selection[prop] = obj[prop]), selection), {}), MAX_URL_LENGTH = 14800, possibleOptions = [
877
877
  "includePreviousRevision",
878
878
  "includeResult",
879
+ "includeMutations",
879
880
  "visibility",
880
881
  "effectFormat",
881
882
  "tag"