@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.
package/dist/index.d.ts CHANGED
@@ -107,6 +107,7 @@ export declare type BaseMutationOptions = RequestOptions & {
107
107
  dryRun?: boolean
108
108
  autoGenerateArrayKeys?: boolean
109
109
  skipCrossDatasetReferenceValidation?: boolean
110
+ transactionId?: string
110
111
  }
111
112
 
112
113
  /** @internal */
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 = "5.4.1";
7
+ var version = "5.4.2";
8
8
  const middleware = [debug({
9
9
  verbose: true,
10
10
  namespace: "sanity:client"
@@ -735,9 +735,18 @@ function _delete(client, httpRequest, selection, options) {
735
735
  }, options);
736
736
  }
737
737
  function _mutate(client, httpRequest, mutations, options) {
738
- const mut = mutations instanceof Patch || mutations instanceof ObservablePatch || mutations instanceof Transaction || mutations instanceof ObservableTransaction ? mutations.serialize() : mutations;
738
+ let mut;
739
+ if (mutations instanceof Patch || mutations instanceof ObservablePatch) {
740
+ mut = {
741
+ patch: mutations.serialize()
742
+ };
743
+ } else if (mutations instanceof Transaction || mutations instanceof ObservableTransaction) {
744
+ mut = mutations.serialize();
745
+ } else {
746
+ mut = mutations;
747
+ }
739
748
  const muts = Array.isArray(mut) ? mut : [mut];
740
- const transactionId = options && options.transactionId;
749
+ const transactionId = options && options.transactionId || void 0;
741
750
  return _dataRequest(client, httpRequest, "mutate", {
742
751
  mutations: muts,
743
752
  transactionId