@sanity/client 6.4.10-dev.0 → 6.4.11
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.browser.cjs +7 -6
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +7 -6
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +8 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +192 -92
- package/dist/index.js +8 -7
- package/dist/index.js.map +1 -1
- package/package.json +12 -14
- package/src/SanityClient.ts +61 -6
- package/src/data/listen.ts +5 -5
- package/src/types.ts +169 -80
- package/umd/sanityClient.js +27 -429
- package/umd/sanityClient.min.js +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -270,7 +270,12 @@ export declare class BaseTransaction {
|
|
|
270
270
|
protected _add(mut: Mutation): this
|
|
271
271
|
}
|
|
272
272
|
|
|
273
|
-
/**
|
|
273
|
+
/**
|
|
274
|
+
* An error occurred. This is different from a network-level error (which will be emitted as 'error').
|
|
275
|
+
* Possible causes are things such as malformed filters, non-existant datasets or similar.
|
|
276
|
+
*
|
|
277
|
+
* @public
|
|
278
|
+
*/
|
|
274
279
|
export declare type ChannelErrorEvent = {
|
|
275
280
|
type: 'channelError'
|
|
276
281
|
message: string
|
|
@@ -485,7 +490,15 @@ export declare type DatasetsResponse = {
|
|
|
485
490
|
declare function deprecatedCreateClient(config: ClientConfig): SanityClient
|
|
486
491
|
export default deprecatedCreateClient
|
|
487
492
|
|
|
488
|
-
/**
|
|
493
|
+
/**
|
|
494
|
+
* The listener has been told to explicitly disconnect and not reconnect.
|
|
495
|
+
* This is a rare situation, but may occur if the API knows reconnect attempts will fail,
|
|
496
|
+
* eg in the case of a deleted dataset, a blocked project or similar events.
|
|
497
|
+
*
|
|
498
|
+
* Note that this is not treated as an error on the observable, but will complete the observable.
|
|
499
|
+
*
|
|
500
|
+
* @public
|
|
501
|
+
*/
|
|
489
502
|
export declare type DisconnectEvent = {
|
|
490
503
|
type: 'disconnect'
|
|
491
504
|
reason: string
|
|
@@ -575,8 +588,8 @@ export declare type InsertPatch =
|
|
|
575
588
|
*
|
|
576
589
|
* @param query - GROQ-filter to listen to changes for
|
|
577
590
|
* @param params - Optional query parameters
|
|
578
|
-
* @param options -
|
|
579
|
-
* @
|
|
591
|
+
* @param options - Optional listener options
|
|
592
|
+
* @public
|
|
580
593
|
*/
|
|
581
594
|
export declare function _listen<R extends Record<string, Any> = Record<string, Any>>(
|
|
582
595
|
this: SanityClient | ObservableSanityClient,
|
|
@@ -589,8 +602,8 @@ export declare function _listen<R extends Record<string, Any> = Record<string, A
|
|
|
589
602
|
*
|
|
590
603
|
* @param query - GROQ-filter to listen to changes for
|
|
591
604
|
* @param params - Optional query parameters
|
|
592
|
-
* @param options -
|
|
593
|
-
* @
|
|
605
|
+
* @param options - Optional listener options
|
|
606
|
+
* @public
|
|
594
607
|
*/
|
|
595
608
|
export declare function _listen<R extends Record<string, Any> = Record<string, Any>>(
|
|
596
609
|
this: SanityClient | ObservableSanityClient,
|
|
@@ -608,15 +621,60 @@ export declare type ListenEvent<R extends Record<string, Any>> =
|
|
|
608
621
|
| WelcomeEvent
|
|
609
622
|
|
|
610
623
|
/** @public */
|
|
611
|
-
export declare type ListenEventName =
|
|
624
|
+
export declare type ListenEventName =
|
|
625
|
+
/** A mutation was performed */
|
|
626
|
+
| 'mutation'
|
|
627
|
+
/** The listener has been (re)established */
|
|
628
|
+
| 'welcome'
|
|
629
|
+
/** The listener has been disconnected, and a reconnect attempt is scheduled */
|
|
630
|
+
| 'reconnect'
|
|
612
631
|
|
|
613
632
|
/** @public */
|
|
614
633
|
export declare interface ListenOptions {
|
|
634
|
+
/**
|
|
635
|
+
* Whether or not to include the resulting document in addition to the mutations performed.
|
|
636
|
+
* If you do not need the actual document, set this to `false` to reduce bandwidth usage.
|
|
637
|
+
* The result will be available on the `.result` property of the events.
|
|
638
|
+
* @defaultValue `true`
|
|
639
|
+
*/
|
|
615
640
|
includeResult?: boolean
|
|
641
|
+
/**
|
|
642
|
+
* Whether or not to include the document as it looked before the mutation event.
|
|
643
|
+
* The previous revision will be available on the `.previous` property of the events,
|
|
644
|
+
* and may be `null` in the case of a new document.
|
|
645
|
+
* @defaultValue `false`
|
|
646
|
+
*/
|
|
616
647
|
includePreviousRevision?: boolean
|
|
617
|
-
|
|
648
|
+
/**
|
|
649
|
+
* Whether events should be sent as soon as a transaction has been committed (`transaction`, default),
|
|
650
|
+
* or only after they are available for queries (query). Note that this is on a best-effort basis,
|
|
651
|
+
* and listeners with `query` may in certain cases (notably with deferred transactions) receive events
|
|
652
|
+
* that are not yet visible to queries.
|
|
653
|
+
*
|
|
654
|
+
* @defaultValue `'transaction'`
|
|
655
|
+
*/
|
|
656
|
+
visibility?: 'transaction' | 'query'
|
|
657
|
+
/**
|
|
658
|
+
* Array of event names to include in the observable. By default, only mutation events are included.
|
|
659
|
+
*
|
|
660
|
+
* @defaultValue `['mutation']`
|
|
661
|
+
*/
|
|
618
662
|
events?: ListenEventName[]
|
|
663
|
+
/**
|
|
664
|
+
* Format of "effects", eg the resulting changes of a mutation.
|
|
665
|
+
* Currently only `mendoza` is supported, and (if set) will include `apply` and `revert` arrays
|
|
666
|
+
* in the mutation events under the `effects` property.
|
|
667
|
+
*
|
|
668
|
+
* See {@link https://github.com/sanity-io/mendoza | The mendoza docs} for more info
|
|
669
|
+
*
|
|
670
|
+
* @defaultValue `undefined`
|
|
671
|
+
*/
|
|
619
672
|
effectFormat?: 'mendoza'
|
|
673
|
+
/**
|
|
674
|
+
* Optional request tag for the listener. Use to identify the request in logs.
|
|
675
|
+
*
|
|
676
|
+
* @defaultValue `undefined`
|
|
677
|
+
*/
|
|
620
678
|
tag?: string
|
|
621
679
|
}
|
|
622
680
|
|
|
@@ -666,25 +724,100 @@ export declare interface MutationErrorItem {
|
|
|
666
724
|
}
|
|
667
725
|
}
|
|
668
726
|
|
|
669
|
-
/**
|
|
727
|
+
/**
|
|
728
|
+
* A mutation was performed. Note that when updating multiple documents in a transaction,
|
|
729
|
+
* each document affected will get a separate mutation event.
|
|
730
|
+
*
|
|
731
|
+
* @public
|
|
732
|
+
*/
|
|
670
733
|
declare type MutationEvent_2<R extends Record<string, Any> = Record<string, Any>> = {
|
|
671
734
|
type: 'mutation'
|
|
735
|
+
/**
|
|
736
|
+
* The ID of the document that was affected
|
|
737
|
+
*/
|
|
672
738
|
documentId: string
|
|
739
|
+
/**
|
|
740
|
+
* A unique ID for this event
|
|
741
|
+
*/
|
|
673
742
|
eventId: string
|
|
743
|
+
/**
|
|
744
|
+
* The user ID of the user that performed the mutation
|
|
745
|
+
*/
|
|
674
746
|
identity: string
|
|
747
|
+
/**
|
|
748
|
+
* An array of mutations that were performed. Note that this can differ slightly from the
|
|
749
|
+
* mutations sent to the server, as the server may perform some mutations automatically.
|
|
750
|
+
*/
|
|
675
751
|
mutations: Mutation[]
|
|
752
|
+
/**
|
|
753
|
+
* The revision ID of the document before the mutation was performed
|
|
754
|
+
*/
|
|
676
755
|
previousRev?: string
|
|
756
|
+
/**
|
|
757
|
+
* The revision ID of the document after the mutation was performed
|
|
758
|
+
*/
|
|
677
759
|
resultRev?: string
|
|
760
|
+
/**
|
|
761
|
+
* The document as it looked after the mutation was performed. This is only included if
|
|
762
|
+
* the listener was configured with `includeResult: true`.
|
|
763
|
+
*/
|
|
678
764
|
result?: SanityDocument<R>
|
|
765
|
+
/**
|
|
766
|
+
* The document as it looked before the mutation was performed. This is only included if
|
|
767
|
+
* the listener was configured with `includePreviousRevision: true`.
|
|
768
|
+
*/
|
|
679
769
|
previous?: SanityDocument<R> | null
|
|
770
|
+
/**
|
|
771
|
+
* The effects of the mutation, if the listener was configured with `effectFormat: 'mendoza'`.
|
|
772
|
+
* Object with `apply` and `revert` arrays, see {@link https://github.com/sanity-io/mendoza}.
|
|
773
|
+
*/
|
|
680
774
|
effects?: {
|
|
681
775
|
apply: unknown[]
|
|
682
776
|
revert: unknown[]
|
|
683
777
|
}
|
|
778
|
+
/**
|
|
779
|
+
* A timestamp for when the mutation was performed
|
|
780
|
+
*/
|
|
684
781
|
timestamp: string
|
|
782
|
+
/**
|
|
783
|
+
* The transaction ID for the mutation
|
|
784
|
+
*/
|
|
685
785
|
transactionId: string
|
|
786
|
+
/**
|
|
787
|
+
* The type of transition the document went through.
|
|
788
|
+
*
|
|
789
|
+
* - `update` means the document was previously part of the subscribed set of documents,
|
|
790
|
+
* and still is.
|
|
791
|
+
* - `appear` means the document was not previously part of the subscribed set of documents,
|
|
792
|
+
* but is now. This can happen both on create or if updating to a state where it now matches
|
|
793
|
+
* the filter provided to the listener.
|
|
794
|
+
* - `disappear` means the document was previously part of the subscribed set of documents,
|
|
795
|
+
* but is no longer. This can happen both on delete or if updating to a state where it no
|
|
796
|
+
* longer matches the filter provided to the listener.
|
|
797
|
+
*/
|
|
686
798
|
transition: 'update' | 'appear' | 'disappear'
|
|
799
|
+
/**
|
|
800
|
+
* Whether the change that triggered this event is visible to queries (query) or only to
|
|
801
|
+
* subsequent transactions (transaction). The listener client can specify a preferred visibility
|
|
802
|
+
* through the `visibility` parameter on the listener, but this is only on a best-effort basis,
|
|
803
|
+
* and may yet not be accurate.
|
|
804
|
+
*/
|
|
687
805
|
visibility: 'query' | 'transaction'
|
|
806
|
+
/**
|
|
807
|
+
* The total number of events that will be sent for this transaction.
|
|
808
|
+
* Note that this may differ from the amount of _documents_ affected by the transaction, as this
|
|
809
|
+
* number only includes the documents that matches the given filter.
|
|
810
|
+
*
|
|
811
|
+
* This can be useful if you need to perform changes to all matched documents atomically,
|
|
812
|
+
* eg you would wait for `transactionTotalEvents` events with the same `transactionId` before
|
|
813
|
+
* applying the changes locally.
|
|
814
|
+
*/
|
|
815
|
+
transactionTotalEvents: number
|
|
816
|
+
/**
|
|
817
|
+
* The index of this event within the transaction. Note that events may be delivered out of order,
|
|
818
|
+
* and that the index is zero-based.
|
|
819
|
+
*/
|
|
820
|
+
transactionCurrentEvent: number
|
|
688
821
|
}
|
|
689
822
|
export {MutationEvent_2 as MutationEvent}
|
|
690
823
|
|
|
@@ -1291,10 +1424,27 @@ export declare class ObservableSanityClient {
|
|
|
1291
1424
|
/**
|
|
1292
1425
|
* Create a new buildable patch of operations to perform
|
|
1293
1426
|
*
|
|
1294
|
-
* @param documentId - Document ID
|
|
1427
|
+
* @param documentId - Document ID to patch
|
|
1295
1428
|
* @param operations - Optional object of patch operations to initialize the patch instance with
|
|
1429
|
+
* @returns Patch instance - call `.commit()` to perform the operations defined
|
|
1296
1430
|
*/
|
|
1297
|
-
patch(documentId:
|
|
1431
|
+
patch(documentId: string, operations?: PatchOperations): ObservablePatch
|
|
1432
|
+
/**
|
|
1433
|
+
* Create a new buildable patch of operations to perform
|
|
1434
|
+
*
|
|
1435
|
+
* @param documentIds - Array of document IDs to patch
|
|
1436
|
+
* @param operations - Optional object of patch operations to initialize the patch instance with
|
|
1437
|
+
* @returns Patch instance - call `.commit()` to perform the operations defined
|
|
1438
|
+
*/
|
|
1439
|
+
patch(documentIds: string[], operations?: PatchOperations): ObservablePatch
|
|
1440
|
+
/**
|
|
1441
|
+
* Create a new buildable patch of operations to perform
|
|
1442
|
+
*
|
|
1443
|
+
* @param selection - An object with `query` and optional `params`, defining which document(s) to patch
|
|
1444
|
+
* @param operations - Optional object of patch operations to initialize the patch instance with
|
|
1445
|
+
* @returns Patch instance - call `.commit()` to perform the operations defined
|
|
1446
|
+
*/
|
|
1447
|
+
patch(selection: MutationSelection, operations?: PatchOperations): ObservablePatch
|
|
1298
1448
|
/**
|
|
1299
1449
|
* Create a new transaction of mutations
|
|
1300
1450
|
*
|
|
@@ -1304,9 +1454,8 @@ export declare class ObservableSanityClient {
|
|
|
1304
1454
|
operations?: Mutation<R>[],
|
|
1305
1455
|
): ObservableTransaction
|
|
1306
1456
|
/**
|
|
1307
|
-
*
|
|
1457
|
+
* Perform an HTTP request against the Sanity API
|
|
1308
1458
|
*
|
|
1309
|
-
* @deprecated Use your own request library!
|
|
1310
1459
|
* @param options - Request options
|
|
1311
1460
|
*/
|
|
1312
1461
|
request<R = Any>(options: RawRequestOptions): Observable<R>
|
|
@@ -1542,7 +1691,11 @@ export declare interface RawRequestOptions {
|
|
|
1542
1691
|
maxRedirects?: number
|
|
1543
1692
|
}
|
|
1544
1693
|
|
|
1545
|
-
/**
|
|
1694
|
+
/**
|
|
1695
|
+
* The listener has been disconnected, and a reconnect attempt is scheduled.
|
|
1696
|
+
*
|
|
1697
|
+
* @public
|
|
1698
|
+
*/
|
|
1546
1699
|
export declare type ReconnectEvent = {
|
|
1547
1700
|
type: 'reconnect'
|
|
1548
1701
|
}
|
|
@@ -2038,10 +2191,27 @@ export declare class SanityClient {
|
|
|
2038
2191
|
/**
|
|
2039
2192
|
* Create a new buildable patch of operations to perform
|
|
2040
2193
|
*
|
|
2041
|
-
* @param documentId - Document ID
|
|
2194
|
+
* @param documentId - Document ID to patch
|
|
2195
|
+
* @param operations - Optional object of patch operations to initialize the patch instance with
|
|
2196
|
+
* @returns Patch instance - call `.commit()` to perform the operations defined
|
|
2197
|
+
*/
|
|
2198
|
+
patch(documentId: string, operations?: PatchOperations): Patch
|
|
2199
|
+
/**
|
|
2200
|
+
* Create a new buildable patch of operations to perform
|
|
2201
|
+
*
|
|
2202
|
+
* @param documentIds - Array of document IDs to patch
|
|
2042
2203
|
* @param operations - Optional object of patch operations to initialize the patch instance with
|
|
2204
|
+
* @returns Patch instance - call `.commit()` to perform the operations defined
|
|
2043
2205
|
*/
|
|
2044
|
-
patch(
|
|
2206
|
+
patch(documentIds: string[], operations?: PatchOperations): Patch
|
|
2207
|
+
/**
|
|
2208
|
+
* Create a new buildable patch of operations to perform
|
|
2209
|
+
*
|
|
2210
|
+
* @param selection - An object with `query` and optional `params`, defining which document(s) to patch
|
|
2211
|
+
* @param operations - Optional object of patch operations to initialize the patch instance with
|
|
2212
|
+
* @returns Patch instance - call `.commit()` to perform the operations defined
|
|
2213
|
+
*/
|
|
2214
|
+
patch(selection: MutationSelection, operations?: PatchOperations): Patch
|
|
2045
2215
|
/**
|
|
2046
2216
|
* Create a new transaction of mutations
|
|
2047
2217
|
*
|
|
@@ -2215,81 +2385,6 @@ export declare interface SingleMutationResult {
|
|
|
2215
2385
|
}[]
|
|
2216
2386
|
}
|
|
2217
2387
|
|
|
2218
|
-
/**
|
|
2219
|
-
* Stricter typing of the response from `client.fetch`, intended to be used by type inference libraries and tooling that
|
|
2220
|
-
* delivers runtime safety in production.
|
|
2221
|
-
*
|
|
2222
|
-
* @example
|
|
2223
|
-
* It's not designed to be used directly in application code, in fact that would be the most annoying way to query Content Lake in a runtime safe way:
|
|
2224
|
-
* ```ts
|
|
2225
|
-
* import type {StrictUnknownQueryResponseResult} from '@sanity/client'
|
|
2226
|
-
* const query = '*[_type == "product"]'
|
|
2227
|
-
* const response = client.fetch<StrictUnknownQueryResponseResult>(query)
|
|
2228
|
-
* // Response is now strictly typed, without any knowledge of the dataset or what the GROQ query might return.
|
|
2229
|
-
* // The GROQ query is asking for an array of documents that have `_type` = "product", but TypeScript doesn't know that,
|
|
2230
|
-
* // `query` is `string` and so the type accounts for anything that GROQ supports, which means you might have any JSON valid data in the response.
|
|
2231
|
-
* // \@ts-expect-error -- TS doesn't know the api will always return an array, so it errors
|
|
2232
|
-
* console.log(response.length)
|
|
2233
|
-
* // It needs a runtime check to ensure it's an array
|
|
2234
|
-
* if (Array.isArray(response)) console.log(response.length)
|
|
2235
|
-
* ```
|
|
2236
|
-
*
|
|
2237
|
-
* @example
|
|
2238
|
-
* How's it intended to be used? By libraries that delivers end-to-end GROQ runtime type safety.
|
|
2239
|
-
* For example in an imaginary TypeScript language service plugin that can look at your `sanity.config.ts`:
|
|
2240
|
-
* ```ts
|
|
2241
|
-
* import { defineConfig } from 'sanity'
|
|
2242
|
-
|
|
2243
|
-
* export default defineConfig({
|
|
2244
|
-
* projectId: '...',
|
|
2245
|
-
* dataset: '...',
|
|
2246
|
-
* schema: {
|
|
2247
|
-
* types: [
|
|
2248
|
-
* {
|
|
2249
|
-
* name: 'page',
|
|
2250
|
-
* title: 'Page',
|
|
2251
|
-
* type: 'document',
|
|
2252
|
-
* fields: [
|
|
2253
|
-
* {
|
|
2254
|
-
* name: 'title',
|
|
2255
|
-
* title: 'Title',
|
|
2256
|
-
* type: 'string',
|
|
2257
|
-
* },
|
|
2258
|
-
* ],
|
|
2259
|
-
* },
|
|
2260
|
-
* ],
|
|
2261
|
-
* },
|
|
2262
|
-
* })
|
|
2263
|
-
* ```
|
|
2264
|
-
* And use that to infer typings:
|
|
2265
|
-
* ```ts
|
|
2266
|
-
* import {createClient} from '@sanity/client'
|
|
2267
|
-
*
|
|
2268
|
-
* const client = createClient()
|
|
2269
|
-
* const response = client.fetch('*[_type == "page"]')
|
|
2270
|
-
* // all is well, if title exists the schema says it's a string
|
|
2271
|
-
* response.map(page => page.title?.toUpperCase())
|
|
2272
|
-
* // IDE flags an error, the `author` property isn't defined in the schema so it could be any JSON valid value.
|
|
2273
|
-
* response.map(page => page.author?.toUpperCase())
|
|
2274
|
-
* // Maybe this is by design because `author` is coming from an external source, and not from entering it in the Studio interface,
|
|
2275
|
-
* // the IDE plugin returns `StrictUnknownQueryResponseResult` and you have to handle it manually:
|
|
2276
|
-
* response.map(page => typeof page.author === 'string' ? page.author.toUpperCase() : 'UNKNOWN')
|
|
2277
|
-
* ```
|
|
2278
|
-
* If the imaginary IDE extension returned `any` or `unknown` instead of `StrictUnknownQueryResponseResult` it opens up a lot of
|
|
2279
|
-
* possibilities where it would fail silently and instead error at runtime.
|
|
2280
|
-
*
|
|
2281
|
-
* @public
|
|
2282
|
-
*/
|
|
2283
|
-
export declare type StrictUnknownQueryResponseResult =
|
|
2284
|
-
| string
|
|
2285
|
-
| number
|
|
2286
|
-
| boolean
|
|
2287
|
-
| null
|
|
2288
|
-
| {
|
|
2289
|
-
[key: string]: StrictUnknownQueryResponseResult | undefined
|
|
2290
|
-
}
|
|
2291
|
-
| StrictUnknownQueryResponseResult[]
|
|
2292
|
-
|
|
2293
2388
|
/** @public */
|
|
2294
2389
|
export declare class Transaction extends BaseTransaction {
|
|
2295
2390
|
#private
|
|
@@ -2465,7 +2560,12 @@ export declare class UsersClient {
|
|
|
2465
2560
|
getById<T extends 'me' | string>(id: T): Promise<T extends 'me' ? CurrentSanityUser : SanityUser>
|
|
2466
2561
|
}
|
|
2467
2562
|
|
|
2468
|
-
/**
|
|
2563
|
+
/**
|
|
2564
|
+
* The listener has been established, and will start receiving events.
|
|
2565
|
+
* Note that this is also emitted upon _reconnection_.
|
|
2566
|
+
*
|
|
2567
|
+
* @public
|
|
2568
|
+
*/
|
|
2469
2569
|
export declare type WelcomeEvent = {
|
|
2470
2570
|
type: 'welcome'
|
|
2471
2571
|
}
|
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 = "6.4.
|
|
7
|
+
var version = "6.4.11";
|
|
8
8
|
const middleware = [debug({
|
|
9
9
|
verbose: true,
|
|
10
10
|
namespace: "sanity:client"
|
|
@@ -1718,11 +1718,12 @@ const _ObservableSanityClient = class _ObservableSanityClient {
|
|
|
1718
1718
|
/**
|
|
1719
1719
|
* Create a new buildable patch of operations to perform
|
|
1720
1720
|
*
|
|
1721
|
-
* @param
|
|
1721
|
+
* @param selection - Document ID, an array of document IDs, or an object with `query` and optional `params`, defining which document(s) to patch
|
|
1722
1722
|
* @param operations - Optional object of patch operations to initialize the patch instance with
|
|
1723
|
+
* @returns Patch instance - call `.commit()` to perform the operations defined
|
|
1723
1724
|
*/
|
|
1724
|
-
patch(
|
|
1725
|
-
return new ObservablePatch(
|
|
1725
|
+
patch(selection, operations) {
|
|
1726
|
+
return new ObservablePatch(selection, operations, this);
|
|
1726
1727
|
}
|
|
1727
1728
|
/**
|
|
1728
1729
|
* Create a new transaction of mutations
|
|
@@ -1733,9 +1734,8 @@ const _ObservableSanityClient = class _ObservableSanityClient {
|
|
|
1733
1734
|
return new ObservableTransaction(operations, this);
|
|
1734
1735
|
}
|
|
1735
1736
|
/**
|
|
1736
|
-
*
|
|
1737
|
+
* Perform an HTTP request against the Sanity API
|
|
1737
1738
|
*
|
|
1738
|
-
* @deprecated Use your own request library!
|
|
1739
1739
|
* @param options - Request options
|
|
1740
1740
|
*/
|
|
1741
1741
|
request(options) {
|
|
@@ -1866,8 +1866,9 @@ const _SanityClient = class _SanityClient {
|
|
|
1866
1866
|
/**
|
|
1867
1867
|
* Create a new buildable patch of operations to perform
|
|
1868
1868
|
*
|
|
1869
|
-
* @param
|
|
1869
|
+
* @param selection - Document ID, an array of document IDs, or an object with `query` and optional `params`, defining which document(s) to patch
|
|
1870
1870
|
* @param operations - Optional object of patch operations to initialize the patch instance with
|
|
1871
|
+
* @returns Patch instance - call `.commit()` to perform the operations defined
|
|
1871
1872
|
*/
|
|
1872
1873
|
patch(documentId, operations) {
|
|
1873
1874
|
return new Patch(documentId, operations, this);
|