@sanity/client 5.2.0 → 5.2.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/dist/index.browser.cjs +13 -11
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +13 -11
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +14 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +128 -128
- package/dist/index.js +14 -12
- package/dist/index.js.map +1 -1
- package/package.json +13 -13
- package/src/SanityClient.ts +80 -80
- package/src/assets/AssetsClient.ts +4 -4
- package/src/config.ts +1 -1
- package/src/data/dataMethods.ts +31 -31
- package/src/data/encodeQueryString.ts +3 -3
- package/src/data/listen.ts +11 -11
- package/src/data/patch.ts +18 -18
- package/src/data/transaction.ts +13 -15
- package/src/generateHelpUrl.ts +1 -1
- package/src/http/errors.ts +7 -7
- package/src/http/request.ts +4 -4
- package/src/http/requestOptions.ts +3 -3
- package/src/index.browser.ts +9 -1
- package/src/index.ts +9 -1
- package/src/types.ts +27 -28
- package/src/util/defaults.ts +3 -3
- package/src/util/getSelection.ts +1 -1
- package/src/util/once.ts +4 -4
- package/src/util/pick.ts +3 -3
- package/src/validators.ts +4 -4
- package/src/warnings.ts +8 -4
- package/umd/sanityClient.js +13 -11
- package/umd/sanityClient.min.js +1 -1
- package/src/migrationNotice.ts +0 -9
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,12 @@ export declare type AllDocumentsMutationOptions = BaseMutationOptions & {
|
|
|
15
15
|
returnDocuments?: true
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Used to tag types that is set to `any` as a temporary measure, but should be replaced with proper typings in the future
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export declare type Any = any
|
|
23
|
+
|
|
18
24
|
/** @public */
|
|
19
25
|
export declare type AssetMetadataType =
|
|
20
26
|
| 'location'
|
|
@@ -69,7 +75,7 @@ export declare class AssetsClient {
|
|
|
69
75
|
|
|
70
76
|
/** @internal */
|
|
71
77
|
export declare type AttributeSet = {
|
|
72
|
-
[key: string]:
|
|
78
|
+
[key: string]: Any
|
|
73
79
|
}
|
|
74
80
|
|
|
75
81
|
/** @internal */
|
|
@@ -146,21 +152,21 @@ export declare class BasePatch {
|
|
|
146
152
|
* @param selector - JSONPath expression, eg `comments[-1]` or `blocks[_key=="abc123"]`
|
|
147
153
|
* @param items - Array of items to insert/replace
|
|
148
154
|
*/
|
|
149
|
-
insert(at: 'before' | 'after' | 'replace', selector: string, items:
|
|
155
|
+
insert(at: 'before' | 'after' | 'replace', selector: string, items: Any[]): this
|
|
150
156
|
/**
|
|
151
157
|
* Append the given items to the array at the given JSONPath
|
|
152
158
|
*
|
|
153
159
|
* @param selector - Attribute/path to append to, eg `comments` or `person.hobbies`
|
|
154
160
|
* @param items - Array of items to append to the array
|
|
155
161
|
*/
|
|
156
|
-
append(selector: string, items:
|
|
162
|
+
append(selector: string, items: Any[]): this
|
|
157
163
|
/**
|
|
158
164
|
* Prepend the given items to the array at the given JSONPath
|
|
159
165
|
*
|
|
160
166
|
* @param selector - Attribute/path to prepend to, eg `comments` or `person.hobbies`
|
|
161
167
|
* @param items - Array of items to prepend to the array
|
|
162
168
|
*/
|
|
163
|
-
prepend(selector: string, items:
|
|
169
|
+
prepend(selector: string, items: Any[]): this
|
|
164
170
|
/**
|
|
165
171
|
* Change the contents of an array by removing existing elements and/or adding new elements.
|
|
166
172
|
*
|
|
@@ -169,7 +175,7 @@ export declare class BasePatch {
|
|
|
169
175
|
* @param deleteCount - An integer indicating the number of old array elements to remove.
|
|
170
176
|
* @param items - The elements to add to the array, beginning at the start index. If you don't specify any elements, splice() will only remove elements from the array.
|
|
171
177
|
*/
|
|
172
|
-
splice(selector: string, start: number, deleteCount?: number, items?:
|
|
178
|
+
splice(selector: string, start: number, deleteCount?: number, items?: Any[]): this
|
|
173
179
|
/**
|
|
174
180
|
* Adds a revision clause, preventing the document from being patched if the `_rev` property does not match the given value
|
|
175
181
|
*
|
|
@@ -188,8 +194,8 @@ export declare class BasePatch {
|
|
|
188
194
|
* Clears the patch of all operations
|
|
189
195
|
*/
|
|
190
196
|
reset(): this
|
|
191
|
-
protected _assign(op: keyof PatchOperations, props:
|
|
192
|
-
protected _set(op: keyof PatchOperations, props:
|
|
197
|
+
protected _assign(op: keyof PatchOperations, props: Any, merge?: boolean): this
|
|
198
|
+
protected _set(op: keyof PatchOperations, props: Any): this
|
|
193
199
|
}
|
|
194
200
|
|
|
195
201
|
/** @internal */
|
|
@@ -203,14 +209,14 @@ export declare class BaseTransaction {
|
|
|
203
209
|
*
|
|
204
210
|
* @param doc - Document to create. Requires a `_type` property.
|
|
205
211
|
*/
|
|
206
|
-
create<R extends Record<string,
|
|
212
|
+
create<R extends Record<string, Any> = Record<string, Any>>(doc: SanityDocumentStub<R>): this
|
|
207
213
|
/**
|
|
208
214
|
* Creates a new Sanity document. If a document with the same `_id` already exists, the create operation will be ignored.
|
|
209
215
|
* The operation is added to the current transaction, ready to be commited by `commit()`
|
|
210
216
|
*
|
|
211
217
|
* @param doc - Document to create if it does not already exist. Requires `_id` and `_type` properties.
|
|
212
218
|
*/
|
|
213
|
-
createIfNotExists<R extends Record<string,
|
|
219
|
+
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
214
220
|
doc: IdentifiedSanityDocumentStub<R>
|
|
215
221
|
): this
|
|
216
222
|
/**
|
|
@@ -219,7 +225,7 @@ export declare class BaseTransaction {
|
|
|
219
225
|
*
|
|
220
226
|
* @param doc - Document to create or replace. Requires `_id` and `_type` properties.
|
|
221
227
|
*/
|
|
222
|
-
createOrReplace<R extends Record<string,
|
|
228
|
+
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
223
229
|
doc: IdentifiedSanityDocumentStub<R>
|
|
224
230
|
): this
|
|
225
231
|
/**
|
|
@@ -230,7 +236,7 @@ export declare class BaseTransaction {
|
|
|
230
236
|
*/
|
|
231
237
|
delete(documentId: string): this
|
|
232
238
|
/**
|
|
233
|
-
* Gets the current transaction ID, if
|
|
239
|
+
* Gets the current transaction ID, if any
|
|
234
240
|
*/
|
|
235
241
|
transactionId(): string | undefined
|
|
236
242
|
/**
|
|
@@ -290,7 +296,7 @@ export declare class ClientError extends Error {
|
|
|
290
296
|
statusCode: ErrorProps['statusCode']
|
|
291
297
|
responseBody: ErrorProps['responseBody']
|
|
292
298
|
details: ErrorProps['details']
|
|
293
|
-
constructor(res:
|
|
299
|
+
constructor(res: Any)
|
|
294
300
|
}
|
|
295
301
|
|
|
296
302
|
/** @public */
|
|
@@ -362,6 +368,13 @@ export declare type DatasetsResponse = {
|
|
|
362
368
|
aclMode: DatasetAclMode
|
|
363
369
|
}[]
|
|
364
370
|
|
|
371
|
+
/**
|
|
372
|
+
* @public
|
|
373
|
+
* @deprecated Use the named export `createClient` instead of the `default` export
|
|
374
|
+
*/
|
|
375
|
+
declare function deprecatedCreateClient(config: ClientConfig): SanityClient
|
|
376
|
+
export default deprecatedCreateClient
|
|
377
|
+
|
|
365
378
|
/** @public */
|
|
366
379
|
export declare type DisconnectEvent = {
|
|
367
380
|
type: 'disconnect'
|
|
@@ -371,10 +384,10 @@ export declare type DisconnectEvent = {
|
|
|
371
384
|
/** @public */
|
|
372
385
|
export declare interface ErrorProps {
|
|
373
386
|
message: string
|
|
374
|
-
response:
|
|
387
|
+
response: Any
|
|
375
388
|
statusCode: number
|
|
376
|
-
responseBody:
|
|
377
|
-
details:
|
|
389
|
+
responseBody: Any
|
|
390
|
+
details: Any
|
|
378
391
|
}
|
|
379
392
|
|
|
380
393
|
/** @internal */
|
|
@@ -394,12 +407,6 @@ export declare type FirstDocumentMutationOptions = BaseMutationOptions & {
|
|
|
394
407
|
returnDocuments?: true
|
|
395
408
|
}
|
|
396
409
|
|
|
397
|
-
/**
|
|
398
|
-
* Used to tag types that is set to `any` as a temporary measure, but should be replaced with proper typings in the future
|
|
399
|
-
* @internal
|
|
400
|
-
*/
|
|
401
|
-
export declare type FIXME = any
|
|
402
|
-
|
|
403
410
|
/** @public */
|
|
404
411
|
export declare type HttpRequest = {
|
|
405
412
|
defaultRequester: Requester
|
|
@@ -411,7 +418,7 @@ export declare type HttpRequestEvent<T = unknown> = ResponseEvent<T> | ProgressE
|
|
|
411
418
|
|
|
412
419
|
/** @public */
|
|
413
420
|
export declare type IdentifiedSanityDocumentStub<
|
|
414
|
-
T extends Record<string,
|
|
421
|
+
T extends Record<string, Any> = Record<string, Any>
|
|
415
422
|
> = {
|
|
416
423
|
[P in keyof T]: T[P]
|
|
417
424
|
} & {
|
|
@@ -442,15 +449,15 @@ export declare interface InitializedClientConfig extends ClientConfig {
|
|
|
442
449
|
export declare type InsertPatch =
|
|
443
450
|
| {
|
|
444
451
|
before: string
|
|
445
|
-
items:
|
|
452
|
+
items: Any[]
|
|
446
453
|
}
|
|
447
454
|
| {
|
|
448
455
|
after: string
|
|
449
|
-
items:
|
|
456
|
+
items: Any[]
|
|
450
457
|
}
|
|
451
458
|
| {
|
|
452
459
|
replace: string
|
|
453
|
-
items:
|
|
460
|
+
items: Any[]
|
|
454
461
|
}
|
|
455
462
|
|
|
456
463
|
/**
|
|
@@ -461,7 +468,7 @@ export declare type InsertPatch =
|
|
|
461
468
|
* @param options - Listener options
|
|
462
469
|
* @internal
|
|
463
470
|
*/
|
|
464
|
-
export declare function _listen<R extends Record<string,
|
|
471
|
+
export declare function _listen<R extends Record<string, Any> = Record<string, Any>>(
|
|
465
472
|
this: SanityClient | ObservableSanityClient,
|
|
466
473
|
query: string,
|
|
467
474
|
params?: QueryParams
|
|
@@ -475,7 +482,7 @@ export declare function _listen<R extends Record<string, FIXME> = Record<string,
|
|
|
475
482
|
* @param options - Listener options
|
|
476
483
|
* @internal
|
|
477
484
|
*/
|
|
478
|
-
export declare function _listen<R extends Record<string,
|
|
485
|
+
export declare function _listen<R extends Record<string, Any> = Record<string, Any>>(
|
|
479
486
|
this: SanityClient | ObservableSanityClient,
|
|
480
487
|
query: string,
|
|
481
488
|
params?: QueryParams,
|
|
@@ -483,7 +490,7 @@ export declare function _listen<R extends Record<string, FIXME> = Record<string,
|
|
|
483
490
|
): Observable<ListenEvent<R>>
|
|
484
491
|
|
|
485
492
|
/** @public */
|
|
486
|
-
export declare type ListenEvent<R extends Record<string,
|
|
493
|
+
export declare type ListenEvent<R extends Record<string, Any>> =
|
|
487
494
|
| MutationEvent_2<R>
|
|
488
495
|
| ChannelErrorEvent
|
|
489
496
|
| DisconnectEvent
|
|
@@ -503,13 +510,6 @@ export declare interface ListenOptions {
|
|
|
503
510
|
tag?: string
|
|
504
511
|
}
|
|
505
512
|
|
|
506
|
-
/**
|
|
507
|
-
* @public
|
|
508
|
-
* @deprecated Use the named export `createClient` instead of the `default` export
|
|
509
|
-
*/
|
|
510
|
-
declare function migrationNotice(): void
|
|
511
|
-
export default migrationNotice
|
|
512
|
-
|
|
513
513
|
/** @internal */
|
|
514
514
|
export declare interface MultipleMutationResult {
|
|
515
515
|
transactionId: string
|
|
@@ -521,7 +521,7 @@ export declare interface MultipleMutationResult {
|
|
|
521
521
|
}
|
|
522
522
|
|
|
523
523
|
/** @public */
|
|
524
|
-
export declare type Mutation<R extends Record<string,
|
|
524
|
+
export declare type Mutation<R extends Record<string, Any> = Record<string, Any>> =
|
|
525
525
|
| {
|
|
526
526
|
create: SanityDocumentStub<R>
|
|
527
527
|
}
|
|
@@ -539,7 +539,7 @@ export declare type Mutation<R extends Record<string, FIXME> = Record<string, FI
|
|
|
539
539
|
}
|
|
540
540
|
|
|
541
541
|
/** @public */
|
|
542
|
-
declare type MutationEvent_2<R extends Record<string,
|
|
542
|
+
declare type MutationEvent_2<R extends Record<string, Any> = Record<string, Any>> = {
|
|
543
543
|
type: 'mutation'
|
|
544
544
|
documentId: string
|
|
545
545
|
eventId: string
|
|
@@ -686,7 +686,7 @@ export declare class ObservablePatch extends BasePatch {
|
|
|
686
686
|
*
|
|
687
687
|
* @param options - Options for the mutation operation
|
|
688
688
|
*/
|
|
689
|
-
commit<R extends Record<string,
|
|
689
|
+
commit<R extends Record<string, Any> = Record<string, Any>>(
|
|
690
690
|
options: FirstDocumentMutationOptions
|
|
691
691
|
): Observable<SanityDocument<R>>
|
|
692
692
|
/**
|
|
@@ -694,7 +694,7 @@ export declare class ObservablePatch extends BasePatch {
|
|
|
694
694
|
*
|
|
695
695
|
* @param options - Options for the mutation operation
|
|
696
696
|
*/
|
|
697
|
-
commit<R extends Record<string,
|
|
697
|
+
commit<R extends Record<string, Any> = Record<string, Any>>(
|
|
698
698
|
options: AllDocumentsMutationOptions
|
|
699
699
|
): Observable<SanityDocument<R>[]>
|
|
700
700
|
/**
|
|
@@ -714,7 +714,7 @@ export declare class ObservablePatch extends BasePatch {
|
|
|
714
714
|
*
|
|
715
715
|
* @param options - Options for the mutation operation
|
|
716
716
|
*/
|
|
717
|
-
commit<R extends Record<string,
|
|
717
|
+
commit<R extends Record<string, Any> = Record<string, Any>>(
|
|
718
718
|
options?: BaseMutationOptions
|
|
719
719
|
): Observable<SanityDocument<R>>
|
|
720
720
|
}
|
|
@@ -773,14 +773,14 @@ export declare class ObservableSanityClient {
|
|
|
773
773
|
*
|
|
774
774
|
* @param query - GROQ-query to perform
|
|
775
775
|
*/
|
|
776
|
-
fetch<R =
|
|
776
|
+
fetch<R = Any>(query: string): Observable<R>
|
|
777
777
|
/**
|
|
778
778
|
* Perform a GROQ-query against the configured dataset.
|
|
779
779
|
*
|
|
780
780
|
* @param query - GROQ-query to perform
|
|
781
781
|
* @param params - Query parameters
|
|
782
782
|
*/
|
|
783
|
-
fetch<R =
|
|
783
|
+
fetch<R = Any, Q = QueryParams>(query: string, params: Q): Observable<R>
|
|
784
784
|
/**
|
|
785
785
|
* Perform a GROQ-query against the configured dataset.
|
|
786
786
|
*
|
|
@@ -788,7 +788,7 @@ export declare class ObservableSanityClient {
|
|
|
788
788
|
* @param params - Query parameters
|
|
789
789
|
* @param options - Request options
|
|
790
790
|
*/
|
|
791
|
-
fetch<R =
|
|
791
|
+
fetch<R = Any, Q = QueryParams>(
|
|
792
792
|
query: string,
|
|
793
793
|
params: Q | undefined,
|
|
794
794
|
options: FilteredResponseQueryOptions
|
|
@@ -800,7 +800,7 @@ export declare class ObservableSanityClient {
|
|
|
800
800
|
* @param params - Query parameters
|
|
801
801
|
* @param options - Request options
|
|
802
802
|
*/
|
|
803
|
-
fetch<R =
|
|
803
|
+
fetch<R = Any, Q = QueryParams>(
|
|
804
804
|
query: string,
|
|
805
805
|
params: Q | undefined,
|
|
806
806
|
options: UnfilteredResponseQueryOptions
|
|
@@ -811,7 +811,7 @@ export declare class ObservableSanityClient {
|
|
|
811
811
|
* @param id - Document ID to fetch
|
|
812
812
|
* @param options - Request options
|
|
813
813
|
*/
|
|
814
|
-
getDocument<R extends Record<string,
|
|
814
|
+
getDocument<R extends Record<string, Any> = Record<string, Any>>(
|
|
815
815
|
id: string,
|
|
816
816
|
options?: {
|
|
817
817
|
tag?: string
|
|
@@ -826,7 +826,7 @@ export declare class ObservableSanityClient {
|
|
|
826
826
|
* @param ids - Document IDs to fetch
|
|
827
827
|
* @param options - Request options
|
|
828
828
|
*/
|
|
829
|
-
getDocuments<R extends Record<string,
|
|
829
|
+
getDocuments<R extends Record<string, Any> = Record<string, Any>>(
|
|
830
830
|
ids: string[],
|
|
831
831
|
options?: {
|
|
832
832
|
tag?: string
|
|
@@ -839,7 +839,7 @@ export declare class ObservableSanityClient {
|
|
|
839
839
|
* @param document - Document to create
|
|
840
840
|
* @param options - Mutation options
|
|
841
841
|
*/
|
|
842
|
-
create<R extends Record<string,
|
|
842
|
+
create<R extends Record<string, Any> = Record<string, Any>>(
|
|
843
843
|
document: SanityDocumentStub<R>,
|
|
844
844
|
options: FirstDocumentMutationOptions
|
|
845
845
|
): Observable<SanityDocument<R>>
|
|
@@ -850,7 +850,7 @@ export declare class ObservableSanityClient {
|
|
|
850
850
|
* @param document - Document to create
|
|
851
851
|
* @param options - Mutation options
|
|
852
852
|
*/
|
|
853
|
-
create<R extends Record<string,
|
|
853
|
+
create<R extends Record<string, Any> = Record<string, Any>>(
|
|
854
854
|
document: SanityDocumentStub<R>,
|
|
855
855
|
options: AllDocumentsMutationOptions
|
|
856
856
|
): Observable<SanityDocument<R>[]>
|
|
@@ -861,7 +861,7 @@ export declare class ObservableSanityClient {
|
|
|
861
861
|
* @param document - Document to create
|
|
862
862
|
* @param options - Mutation options
|
|
863
863
|
*/
|
|
864
|
-
create<R extends Record<string,
|
|
864
|
+
create<R extends Record<string, Any> = Record<string, Any>>(
|
|
865
865
|
document: SanityDocumentStub<R>,
|
|
866
866
|
options: FirstDocumentIdMutationOptions
|
|
867
867
|
): Observable<SingleMutationResult>
|
|
@@ -872,7 +872,7 @@ export declare class ObservableSanityClient {
|
|
|
872
872
|
* @param document - Document to create
|
|
873
873
|
* @param options - Mutation options
|
|
874
874
|
*/
|
|
875
|
-
create<R extends Record<string,
|
|
875
|
+
create<R extends Record<string, Any> = Record<string, Any>>(
|
|
876
876
|
document: SanityDocumentStub<R>,
|
|
877
877
|
options: AllDocumentIdsMutationOptions
|
|
878
878
|
): Observable<MultipleMutationResult>
|
|
@@ -883,7 +883,7 @@ export declare class ObservableSanityClient {
|
|
|
883
883
|
* @param document - Document to create
|
|
884
884
|
* @param options - Mutation options
|
|
885
885
|
*/
|
|
886
|
-
create<R extends Record<string,
|
|
886
|
+
create<R extends Record<string, Any> = Record<string, Any>>(
|
|
887
887
|
document: SanityDocumentStub<R>,
|
|
888
888
|
options?: BaseMutationOptions
|
|
889
889
|
): Observable<SanityDocument<R>>
|
|
@@ -894,7 +894,7 @@ export declare class ObservableSanityClient {
|
|
|
894
894
|
* @param document - Document to create
|
|
895
895
|
* @param options - Mutation options
|
|
896
896
|
*/
|
|
897
|
-
createIfNotExists<R extends Record<string,
|
|
897
|
+
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
898
898
|
document: IdentifiedSanityDocumentStub<R>,
|
|
899
899
|
options: FirstDocumentMutationOptions
|
|
900
900
|
): Observable<SanityDocument<R>>
|
|
@@ -905,7 +905,7 @@ export declare class ObservableSanityClient {
|
|
|
905
905
|
* @param document - Document to create
|
|
906
906
|
* @param options - Mutation options
|
|
907
907
|
*/
|
|
908
|
-
createIfNotExists<R extends Record<string,
|
|
908
|
+
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
909
909
|
document: IdentifiedSanityDocumentStub<R>,
|
|
910
910
|
options: AllDocumentsMutationOptions
|
|
911
911
|
): Observable<SanityDocument<R>[]>
|
|
@@ -916,7 +916,7 @@ export declare class ObservableSanityClient {
|
|
|
916
916
|
* @param document - Document to create
|
|
917
917
|
* @param options - Mutation options
|
|
918
918
|
*/
|
|
919
|
-
createIfNotExists<R extends Record<string,
|
|
919
|
+
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
920
920
|
document: IdentifiedSanityDocumentStub<R>,
|
|
921
921
|
options: FirstDocumentIdMutationOptions
|
|
922
922
|
): Observable<SingleMutationResult>
|
|
@@ -927,7 +927,7 @@ export declare class ObservableSanityClient {
|
|
|
927
927
|
* @param document - Document to create
|
|
928
928
|
* @param options - Mutation options
|
|
929
929
|
*/
|
|
930
|
-
createIfNotExists<R extends Record<string,
|
|
930
|
+
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
931
931
|
document: IdentifiedSanityDocumentStub<R>,
|
|
932
932
|
options: AllDocumentIdsMutationOptions
|
|
933
933
|
): Observable<MultipleMutationResult>
|
|
@@ -938,7 +938,7 @@ export declare class ObservableSanityClient {
|
|
|
938
938
|
* @param document - Document to create
|
|
939
939
|
* @param options - Mutation options
|
|
940
940
|
*/
|
|
941
|
-
createIfNotExists<R extends Record<string,
|
|
941
|
+
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
942
942
|
document: IdentifiedSanityDocumentStub<R>,
|
|
943
943
|
options?: BaseMutationOptions
|
|
944
944
|
): Observable<SanityDocument<R>>
|
|
@@ -949,7 +949,7 @@ export declare class ObservableSanityClient {
|
|
|
949
949
|
* @param document - Document to either create or replace
|
|
950
950
|
* @param options - Mutation options
|
|
951
951
|
*/
|
|
952
|
-
createOrReplace<R extends Record<string,
|
|
952
|
+
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
953
953
|
document: IdentifiedSanityDocumentStub<R>,
|
|
954
954
|
options: FirstDocumentMutationOptions
|
|
955
955
|
): Observable<SanityDocument<R>>
|
|
@@ -960,7 +960,7 @@ export declare class ObservableSanityClient {
|
|
|
960
960
|
* @param document - Document to either create or replace
|
|
961
961
|
* @param options - Mutation options
|
|
962
962
|
*/
|
|
963
|
-
createOrReplace<R extends Record<string,
|
|
963
|
+
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
964
964
|
document: IdentifiedSanityDocumentStub<R>,
|
|
965
965
|
options: AllDocumentsMutationOptions
|
|
966
966
|
): Observable<SanityDocument<R>[]>
|
|
@@ -971,7 +971,7 @@ export declare class ObservableSanityClient {
|
|
|
971
971
|
* @param document - Document to either create or replace
|
|
972
972
|
* @param options - Mutation options
|
|
973
973
|
*/
|
|
974
|
-
createOrReplace<R extends Record<string,
|
|
974
|
+
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
975
975
|
document: IdentifiedSanityDocumentStub<R>,
|
|
976
976
|
options: FirstDocumentIdMutationOptions
|
|
977
977
|
): Observable<SingleMutationResult>
|
|
@@ -982,7 +982,7 @@ export declare class ObservableSanityClient {
|
|
|
982
982
|
* @param document - Document to either create or replace
|
|
983
983
|
* @param options - Mutation options
|
|
984
984
|
*/
|
|
985
|
-
createOrReplace<R extends Record<string,
|
|
985
|
+
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
986
986
|
document: IdentifiedSanityDocumentStub<R>,
|
|
987
987
|
options: AllDocumentIdsMutationOptions
|
|
988
988
|
): Observable<MultipleMutationResult>
|
|
@@ -993,7 +993,7 @@ export declare class ObservableSanityClient {
|
|
|
993
993
|
* @param document - Document to either create or replace
|
|
994
994
|
* @param options - Mutation options
|
|
995
995
|
*/
|
|
996
|
-
createOrReplace<R extends Record<string,
|
|
996
|
+
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
997
997
|
document: IdentifiedSanityDocumentStub<R>,
|
|
998
998
|
options?: BaseMutationOptions
|
|
999
999
|
): Observable<SanityDocument<R>>
|
|
@@ -1004,7 +1004,7 @@ export declare class ObservableSanityClient {
|
|
|
1004
1004
|
* @param id - Document ID to delete
|
|
1005
1005
|
* @param options - Options for the mutation
|
|
1006
1006
|
*/
|
|
1007
|
-
delete<R extends Record<string,
|
|
1007
|
+
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
1008
1008
|
id: string,
|
|
1009
1009
|
options: FirstDocumentMutationOptions
|
|
1010
1010
|
): Observable<SanityDocument<R>>
|
|
@@ -1015,7 +1015,7 @@ export declare class ObservableSanityClient {
|
|
|
1015
1015
|
* @param id - Document ID to delete
|
|
1016
1016
|
* @param options - Options for the mutation
|
|
1017
1017
|
*/
|
|
1018
|
-
delete<R extends Record<string,
|
|
1018
|
+
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
1019
1019
|
id: string,
|
|
1020
1020
|
options: AllDocumentsMutationOptions
|
|
1021
1021
|
): Observable<SanityDocument<R>[]>
|
|
@@ -1042,7 +1042,7 @@ export declare class ObservableSanityClient {
|
|
|
1042
1042
|
* @param id - Document ID to delete
|
|
1043
1043
|
* @param options - Options for the mutation
|
|
1044
1044
|
*/
|
|
1045
|
-
delete<R extends Record<string,
|
|
1045
|
+
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
1046
1046
|
id: string,
|
|
1047
1047
|
options?: BaseMutationOptions
|
|
1048
1048
|
): Observable<SanityDocument<R>>
|
|
@@ -1053,7 +1053,7 @@ export declare class ObservableSanityClient {
|
|
|
1053
1053
|
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
1054
1054
|
* @param options - Options for the mutation
|
|
1055
1055
|
*/
|
|
1056
|
-
delete<R extends Record<string,
|
|
1056
|
+
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
1057
1057
|
selection: MutationSelection,
|
|
1058
1058
|
options: FirstDocumentMutationOptions
|
|
1059
1059
|
): Observable<SanityDocument<R>>
|
|
@@ -1064,7 +1064,7 @@ export declare class ObservableSanityClient {
|
|
|
1064
1064
|
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
1065
1065
|
* @param options - Options for the mutation
|
|
1066
1066
|
*/
|
|
1067
|
-
delete<R extends Record<string,
|
|
1067
|
+
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
1068
1068
|
selection: MutationSelection,
|
|
1069
1069
|
options: AllDocumentsMutationOptions
|
|
1070
1070
|
): Observable<SanityDocument<R>[]>
|
|
@@ -1097,7 +1097,7 @@ export declare class ObservableSanityClient {
|
|
|
1097
1097
|
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
1098
1098
|
* @param options - Options for the mutation
|
|
1099
1099
|
*/
|
|
1100
|
-
delete<R extends Record<string,
|
|
1100
|
+
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
1101
1101
|
selection: MutationSelection,
|
|
1102
1102
|
options?: BaseMutationOptions
|
|
1103
1103
|
): Observable<SanityDocument<R>>
|
|
@@ -1108,7 +1108,7 @@ export declare class ObservableSanityClient {
|
|
|
1108
1108
|
* @param operations - Mutation operations to execute
|
|
1109
1109
|
* @param options - Mutation options
|
|
1110
1110
|
*/
|
|
1111
|
-
mutate<R extends Record<string,
|
|
1111
|
+
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
1112
1112
|
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
1113
1113
|
options: FirstDocumentMutationOptions
|
|
1114
1114
|
): Observable<SanityDocument<R>>
|
|
@@ -1119,7 +1119,7 @@ export declare class ObservableSanityClient {
|
|
|
1119
1119
|
* @param operations - Mutation operations to execute
|
|
1120
1120
|
* @param options - Mutation options
|
|
1121
1121
|
*/
|
|
1122
|
-
mutate<R extends Record<string,
|
|
1122
|
+
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
1123
1123
|
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
1124
1124
|
options: AllDocumentsMutationOptions
|
|
1125
1125
|
): Observable<SanityDocument<R>[]>
|
|
@@ -1130,7 +1130,7 @@ export declare class ObservableSanityClient {
|
|
|
1130
1130
|
* @param operations - Mutation operations to execute
|
|
1131
1131
|
* @param options - Mutation options
|
|
1132
1132
|
*/
|
|
1133
|
-
mutate<R extends Record<string,
|
|
1133
|
+
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
1134
1134
|
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
1135
1135
|
options: FirstDocumentIdMutationOptions
|
|
1136
1136
|
): Observable<SingleMutationResult>
|
|
@@ -1141,7 +1141,7 @@ export declare class ObservableSanityClient {
|
|
|
1141
1141
|
* @param operations - Mutation operations to execute
|
|
1142
1142
|
* @param options - Mutation options
|
|
1143
1143
|
*/
|
|
1144
|
-
mutate<R extends Record<string,
|
|
1144
|
+
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
1145
1145
|
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
1146
1146
|
options: AllDocumentIdsMutationOptions
|
|
1147
1147
|
): Observable<MultipleMutationResult>
|
|
@@ -1152,7 +1152,7 @@ export declare class ObservableSanityClient {
|
|
|
1152
1152
|
* @param operations - Mutation operations to execute
|
|
1153
1153
|
* @param options - Mutation options
|
|
1154
1154
|
*/
|
|
1155
|
-
mutate<R extends Record<string,
|
|
1155
|
+
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
1156
1156
|
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
1157
1157
|
options?: BaseMutationOptions
|
|
1158
1158
|
): Observable<SanityDocument<R>>
|
|
@@ -1168,7 +1168,7 @@ export declare class ObservableSanityClient {
|
|
|
1168
1168
|
*
|
|
1169
1169
|
* @param operations - Optional array of mutation operations to initialize the transaction instance with
|
|
1170
1170
|
*/
|
|
1171
|
-
transaction<R extends Record<string,
|
|
1171
|
+
transaction<R extends Record<string, Any> = Record<string, Any>>(
|
|
1172
1172
|
operations?: Mutation<R>[]
|
|
1173
1173
|
): ObservableTransaction
|
|
1174
1174
|
/**
|
|
@@ -1177,7 +1177,7 @@ export declare class ObservableSanityClient {
|
|
|
1177
1177
|
* @deprecated Use your own request library!
|
|
1178
1178
|
* @param options - Request options
|
|
1179
1179
|
*/
|
|
1180
|
-
request<R =
|
|
1180
|
+
request<R = Any>(options: RawRequestOptions): Observable<R>
|
|
1181
1181
|
/**
|
|
1182
1182
|
* Get a Sanity API URL for the URI provided
|
|
1183
1183
|
*
|
|
@@ -1207,7 +1207,7 @@ export declare class ObservableTransaction extends BaseTransaction {
|
|
|
1207
1207
|
*
|
|
1208
1208
|
* @param options - Options for the mutation operation
|
|
1209
1209
|
*/
|
|
1210
|
-
commit<R extends Record<string,
|
|
1210
|
+
commit<R extends Record<string, Any>>(
|
|
1211
1211
|
options: TransactionFirstDocumentMutationOptions
|
|
1212
1212
|
): Observable<SanityDocument<R>>
|
|
1213
1213
|
/**
|
|
@@ -1215,7 +1215,7 @@ export declare class ObservableTransaction extends BaseTransaction {
|
|
|
1215
1215
|
*
|
|
1216
1216
|
* @param options - Options for the mutation operation
|
|
1217
1217
|
*/
|
|
1218
|
-
commit<R extends Record<string,
|
|
1218
|
+
commit<R extends Record<string, Any>>(
|
|
1219
1219
|
options: TransactionAllDocumentsMutationOptions
|
|
1220
1220
|
): Observable<SanityDocument<R>[]>
|
|
1221
1221
|
/**
|
|
@@ -1280,7 +1280,7 @@ export declare class Patch extends BasePatch {
|
|
|
1280
1280
|
*
|
|
1281
1281
|
* @param options - Options for the mutation operation
|
|
1282
1282
|
*/
|
|
1283
|
-
commit<R extends Record<string,
|
|
1283
|
+
commit<R extends Record<string, Any> = Record<string, Any>>(
|
|
1284
1284
|
options: FirstDocumentMutationOptions
|
|
1285
1285
|
): Promise<SanityDocument<R>>
|
|
1286
1286
|
/**
|
|
@@ -1288,7 +1288,7 @@ export declare class Patch extends BasePatch {
|
|
|
1288
1288
|
*
|
|
1289
1289
|
* @param options - Options for the mutation operation
|
|
1290
1290
|
*/
|
|
1291
|
-
commit<R extends Record<string,
|
|
1291
|
+
commit<R extends Record<string, Any> = Record<string, Any>>(
|
|
1292
1292
|
options: AllDocumentsMutationOptions
|
|
1293
1293
|
): Promise<SanityDocument<R>[]>
|
|
1294
1294
|
/**
|
|
@@ -1308,7 +1308,7 @@ export declare class Patch extends BasePatch {
|
|
|
1308
1308
|
*
|
|
1309
1309
|
* @param options - Options for the mutation operation
|
|
1310
1310
|
*/
|
|
1311
|
-
commit<R extends Record<string,
|
|
1311
|
+
commit<R extends Record<string, Any> = Record<string, Any>>(
|
|
1312
1312
|
options?: BaseMutationOptions
|
|
1313
1313
|
): Promise<SanityDocument<R>>
|
|
1314
1314
|
}
|
|
@@ -1322,13 +1322,13 @@ export declare type PatchMutationOperation = PatchOperations & MutationSelection
|
|
|
1322
1322
|
/** @internal */
|
|
1323
1323
|
export declare interface PatchOperations {
|
|
1324
1324
|
set?: {
|
|
1325
|
-
[key: string]:
|
|
1325
|
+
[key: string]: Any
|
|
1326
1326
|
}
|
|
1327
1327
|
setIfMissing?: {
|
|
1328
|
-
[key: string]:
|
|
1328
|
+
[key: string]: Any
|
|
1329
1329
|
}
|
|
1330
1330
|
diffMatchPatch?: {
|
|
1331
|
-
[key: string]:
|
|
1331
|
+
[key: string]: Any
|
|
1332
1332
|
}
|
|
1333
1333
|
unset?: string[]
|
|
1334
1334
|
inc?: {
|
|
@@ -1373,7 +1373,7 @@ export declare class ProjectsClient {
|
|
|
1373
1373
|
|
|
1374
1374
|
/** @public */
|
|
1375
1375
|
export declare type QueryParams = {
|
|
1376
|
-
[key: string]:
|
|
1376
|
+
[key: string]: Any
|
|
1377
1377
|
}
|
|
1378
1378
|
|
|
1379
1379
|
/** @internal */
|
|
@@ -1401,7 +1401,7 @@ export declare interface RawRequestOptions {
|
|
|
1401
1401
|
}
|
|
1402
1402
|
timeout?: number
|
|
1403
1403
|
proxy?: string
|
|
1404
|
-
body?:
|
|
1404
|
+
body?: Any
|
|
1405
1405
|
maxRedirects?: number
|
|
1406
1406
|
}
|
|
1407
1407
|
|
|
@@ -1428,8 +1428,8 @@ export declare interface RequestOptions {
|
|
|
1428
1428
|
tag?: string
|
|
1429
1429
|
headers?: Record<string, string>
|
|
1430
1430
|
method?: string
|
|
1431
|
-
query?:
|
|
1432
|
-
body?:
|
|
1431
|
+
query?: Any
|
|
1432
|
+
body?: Any
|
|
1433
1433
|
signal?: AbortSignal
|
|
1434
1434
|
}
|
|
1435
1435
|
|
|
@@ -1496,14 +1496,14 @@ export declare class SanityClient {
|
|
|
1496
1496
|
*
|
|
1497
1497
|
* @param query - GROQ-query to perform
|
|
1498
1498
|
*/
|
|
1499
|
-
fetch<R =
|
|
1499
|
+
fetch<R = Any>(query: string): Promise<R>
|
|
1500
1500
|
/**
|
|
1501
1501
|
* Perform a GROQ-query against the configured dataset.
|
|
1502
1502
|
*
|
|
1503
1503
|
* @param query - GROQ-query to perform
|
|
1504
1504
|
* @param params - Optional query parameters
|
|
1505
1505
|
*/
|
|
1506
|
-
fetch<R =
|
|
1506
|
+
fetch<R = Any, Q = QueryParams>(query: string, params: Q): Promise<R>
|
|
1507
1507
|
/**
|
|
1508
1508
|
* Perform a GROQ-query against the configured dataset.
|
|
1509
1509
|
*
|
|
@@ -1511,7 +1511,7 @@ export declare class SanityClient {
|
|
|
1511
1511
|
* @param params - Optional query parameters
|
|
1512
1512
|
* @param options - Request options
|
|
1513
1513
|
*/
|
|
1514
|
-
fetch<R =
|
|
1514
|
+
fetch<R = Any, Q = QueryParams>(
|
|
1515
1515
|
query: string,
|
|
1516
1516
|
params: Q | undefined,
|
|
1517
1517
|
options: FilteredResponseQueryOptions
|
|
@@ -1523,7 +1523,7 @@ export declare class SanityClient {
|
|
|
1523
1523
|
* @param params - Optional query parameters
|
|
1524
1524
|
* @param options - Request options
|
|
1525
1525
|
*/
|
|
1526
|
-
fetch<R =
|
|
1526
|
+
fetch<R = Any, Q = QueryParams>(
|
|
1527
1527
|
query: string,
|
|
1528
1528
|
params: Q | undefined,
|
|
1529
1529
|
options: UnfilteredResponseQueryOptions
|
|
@@ -1534,7 +1534,7 @@ export declare class SanityClient {
|
|
|
1534
1534
|
* @param id - Document ID to fetch
|
|
1535
1535
|
* @param options - Request options
|
|
1536
1536
|
*/
|
|
1537
|
-
getDocument<R extends Record<string,
|
|
1537
|
+
getDocument<R extends Record<string, Any> = Record<string, Any>>(
|
|
1538
1538
|
id: string,
|
|
1539
1539
|
options?: {
|
|
1540
1540
|
tag?: string
|
|
@@ -1549,7 +1549,7 @@ export declare class SanityClient {
|
|
|
1549
1549
|
* @param ids - Document IDs to fetch
|
|
1550
1550
|
* @param options - Request options
|
|
1551
1551
|
*/
|
|
1552
|
-
getDocuments<R extends Record<string,
|
|
1552
|
+
getDocuments<R extends Record<string, Any> = Record<string, Any>>(
|
|
1553
1553
|
ids: string[],
|
|
1554
1554
|
options?: {
|
|
1555
1555
|
tag?: string
|
|
@@ -1562,7 +1562,7 @@ export declare class SanityClient {
|
|
|
1562
1562
|
* @param document - Document to create
|
|
1563
1563
|
* @param options - Mutation options
|
|
1564
1564
|
*/
|
|
1565
|
-
create<R extends Record<string,
|
|
1565
|
+
create<R extends Record<string, Any> = Record<string, Any>>(
|
|
1566
1566
|
document: SanityDocumentStub<R>,
|
|
1567
1567
|
options: FirstDocumentMutationOptions
|
|
1568
1568
|
): Promise<SanityDocument<R>>
|
|
@@ -1573,7 +1573,7 @@ export declare class SanityClient {
|
|
|
1573
1573
|
* @param document - Document to create
|
|
1574
1574
|
* @param options - Mutation options
|
|
1575
1575
|
*/
|
|
1576
|
-
create<R extends Record<string,
|
|
1576
|
+
create<R extends Record<string, Any> = Record<string, Any>>(
|
|
1577
1577
|
document: SanityDocumentStub<R>,
|
|
1578
1578
|
options: AllDocumentsMutationOptions
|
|
1579
1579
|
): Promise<SanityDocument<R>[]>
|
|
@@ -1584,7 +1584,7 @@ export declare class SanityClient {
|
|
|
1584
1584
|
* @param document - Document to create
|
|
1585
1585
|
* @param options - Mutation options
|
|
1586
1586
|
*/
|
|
1587
|
-
create<R extends Record<string,
|
|
1587
|
+
create<R extends Record<string, Any> = Record<string, Any>>(
|
|
1588
1588
|
document: SanityDocumentStub<R>,
|
|
1589
1589
|
options: FirstDocumentIdMutationOptions
|
|
1590
1590
|
): Promise<SingleMutationResult>
|
|
@@ -1595,7 +1595,7 @@ export declare class SanityClient {
|
|
|
1595
1595
|
* @param document - Document to create
|
|
1596
1596
|
* @param options - Mutation options
|
|
1597
1597
|
*/
|
|
1598
|
-
create<R extends Record<string,
|
|
1598
|
+
create<R extends Record<string, Any> = Record<string, Any>>(
|
|
1599
1599
|
document: SanityDocumentStub<R>,
|
|
1600
1600
|
options: AllDocumentIdsMutationOptions
|
|
1601
1601
|
): Promise<MultipleMutationResult>
|
|
@@ -1606,7 +1606,7 @@ export declare class SanityClient {
|
|
|
1606
1606
|
* @param document - Document to create
|
|
1607
1607
|
* @param options - Mutation options
|
|
1608
1608
|
*/
|
|
1609
|
-
create<R extends Record<string,
|
|
1609
|
+
create<R extends Record<string, Any> = Record<string, Any>>(
|
|
1610
1610
|
document: SanityDocumentStub<R>,
|
|
1611
1611
|
options?: BaseMutationOptions
|
|
1612
1612
|
): Promise<SanityDocument<R>>
|
|
@@ -1617,7 +1617,7 @@ export declare class SanityClient {
|
|
|
1617
1617
|
* @param document - Document to create
|
|
1618
1618
|
* @param options - Mutation options
|
|
1619
1619
|
*/
|
|
1620
|
-
createIfNotExists<R extends Record<string,
|
|
1620
|
+
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
1621
1621
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1622
1622
|
options: FirstDocumentMutationOptions
|
|
1623
1623
|
): Promise<SanityDocument<R>>
|
|
@@ -1628,7 +1628,7 @@ export declare class SanityClient {
|
|
|
1628
1628
|
* @param document - Document to create
|
|
1629
1629
|
* @param options - Mutation options
|
|
1630
1630
|
*/
|
|
1631
|
-
createIfNotExists<R extends Record<string,
|
|
1631
|
+
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
1632
1632
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1633
1633
|
options: AllDocumentsMutationOptions
|
|
1634
1634
|
): Promise<SanityDocument<R>[]>
|
|
@@ -1639,7 +1639,7 @@ export declare class SanityClient {
|
|
|
1639
1639
|
* @param document - Document to create
|
|
1640
1640
|
* @param options - Mutation options
|
|
1641
1641
|
*/
|
|
1642
|
-
createIfNotExists<R extends Record<string,
|
|
1642
|
+
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
1643
1643
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1644
1644
|
options: FirstDocumentIdMutationOptions
|
|
1645
1645
|
): Promise<SingleMutationResult>
|
|
@@ -1650,7 +1650,7 @@ export declare class SanityClient {
|
|
|
1650
1650
|
* @param document - Document to create
|
|
1651
1651
|
* @param options - Mutation options
|
|
1652
1652
|
*/
|
|
1653
|
-
createIfNotExists<R extends Record<string,
|
|
1653
|
+
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
1654
1654
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1655
1655
|
options: AllDocumentIdsMutationOptions
|
|
1656
1656
|
): Promise<MultipleMutationResult>
|
|
@@ -1661,7 +1661,7 @@ export declare class SanityClient {
|
|
|
1661
1661
|
* @param document - Document to create
|
|
1662
1662
|
* @param options - Mutation options
|
|
1663
1663
|
*/
|
|
1664
|
-
createIfNotExists<R extends Record<string,
|
|
1664
|
+
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
1665
1665
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1666
1666
|
options?: BaseMutationOptions
|
|
1667
1667
|
): Promise<SanityDocument<R>>
|
|
@@ -1672,7 +1672,7 @@ export declare class SanityClient {
|
|
|
1672
1672
|
* @param document - Document to either create or replace
|
|
1673
1673
|
* @param options - Mutation options
|
|
1674
1674
|
*/
|
|
1675
|
-
createOrReplace<R extends Record<string,
|
|
1675
|
+
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
1676
1676
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1677
1677
|
options: FirstDocumentMutationOptions
|
|
1678
1678
|
): Promise<SanityDocument<R>>
|
|
@@ -1683,7 +1683,7 @@ export declare class SanityClient {
|
|
|
1683
1683
|
* @param document - Document to either create or replace
|
|
1684
1684
|
* @param options - Mutation options
|
|
1685
1685
|
*/
|
|
1686
|
-
createOrReplace<R extends Record<string,
|
|
1686
|
+
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
1687
1687
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1688
1688
|
options: AllDocumentsMutationOptions
|
|
1689
1689
|
): Promise<SanityDocument<R>[]>
|
|
@@ -1694,7 +1694,7 @@ export declare class SanityClient {
|
|
|
1694
1694
|
* @param document - Document to either create or replace
|
|
1695
1695
|
* @param options - Mutation options
|
|
1696
1696
|
*/
|
|
1697
|
-
createOrReplace<R extends Record<string,
|
|
1697
|
+
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
1698
1698
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1699
1699
|
options: FirstDocumentIdMutationOptions
|
|
1700
1700
|
): Promise<SingleMutationResult>
|
|
@@ -1705,7 +1705,7 @@ export declare class SanityClient {
|
|
|
1705
1705
|
* @param document - Document to either create or replace
|
|
1706
1706
|
* @param options - Mutation options
|
|
1707
1707
|
*/
|
|
1708
|
-
createOrReplace<R extends Record<string,
|
|
1708
|
+
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
1709
1709
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1710
1710
|
options: AllDocumentIdsMutationOptions
|
|
1711
1711
|
): Promise<MultipleMutationResult>
|
|
@@ -1716,7 +1716,7 @@ export declare class SanityClient {
|
|
|
1716
1716
|
* @param document - Document to either create or replace
|
|
1717
1717
|
* @param options - Mutation options
|
|
1718
1718
|
*/
|
|
1719
|
-
createOrReplace<R extends Record<string,
|
|
1719
|
+
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
1720
1720
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1721
1721
|
options?: BaseMutationOptions
|
|
1722
1722
|
): Promise<SanityDocument<R>>
|
|
@@ -1727,7 +1727,7 @@ export declare class SanityClient {
|
|
|
1727
1727
|
* @param id - Document ID to delete
|
|
1728
1728
|
* @param options - Options for the mutation
|
|
1729
1729
|
*/
|
|
1730
|
-
delete<R extends Record<string,
|
|
1730
|
+
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
1731
1731
|
id: string,
|
|
1732
1732
|
options: FirstDocumentMutationOptions
|
|
1733
1733
|
): Promise<SanityDocument<R>>
|
|
@@ -1738,7 +1738,7 @@ export declare class SanityClient {
|
|
|
1738
1738
|
* @param id - Document ID to delete
|
|
1739
1739
|
* @param options - Options for the mutation
|
|
1740
1740
|
*/
|
|
1741
|
-
delete<R extends Record<string,
|
|
1741
|
+
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
1742
1742
|
id: string,
|
|
1743
1743
|
options: AllDocumentsMutationOptions
|
|
1744
1744
|
): Promise<SanityDocument<R>[]>
|
|
@@ -1765,7 +1765,7 @@ export declare class SanityClient {
|
|
|
1765
1765
|
* @param id - Document ID to delete
|
|
1766
1766
|
* @param options - Options for the mutation
|
|
1767
1767
|
*/
|
|
1768
|
-
delete<R extends Record<string,
|
|
1768
|
+
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
1769
1769
|
id: string,
|
|
1770
1770
|
options?: BaseMutationOptions
|
|
1771
1771
|
): Promise<SanityDocument<R>>
|
|
@@ -1776,7 +1776,7 @@ export declare class SanityClient {
|
|
|
1776
1776
|
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
1777
1777
|
* @param options - Options for the mutation
|
|
1778
1778
|
*/
|
|
1779
|
-
delete<R extends Record<string,
|
|
1779
|
+
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
1780
1780
|
selection: MutationSelection,
|
|
1781
1781
|
options: FirstDocumentMutationOptions
|
|
1782
1782
|
): Promise<SanityDocument<R>>
|
|
@@ -1787,7 +1787,7 @@ export declare class SanityClient {
|
|
|
1787
1787
|
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
1788
1788
|
* @param options - Options for the mutation
|
|
1789
1789
|
*/
|
|
1790
|
-
delete<R extends Record<string,
|
|
1790
|
+
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
1791
1791
|
selection: MutationSelection,
|
|
1792
1792
|
options: AllDocumentsMutationOptions
|
|
1793
1793
|
): Promise<SanityDocument<R>[]>
|
|
@@ -1820,7 +1820,7 @@ export declare class SanityClient {
|
|
|
1820
1820
|
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
1821
1821
|
* @param options - Options for the mutation
|
|
1822
1822
|
*/
|
|
1823
|
-
delete<R extends Record<string,
|
|
1823
|
+
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
1824
1824
|
selection: MutationSelection,
|
|
1825
1825
|
options?: BaseMutationOptions
|
|
1826
1826
|
): Promise<SanityDocument<R>>
|
|
@@ -1831,7 +1831,7 @@ export declare class SanityClient {
|
|
|
1831
1831
|
* @param operations - Mutation operations to execute
|
|
1832
1832
|
* @param options - Mutation options
|
|
1833
1833
|
*/
|
|
1834
|
-
mutate<R extends Record<string,
|
|
1834
|
+
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
1835
1835
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
1836
1836
|
options: FirstDocumentMutationOptions
|
|
1837
1837
|
): Promise<SanityDocument<R>>
|
|
@@ -1842,7 +1842,7 @@ export declare class SanityClient {
|
|
|
1842
1842
|
* @param operations - Mutation operations to execute
|
|
1843
1843
|
* @param options - Mutation options
|
|
1844
1844
|
*/
|
|
1845
|
-
mutate<R extends Record<string,
|
|
1845
|
+
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
1846
1846
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
1847
1847
|
options: AllDocumentsMutationOptions
|
|
1848
1848
|
): Promise<SanityDocument<R>[]>
|
|
@@ -1853,7 +1853,7 @@ export declare class SanityClient {
|
|
|
1853
1853
|
* @param operations - Mutation operations to execute
|
|
1854
1854
|
* @param options - Mutation options
|
|
1855
1855
|
*/
|
|
1856
|
-
mutate<R extends Record<string,
|
|
1856
|
+
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
1857
1857
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
1858
1858
|
options: FirstDocumentIdMutationOptions
|
|
1859
1859
|
): Promise<SingleMutationResult>
|
|
@@ -1864,7 +1864,7 @@ export declare class SanityClient {
|
|
|
1864
1864
|
* @param operations - Mutation operations to execute
|
|
1865
1865
|
* @param options - Mutation options
|
|
1866
1866
|
*/
|
|
1867
|
-
mutate<R extends Record<string,
|
|
1867
|
+
mutate<R extends Record<string, Any>>(
|
|
1868
1868
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
1869
1869
|
options: AllDocumentIdsMutationOptions
|
|
1870
1870
|
): Promise<MultipleMutationResult>
|
|
@@ -1875,7 +1875,7 @@ export declare class SanityClient {
|
|
|
1875
1875
|
* @param operations - Mutation operations to execute
|
|
1876
1876
|
* @param options - Mutation options
|
|
1877
1877
|
*/
|
|
1878
|
-
mutate<R extends Record<string,
|
|
1878
|
+
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
1879
1879
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
1880
1880
|
options?: BaseMutationOptions
|
|
1881
1881
|
): Promise<SanityDocument<R>>
|
|
@@ -1891,7 +1891,7 @@ export declare class SanityClient {
|
|
|
1891
1891
|
*
|
|
1892
1892
|
* @param operations - Optional array of mutation operations to initialize the transaction instance with
|
|
1893
1893
|
*/
|
|
1894
|
-
transaction<R extends Record<string,
|
|
1894
|
+
transaction<R extends Record<string, Any> = Record<string, Any>>(
|
|
1895
1895
|
operations?: Mutation<R>[]
|
|
1896
1896
|
): Transaction
|
|
1897
1897
|
/**
|
|
@@ -1900,7 +1900,7 @@ export declare class SanityClient {
|
|
|
1900
1900
|
* @deprecated Use your own request library!
|
|
1901
1901
|
* @param options - Request options
|
|
1902
1902
|
*/
|
|
1903
|
-
request<R =
|
|
1903
|
+
request<R = Any>(options: RawRequestOptions): Promise<R>
|
|
1904
1904
|
/**
|
|
1905
1905
|
* DEPRECATED: Perform an HTTP request a `/data` sub-endpoint
|
|
1906
1906
|
*
|
|
@@ -1909,7 +1909,7 @@ export declare class SanityClient {
|
|
|
1909
1909
|
* @param body - Request body
|
|
1910
1910
|
* @param options - Request options
|
|
1911
1911
|
*/
|
|
1912
|
-
dataRequest(endpoint: string, body: unknown, options?: BaseMutationOptions): Promise<
|
|
1912
|
+
dataRequest(endpoint: string, body: unknown, options?: BaseMutationOptions): Promise<Any>
|
|
1913
1913
|
/**
|
|
1914
1914
|
* Get a Sanity API URL for the URI provided
|
|
1915
1915
|
*
|
|
@@ -1927,7 +1927,7 @@ export declare class SanityClient {
|
|
|
1927
1927
|
}
|
|
1928
1928
|
|
|
1929
1929
|
/** @internal */
|
|
1930
|
-
export declare type SanityDocument<T extends Record<string,
|
|
1930
|
+
export declare type SanityDocument<T extends Record<string, Any> = Record<string, Any>> = {
|
|
1931
1931
|
[P in keyof T]: T[P]
|
|
1932
1932
|
} & {
|
|
1933
1933
|
_id: string
|
|
@@ -1938,7 +1938,7 @@ export declare type SanityDocument<T extends Record<string, FIXME> = Record<stri
|
|
|
1938
1938
|
}
|
|
1939
1939
|
|
|
1940
1940
|
/** @public */
|
|
1941
|
-
export declare type SanityDocumentStub<T extends Record<string,
|
|
1941
|
+
export declare type SanityDocumentStub<T extends Record<string, Any> = Record<string, Any>> = {
|
|
1942
1942
|
[P in keyof T]: T[P]
|
|
1943
1943
|
} & {
|
|
1944
1944
|
_type: string
|
|
@@ -1970,11 +1970,11 @@ export declare interface SanityImageAssetDocument extends SanityAssetDocument {
|
|
|
1970
1970
|
}
|
|
1971
1971
|
image?: {
|
|
1972
1972
|
_type: 'sanity.imageExifTags'
|
|
1973
|
-
[key: string]:
|
|
1973
|
+
[key: string]: Any
|
|
1974
1974
|
}
|
|
1975
1975
|
exif?: {
|
|
1976
1976
|
_type: 'sanity.imageExifMetadata'
|
|
1977
|
-
[key: string]:
|
|
1977
|
+
[key: string]: Any
|
|
1978
1978
|
}
|
|
1979
1979
|
}
|
|
1980
1980
|
}
|
|
@@ -2039,7 +2039,7 @@ export declare class ServerError extends Error {
|
|
|
2039
2039
|
statusCode: ErrorProps['statusCode']
|
|
2040
2040
|
responseBody: ErrorProps['responseBody']
|
|
2041
2041
|
details: ErrorProps['details']
|
|
2042
|
-
constructor(res:
|
|
2042
|
+
constructor(res: Any)
|
|
2043
2043
|
}
|
|
2044
2044
|
|
|
2045
2045
|
/** @internal */
|
|
@@ -2065,7 +2065,7 @@ export declare class Transaction extends BaseTransaction {
|
|
|
2065
2065
|
*
|
|
2066
2066
|
* @param options - Options for the mutation operation
|
|
2067
2067
|
*/
|
|
2068
|
-
commit<R extends Record<string,
|
|
2068
|
+
commit<R extends Record<string, Any>>(
|
|
2069
2069
|
options: TransactionFirstDocumentMutationOptions
|
|
2070
2070
|
): Promise<SanityDocument<R>>
|
|
2071
2071
|
/**
|
|
@@ -2073,7 +2073,7 @@ export declare class Transaction extends BaseTransaction {
|
|
|
2073
2073
|
*
|
|
2074
2074
|
* @param options - Options for the mutation operation
|
|
2075
2075
|
*/
|
|
2076
|
-
commit<R extends Record<string,
|
|
2076
|
+
commit<R extends Record<string, Any>>(
|
|
2077
2077
|
options: TransactionAllDocumentsMutationOptions
|
|
2078
2078
|
): Promise<SanityDocument<R>[]>
|
|
2079
2079
|
/**
|