@sanity/client 5.4.1 → 5.4.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.
@@ -726,9 +726,18 @@ function _delete(client, httpRequest, selection, options) {
726
726
  }, options);
727
727
  }
728
728
  function _mutate(client, httpRequest, mutations, options) {
729
- const mut = mutations instanceof Patch || mutations instanceof ObservablePatch || mutations instanceof Transaction || mutations instanceof ObservableTransaction ? mutations.serialize() : mutations;
729
+ let mut;
730
+ if (mutations instanceof Patch || mutations instanceof ObservablePatch) {
731
+ mut = {
732
+ patch: mutations.serialize()
733
+ };
734
+ } else if (mutations instanceof Transaction || mutations instanceof ObservableTransaction) {
735
+ mut = mutations.serialize();
736
+ } else {
737
+ mut = mutations;
738
+ }
730
739
  const muts = Array.isArray(mut) ? mut : [mut];
731
- const transactionId = options && options.transactionId;
740
+ const transactionId = options && options.transactionId || void 0;
732
741
  return _dataRequest(client, httpRequest, "mutate", {
733
742
  mutations: muts,
734
743
  transactionId