@sanity/mutate
Advanced tools
@@ -238,9 +238,13 @@ "use strict"; | ||
| ), | ||
| rxjs.mergeMap( | ||
| (batchResult) => requests.map((request, i) => ({ | ||
| rxjs.mergeMap((batchResult) => { | ||
| if (batchResult.length !== requests.length) | ||
| throw new Error( | ||
| `The length of the returned batch must be equal to the number of batched requests. Requested a batch of length ${requests.length}, but received a batch of ${batchResult.length}.` | ||
| ); | ||
| return requests.map((request, i) => ({ | ||
| type: "value", | ||
| request, | ||
| response: batchResult[i] | ||
| })) | ||
| ) | ||
| })); | ||
| }) | ||
| ), responseEnds = requests.map((request) => ({ | ||
@@ -375,3 +379,3 @@ request, | ||
| return; | ||
| const { ...doc } = document; | ||
| const { _rev, ...doc } = document; | ||
| return doc; | ||
@@ -550,3 +554,3 @@ } | ||
| let latest, emitted = !1; | ||
| const { ...shareConfig } = config, wrapped = source.pipe( | ||
| const { predicate, ...shareConfig } = config, wrapped = source.pipe( | ||
| rxjs.tap((value) => { | ||
@@ -553,0 +557,0 @@ config.predicate(value) && (emitted = !0, latest = value); |
@@ -245,9 +245,13 @@ import { combineLatest, finalize, share, ReplaySubject, timer, switchMap, concat, of, throwError, concatMap, EMPTY, catchError, map, BehaviorSubject, Subject, filter, bufferWhen, scheduled, mergeMap as mergeMap$1, takeUntil, Observable, defer, merge, takeWhile, asyncScheduler, tap, NEVER, from, lastValueFrom, toArray } from "rxjs"; | ||
| ), | ||
| mergeMap$1( | ||
| (batchResult) => requests.map((request, i) => ({ | ||
| mergeMap$1((batchResult) => { | ||
| if (batchResult.length !== requests.length) | ||
| throw new Error( | ||
| `The length of the returned batch must be equal to the number of batched requests. Requested a batch of length ${requests.length}, but received a batch of ${batchResult.length}.` | ||
| ); | ||
| return requests.map((request, i) => ({ | ||
| type: "value", | ||
| request, | ||
| response: batchResult[i] | ||
| })) | ||
| ) | ||
| })); | ||
| }) | ||
| ), responseEnds = requests.map((request) => ({ | ||
@@ -382,3 +386,3 @@ request, | ||
| return; | ||
| const { ...doc } = document; | ||
| const { _rev, ...doc } = document; | ||
| return doc; | ||
@@ -557,3 +561,3 @@ } | ||
| let latest, emitted = !1; | ||
| const { ...shareConfig } = config, wrapped = source.pipe( | ||
| const { predicate, ...shareConfig } = config, wrapped = source.pipe( | ||
| tap((value) => { | ||
@@ -560,0 +564,0 @@ config.predicate(value) && (emitted = !0, latest = value); |
+2
-2
@@ -390,3 +390,3 @@ export declare type AnyArray<T = any> = T[] | readonly T[] | ||
| | { | ||
| [x: string]: any | ||
| [mutation.type]: any | ||
| delete?: undefined | ||
@@ -516,3 +516,3 @@ } | ||
| | { | ||
| [x: string]: any | ||
| [mutation.type]: any | ||
| delete?: undefined | ||
@@ -519,0 +519,0 @@ } |
+2
-2
@@ -390,3 +390,3 @@ export declare type AnyArray<T = any> = T[] | readonly T[] | ||
| | { | ||
| [x: string]: any | ||
| [mutation.type]: any | ||
| delete?: undefined | ||
@@ -516,3 +516,3 @@ } | ||
| | { | ||
| [x: string]: any | ||
| [mutation.type]: any | ||
| delete?: undefined | ||
@@ -519,0 +519,0 @@ } |
+18
-18
| { | ||
| "name": "@sanity/mutate", | ||
| "version": "0.12.3", | ||
| "version": "0.12.4", | ||
| "description": "Experimental toolkit for working with Sanity mutations in JavaScript & TypeScript", | ||
@@ -73,4 +73,4 @@ "keywords": [ | ||
| "dependencies": { | ||
| "@sanity/client": "^6.24.1", | ||
| "@sanity/diff-match-patch": "^3.1.1", | ||
| "@sanity/client": "^6.28.3", | ||
| "@sanity/diff-match-patch": "^3.2.0", | ||
| "@sanity/uuid": "^3.0.2", | ||
@@ -80,26 +80,26 @@ "hotscript": "^1.0.13", | ||
| "mendoza": "^3.0.8", | ||
| "nanoid": "^5.0.9", | ||
| "rxjs": "^7.8.1" | ||
| "nanoid": "^5.1.3", | ||
| "rxjs": "^7.8.2" | ||
| }, | ||
| "devDependencies": { | ||
| "@eslint/js": "^9.17.0", | ||
| "@sanity/pkg-utils": "^6.12.0", | ||
| "@eslint/js": "^9.22.0", | ||
| "@sanity/pkg-utils": "^6.13.4", | ||
| "@sanity/prettier-config": "^1.0.3", | ||
| "@types/diff-match-patch": "^1.0.36", | ||
| "@types/lodash": "^4.17.13", | ||
| "@typescript-eslint/parser": "^8.18.1", | ||
| "@vitest/coverage-v8": "^3.0.4", | ||
| "@vitest/ui": "^3.0.4", | ||
| "eslint": "^9.17.0", | ||
| "@types/lodash": "^4.17.16", | ||
| "@typescript-eslint/parser": "^8.26.1", | ||
| "@vitest/coverage-v8": "^3.0.8", | ||
| "@vitest/ui": "^3.0.8", | ||
| "eslint": "^9.22.0", | ||
| "eslint-plugin-import": "^2.31.0", | ||
| "eslint-plugin-prettier": "^5.2.1", | ||
| "eslint-plugin-prettier": "^5.2.3", | ||
| "eslint-plugin-simple-import-sort": "^12.1.1", | ||
| "eslint-plugin-unused-imports": "^4.1.4", | ||
| "npm-run-all2": "^7.0.2", | ||
| "prettier": "^3.4.2", | ||
| "prettier": "^3.5.3", | ||
| "rimraf": "^6.0.1", | ||
| "tsx": "^4.19.2", | ||
| "typescript": "^5.7.2", | ||
| "typescript-eslint": "^8.18.1", | ||
| "vitest": "^3.0.4" | ||
| "tsx": "^4.19.3", | ||
| "typescript": "^5.8.2", | ||
| "typescript-eslint": "^8.26.1", | ||
| "vitest": "^3.0.8" | ||
| }, | ||
@@ -106,0 +106,0 @@ "engines": { |
+1
-1
@@ -62,3 +62,3 @@ # @sanity/mutate | ||
| }, | ||
| body: JSON.stringify(SanityEncoder.encode(mutations)), | ||
| body: JSON.stringify(SanityEncoder.encodeAll(mutations)), | ||
| }) | ||
@@ -65,0 +65,0 @@ .then(response => response.json()) |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
755346
0.23%7967
0.1%Updated
Updated
Updated