@sanity/client 5.2.0 → 5.2.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.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 +15 -15
- 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 +14 -27
- package/umd/sanityClient.min.js +3 -3
- package/src/migrationNotice.ts +0 -9
package/src/SanityClient.ts
CHANGED
|
@@ -11,12 +11,12 @@ import {ObservableProjectsClient, ProjectsClient} from './projects/ProjectsClien
|
|
|
11
11
|
import type {
|
|
12
12
|
AllDocumentIdsMutationOptions,
|
|
13
13
|
AllDocumentsMutationOptions,
|
|
14
|
+
Any,
|
|
14
15
|
BaseMutationOptions,
|
|
15
16
|
ClientConfig,
|
|
16
17
|
FilteredResponseQueryOptions,
|
|
17
18
|
FirstDocumentIdMutationOptions,
|
|
18
19
|
FirstDocumentMutationOptions,
|
|
19
|
-
FIXME,
|
|
20
20
|
HttpRequest,
|
|
21
21
|
IdentifiedSanityDocumentStub,
|
|
22
22
|
InitializedClientConfig,
|
|
@@ -120,14 +120,14 @@ export class ObservableSanityClient {
|
|
|
120
120
|
*
|
|
121
121
|
* @param query - GROQ-query to perform
|
|
122
122
|
*/
|
|
123
|
-
fetch<R =
|
|
123
|
+
fetch<R = Any>(query: string): Observable<R>
|
|
124
124
|
/**
|
|
125
125
|
* Perform a GROQ-query against the configured dataset.
|
|
126
126
|
*
|
|
127
127
|
* @param query - GROQ-query to perform
|
|
128
128
|
* @param params - Query parameters
|
|
129
129
|
*/
|
|
130
|
-
fetch<R =
|
|
130
|
+
fetch<R = Any, Q = QueryParams>(query: string, params: Q): Observable<R>
|
|
131
131
|
/**
|
|
132
132
|
* Perform a GROQ-query against the configured dataset.
|
|
133
133
|
*
|
|
@@ -135,7 +135,7 @@ export class ObservableSanityClient {
|
|
|
135
135
|
* @param params - Query parameters
|
|
136
136
|
* @param options - Request options
|
|
137
137
|
*/
|
|
138
|
-
fetch<R =
|
|
138
|
+
fetch<R = Any, Q = QueryParams>(
|
|
139
139
|
query: string,
|
|
140
140
|
params: Q | undefined,
|
|
141
141
|
options: FilteredResponseQueryOptions
|
|
@@ -147,7 +147,7 @@ export class ObservableSanityClient {
|
|
|
147
147
|
* @param params - Query parameters
|
|
148
148
|
* @param options - Request options
|
|
149
149
|
*/
|
|
150
|
-
fetch<R =
|
|
150
|
+
fetch<R = Any, Q = QueryParams>(
|
|
151
151
|
query: string,
|
|
152
152
|
params: Q | undefined,
|
|
153
153
|
options: UnfilteredResponseQueryOptions
|
|
@@ -166,7 +166,7 @@ export class ObservableSanityClient {
|
|
|
166
166
|
* @param id - Document ID to fetch
|
|
167
167
|
* @param options - Request options
|
|
168
168
|
*/
|
|
169
|
-
getDocument<R extends Record<string,
|
|
169
|
+
getDocument<R extends Record<string, Any> = Record<string, Any>>(
|
|
170
170
|
id: string,
|
|
171
171
|
options?: {tag?: string}
|
|
172
172
|
): Observable<SanityDocument<R> | undefined> {
|
|
@@ -182,7 +182,7 @@ export class ObservableSanityClient {
|
|
|
182
182
|
* @param ids - Document IDs to fetch
|
|
183
183
|
* @param options - Request options
|
|
184
184
|
*/
|
|
185
|
-
getDocuments<R extends Record<string,
|
|
185
|
+
getDocuments<R extends Record<string, Any> = Record<string, Any>>(
|
|
186
186
|
ids: string[],
|
|
187
187
|
options?: {tag?: string}
|
|
188
188
|
): Observable<(SanityDocument<R> | null)[]> {
|
|
@@ -196,7 +196,7 @@ export class ObservableSanityClient {
|
|
|
196
196
|
* @param document - Document to create
|
|
197
197
|
* @param options - Mutation options
|
|
198
198
|
*/
|
|
199
|
-
create<R extends Record<string,
|
|
199
|
+
create<R extends Record<string, Any> = Record<string, Any>>(
|
|
200
200
|
document: SanityDocumentStub<R>,
|
|
201
201
|
options: FirstDocumentMutationOptions
|
|
202
202
|
): Observable<SanityDocument<R>>
|
|
@@ -207,7 +207,7 @@ export class ObservableSanityClient {
|
|
|
207
207
|
* @param document - Document to create
|
|
208
208
|
* @param options - Mutation options
|
|
209
209
|
*/
|
|
210
|
-
create<R extends Record<string,
|
|
210
|
+
create<R extends Record<string, Any> = Record<string, Any>>(
|
|
211
211
|
document: SanityDocumentStub<R>,
|
|
212
212
|
options: AllDocumentsMutationOptions
|
|
213
213
|
): Observable<SanityDocument<R>[]>
|
|
@@ -218,7 +218,7 @@ export class ObservableSanityClient {
|
|
|
218
218
|
* @param document - Document to create
|
|
219
219
|
* @param options - Mutation options
|
|
220
220
|
*/
|
|
221
|
-
create<R extends Record<string,
|
|
221
|
+
create<R extends Record<string, Any> = Record<string, Any>>(
|
|
222
222
|
document: SanityDocumentStub<R>,
|
|
223
223
|
options: FirstDocumentIdMutationOptions
|
|
224
224
|
): Observable<SingleMutationResult>
|
|
@@ -229,7 +229,7 @@ export class ObservableSanityClient {
|
|
|
229
229
|
* @param document - Document to create
|
|
230
230
|
* @param options - Mutation options
|
|
231
231
|
*/
|
|
232
|
-
create<R extends Record<string,
|
|
232
|
+
create<R extends Record<string, Any> = Record<string, Any>>(
|
|
233
233
|
document: SanityDocumentStub<R>,
|
|
234
234
|
options: AllDocumentIdsMutationOptions
|
|
235
235
|
): Observable<MultipleMutationResult>
|
|
@@ -240,11 +240,11 @@ export class ObservableSanityClient {
|
|
|
240
240
|
* @param document - Document to create
|
|
241
241
|
* @param options - Mutation options
|
|
242
242
|
*/
|
|
243
|
-
create<R extends Record<string,
|
|
243
|
+
create<R extends Record<string, Any> = Record<string, Any>>(
|
|
244
244
|
document: SanityDocumentStub<R>,
|
|
245
245
|
options?: BaseMutationOptions
|
|
246
246
|
): Observable<SanityDocument<R>>
|
|
247
|
-
create<R extends Record<string,
|
|
247
|
+
create<R extends Record<string, Any> = Record<string, Any>>(
|
|
248
248
|
document: SanityDocumentStub<R>,
|
|
249
249
|
options?:
|
|
250
250
|
| AllDocumentIdsMutationOptions
|
|
@@ -265,7 +265,7 @@ export class ObservableSanityClient {
|
|
|
265
265
|
* @param document - Document to create
|
|
266
266
|
* @param options - Mutation options
|
|
267
267
|
*/
|
|
268
|
-
createIfNotExists<R extends Record<string,
|
|
268
|
+
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
269
269
|
document: IdentifiedSanityDocumentStub<R>,
|
|
270
270
|
options: FirstDocumentMutationOptions
|
|
271
271
|
): Observable<SanityDocument<R>>
|
|
@@ -276,7 +276,7 @@ export class ObservableSanityClient {
|
|
|
276
276
|
* @param document - Document to create
|
|
277
277
|
* @param options - Mutation options
|
|
278
278
|
*/
|
|
279
|
-
createIfNotExists<R extends Record<string,
|
|
279
|
+
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
280
280
|
document: IdentifiedSanityDocumentStub<R>,
|
|
281
281
|
options: AllDocumentsMutationOptions
|
|
282
282
|
): Observable<SanityDocument<R>[]>
|
|
@@ -287,7 +287,7 @@ export class ObservableSanityClient {
|
|
|
287
287
|
* @param document - Document to create
|
|
288
288
|
* @param options - Mutation options
|
|
289
289
|
*/
|
|
290
|
-
createIfNotExists<R extends Record<string,
|
|
290
|
+
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
291
291
|
document: IdentifiedSanityDocumentStub<R>,
|
|
292
292
|
options: FirstDocumentIdMutationOptions
|
|
293
293
|
): Observable<SingleMutationResult>
|
|
@@ -298,7 +298,7 @@ export class ObservableSanityClient {
|
|
|
298
298
|
* @param document - Document to create
|
|
299
299
|
* @param options - Mutation options
|
|
300
300
|
*/
|
|
301
|
-
createIfNotExists<R extends Record<string,
|
|
301
|
+
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
302
302
|
document: IdentifiedSanityDocumentStub<R>,
|
|
303
303
|
options: AllDocumentIdsMutationOptions
|
|
304
304
|
): Observable<MultipleMutationResult>
|
|
@@ -309,11 +309,11 @@ export class ObservableSanityClient {
|
|
|
309
309
|
* @param document - Document to create
|
|
310
310
|
* @param options - Mutation options
|
|
311
311
|
*/
|
|
312
|
-
createIfNotExists<R extends Record<string,
|
|
312
|
+
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
313
313
|
document: IdentifiedSanityDocumentStub<R>,
|
|
314
314
|
options?: BaseMutationOptions
|
|
315
315
|
): Observable<SanityDocument<R>>
|
|
316
|
-
createIfNotExists<R extends Record<string,
|
|
316
|
+
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
317
317
|
document: IdentifiedSanityDocumentStub<R>,
|
|
318
318
|
options?:
|
|
319
319
|
| AllDocumentIdsMutationOptions
|
|
@@ -334,7 +334,7 @@ export class ObservableSanityClient {
|
|
|
334
334
|
* @param document - Document to either create or replace
|
|
335
335
|
* @param options - Mutation options
|
|
336
336
|
*/
|
|
337
|
-
createOrReplace<R extends Record<string,
|
|
337
|
+
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
338
338
|
document: IdentifiedSanityDocumentStub<R>,
|
|
339
339
|
options: FirstDocumentMutationOptions
|
|
340
340
|
): Observable<SanityDocument<R>>
|
|
@@ -345,7 +345,7 @@ export class ObservableSanityClient {
|
|
|
345
345
|
* @param document - Document to either create or replace
|
|
346
346
|
* @param options - Mutation options
|
|
347
347
|
*/
|
|
348
|
-
createOrReplace<R extends Record<string,
|
|
348
|
+
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
349
349
|
document: IdentifiedSanityDocumentStub<R>,
|
|
350
350
|
options: AllDocumentsMutationOptions
|
|
351
351
|
): Observable<SanityDocument<R>[]>
|
|
@@ -356,7 +356,7 @@ export class ObservableSanityClient {
|
|
|
356
356
|
* @param document - Document to either create or replace
|
|
357
357
|
* @param options - Mutation options
|
|
358
358
|
*/
|
|
359
|
-
createOrReplace<R extends Record<string,
|
|
359
|
+
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
360
360
|
document: IdentifiedSanityDocumentStub<R>,
|
|
361
361
|
options: FirstDocumentIdMutationOptions
|
|
362
362
|
): Observable<SingleMutationResult>
|
|
@@ -367,7 +367,7 @@ export class ObservableSanityClient {
|
|
|
367
367
|
* @param document - Document to either create or replace
|
|
368
368
|
* @param options - Mutation options
|
|
369
369
|
*/
|
|
370
|
-
createOrReplace<R extends Record<string,
|
|
370
|
+
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
371
371
|
document: IdentifiedSanityDocumentStub<R>,
|
|
372
372
|
options: AllDocumentIdsMutationOptions
|
|
373
373
|
): Observable<MultipleMutationResult>
|
|
@@ -378,11 +378,11 @@ export class ObservableSanityClient {
|
|
|
378
378
|
* @param document - Document to either create or replace
|
|
379
379
|
* @param options - Mutation options
|
|
380
380
|
*/
|
|
381
|
-
createOrReplace<R extends Record<string,
|
|
381
|
+
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
382
382
|
document: IdentifiedSanityDocumentStub<R>,
|
|
383
383
|
options?: BaseMutationOptions
|
|
384
384
|
): Observable<SanityDocument<R>>
|
|
385
|
-
createOrReplace<R extends Record<string,
|
|
385
|
+
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
386
386
|
document: IdentifiedSanityDocumentStub<R>,
|
|
387
387
|
options?:
|
|
388
388
|
| AllDocumentIdsMutationOptions
|
|
@@ -403,7 +403,7 @@ export class ObservableSanityClient {
|
|
|
403
403
|
* @param id - Document ID to delete
|
|
404
404
|
* @param options - Options for the mutation
|
|
405
405
|
*/
|
|
406
|
-
delete<R extends Record<string,
|
|
406
|
+
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
407
407
|
id: string,
|
|
408
408
|
options: FirstDocumentMutationOptions
|
|
409
409
|
): Observable<SanityDocument<R>>
|
|
@@ -414,7 +414,7 @@ export class ObservableSanityClient {
|
|
|
414
414
|
* @param id - Document ID to delete
|
|
415
415
|
* @param options - Options for the mutation
|
|
416
416
|
*/
|
|
417
|
-
delete<R extends Record<string,
|
|
417
|
+
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
418
418
|
id: string,
|
|
419
419
|
options: AllDocumentsMutationOptions
|
|
420
420
|
): Observable<SanityDocument<R>[]>
|
|
@@ -441,7 +441,7 @@ export class ObservableSanityClient {
|
|
|
441
441
|
* @param id - Document ID to delete
|
|
442
442
|
* @param options - Options for the mutation
|
|
443
443
|
*/
|
|
444
|
-
delete<R extends Record<string,
|
|
444
|
+
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
445
445
|
id: string,
|
|
446
446
|
options?: BaseMutationOptions
|
|
447
447
|
): Observable<SanityDocument<R>>
|
|
@@ -452,7 +452,7 @@ export class ObservableSanityClient {
|
|
|
452
452
|
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
453
453
|
* @param options - Options for the mutation
|
|
454
454
|
*/
|
|
455
|
-
delete<R extends Record<string,
|
|
455
|
+
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
456
456
|
selection: MutationSelection,
|
|
457
457
|
options: FirstDocumentMutationOptions
|
|
458
458
|
): Observable<SanityDocument<R>>
|
|
@@ -463,7 +463,7 @@ export class ObservableSanityClient {
|
|
|
463
463
|
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
464
464
|
* @param options - Options for the mutation
|
|
465
465
|
*/
|
|
466
|
-
delete<R extends Record<string,
|
|
466
|
+
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
467
467
|
selection: MutationSelection,
|
|
468
468
|
options: AllDocumentsMutationOptions
|
|
469
469
|
): Observable<SanityDocument<R>[]>
|
|
@@ -496,11 +496,11 @@ export class ObservableSanityClient {
|
|
|
496
496
|
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
497
497
|
* @param options - Options for the mutation
|
|
498
498
|
*/
|
|
499
|
-
delete<R extends Record<string,
|
|
499
|
+
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
500
500
|
selection: MutationSelection,
|
|
501
501
|
options?: BaseMutationOptions
|
|
502
502
|
): Observable<SanityDocument<R>>
|
|
503
|
-
delete<R extends Record<string,
|
|
503
|
+
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
504
504
|
selection: string | MutationSelection,
|
|
505
505
|
options?:
|
|
506
506
|
| AllDocumentIdsMutationOptions
|
|
@@ -521,7 +521,7 @@ export class ObservableSanityClient {
|
|
|
521
521
|
* @param operations - Mutation operations to execute
|
|
522
522
|
* @param options - Mutation options
|
|
523
523
|
*/
|
|
524
|
-
mutate<R extends Record<string,
|
|
524
|
+
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
525
525
|
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
526
526
|
options: FirstDocumentMutationOptions
|
|
527
527
|
): Observable<SanityDocument<R>>
|
|
@@ -532,7 +532,7 @@ export class ObservableSanityClient {
|
|
|
532
532
|
* @param operations - Mutation operations to execute
|
|
533
533
|
* @param options - Mutation options
|
|
534
534
|
*/
|
|
535
|
-
mutate<R extends Record<string,
|
|
535
|
+
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
536
536
|
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
537
537
|
options: AllDocumentsMutationOptions
|
|
538
538
|
): Observable<SanityDocument<R>[]>
|
|
@@ -543,7 +543,7 @@ export class ObservableSanityClient {
|
|
|
543
543
|
* @param operations - Mutation operations to execute
|
|
544
544
|
* @param options - Mutation options
|
|
545
545
|
*/
|
|
546
|
-
mutate<R extends Record<string,
|
|
546
|
+
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
547
547
|
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
548
548
|
options: FirstDocumentIdMutationOptions
|
|
549
549
|
): Observable<SingleMutationResult>
|
|
@@ -554,7 +554,7 @@ export class ObservableSanityClient {
|
|
|
554
554
|
* @param operations - Mutation operations to execute
|
|
555
555
|
* @param options - Mutation options
|
|
556
556
|
*/
|
|
557
|
-
mutate<R extends Record<string,
|
|
557
|
+
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
558
558
|
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
559
559
|
options: AllDocumentIdsMutationOptions
|
|
560
560
|
): Observable<MultipleMutationResult>
|
|
@@ -565,11 +565,11 @@ export class ObservableSanityClient {
|
|
|
565
565
|
* @param operations - Mutation operations to execute
|
|
566
566
|
* @param options - Mutation options
|
|
567
567
|
*/
|
|
568
|
-
mutate<R extends Record<string,
|
|
568
|
+
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
569
569
|
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
570
570
|
options?: BaseMutationOptions
|
|
571
571
|
): Observable<SanityDocument<R>>
|
|
572
|
-
mutate<R extends Record<string,
|
|
572
|
+
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
573
573
|
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
574
574
|
options?:
|
|
575
575
|
| FirstDocumentMutationOptions
|
|
@@ -598,7 +598,7 @@ export class ObservableSanityClient {
|
|
|
598
598
|
*
|
|
599
599
|
* @param operations - Optional array of mutation operations to initialize the transaction instance with
|
|
600
600
|
*/
|
|
601
|
-
transaction<R extends Record<string,
|
|
601
|
+
transaction<R extends Record<string, Any> = Record<string, Any>>(
|
|
602
602
|
operations?: Mutation<R>[]
|
|
603
603
|
): ObservableTransaction {
|
|
604
604
|
return new ObservableTransaction(operations, this)
|
|
@@ -610,7 +610,7 @@ export class ObservableSanityClient {
|
|
|
610
610
|
* @deprecated Use your own request library!
|
|
611
611
|
* @param options - Request options
|
|
612
612
|
*/
|
|
613
|
-
request<R =
|
|
613
|
+
request<R = Any>(options: RawRequestOptions): Observable<R> {
|
|
614
614
|
return dataMethods._request(this, this.#httpRequest, options)
|
|
615
615
|
}
|
|
616
616
|
|
|
@@ -719,14 +719,14 @@ export class SanityClient {
|
|
|
719
719
|
*
|
|
720
720
|
* @param query - GROQ-query to perform
|
|
721
721
|
*/
|
|
722
|
-
fetch<R =
|
|
722
|
+
fetch<R = Any>(query: string): Promise<R>
|
|
723
723
|
/**
|
|
724
724
|
* Perform a GROQ-query against the configured dataset.
|
|
725
725
|
*
|
|
726
726
|
* @param query - GROQ-query to perform
|
|
727
727
|
* @param params - Optional query parameters
|
|
728
728
|
*/
|
|
729
|
-
fetch<R =
|
|
729
|
+
fetch<R = Any, Q = QueryParams>(query: string, params: Q): Promise<R>
|
|
730
730
|
/**
|
|
731
731
|
* Perform a GROQ-query against the configured dataset.
|
|
732
732
|
*
|
|
@@ -734,7 +734,7 @@ export class SanityClient {
|
|
|
734
734
|
* @param params - Optional query parameters
|
|
735
735
|
* @param options - Request options
|
|
736
736
|
*/
|
|
737
|
-
fetch<R =
|
|
737
|
+
fetch<R = Any, Q = QueryParams>(
|
|
738
738
|
query: string,
|
|
739
739
|
params: Q | undefined,
|
|
740
740
|
options: FilteredResponseQueryOptions
|
|
@@ -746,7 +746,7 @@ export class SanityClient {
|
|
|
746
746
|
* @param params - Optional query parameters
|
|
747
747
|
* @param options - Request options
|
|
748
748
|
*/
|
|
749
|
-
fetch<R =
|
|
749
|
+
fetch<R = Any, Q = QueryParams>(
|
|
750
750
|
query: string,
|
|
751
751
|
params: Q | undefined,
|
|
752
752
|
options: UnfilteredResponseQueryOptions
|
|
@@ -765,7 +765,7 @@ export class SanityClient {
|
|
|
765
765
|
* @param id - Document ID to fetch
|
|
766
766
|
* @param options - Request options
|
|
767
767
|
*/
|
|
768
|
-
getDocument<R extends Record<string,
|
|
768
|
+
getDocument<R extends Record<string, Any> = Record<string, Any>>(
|
|
769
769
|
id: string,
|
|
770
770
|
options?: {tag?: string}
|
|
771
771
|
): Promise<SanityDocument<R> | undefined> {
|
|
@@ -781,7 +781,7 @@ export class SanityClient {
|
|
|
781
781
|
* @param ids - Document IDs to fetch
|
|
782
782
|
* @param options - Request options
|
|
783
783
|
*/
|
|
784
|
-
getDocuments<R extends Record<string,
|
|
784
|
+
getDocuments<R extends Record<string, Any> = Record<string, Any>>(
|
|
785
785
|
ids: string[],
|
|
786
786
|
options?: {tag?: string}
|
|
787
787
|
): Promise<(SanityDocument<R> | null)[]> {
|
|
@@ -795,7 +795,7 @@ export class SanityClient {
|
|
|
795
795
|
* @param document - Document to create
|
|
796
796
|
* @param options - Mutation options
|
|
797
797
|
*/
|
|
798
|
-
create<R extends Record<string,
|
|
798
|
+
create<R extends Record<string, Any> = Record<string, Any>>(
|
|
799
799
|
document: SanityDocumentStub<R>,
|
|
800
800
|
options: FirstDocumentMutationOptions
|
|
801
801
|
): Promise<SanityDocument<R>>
|
|
@@ -806,7 +806,7 @@ export class SanityClient {
|
|
|
806
806
|
* @param document - Document to create
|
|
807
807
|
* @param options - Mutation options
|
|
808
808
|
*/
|
|
809
|
-
create<R extends Record<string,
|
|
809
|
+
create<R extends Record<string, Any> = Record<string, Any>>(
|
|
810
810
|
document: SanityDocumentStub<R>,
|
|
811
811
|
options: AllDocumentsMutationOptions
|
|
812
812
|
): Promise<SanityDocument<R>[]>
|
|
@@ -817,7 +817,7 @@ export class SanityClient {
|
|
|
817
817
|
* @param document - Document to create
|
|
818
818
|
* @param options - Mutation options
|
|
819
819
|
*/
|
|
820
|
-
create<R extends Record<string,
|
|
820
|
+
create<R extends Record<string, Any> = Record<string, Any>>(
|
|
821
821
|
document: SanityDocumentStub<R>,
|
|
822
822
|
options: FirstDocumentIdMutationOptions
|
|
823
823
|
): Promise<SingleMutationResult>
|
|
@@ -828,7 +828,7 @@ export class SanityClient {
|
|
|
828
828
|
* @param document - Document to create
|
|
829
829
|
* @param options - Mutation options
|
|
830
830
|
*/
|
|
831
|
-
create<R extends Record<string,
|
|
831
|
+
create<R extends Record<string, Any> = Record<string, Any>>(
|
|
832
832
|
document: SanityDocumentStub<R>,
|
|
833
833
|
options: AllDocumentIdsMutationOptions
|
|
834
834
|
): Promise<MultipleMutationResult>
|
|
@@ -839,11 +839,11 @@ export class SanityClient {
|
|
|
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?: BaseMutationOptions
|
|
845
845
|
): Promise<SanityDocument<R>>
|
|
846
|
-
create<R extends Record<string,
|
|
846
|
+
create<R extends Record<string, Any> = Record<string, Any>>(
|
|
847
847
|
document: SanityDocumentStub<R>,
|
|
848
848
|
options?:
|
|
849
849
|
| AllDocumentIdsMutationOptions
|
|
@@ -866,7 +866,7 @@ export class SanityClient {
|
|
|
866
866
|
* @param document - Document to create
|
|
867
867
|
* @param options - Mutation options
|
|
868
868
|
*/
|
|
869
|
-
createIfNotExists<R extends Record<string,
|
|
869
|
+
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
870
870
|
document: IdentifiedSanityDocumentStub<R>,
|
|
871
871
|
options: FirstDocumentMutationOptions
|
|
872
872
|
): Promise<SanityDocument<R>>
|
|
@@ -877,7 +877,7 @@ export class SanityClient {
|
|
|
877
877
|
* @param document - Document to create
|
|
878
878
|
* @param options - Mutation options
|
|
879
879
|
*/
|
|
880
|
-
createIfNotExists<R extends Record<string,
|
|
880
|
+
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
881
881
|
document: IdentifiedSanityDocumentStub<R>,
|
|
882
882
|
options: AllDocumentsMutationOptions
|
|
883
883
|
): Promise<SanityDocument<R>[]>
|
|
@@ -888,7 +888,7 @@ export class SanityClient {
|
|
|
888
888
|
* @param document - Document to create
|
|
889
889
|
* @param options - Mutation options
|
|
890
890
|
*/
|
|
891
|
-
createIfNotExists<R extends Record<string,
|
|
891
|
+
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
892
892
|
document: IdentifiedSanityDocumentStub<R>,
|
|
893
893
|
options: FirstDocumentIdMutationOptions
|
|
894
894
|
): Promise<SingleMutationResult>
|
|
@@ -899,7 +899,7 @@ export class SanityClient {
|
|
|
899
899
|
* @param document - Document to create
|
|
900
900
|
* @param options - Mutation options
|
|
901
901
|
*/
|
|
902
|
-
createIfNotExists<R extends Record<string,
|
|
902
|
+
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
903
903
|
document: IdentifiedSanityDocumentStub<R>,
|
|
904
904
|
options: AllDocumentIdsMutationOptions
|
|
905
905
|
): Promise<MultipleMutationResult>
|
|
@@ -910,11 +910,11 @@ export class SanityClient {
|
|
|
910
910
|
* @param document - Document to create
|
|
911
911
|
* @param options - Mutation options
|
|
912
912
|
*/
|
|
913
|
-
createIfNotExists<R extends Record<string,
|
|
913
|
+
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
914
914
|
document: IdentifiedSanityDocumentStub<R>,
|
|
915
915
|
options?: BaseMutationOptions
|
|
916
916
|
): Promise<SanityDocument<R>>
|
|
917
|
-
createIfNotExists<R extends Record<string,
|
|
917
|
+
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
918
918
|
document: IdentifiedSanityDocumentStub<R>,
|
|
919
919
|
options?:
|
|
920
920
|
| AllDocumentIdsMutationOptions
|
|
@@ -937,7 +937,7 @@ export class SanityClient {
|
|
|
937
937
|
* @param document - Document to either create or replace
|
|
938
938
|
* @param options - Mutation options
|
|
939
939
|
*/
|
|
940
|
-
createOrReplace<R extends Record<string,
|
|
940
|
+
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
941
941
|
document: IdentifiedSanityDocumentStub<R>,
|
|
942
942
|
options: FirstDocumentMutationOptions
|
|
943
943
|
): Promise<SanityDocument<R>>
|
|
@@ -948,7 +948,7 @@ export class SanityClient {
|
|
|
948
948
|
* @param document - Document to either create or replace
|
|
949
949
|
* @param options - Mutation options
|
|
950
950
|
*/
|
|
951
|
-
createOrReplace<R extends Record<string,
|
|
951
|
+
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
952
952
|
document: IdentifiedSanityDocumentStub<R>,
|
|
953
953
|
options: AllDocumentsMutationOptions
|
|
954
954
|
): Promise<SanityDocument<R>[]>
|
|
@@ -959,7 +959,7 @@ export class SanityClient {
|
|
|
959
959
|
* @param document - Document to either create or replace
|
|
960
960
|
* @param options - Mutation options
|
|
961
961
|
*/
|
|
962
|
-
createOrReplace<R extends Record<string,
|
|
962
|
+
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
963
963
|
document: IdentifiedSanityDocumentStub<R>,
|
|
964
964
|
options: FirstDocumentIdMutationOptions
|
|
965
965
|
): Promise<SingleMutationResult>
|
|
@@ -970,7 +970,7 @@ export class SanityClient {
|
|
|
970
970
|
* @param document - Document to either create or replace
|
|
971
971
|
* @param options - Mutation options
|
|
972
972
|
*/
|
|
973
|
-
createOrReplace<R extends Record<string,
|
|
973
|
+
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
974
974
|
document: IdentifiedSanityDocumentStub<R>,
|
|
975
975
|
options: AllDocumentIdsMutationOptions
|
|
976
976
|
): Promise<MultipleMutationResult>
|
|
@@ -981,11 +981,11 @@ export class SanityClient {
|
|
|
981
981
|
* @param document - Document to either create or replace
|
|
982
982
|
* @param options - Mutation options
|
|
983
983
|
*/
|
|
984
|
-
createOrReplace<R extends Record<string,
|
|
984
|
+
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
985
985
|
document: IdentifiedSanityDocumentStub<R>,
|
|
986
986
|
options?: BaseMutationOptions
|
|
987
987
|
): Promise<SanityDocument<R>>
|
|
988
|
-
createOrReplace<R extends Record<string,
|
|
988
|
+
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
989
989
|
document: IdentifiedSanityDocumentStub<R>,
|
|
990
990
|
options?:
|
|
991
991
|
| AllDocumentIdsMutationOptions
|
|
@@ -1008,7 +1008,7 @@ export class SanityClient {
|
|
|
1008
1008
|
* @param id - Document ID to delete
|
|
1009
1009
|
* @param options - Options for the mutation
|
|
1010
1010
|
*/
|
|
1011
|
-
delete<R extends Record<string,
|
|
1011
|
+
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
1012
1012
|
id: string,
|
|
1013
1013
|
options: FirstDocumentMutationOptions
|
|
1014
1014
|
): Promise<SanityDocument<R>>
|
|
@@ -1019,7 +1019,7 @@ export class SanityClient {
|
|
|
1019
1019
|
* @param id - Document ID to delete
|
|
1020
1020
|
* @param options - Options for the mutation
|
|
1021
1021
|
*/
|
|
1022
|
-
delete<R extends Record<string,
|
|
1022
|
+
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
1023
1023
|
id: string,
|
|
1024
1024
|
options: AllDocumentsMutationOptions
|
|
1025
1025
|
): Promise<SanityDocument<R>[]>
|
|
@@ -1046,7 +1046,7 @@ export class SanityClient {
|
|
|
1046
1046
|
* @param id - Document ID to delete
|
|
1047
1047
|
* @param options - Options for the mutation
|
|
1048
1048
|
*/
|
|
1049
|
-
delete<R extends Record<string,
|
|
1049
|
+
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
1050
1050
|
id: string,
|
|
1051
1051
|
options?: BaseMutationOptions
|
|
1052
1052
|
): Promise<SanityDocument<R>>
|
|
@@ -1057,7 +1057,7 @@ export class SanityClient {
|
|
|
1057
1057
|
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
1058
1058
|
* @param options - Options for the mutation
|
|
1059
1059
|
*/
|
|
1060
|
-
delete<R extends Record<string,
|
|
1060
|
+
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
1061
1061
|
selection: MutationSelection,
|
|
1062
1062
|
options: FirstDocumentMutationOptions
|
|
1063
1063
|
): Promise<SanityDocument<R>>
|
|
@@ -1068,7 +1068,7 @@ export class SanityClient {
|
|
|
1068
1068
|
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
1069
1069
|
* @param options - Options for the mutation
|
|
1070
1070
|
*/
|
|
1071
|
-
delete<R extends Record<string,
|
|
1071
|
+
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
1072
1072
|
selection: MutationSelection,
|
|
1073
1073
|
options: AllDocumentsMutationOptions
|
|
1074
1074
|
): Promise<SanityDocument<R>[]>
|
|
@@ -1101,11 +1101,11 @@ export class SanityClient {
|
|
|
1101
1101
|
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
1102
1102
|
* @param options - Options for the mutation
|
|
1103
1103
|
*/
|
|
1104
|
-
delete<R extends Record<string,
|
|
1104
|
+
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
1105
1105
|
selection: MutationSelection,
|
|
1106
1106
|
options?: BaseMutationOptions
|
|
1107
1107
|
): Promise<SanityDocument<R>>
|
|
1108
|
-
delete<R extends Record<string,
|
|
1108
|
+
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
1109
1109
|
selection: string | MutationSelection,
|
|
1110
1110
|
options?:
|
|
1111
1111
|
| AllDocumentIdsMutationOptions
|
|
@@ -1126,7 +1126,7 @@ export class SanityClient {
|
|
|
1126
1126
|
* @param operations - Mutation operations to execute
|
|
1127
1127
|
* @param options - Mutation options
|
|
1128
1128
|
*/
|
|
1129
|
-
mutate<R extends Record<string,
|
|
1129
|
+
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
1130
1130
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
1131
1131
|
options: FirstDocumentMutationOptions
|
|
1132
1132
|
): Promise<SanityDocument<R>>
|
|
@@ -1137,7 +1137,7 @@ export class SanityClient {
|
|
|
1137
1137
|
* @param operations - Mutation operations to execute
|
|
1138
1138
|
* @param options - Mutation options
|
|
1139
1139
|
*/
|
|
1140
|
-
mutate<R extends Record<string,
|
|
1140
|
+
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
1141
1141
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
1142
1142
|
options: AllDocumentsMutationOptions
|
|
1143
1143
|
): Promise<SanityDocument<R>[]>
|
|
@@ -1148,7 +1148,7 @@ export class SanityClient {
|
|
|
1148
1148
|
* @param operations - Mutation operations to execute
|
|
1149
1149
|
* @param options - Mutation options
|
|
1150
1150
|
*/
|
|
1151
|
-
mutate<R extends Record<string,
|
|
1151
|
+
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
1152
1152
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
1153
1153
|
options: FirstDocumentIdMutationOptions
|
|
1154
1154
|
): Promise<SingleMutationResult>
|
|
@@ -1159,7 +1159,7 @@ export class SanityClient {
|
|
|
1159
1159
|
* @param operations - Mutation operations to execute
|
|
1160
1160
|
* @param options - Mutation options
|
|
1161
1161
|
*/
|
|
1162
|
-
mutate<R extends Record<string,
|
|
1162
|
+
mutate<R extends Record<string, Any>>(
|
|
1163
1163
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
1164
1164
|
options: AllDocumentIdsMutationOptions
|
|
1165
1165
|
): Promise<MultipleMutationResult>
|
|
@@ -1170,11 +1170,11 @@ export class SanityClient {
|
|
|
1170
1170
|
* @param operations - Mutation operations to execute
|
|
1171
1171
|
* @param options - Mutation options
|
|
1172
1172
|
*/
|
|
1173
|
-
mutate<R extends Record<string,
|
|
1173
|
+
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
1174
1174
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
1175
1175
|
options?: BaseMutationOptions
|
|
1176
1176
|
): Promise<SanityDocument<R>>
|
|
1177
|
-
mutate<R extends Record<string,
|
|
1177
|
+
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
1178
1178
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
1179
1179
|
options?:
|
|
1180
1180
|
| FirstDocumentMutationOptions
|
|
@@ -1203,7 +1203,7 @@ export class SanityClient {
|
|
|
1203
1203
|
*
|
|
1204
1204
|
* @param operations - Optional array of mutation operations to initialize the transaction instance with
|
|
1205
1205
|
*/
|
|
1206
|
-
transaction<R extends Record<string,
|
|
1206
|
+
transaction<R extends Record<string, Any> = Record<string, Any>>(
|
|
1207
1207
|
operations?: Mutation<R>[]
|
|
1208
1208
|
): Transaction {
|
|
1209
1209
|
return new Transaction(operations, this)
|
|
@@ -1215,7 +1215,7 @@ export class SanityClient {
|
|
|
1215
1215
|
* @deprecated Use your own request library!
|
|
1216
1216
|
* @param options - Request options
|
|
1217
1217
|
*/
|
|
1218
|
-
request<R =
|
|
1218
|
+
request<R = Any>(options: RawRequestOptions): Promise<R> {
|
|
1219
1219
|
return lastValueFrom(dataMethods._request<R>(this, this.#httpRequest, options))
|
|
1220
1220
|
}
|
|
1221
1221
|
|
|
@@ -1227,7 +1227,7 @@ export class SanityClient {
|
|
|
1227
1227
|
* @param body - Request body
|
|
1228
1228
|
* @param options - Request options
|
|
1229
1229
|
*/
|
|
1230
|
-
dataRequest(endpoint: string, body: unknown, options?: BaseMutationOptions): Promise<
|
|
1230
|
+
dataRequest(endpoint: string, body: unknown, options?: BaseMutationOptions): Promise<Any> {
|
|
1231
1231
|
return lastValueFrom(dataMethods._dataRequest(this, this.#httpRequest, endpoint, body, options))
|
|
1232
1232
|
}
|
|
1233
1233
|
|