@sanity/client 5.0.0-esm.7 → 5.0.0-esm.9
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/README.md +110 -57
- package/dist/index.browser.cjs +6 -4
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +6 -4
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +7 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +127 -121
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/SanityClient.ts +84 -83
- package/src/assets/AssetsClient.ts +4 -3
- package/src/config.ts +1 -0
- package/src/data/dataMethods.ts +28 -26
- package/src/data/encodeQueryString.ts +4 -4
- package/src/data/listen.ts +9 -9
- package/src/data/patch.ts +18 -17
- package/src/data/transaction.ts +15 -12
- package/src/http/errors.ts +7 -7
- package/src/http/request.ts +4 -4
- package/src/http/requestOptions.ts +4 -2
- package/src/types.ts +36 -30
- package/src/util/defaults.ts +4 -2
- package/src/util/once.ts +5 -3
- package/src/util/pick.ts +4 -2
- package/src/validators.ts +4 -4
- package/src/warnings.ts +2 -1
- package/umd/sanityClient.js +4990 -5753
- package/umd/sanityClient.min.js +12 -12
package/src/SanityClient.ts
CHANGED
|
@@ -17,6 +17,7 @@ import type {
|
|
|
17
17
|
FilteredResponseQueryOptions,
|
|
18
18
|
FirstDocumentIdMutationOptions,
|
|
19
19
|
FirstDocumentMutationOptions,
|
|
20
|
+
FIXME,
|
|
20
21
|
HttpRequest,
|
|
21
22
|
IdentifiedSanityDocumentStub,
|
|
22
23
|
InitializedClientConfig,
|
|
@@ -119,14 +120,14 @@ export class ObservableSanityClient {
|
|
|
119
120
|
*
|
|
120
121
|
* @param query - GROQ-query to perform
|
|
121
122
|
*/
|
|
122
|
-
fetch<R =
|
|
123
|
+
fetch<R = FIXME>(query: string): Observable<R>
|
|
123
124
|
/**
|
|
124
125
|
* Perform a GROQ-query against the configured dataset.
|
|
125
126
|
*
|
|
126
127
|
* @param query - GROQ-query to perform
|
|
127
128
|
* @param params - Query parameters
|
|
128
129
|
*/
|
|
129
|
-
fetch<R =
|
|
130
|
+
fetch<R = FIXME>(query: string, params: QueryParams): Observable<R>
|
|
130
131
|
/**
|
|
131
132
|
* Perform a GROQ-query against the configured dataset.
|
|
132
133
|
*
|
|
@@ -134,7 +135,7 @@ export class ObservableSanityClient {
|
|
|
134
135
|
* @param params - Query parameters
|
|
135
136
|
* @param options - Request options
|
|
136
137
|
*/
|
|
137
|
-
fetch<R =
|
|
138
|
+
fetch<R = FIXME>(
|
|
138
139
|
query: string,
|
|
139
140
|
params: QueryParams | undefined,
|
|
140
141
|
options: FilteredResponseQueryOptions
|
|
@@ -146,12 +147,12 @@ export class ObservableSanityClient {
|
|
|
146
147
|
* @param params - Query parameters
|
|
147
148
|
* @param options - Request options
|
|
148
149
|
*/
|
|
149
|
-
fetch<R =
|
|
150
|
+
fetch<R = FIXME>(
|
|
150
151
|
query: string,
|
|
151
152
|
params: QueryParams | undefined,
|
|
152
153
|
options: UnfilteredResponseQueryOptions
|
|
153
154
|
): Observable<RawQueryResponse<R>>
|
|
154
|
-
fetch<R =
|
|
155
|
+
fetch<R = FIXME>(
|
|
155
156
|
query: string,
|
|
156
157
|
params?: QueryParams,
|
|
157
158
|
options: FilteredResponseQueryOptions | UnfilteredResponseQueryOptions = {}
|
|
@@ -165,7 +166,7 @@ export class ObservableSanityClient {
|
|
|
165
166
|
* @param id - Document ID to fetch
|
|
166
167
|
* @param options - Request options
|
|
167
168
|
*/
|
|
168
|
-
getDocument<R extends Record<string,
|
|
169
|
+
getDocument<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
169
170
|
id: string,
|
|
170
171
|
options?: {tag?: string}
|
|
171
172
|
): Observable<SanityDocument<R> | undefined> {
|
|
@@ -176,12 +177,12 @@ export class ObservableSanityClient {
|
|
|
176
177
|
* Fetch multiple documents in one request.
|
|
177
178
|
* Should be used sparingly - performing a query is usually a better option.
|
|
178
179
|
* The order/position of documents is preserved based on the original array of IDs.
|
|
179
|
-
* If a
|
|
180
|
+
* If a FIXME of the documents are missing, they will be replaced by a `null` entry in the returned array
|
|
180
181
|
*
|
|
181
182
|
* @param ids - Document IDs to fetch
|
|
182
183
|
* @param options - Request options
|
|
183
184
|
*/
|
|
184
|
-
getDocuments<R extends Record<string,
|
|
185
|
+
getDocuments<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
185
186
|
ids: string[],
|
|
186
187
|
options?: {tag?: string}
|
|
187
188
|
): Observable<(SanityDocument<R> | null)[]> {
|
|
@@ -195,7 +196,7 @@ export class ObservableSanityClient {
|
|
|
195
196
|
* @param document - Document to create
|
|
196
197
|
* @param options - Mutation options
|
|
197
198
|
*/
|
|
198
|
-
create<R extends Record<string,
|
|
199
|
+
create<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
199
200
|
document: SanityDocumentStub<R>,
|
|
200
201
|
options: FirstDocumentMutationOptions
|
|
201
202
|
): Observable<SanityDocument<R>>
|
|
@@ -206,7 +207,7 @@ export class ObservableSanityClient {
|
|
|
206
207
|
* @param document - Document to create
|
|
207
208
|
* @param options - Mutation options
|
|
208
209
|
*/
|
|
209
|
-
create<R extends Record<string,
|
|
210
|
+
create<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
210
211
|
document: SanityDocumentStub<R>,
|
|
211
212
|
options: AllDocumentsMutationOptions
|
|
212
213
|
): Observable<SanityDocument<R>[]>
|
|
@@ -217,7 +218,7 @@ export class ObservableSanityClient {
|
|
|
217
218
|
* @param document - Document to create
|
|
218
219
|
* @param options - Mutation options
|
|
219
220
|
*/
|
|
220
|
-
create<R extends Record<string,
|
|
221
|
+
create<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
221
222
|
document: SanityDocumentStub<R>,
|
|
222
223
|
options: FirstDocumentIdMutationOptions
|
|
223
224
|
): Observable<SingleMutationResult>
|
|
@@ -228,7 +229,7 @@ export class ObservableSanityClient {
|
|
|
228
229
|
* @param document - Document to create
|
|
229
230
|
* @param options - Mutation options
|
|
230
231
|
*/
|
|
231
|
-
create<R extends Record<string,
|
|
232
|
+
create<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
232
233
|
document: SanityDocumentStub<R>,
|
|
233
234
|
options: AllDocumentIdsMutationOptions
|
|
234
235
|
): Observable<MultipleMutationResult>
|
|
@@ -239,11 +240,11 @@ export class ObservableSanityClient {
|
|
|
239
240
|
* @param document - Document to create
|
|
240
241
|
* @param options - Mutation options
|
|
241
242
|
*/
|
|
242
|
-
create<R extends Record<string,
|
|
243
|
+
create<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
243
244
|
document: SanityDocumentStub<R>,
|
|
244
245
|
options?: BaseMutationOptions
|
|
245
246
|
): Observable<SanityDocument<R>>
|
|
246
|
-
create<R extends Record<string,
|
|
247
|
+
create<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
247
248
|
document: SanityDocumentStub<R>,
|
|
248
249
|
options?:
|
|
249
250
|
| AllDocumentIdsMutationOptions
|
|
@@ -264,7 +265,7 @@ export class ObservableSanityClient {
|
|
|
264
265
|
* @param document - Document to create
|
|
265
266
|
* @param options - Mutation options
|
|
266
267
|
*/
|
|
267
|
-
createIfNotExists<R extends Record<string,
|
|
268
|
+
createIfNotExists<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
268
269
|
document: IdentifiedSanityDocumentStub<R>,
|
|
269
270
|
options: FirstDocumentMutationOptions
|
|
270
271
|
): Observable<SanityDocument<R>>
|
|
@@ -275,7 +276,7 @@ export class ObservableSanityClient {
|
|
|
275
276
|
* @param document - Document to create
|
|
276
277
|
* @param options - Mutation options
|
|
277
278
|
*/
|
|
278
|
-
createIfNotExists<R extends Record<string,
|
|
279
|
+
createIfNotExists<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
279
280
|
document: IdentifiedSanityDocumentStub<R>,
|
|
280
281
|
options: AllDocumentsMutationOptions
|
|
281
282
|
): Observable<SanityDocument<R>[]>
|
|
@@ -286,7 +287,7 @@ export class ObservableSanityClient {
|
|
|
286
287
|
* @param document - Document to create
|
|
287
288
|
* @param options - Mutation options
|
|
288
289
|
*/
|
|
289
|
-
createIfNotExists<R extends Record<string,
|
|
290
|
+
createIfNotExists<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
290
291
|
document: IdentifiedSanityDocumentStub<R>,
|
|
291
292
|
options: FirstDocumentIdMutationOptions
|
|
292
293
|
): Observable<SingleMutationResult>
|
|
@@ -297,7 +298,7 @@ export class ObservableSanityClient {
|
|
|
297
298
|
* @param document - Document to create
|
|
298
299
|
* @param options - Mutation options
|
|
299
300
|
*/
|
|
300
|
-
createIfNotExists<R extends Record<string,
|
|
301
|
+
createIfNotExists<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
301
302
|
document: IdentifiedSanityDocumentStub<R>,
|
|
302
303
|
options: AllDocumentIdsMutationOptions
|
|
303
304
|
): Observable<MultipleMutationResult>
|
|
@@ -308,11 +309,11 @@ export class ObservableSanityClient {
|
|
|
308
309
|
* @param document - Document to create
|
|
309
310
|
* @param options - Mutation options
|
|
310
311
|
*/
|
|
311
|
-
createIfNotExists<R extends Record<string,
|
|
312
|
+
createIfNotExists<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
312
313
|
document: IdentifiedSanityDocumentStub<R>,
|
|
313
314
|
options?: BaseMutationOptions
|
|
314
315
|
): Observable<SanityDocument<R>>
|
|
315
|
-
createIfNotExists<R extends Record<string,
|
|
316
|
+
createIfNotExists<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
316
317
|
document: IdentifiedSanityDocumentStub<R>,
|
|
317
318
|
options?:
|
|
318
319
|
| AllDocumentIdsMutationOptions
|
|
@@ -333,7 +334,7 @@ export class ObservableSanityClient {
|
|
|
333
334
|
* @param document - Document to either create or replace
|
|
334
335
|
* @param options - Mutation options
|
|
335
336
|
*/
|
|
336
|
-
createOrReplace<R extends Record<string,
|
|
337
|
+
createOrReplace<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
337
338
|
document: IdentifiedSanityDocumentStub<R>,
|
|
338
339
|
options: FirstDocumentMutationOptions
|
|
339
340
|
): Observable<SanityDocument<R>>
|
|
@@ -344,7 +345,7 @@ export class ObservableSanityClient {
|
|
|
344
345
|
* @param document - Document to either create or replace
|
|
345
346
|
* @param options - Mutation options
|
|
346
347
|
*/
|
|
347
|
-
createOrReplace<R extends Record<string,
|
|
348
|
+
createOrReplace<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
348
349
|
document: IdentifiedSanityDocumentStub<R>,
|
|
349
350
|
options: AllDocumentsMutationOptions
|
|
350
351
|
): Observable<SanityDocument<R>[]>
|
|
@@ -355,7 +356,7 @@ export class ObservableSanityClient {
|
|
|
355
356
|
* @param document - Document to either create or replace
|
|
356
357
|
* @param options - Mutation options
|
|
357
358
|
*/
|
|
358
|
-
createOrReplace<R extends Record<string,
|
|
359
|
+
createOrReplace<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
359
360
|
document: IdentifiedSanityDocumentStub<R>,
|
|
360
361
|
options: FirstDocumentIdMutationOptions
|
|
361
362
|
): Observable<SingleMutationResult>
|
|
@@ -366,7 +367,7 @@ export class ObservableSanityClient {
|
|
|
366
367
|
* @param document - Document to either create or replace
|
|
367
368
|
* @param options - Mutation options
|
|
368
369
|
*/
|
|
369
|
-
createOrReplace<R extends Record<string,
|
|
370
|
+
createOrReplace<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
370
371
|
document: IdentifiedSanityDocumentStub<R>,
|
|
371
372
|
options: AllDocumentIdsMutationOptions
|
|
372
373
|
): Observable<MultipleMutationResult>
|
|
@@ -377,11 +378,11 @@ export class ObservableSanityClient {
|
|
|
377
378
|
* @param document - Document to either create or replace
|
|
378
379
|
* @param options - Mutation options
|
|
379
380
|
*/
|
|
380
|
-
createOrReplace<R extends Record<string,
|
|
381
|
+
createOrReplace<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
381
382
|
document: IdentifiedSanityDocumentStub<R>,
|
|
382
383
|
options?: BaseMutationOptions
|
|
383
384
|
): Observable<SanityDocument<R>>
|
|
384
|
-
createOrReplace<R extends Record<string,
|
|
385
|
+
createOrReplace<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
385
386
|
document: IdentifiedSanityDocumentStub<R>,
|
|
386
387
|
options?:
|
|
387
388
|
| AllDocumentIdsMutationOptions
|
|
@@ -402,7 +403,7 @@ export class ObservableSanityClient {
|
|
|
402
403
|
* @param id - Document ID to delete
|
|
403
404
|
* @param options - Options for the mutation
|
|
404
405
|
*/
|
|
405
|
-
delete<R extends Record<string,
|
|
406
|
+
delete<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
406
407
|
id: string,
|
|
407
408
|
options: FirstDocumentMutationOptions
|
|
408
409
|
): Observable<SanityDocument<R>>
|
|
@@ -413,7 +414,7 @@ export class ObservableSanityClient {
|
|
|
413
414
|
* @param id - Document ID to delete
|
|
414
415
|
* @param options - Options for the mutation
|
|
415
416
|
*/
|
|
416
|
-
delete<R extends Record<string,
|
|
417
|
+
delete<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
417
418
|
id: string,
|
|
418
419
|
options: AllDocumentsMutationOptions
|
|
419
420
|
): Observable<SanityDocument<R>[]>
|
|
@@ -440,7 +441,7 @@ export class ObservableSanityClient {
|
|
|
440
441
|
* @param id - Document ID to delete
|
|
441
442
|
* @param options - Options for the mutation
|
|
442
443
|
*/
|
|
443
|
-
delete<R extends Record<string,
|
|
444
|
+
delete<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
444
445
|
id: string,
|
|
445
446
|
options?: BaseMutationOptions
|
|
446
447
|
): Observable<SanityDocument<R>>
|
|
@@ -451,7 +452,7 @@ export class ObservableSanityClient {
|
|
|
451
452
|
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
452
453
|
* @param options - Options for the mutation
|
|
453
454
|
*/
|
|
454
|
-
delete<R extends Record<string,
|
|
455
|
+
delete<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
455
456
|
selection: MutationSelection,
|
|
456
457
|
options: FirstDocumentMutationOptions
|
|
457
458
|
): Observable<SanityDocument<R>>
|
|
@@ -462,7 +463,7 @@ export class ObservableSanityClient {
|
|
|
462
463
|
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
463
464
|
* @param options - Options for the mutation
|
|
464
465
|
*/
|
|
465
|
-
delete<R extends Record<string,
|
|
466
|
+
delete<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
466
467
|
selection: MutationSelection,
|
|
467
468
|
options: AllDocumentsMutationOptions
|
|
468
469
|
): Observable<SanityDocument<R>[]>
|
|
@@ -495,11 +496,11 @@ export class ObservableSanityClient {
|
|
|
495
496
|
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
496
497
|
* @param options - Options for the mutation
|
|
497
498
|
*/
|
|
498
|
-
delete<R extends Record<string,
|
|
499
|
+
delete<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
499
500
|
selection: MutationSelection,
|
|
500
501
|
options?: BaseMutationOptions
|
|
501
502
|
): Observable<SanityDocument<R>>
|
|
502
|
-
delete<R extends Record<string,
|
|
503
|
+
delete<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
503
504
|
selection: string | MutationSelection,
|
|
504
505
|
options?:
|
|
505
506
|
| AllDocumentIdsMutationOptions
|
|
@@ -520,7 +521,7 @@ export class ObservableSanityClient {
|
|
|
520
521
|
* @param operations - Mutation operations to execute
|
|
521
522
|
* @param options - Mutation options
|
|
522
523
|
*/
|
|
523
|
-
mutate<R extends Record<string,
|
|
524
|
+
mutate<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
524
525
|
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
525
526
|
options: FirstDocumentMutationOptions
|
|
526
527
|
): Observable<SanityDocument<R>>
|
|
@@ -531,7 +532,7 @@ export class ObservableSanityClient {
|
|
|
531
532
|
* @param operations - Mutation operations to execute
|
|
532
533
|
* @param options - Mutation options
|
|
533
534
|
*/
|
|
534
|
-
mutate<R extends Record<string,
|
|
535
|
+
mutate<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
535
536
|
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
536
537
|
options: AllDocumentsMutationOptions
|
|
537
538
|
): Observable<SanityDocument<R>[]>
|
|
@@ -542,7 +543,7 @@ export class ObservableSanityClient {
|
|
|
542
543
|
* @param operations - Mutation operations to execute
|
|
543
544
|
* @param options - Mutation options
|
|
544
545
|
*/
|
|
545
|
-
mutate<R extends Record<string,
|
|
546
|
+
mutate<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
546
547
|
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
547
548
|
options: FirstDocumentIdMutationOptions
|
|
548
549
|
): Observable<SingleMutationResult>
|
|
@@ -553,7 +554,7 @@ export class ObservableSanityClient {
|
|
|
553
554
|
* @param operations - Mutation operations to execute
|
|
554
555
|
* @param options - Mutation options
|
|
555
556
|
*/
|
|
556
|
-
mutate<R extends Record<string,
|
|
557
|
+
mutate<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
557
558
|
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
558
559
|
options: AllDocumentIdsMutationOptions
|
|
559
560
|
): Observable<MultipleMutationResult>
|
|
@@ -564,11 +565,11 @@ export class ObservableSanityClient {
|
|
|
564
565
|
* @param operations - Mutation operations to execute
|
|
565
566
|
* @param options - Mutation options
|
|
566
567
|
*/
|
|
567
|
-
mutate<R extends Record<string,
|
|
568
|
+
mutate<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
568
569
|
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
569
570
|
options?: BaseMutationOptions
|
|
570
571
|
): Observable<SanityDocument<R>>
|
|
571
|
-
mutate<R extends Record<string,
|
|
572
|
+
mutate<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
572
573
|
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
573
574
|
options?:
|
|
574
575
|
| FirstDocumentMutationOptions
|
|
@@ -597,7 +598,7 @@ export class ObservableSanityClient {
|
|
|
597
598
|
*
|
|
598
599
|
* @param operations - Optional array of mutation operations to initialize the transaction instance with
|
|
599
600
|
*/
|
|
600
|
-
transaction<R extends Record<string,
|
|
601
|
+
transaction<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
601
602
|
operations?: Mutation<R>[]
|
|
602
603
|
): ObservableTransaction {
|
|
603
604
|
return new ObservableTransaction(operations, this)
|
|
@@ -609,7 +610,7 @@ export class ObservableSanityClient {
|
|
|
609
610
|
* @deprecated Use your own request library!
|
|
610
611
|
* @param options - Request options
|
|
611
612
|
*/
|
|
612
|
-
request<R =
|
|
613
|
+
request<R = FIXME>(options: RawRequestOptions): Observable<R> {
|
|
613
614
|
return dataMethods._request(this, this.#httpRequest, options)
|
|
614
615
|
}
|
|
615
616
|
}
|
|
@@ -700,14 +701,14 @@ export class SanityClient {
|
|
|
700
701
|
*
|
|
701
702
|
* @param query - GROQ-query to perform
|
|
702
703
|
*/
|
|
703
|
-
fetch<R =
|
|
704
|
+
fetch<R = FIXME>(query: string): Promise<R>
|
|
704
705
|
/**
|
|
705
706
|
* Perform a GROQ-query against the configured dataset.
|
|
706
707
|
*
|
|
707
708
|
* @param query - GROQ-query to perform
|
|
708
709
|
* @param params - Optional query parameters
|
|
709
710
|
*/
|
|
710
|
-
fetch<R =
|
|
711
|
+
fetch<R = FIXME>(query: string, params: QueryParams): Promise<R>
|
|
711
712
|
/**
|
|
712
713
|
* Perform a GROQ-query against the configured dataset.
|
|
713
714
|
*
|
|
@@ -715,7 +716,7 @@ export class SanityClient {
|
|
|
715
716
|
* @param params - Optional query parameters
|
|
716
717
|
* @param options - Request options
|
|
717
718
|
*/
|
|
718
|
-
fetch<R =
|
|
719
|
+
fetch<R = FIXME>(
|
|
719
720
|
query: string,
|
|
720
721
|
params: QueryParams | undefined,
|
|
721
722
|
options: FilteredResponseQueryOptions
|
|
@@ -727,12 +728,12 @@ export class SanityClient {
|
|
|
727
728
|
* @param params - Optional query parameters
|
|
728
729
|
* @param options - Request options
|
|
729
730
|
*/
|
|
730
|
-
fetch<R =
|
|
731
|
+
fetch<R = FIXME>(
|
|
731
732
|
query: string,
|
|
732
733
|
params: QueryParams | undefined,
|
|
733
734
|
options: UnfilteredResponseQueryOptions
|
|
734
735
|
): Promise<RawQueryResponse<R>>
|
|
735
|
-
fetch<R =
|
|
736
|
+
fetch<R = FIXME>(
|
|
736
737
|
query: string,
|
|
737
738
|
params?: QueryParams,
|
|
738
739
|
options: FilteredResponseQueryOptions | UnfilteredResponseQueryOptions = {}
|
|
@@ -746,7 +747,7 @@ export class SanityClient {
|
|
|
746
747
|
* @param id - Document ID to fetch
|
|
747
748
|
* @param options - Request options
|
|
748
749
|
*/
|
|
749
|
-
getDocument<R extends Record<string,
|
|
750
|
+
getDocument<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
750
751
|
id: string,
|
|
751
752
|
options?: {tag?: string}
|
|
752
753
|
): Promise<SanityDocument<R> | undefined> {
|
|
@@ -757,12 +758,12 @@ export class SanityClient {
|
|
|
757
758
|
* Fetch multiple documents in one request.
|
|
758
759
|
* Should be used sparingly - performing a query is usually a better option.
|
|
759
760
|
* The order/position of documents is preserved based on the original array of IDs.
|
|
760
|
-
* If a
|
|
761
|
+
* If a FIXME of the documents are missing, they will be replaced by a `null` entry in the returned array
|
|
761
762
|
*
|
|
762
763
|
* @param ids - Document IDs to fetch
|
|
763
764
|
* @param options - Request options
|
|
764
765
|
*/
|
|
765
|
-
getDocuments<R extends Record<string,
|
|
766
|
+
getDocuments<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
766
767
|
ids: string[],
|
|
767
768
|
options?: {tag?: string}
|
|
768
769
|
): Promise<(SanityDocument<R> | null)[]> {
|
|
@@ -776,7 +777,7 @@ export class SanityClient {
|
|
|
776
777
|
* @param document - Document to create
|
|
777
778
|
* @param options - Mutation options
|
|
778
779
|
*/
|
|
779
|
-
create<R extends Record<string,
|
|
780
|
+
create<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
780
781
|
document: SanityDocumentStub<R>,
|
|
781
782
|
options: FirstDocumentMutationOptions
|
|
782
783
|
): Promise<SanityDocument<R>>
|
|
@@ -787,7 +788,7 @@ export class SanityClient {
|
|
|
787
788
|
* @param document - Document to create
|
|
788
789
|
* @param options - Mutation options
|
|
789
790
|
*/
|
|
790
|
-
create<R extends Record<string,
|
|
791
|
+
create<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
791
792
|
document: SanityDocumentStub<R>,
|
|
792
793
|
options: AllDocumentsMutationOptions
|
|
793
794
|
): Promise<SanityDocument<R>[]>
|
|
@@ -798,7 +799,7 @@ export class SanityClient {
|
|
|
798
799
|
* @param document - Document to create
|
|
799
800
|
* @param options - Mutation options
|
|
800
801
|
*/
|
|
801
|
-
create<R extends Record<string,
|
|
802
|
+
create<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
802
803
|
document: SanityDocumentStub<R>,
|
|
803
804
|
options: FirstDocumentIdMutationOptions
|
|
804
805
|
): Promise<SingleMutationResult>
|
|
@@ -809,7 +810,7 @@ export class SanityClient {
|
|
|
809
810
|
* @param document - Document to create
|
|
810
811
|
* @param options - Mutation options
|
|
811
812
|
*/
|
|
812
|
-
create<R extends Record<string,
|
|
813
|
+
create<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
813
814
|
document: SanityDocumentStub<R>,
|
|
814
815
|
options: AllDocumentIdsMutationOptions
|
|
815
816
|
): Promise<MultipleMutationResult>
|
|
@@ -820,11 +821,11 @@ export class SanityClient {
|
|
|
820
821
|
* @param document - Document to create
|
|
821
822
|
* @param options - Mutation options
|
|
822
823
|
*/
|
|
823
|
-
create<R extends Record<string,
|
|
824
|
+
create<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
824
825
|
document: SanityDocumentStub<R>,
|
|
825
826
|
options?: BaseMutationOptions
|
|
826
827
|
): Promise<SanityDocument<R>>
|
|
827
|
-
create<R extends Record<string,
|
|
828
|
+
create<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
828
829
|
document: SanityDocumentStub<R>,
|
|
829
830
|
options?:
|
|
830
831
|
| AllDocumentIdsMutationOptions
|
|
@@ -847,7 +848,7 @@ export class SanityClient {
|
|
|
847
848
|
* @param document - Document to create
|
|
848
849
|
* @param options - Mutation options
|
|
849
850
|
*/
|
|
850
|
-
createIfNotExists<R extends Record<string,
|
|
851
|
+
createIfNotExists<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
851
852
|
document: IdentifiedSanityDocumentStub<R>,
|
|
852
853
|
options: FirstDocumentMutationOptions
|
|
853
854
|
): Promise<SanityDocument<R>>
|
|
@@ -858,7 +859,7 @@ export class SanityClient {
|
|
|
858
859
|
* @param document - Document to create
|
|
859
860
|
* @param options - Mutation options
|
|
860
861
|
*/
|
|
861
|
-
createIfNotExists<R extends Record<string,
|
|
862
|
+
createIfNotExists<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
862
863
|
document: IdentifiedSanityDocumentStub<R>,
|
|
863
864
|
options: AllDocumentsMutationOptions
|
|
864
865
|
): Promise<SanityDocument<R>[]>
|
|
@@ -869,7 +870,7 @@ export class SanityClient {
|
|
|
869
870
|
* @param document - Document to create
|
|
870
871
|
* @param options - Mutation options
|
|
871
872
|
*/
|
|
872
|
-
createIfNotExists<R extends Record<string,
|
|
873
|
+
createIfNotExists<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
873
874
|
document: IdentifiedSanityDocumentStub<R>,
|
|
874
875
|
options: FirstDocumentIdMutationOptions
|
|
875
876
|
): Promise<SingleMutationResult>
|
|
@@ -880,7 +881,7 @@ export class SanityClient {
|
|
|
880
881
|
* @param document - Document to create
|
|
881
882
|
* @param options - Mutation options
|
|
882
883
|
*/
|
|
883
|
-
createIfNotExists<R extends Record<string,
|
|
884
|
+
createIfNotExists<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
884
885
|
document: IdentifiedSanityDocumentStub<R>,
|
|
885
886
|
options: AllDocumentIdsMutationOptions
|
|
886
887
|
): Promise<MultipleMutationResult>
|
|
@@ -891,11 +892,11 @@ export class SanityClient {
|
|
|
891
892
|
* @param document - Document to create
|
|
892
893
|
* @param options - Mutation options
|
|
893
894
|
*/
|
|
894
|
-
createIfNotExists<R extends Record<string,
|
|
895
|
+
createIfNotExists<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
895
896
|
document: IdentifiedSanityDocumentStub<R>,
|
|
896
897
|
options?: BaseMutationOptions
|
|
897
898
|
): Promise<SanityDocument<R>>
|
|
898
|
-
createIfNotExists<R extends Record<string,
|
|
899
|
+
createIfNotExists<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
899
900
|
document: IdentifiedSanityDocumentStub<R>,
|
|
900
901
|
options?:
|
|
901
902
|
| AllDocumentIdsMutationOptions
|
|
@@ -918,7 +919,7 @@ export class SanityClient {
|
|
|
918
919
|
* @param document - Document to either create or replace
|
|
919
920
|
* @param options - Mutation options
|
|
920
921
|
*/
|
|
921
|
-
createOrReplace<R extends Record<string,
|
|
922
|
+
createOrReplace<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
922
923
|
document: IdentifiedSanityDocumentStub<R>,
|
|
923
924
|
options: FirstDocumentMutationOptions
|
|
924
925
|
): Promise<SanityDocument<R>>
|
|
@@ -929,7 +930,7 @@ export class SanityClient {
|
|
|
929
930
|
* @param document - Document to either create or replace
|
|
930
931
|
* @param options - Mutation options
|
|
931
932
|
*/
|
|
932
|
-
createOrReplace<R extends Record<string,
|
|
933
|
+
createOrReplace<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
933
934
|
document: IdentifiedSanityDocumentStub<R>,
|
|
934
935
|
options: AllDocumentsMutationOptions
|
|
935
936
|
): Promise<SanityDocument<R>[]>
|
|
@@ -940,7 +941,7 @@ export class SanityClient {
|
|
|
940
941
|
* @param document - Document to either create or replace
|
|
941
942
|
* @param options - Mutation options
|
|
942
943
|
*/
|
|
943
|
-
createOrReplace<R extends Record<string,
|
|
944
|
+
createOrReplace<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
944
945
|
document: IdentifiedSanityDocumentStub<R>,
|
|
945
946
|
options: FirstDocumentIdMutationOptions
|
|
946
947
|
): Promise<SingleMutationResult>
|
|
@@ -951,7 +952,7 @@ export class SanityClient {
|
|
|
951
952
|
* @param document - Document to either create or replace
|
|
952
953
|
* @param options - Mutation options
|
|
953
954
|
*/
|
|
954
|
-
createOrReplace<R extends Record<string,
|
|
955
|
+
createOrReplace<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
955
956
|
document: IdentifiedSanityDocumentStub<R>,
|
|
956
957
|
options: AllDocumentIdsMutationOptions
|
|
957
958
|
): Promise<MultipleMutationResult>
|
|
@@ -962,11 +963,11 @@ export class SanityClient {
|
|
|
962
963
|
* @param document - Document to either create or replace
|
|
963
964
|
* @param options - Mutation options
|
|
964
965
|
*/
|
|
965
|
-
createOrReplace<R extends Record<string,
|
|
966
|
+
createOrReplace<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
966
967
|
document: IdentifiedSanityDocumentStub<R>,
|
|
967
968
|
options?: BaseMutationOptions
|
|
968
969
|
): Promise<SanityDocument<R>>
|
|
969
|
-
createOrReplace<R extends Record<string,
|
|
970
|
+
createOrReplace<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
970
971
|
document: IdentifiedSanityDocumentStub<R>,
|
|
971
972
|
options?:
|
|
972
973
|
| AllDocumentIdsMutationOptions
|
|
@@ -989,7 +990,7 @@ export class SanityClient {
|
|
|
989
990
|
* @param id - Document ID to delete
|
|
990
991
|
* @param options - Options for the mutation
|
|
991
992
|
*/
|
|
992
|
-
delete<R extends Record<string,
|
|
993
|
+
delete<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
993
994
|
id: string,
|
|
994
995
|
options: FirstDocumentMutationOptions
|
|
995
996
|
): Promise<SanityDocument<R>>
|
|
@@ -1000,7 +1001,7 @@ export class SanityClient {
|
|
|
1000
1001
|
* @param id - Document ID to delete
|
|
1001
1002
|
* @param options - Options for the mutation
|
|
1002
1003
|
*/
|
|
1003
|
-
delete<R extends Record<string,
|
|
1004
|
+
delete<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1004
1005
|
id: string,
|
|
1005
1006
|
options: AllDocumentsMutationOptions
|
|
1006
1007
|
): Promise<SanityDocument<R>[]>
|
|
@@ -1027,7 +1028,7 @@ export class SanityClient {
|
|
|
1027
1028
|
* @param id - Document ID to delete
|
|
1028
1029
|
* @param options - Options for the mutation
|
|
1029
1030
|
*/
|
|
1030
|
-
delete<R extends Record<string,
|
|
1031
|
+
delete<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1031
1032
|
id: string,
|
|
1032
1033
|
options?: BaseMutationOptions
|
|
1033
1034
|
): Promise<SanityDocument<R>>
|
|
@@ -1038,7 +1039,7 @@ export class SanityClient {
|
|
|
1038
1039
|
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
1039
1040
|
* @param options - Options for the mutation
|
|
1040
1041
|
*/
|
|
1041
|
-
delete<R extends Record<string,
|
|
1042
|
+
delete<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1042
1043
|
selection: MutationSelection,
|
|
1043
1044
|
options: FirstDocumentMutationOptions
|
|
1044
1045
|
): Promise<SanityDocument<R>>
|
|
@@ -1049,7 +1050,7 @@ export class SanityClient {
|
|
|
1049
1050
|
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
1050
1051
|
* @param options - Options for the mutation
|
|
1051
1052
|
*/
|
|
1052
|
-
delete<R extends Record<string,
|
|
1053
|
+
delete<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1053
1054
|
selection: MutationSelection,
|
|
1054
1055
|
options: AllDocumentsMutationOptions
|
|
1055
1056
|
): Promise<SanityDocument<R>[]>
|
|
@@ -1082,11 +1083,11 @@ export class SanityClient {
|
|
|
1082
1083
|
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
1083
1084
|
* @param options - Options for the mutation
|
|
1084
1085
|
*/
|
|
1085
|
-
delete<R extends Record<string,
|
|
1086
|
+
delete<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1086
1087
|
selection: MutationSelection,
|
|
1087
1088
|
options?: BaseMutationOptions
|
|
1088
1089
|
): Promise<SanityDocument<R>>
|
|
1089
|
-
delete<R extends Record<string,
|
|
1090
|
+
delete<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1090
1091
|
selection: string | MutationSelection,
|
|
1091
1092
|
options?:
|
|
1092
1093
|
| AllDocumentIdsMutationOptions
|
|
@@ -1107,7 +1108,7 @@ export class SanityClient {
|
|
|
1107
1108
|
* @param operations - Mutation operations to execute
|
|
1108
1109
|
* @param options - Mutation options
|
|
1109
1110
|
*/
|
|
1110
|
-
mutate<R extends Record<string,
|
|
1111
|
+
mutate<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1111
1112
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
1112
1113
|
options: FirstDocumentMutationOptions
|
|
1113
1114
|
): Promise<SanityDocument<R>>
|
|
@@ -1118,7 +1119,7 @@ export class SanityClient {
|
|
|
1118
1119
|
* @param operations - Mutation operations to execute
|
|
1119
1120
|
* @param options - Mutation options
|
|
1120
1121
|
*/
|
|
1121
|
-
mutate<R extends Record<string,
|
|
1122
|
+
mutate<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1122
1123
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
1123
1124
|
options: AllDocumentsMutationOptions
|
|
1124
1125
|
): Promise<SanityDocument<R>[]>
|
|
@@ -1129,7 +1130,7 @@ export class SanityClient {
|
|
|
1129
1130
|
* @param operations - Mutation operations to execute
|
|
1130
1131
|
* @param options - Mutation options
|
|
1131
1132
|
*/
|
|
1132
|
-
mutate<R extends Record<string,
|
|
1133
|
+
mutate<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1133
1134
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
1134
1135
|
options: FirstDocumentIdMutationOptions
|
|
1135
1136
|
): Promise<SingleMutationResult>
|
|
@@ -1140,7 +1141,7 @@ export class SanityClient {
|
|
|
1140
1141
|
* @param operations - Mutation operations to execute
|
|
1141
1142
|
* @param options - Mutation options
|
|
1142
1143
|
*/
|
|
1143
|
-
mutate<R extends Record<string,
|
|
1144
|
+
mutate<R extends Record<string, FIXME>>(
|
|
1144
1145
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
1145
1146
|
options: AllDocumentIdsMutationOptions
|
|
1146
1147
|
): Promise<MultipleMutationResult>
|
|
@@ -1151,11 +1152,11 @@ export class SanityClient {
|
|
|
1151
1152
|
* @param operations - Mutation operations to execute
|
|
1152
1153
|
* @param options - Mutation options
|
|
1153
1154
|
*/
|
|
1154
|
-
mutate<R extends Record<string,
|
|
1155
|
+
mutate<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1155
1156
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
1156
1157
|
options?: BaseMutationOptions
|
|
1157
1158
|
): Promise<SanityDocument<R>>
|
|
1158
|
-
mutate<R extends Record<string,
|
|
1159
|
+
mutate<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1159
1160
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
1160
1161
|
options?:
|
|
1161
1162
|
| FirstDocumentMutationOptions
|
|
@@ -1184,7 +1185,7 @@ export class SanityClient {
|
|
|
1184
1185
|
*
|
|
1185
1186
|
* @param operations - Optional array of mutation operations to initialize the transaction instance with
|
|
1186
1187
|
*/
|
|
1187
|
-
transaction<R extends Record<string,
|
|
1188
|
+
transaction<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1188
1189
|
operations?: Mutation<R>[]
|
|
1189
1190
|
): Transaction {
|
|
1190
1191
|
return new Transaction(operations, this)
|
|
@@ -1196,7 +1197,7 @@ export class SanityClient {
|
|
|
1196
1197
|
* @deprecated Use your own request library!
|
|
1197
1198
|
* @param options - Request options
|
|
1198
1199
|
*/
|
|
1199
|
-
request<R =
|
|
1200
|
+
request<R = FIXME>(options: RawRequestOptions): Promise<R> {
|
|
1200
1201
|
return lastValueFrom(dataMethods._request<R>(this, this.#httpRequest, options))
|
|
1201
1202
|
}
|
|
1202
1203
|
|
|
@@ -1208,7 +1209,7 @@ export class SanityClient {
|
|
|
1208
1209
|
* @param body - Request body
|
|
1209
1210
|
* @param options - Request options
|
|
1210
1211
|
*/
|
|
1211
|
-
dataRequest(endpoint: string, body: unknown, options?: BaseMutationOptions): Promise<
|
|
1212
|
+
dataRequest(endpoint: string, body: unknown, options?: BaseMutationOptions): Promise<FIXME> {
|
|
1212
1213
|
return lastValueFrom(dataMethods._dataRequest(this, this.#httpRequest, endpoint, body, options))
|
|
1213
1214
|
}
|
|
1214
1215
|
}
|