@sanity/client 3.4.0-beta.esm.2 → 3.4.0
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 +1 -1
- package/dist/sanityClient.browser.mjs +316 -3452
- package/dist/sanityClient.browser.mjs.map +3 -3
- package/lib/config.js +2 -2
- package/lib/generateHelpUrl.js +7 -0
- package/lib/sanityClient.js +5 -1
- package/lib/warnings.js +1 -1
- package/package.json +19 -27
- package/sanityClient.d.ts +252 -97
- package/umd/sanityClient.js +30 -30
- package/umd/sanityClient.min.js +1 -1
- package/dist/sanityClient.node.js +0 -1129
- package/dist/sanityClient.node.js.map +0 -7
package/sanityClient.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export interface ProgressEvent {
|
|
|
35
35
|
|
|
36
36
|
type AttributeSet = {[key: string]: any}
|
|
37
37
|
type QueryParams = {[key: string]: any}
|
|
38
|
-
type MutationSelection = {query: string} | {id: string}
|
|
38
|
+
type MutationSelection = {query: string; params?: QueryParams} | {id: string}
|
|
39
39
|
type SanityReference = {_ref: string}
|
|
40
40
|
|
|
41
41
|
interface RawRequestOptions {
|
|
@@ -205,7 +205,7 @@ export type PatchBuilder = (patch: Patch) => Patch
|
|
|
205
205
|
|
|
206
206
|
export type PatchMutationOperation = PatchOperations & MutationSelection
|
|
207
207
|
|
|
208
|
-
export type Mutation<R
|
|
208
|
+
export type Mutation<R extends Record<string, any> = Record<string, any>> =
|
|
209
209
|
| {create: SanityDocumentStub<R>}
|
|
210
210
|
| {createOrReplace: IdentifiedSanityDocumentStub<R>}
|
|
211
211
|
| {createIfNotExists: IdentifiedSanityDocumentStub<R>}
|
|
@@ -224,14 +224,7 @@ export interface MultipleMutationResult {
|
|
|
224
224
|
results: {id: string; operation: MutationOperation}[]
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
export class
|
|
228
|
-
constructor(documentId: string, operations?: PatchOperations, client?: SanityClient)
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* Clones the patch
|
|
232
|
-
*/
|
|
233
|
-
clone(): Patch
|
|
234
|
-
|
|
227
|
+
export abstract class BasePatch {
|
|
235
228
|
/**
|
|
236
229
|
* DEPRECATED: Don't use.
|
|
237
230
|
* The operation is added to the current patch, ready to be commited by `commit()`
|
|
@@ -339,19 +332,37 @@ export class Patch {
|
|
|
339
332
|
*/
|
|
340
333
|
toJSON(): PatchMutationOperation
|
|
341
334
|
|
|
335
|
+
/**
|
|
336
|
+
* Clears the patch of all operations
|
|
337
|
+
*/
|
|
338
|
+
reset(): this
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export class Patch extends BasePatch {
|
|
342
|
+
constructor(documentId: string, operations?: PatchOperations, client?: SanityClient)
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Clones the patch
|
|
346
|
+
*/
|
|
347
|
+
clone(): Patch
|
|
348
|
+
|
|
342
349
|
/**
|
|
343
350
|
* Commit the patch, returning a promise that resolves to the first patched document
|
|
344
351
|
*
|
|
345
352
|
* @param options Options for the mutation operation
|
|
346
353
|
*/
|
|
347
|
-
commit<R
|
|
354
|
+
commit<R extends Record<string, any> = Record<string, any>>(
|
|
355
|
+
options: FirstDocumentMutationOptions
|
|
356
|
+
): Promise<SanityDocument<R>>
|
|
348
357
|
|
|
349
358
|
/**
|
|
350
359
|
* Commit the patch, returning a promise that resolves to an array of the mutated documents
|
|
351
360
|
*
|
|
352
361
|
* @param options Options for the mutation operation
|
|
353
362
|
*/
|
|
354
|
-
commit<R
|
|
363
|
+
commit<R extends Record<string, any> = Record<string, any>>(
|
|
364
|
+
options: AllDocumentsMutationOptions
|
|
365
|
+
): Promise<SanityDocument<R>[]>
|
|
355
366
|
|
|
356
367
|
/**
|
|
357
368
|
* Commit the patch, returning a promise that resolves to a mutation result object
|
|
@@ -372,25 +383,69 @@ export class Patch {
|
|
|
372
383
|
*
|
|
373
384
|
* @param options Options for the mutation operation
|
|
374
385
|
*/
|
|
375
|
-
commit<R
|
|
386
|
+
commit<R extends Record<string, any> = Record<string, any>>(
|
|
387
|
+
options?: BaseMutationOptions
|
|
388
|
+
): Promise<SanityDocument<R>>
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
export class ObservablePatch extends BasePatch {
|
|
392
|
+
constructor(documentId: string, operations?: PatchOperations, client?: ObservableSanityClient)
|
|
376
393
|
|
|
377
394
|
/**
|
|
378
|
-
*
|
|
395
|
+
* Clones the patch
|
|
379
396
|
*/
|
|
380
|
-
|
|
381
|
-
}
|
|
397
|
+
clone(): ObservablePatch
|
|
382
398
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
399
|
+
/**
|
|
400
|
+
* Commit the patch, returning an observable that produces the first patched document
|
|
401
|
+
*
|
|
402
|
+
* @param options Options for the mutation operation
|
|
403
|
+
*/
|
|
404
|
+
commit<R extends Record<string, any> = Record<string, any>>(
|
|
405
|
+
options: FirstDocumentMutationOptions
|
|
406
|
+
): Observable<SanityDocument<R>>
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Commit the patch, returning an observable that produces an array of the mutated documents
|
|
410
|
+
*
|
|
411
|
+
* @param options Options for the mutation operation
|
|
412
|
+
*/
|
|
413
|
+
commit<R extends Record<string, any> = Record<string, any>>(
|
|
414
|
+
options: AllDocumentsMutationOptions
|
|
415
|
+
): Observable<SanityDocument<R>[]>
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* Commit the patch, returning an observable that produces a mutation result object
|
|
419
|
+
*
|
|
420
|
+
* @param options Options for the mutation operation
|
|
421
|
+
*/
|
|
422
|
+
commit(options: FirstDocumentIdMutationOptions): Observable<SingleMutationResult>
|
|
386
423
|
|
|
424
|
+
/**
|
|
425
|
+
* Commit the patch, returning an observable that produces a mutation result object
|
|
426
|
+
*
|
|
427
|
+
* @param options Options for the mutation operation
|
|
428
|
+
*/
|
|
429
|
+
commit(options: AllDocumentIdsMutationOptions): Observable<MultipleMutationResult>
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* Commit the patch, returning an observable that produces the first patched document
|
|
433
|
+
*
|
|
434
|
+
* @param options Options for the mutation operation
|
|
435
|
+
*/
|
|
436
|
+
commit<R extends Record<string, any> = Record<string, any>>(
|
|
437
|
+
options?: BaseMutationOptions
|
|
438
|
+
): Observable<SanityDocument<R>>
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
export abstract class BaseTransaction {
|
|
387
442
|
/**
|
|
388
443
|
* Creates a new Sanity document. If `_id` is provided and already exists, the mutation will fail. If no `_id` is given, one will automatically be generated by the database.
|
|
389
444
|
* The operation is added to the current transaction, ready to be commited by `commit()`
|
|
390
445
|
*
|
|
391
446
|
* @param doc Document to create. Requires a `_type` property.
|
|
392
447
|
*/
|
|
393
|
-
create<R = any
|
|
448
|
+
create<R extends Record<string, any> = Record<string, any>>(doc: SanityDocumentStub<R>): this
|
|
394
449
|
|
|
395
450
|
/**
|
|
396
451
|
* Creates a new Sanity document. If a document with the same `_id` already exists, the create operation will be ignored.
|
|
@@ -398,7 +453,9 @@ export class Transaction {
|
|
|
398
453
|
*
|
|
399
454
|
* @param doc Document to create if it does not already exist. Requires `_id` and `_type` properties.
|
|
400
455
|
*/
|
|
401
|
-
createIfNotExists<R
|
|
456
|
+
createIfNotExists<R extends Record<string, any> = Record<string, any>>(
|
|
457
|
+
doc: IdentifiedSanityDocumentStub<R>
|
|
458
|
+
): this
|
|
402
459
|
|
|
403
460
|
/**
|
|
404
461
|
* Creates a new Sanity document, or replaces an existing one if the same `_id` is already used.
|
|
@@ -406,7 +463,9 @@ export class Transaction {
|
|
|
406
463
|
*
|
|
407
464
|
* @param doc Document to create or replace. Requires `_id` and `_type` properties.
|
|
408
465
|
*/
|
|
409
|
-
createOrReplace<R
|
|
466
|
+
createOrReplace<R extends Record<string, any> = Record<string, any>>(
|
|
467
|
+
doc: IdentifiedSanityDocumentStub<R>
|
|
468
|
+
): this
|
|
410
469
|
|
|
411
470
|
/**
|
|
412
471
|
* Deletes the document with the given document ID
|
|
@@ -452,19 +511,37 @@ export class Transaction {
|
|
|
452
511
|
*/
|
|
453
512
|
toJSON(): Mutation[]
|
|
454
513
|
|
|
514
|
+
/**
|
|
515
|
+
* Clears the transaction of all operations
|
|
516
|
+
*/
|
|
517
|
+
reset(): this
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
export class Transaction extends BaseTransaction {
|
|
521
|
+
constructor(operations?: Mutation[], client?: SanityClient, transactionId?: string)
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* Clones the transaction
|
|
525
|
+
*/
|
|
526
|
+
clone(): Transaction
|
|
527
|
+
|
|
455
528
|
/**
|
|
456
529
|
* Commit the transaction, returning a promise that resolves to the first mutated document
|
|
457
530
|
*
|
|
458
531
|
* @param options Options for the mutation operation
|
|
459
532
|
*/
|
|
460
|
-
commit<R
|
|
533
|
+
commit<R extends Record<string, any>>(
|
|
534
|
+
options: TransactionFirstDocumentMutationOptions
|
|
535
|
+
): Promise<SanityDocument<R>>
|
|
461
536
|
|
|
462
537
|
/**
|
|
463
538
|
* Commit the transaction, returning a promise that resolves to an array of the mutated documents
|
|
464
539
|
*
|
|
465
540
|
* @param options Options for the mutation operation
|
|
466
541
|
*/
|
|
467
|
-
commit<R
|
|
542
|
+
commit<R extends Record<string, any>>(
|
|
543
|
+
options: TransactionAllDocumentsMutationOptions
|
|
544
|
+
): Promise<SanityDocument<R>[]>
|
|
468
545
|
|
|
469
546
|
/**
|
|
470
547
|
* Commit the transaction, returning a promise that resolves to a mutation result object
|
|
@@ -486,11 +563,54 @@ export class Transaction {
|
|
|
486
563
|
* @param options Options for the mutation operation
|
|
487
564
|
*/
|
|
488
565
|
commit(options?: BaseMutationOptions): Promise<MultipleMutationResult>
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
export class ObservableTransaction extends BaseTransaction {
|
|
569
|
+
constructor(operations?: Mutation[], client?: ObservableSanityClient, transactionId?: string)
|
|
489
570
|
|
|
490
571
|
/**
|
|
491
|
-
*
|
|
572
|
+
* Clones the transaction
|
|
492
573
|
*/
|
|
493
|
-
|
|
574
|
+
clone(): ObservableTransaction
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* Commit the transaction, returning an observable that produces the first mutated document
|
|
578
|
+
*
|
|
579
|
+
* @param options Options for the mutation operation
|
|
580
|
+
*/
|
|
581
|
+
commit<R extends Record<string, any>>(
|
|
582
|
+
options: TransactionFirstDocumentMutationOptions
|
|
583
|
+
): Observable<SanityDocument<R>>
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* Commit the transaction, returning an observable that produces an array of the mutated documents
|
|
587
|
+
*
|
|
588
|
+
* @param options Options for the mutation operation
|
|
589
|
+
*/
|
|
590
|
+
commit<R extends Record<string, any>>(
|
|
591
|
+
options: TransactionAllDocumentsMutationOptions
|
|
592
|
+
): Observable<SanityDocument<R>[]>
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* Commit the transaction, returning an observable that produces a mutation result object
|
|
596
|
+
*
|
|
597
|
+
* @param options Options for the mutation operation
|
|
598
|
+
*/
|
|
599
|
+
commit(options: TransactionFirstDocumentIdMutationOptions): Observable<SingleMutationResult>
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* Commit the transaction, returning an observable that produces a mutation result object
|
|
603
|
+
*
|
|
604
|
+
* @param options Options for the mutation operation
|
|
605
|
+
*/
|
|
606
|
+
commit(options: TransactionAllDocumentIdsMutationOptions): Observable<MultipleMutationResult>
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* Commit the transaction, returning an observable that produces a mutation result object
|
|
610
|
+
*
|
|
611
|
+
* @param options Options for the mutation operation
|
|
612
|
+
*/
|
|
613
|
+
commit(options?: BaseMutationOptions): Observable<MultipleMutationResult>
|
|
494
614
|
}
|
|
495
615
|
|
|
496
616
|
export interface ClientConfig {
|
|
@@ -504,6 +624,7 @@ export interface ClientConfig {
|
|
|
504
624
|
requestTagPrefix?: string
|
|
505
625
|
ignoreBrowserTokenWarning?: boolean
|
|
506
626
|
withCredentials?: boolean
|
|
627
|
+
allowReconfigure?: boolean
|
|
507
628
|
timeout?: number
|
|
508
629
|
|
|
509
630
|
/**
|
|
@@ -546,7 +667,7 @@ type BaseMutationOptions = RequestOptions & {
|
|
|
546
667
|
skipCrossDatasetReferenceValidation?: boolean
|
|
547
668
|
}
|
|
548
669
|
|
|
549
|
-
export type MutationEvent<R
|
|
670
|
+
export type MutationEvent<R extends Record<string, any> = Record<string, any>> = {
|
|
550
671
|
type: 'mutation'
|
|
551
672
|
documentId: string
|
|
552
673
|
eventId: string
|
|
@@ -581,7 +702,7 @@ export type WelcomeEvent = {
|
|
|
581
702
|
type: 'welcome'
|
|
582
703
|
}
|
|
583
704
|
|
|
584
|
-
export type ListenEvent<R
|
|
705
|
+
export type ListenEvent<R extends Record<string, any>> =
|
|
585
706
|
| MutationEvent<R>
|
|
586
707
|
| ChannelErrorEvent
|
|
587
708
|
| DisconnectEvent
|
|
@@ -973,7 +1094,7 @@ export class ObservableSanityClient {
|
|
|
973
1094
|
*
|
|
974
1095
|
* @param query GROQ-query to perform
|
|
975
1096
|
*/
|
|
976
|
-
fetch<R = any
|
|
1097
|
+
fetch<R extends Record<string, any> = Record<string, any>>(query: string): Observable<R>
|
|
977
1098
|
|
|
978
1099
|
/**
|
|
979
1100
|
* Perform a GROQ-query against the configured dataset.
|
|
@@ -981,7 +1102,10 @@ export class ObservableSanityClient {
|
|
|
981
1102
|
* @param query GROQ-query to perform
|
|
982
1103
|
* @param params Query parameters
|
|
983
1104
|
*/
|
|
984
|
-
fetch<R
|
|
1105
|
+
fetch<R extends Record<string, any> = Record<string, any>>(
|
|
1106
|
+
query: string,
|
|
1107
|
+
params: QueryParams
|
|
1108
|
+
): Observable<R>
|
|
985
1109
|
|
|
986
1110
|
/**
|
|
987
1111
|
* Perform a GROQ-query against the configured dataset.
|
|
@@ -990,7 +1114,7 @@ export class ObservableSanityClient {
|
|
|
990
1114
|
* @param params Query parameters
|
|
991
1115
|
* @param options Request options
|
|
992
1116
|
*/
|
|
993
|
-
fetch<R = any
|
|
1117
|
+
fetch<R extends Record<string, any> = Record<string, any>>(
|
|
994
1118
|
query: string,
|
|
995
1119
|
params: QueryParams | undefined,
|
|
996
1120
|
options: FilteredResponseQueryOptions
|
|
@@ -1003,7 +1127,7 @@ export class ObservableSanityClient {
|
|
|
1003
1127
|
* @param params Query parameters
|
|
1004
1128
|
* @param options Request options
|
|
1005
1129
|
*/
|
|
1006
|
-
fetch<R = any
|
|
1130
|
+
fetch<R extends Record<string, any> = Record<string, any>>(
|
|
1007
1131
|
query: string,
|
|
1008
1132
|
params: QueryParams | undefined,
|
|
1009
1133
|
options: UnfilteredResponseQueryOptions
|
|
@@ -1015,7 +1139,7 @@ export class ObservableSanityClient {
|
|
|
1015
1139
|
* @param id Document ID to fetch
|
|
1016
1140
|
* @param options Request options
|
|
1017
1141
|
*/
|
|
1018
|
-
getDocument<R = any
|
|
1142
|
+
getDocument<R extends Record<string, any> = Record<string, any>>(
|
|
1019
1143
|
id: string,
|
|
1020
1144
|
options?: {tag?: string}
|
|
1021
1145
|
): Observable<SanityDocument<R> | undefined>
|
|
@@ -1029,7 +1153,7 @@ export class ObservableSanityClient {
|
|
|
1029
1153
|
* @param ids Document IDs to fetch
|
|
1030
1154
|
* @param options Request options
|
|
1031
1155
|
*/
|
|
1032
|
-
getDocuments<R = any
|
|
1156
|
+
getDocuments<R extends Record<string, any> = Record<string, any>>(
|
|
1033
1157
|
ids: string[],
|
|
1034
1158
|
options?: {tag?: string}
|
|
1035
1159
|
): Observable<(SanityDocument<R> | null)[]>
|
|
@@ -1041,7 +1165,7 @@ export class ObservableSanityClient {
|
|
|
1041
1165
|
* @param document Document to create
|
|
1042
1166
|
* @param options Mutation options
|
|
1043
1167
|
*/
|
|
1044
|
-
create<R = any
|
|
1168
|
+
create<R extends Record<string, any> = Record<string, any>>(
|
|
1045
1169
|
document: SanityDocumentStub<R>,
|
|
1046
1170
|
options: FirstDocumentMutationOptions
|
|
1047
1171
|
): Observable<SanityDocument<R>>
|
|
@@ -1053,7 +1177,7 @@ export class ObservableSanityClient {
|
|
|
1053
1177
|
* @param document Document to create
|
|
1054
1178
|
* @param options Mutation options
|
|
1055
1179
|
*/
|
|
1056
|
-
create<R = any
|
|
1180
|
+
create<R extends Record<string, any> = Record<string, any>>(
|
|
1057
1181
|
document: SanityDocumentStub<R>,
|
|
1058
1182
|
options: AllDocumentsMutationOptions
|
|
1059
1183
|
): Observable<SanityDocument<R>[]>
|
|
@@ -1065,7 +1189,7 @@ export class ObservableSanityClient {
|
|
|
1065
1189
|
* @param document Document to create
|
|
1066
1190
|
* @param options Mutation options
|
|
1067
1191
|
*/
|
|
1068
|
-
create<R = any
|
|
1192
|
+
create<R extends Record<string, any> = Record<string, any>>(
|
|
1069
1193
|
document: SanityDocumentStub<R>,
|
|
1070
1194
|
options: FirstDocumentIdMutationOptions
|
|
1071
1195
|
): Observable<SingleMutationResult>
|
|
@@ -1077,7 +1201,7 @@ export class ObservableSanityClient {
|
|
|
1077
1201
|
* @param document Document to create
|
|
1078
1202
|
* @param options Mutation options
|
|
1079
1203
|
*/
|
|
1080
|
-
create<R = any
|
|
1204
|
+
create<R extends Record<string, any> = Record<string, any>>(
|
|
1081
1205
|
document: SanityDocumentStub<R>,
|
|
1082
1206
|
options: AllDocumentIdsMutationOptions
|
|
1083
1207
|
): Observable<MultipleMutationResult>
|
|
@@ -1089,7 +1213,7 @@ export class ObservableSanityClient {
|
|
|
1089
1213
|
* @param document Document to create
|
|
1090
1214
|
* @param options Mutation options
|
|
1091
1215
|
*/
|
|
1092
|
-
create<R = any
|
|
1216
|
+
create<R extends Record<string, any> = Record<string, any>>(
|
|
1093
1217
|
document: SanityDocumentStub<R>,
|
|
1094
1218
|
options?: BaseMutationOptions
|
|
1095
1219
|
): Observable<SanityDocument<R>>
|
|
@@ -1101,7 +1225,7 @@ export class ObservableSanityClient {
|
|
|
1101
1225
|
* @param document Document to create
|
|
1102
1226
|
* @param options Mutation options
|
|
1103
1227
|
*/
|
|
1104
|
-
createIfNotExists<R = any
|
|
1228
|
+
createIfNotExists<R extends Record<string, any> = Record<string, any>>(
|
|
1105
1229
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1106
1230
|
options: FirstDocumentMutationOptions
|
|
1107
1231
|
): Observable<SanityDocument<R>>
|
|
@@ -1113,7 +1237,7 @@ export class ObservableSanityClient {
|
|
|
1113
1237
|
* @param document Document to create
|
|
1114
1238
|
* @param options Mutation options
|
|
1115
1239
|
*/
|
|
1116
|
-
createIfNotExists<R = any
|
|
1240
|
+
createIfNotExists<R extends Record<string, any> = Record<string, any>>(
|
|
1117
1241
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1118
1242
|
options: AllDocumentsMutationOptions
|
|
1119
1243
|
): Observable<SanityDocument<R>[]>
|
|
@@ -1125,7 +1249,7 @@ export class ObservableSanityClient {
|
|
|
1125
1249
|
* @param document Document to create
|
|
1126
1250
|
* @param options Mutation options
|
|
1127
1251
|
*/
|
|
1128
|
-
createIfNotExists<R = any
|
|
1252
|
+
createIfNotExists<R extends Record<string, any> = Record<string, any>>(
|
|
1129
1253
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1130
1254
|
options: FirstDocumentIdMutationOptions
|
|
1131
1255
|
): Observable<SingleMutationResult>
|
|
@@ -1137,7 +1261,7 @@ export class ObservableSanityClient {
|
|
|
1137
1261
|
* @param document Document to create
|
|
1138
1262
|
* @param options Mutation options
|
|
1139
1263
|
*/
|
|
1140
|
-
createIfNotExists<R = any
|
|
1264
|
+
createIfNotExists<R extends Record<string, any> = Record<string, any>>(
|
|
1141
1265
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1142
1266
|
options: AllDocumentIdsMutationOptions
|
|
1143
1267
|
): Observable<MultipleMutationResult>
|
|
@@ -1149,7 +1273,7 @@ export class ObservableSanityClient {
|
|
|
1149
1273
|
* @param document Document to create
|
|
1150
1274
|
* @param options Mutation options
|
|
1151
1275
|
*/
|
|
1152
|
-
createIfNotExists<R = any
|
|
1276
|
+
createIfNotExists<R extends Record<string, any> = Record<string, any>>(
|
|
1153
1277
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1154
1278
|
options?: BaseMutationOptions
|
|
1155
1279
|
): Observable<SanityDocument<R>>
|
|
@@ -1161,7 +1285,7 @@ export class ObservableSanityClient {
|
|
|
1161
1285
|
* @param document Document to either create or replace
|
|
1162
1286
|
* @param options Mutation options
|
|
1163
1287
|
*/
|
|
1164
|
-
createOrReplace<R = any
|
|
1288
|
+
createOrReplace<R extends Record<string, any> = Record<string, any>>(
|
|
1165
1289
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1166
1290
|
options: FirstDocumentMutationOptions
|
|
1167
1291
|
): Observable<SanityDocument<R>>
|
|
@@ -1173,7 +1297,7 @@ export class ObservableSanityClient {
|
|
|
1173
1297
|
* @param document Document to either create or replace
|
|
1174
1298
|
* @param options Mutation options
|
|
1175
1299
|
*/
|
|
1176
|
-
createOrReplace<R = any
|
|
1300
|
+
createOrReplace<R extends Record<string, any> = Record<string, any>>(
|
|
1177
1301
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1178
1302
|
options: AllDocumentsMutationOptions
|
|
1179
1303
|
): Observable<SanityDocument<R>[]>
|
|
@@ -1185,7 +1309,7 @@ export class ObservableSanityClient {
|
|
|
1185
1309
|
* @param document Document to either create or replace
|
|
1186
1310
|
* @param options Mutation options
|
|
1187
1311
|
*/
|
|
1188
|
-
createOrReplace<R = any
|
|
1312
|
+
createOrReplace<R extends Record<string, any> = Record<string, any>>(
|
|
1189
1313
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1190
1314
|
options: FirstDocumentIdMutationOptions
|
|
1191
1315
|
): Observable<SingleMutationResult>
|
|
@@ -1197,7 +1321,7 @@ export class ObservableSanityClient {
|
|
|
1197
1321
|
* @param document Document to either create or replace
|
|
1198
1322
|
* @param options Mutation options
|
|
1199
1323
|
*/
|
|
1200
|
-
createOrReplace<R = any
|
|
1324
|
+
createOrReplace<R extends Record<string, any> = Record<string, any>>(
|
|
1201
1325
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1202
1326
|
options: AllDocumentIdsMutationOptions
|
|
1203
1327
|
): Observable<MultipleMutationResult>
|
|
@@ -1209,7 +1333,7 @@ export class ObservableSanityClient {
|
|
|
1209
1333
|
* @param document Document to either create or replace
|
|
1210
1334
|
* @param options Mutation options
|
|
1211
1335
|
*/
|
|
1212
|
-
createOrReplace<R = any
|
|
1336
|
+
createOrReplace<R extends Record<string, any> = Record<string, any>>(
|
|
1213
1337
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1214
1338
|
options?: BaseMutationOptions
|
|
1215
1339
|
): Observable<SanityDocument<R>>
|
|
@@ -1221,7 +1345,10 @@ export class ObservableSanityClient {
|
|
|
1221
1345
|
* @param id Document ID to delete
|
|
1222
1346
|
* @param options Options for the mutation
|
|
1223
1347
|
*/
|
|
1224
|
-
delete<R
|
|
1348
|
+
delete<R extends Record<string, any> = Record<string, any>>(
|
|
1349
|
+
id: string,
|
|
1350
|
+
options: FirstDocumentMutationOptions
|
|
1351
|
+
): Observable<SanityDocument<R>>
|
|
1225
1352
|
|
|
1226
1353
|
/**
|
|
1227
1354
|
* Deletes a document with the given document ID.
|
|
@@ -1230,7 +1357,10 @@ export class ObservableSanityClient {
|
|
|
1230
1357
|
* @param id Document ID to delete
|
|
1231
1358
|
* @param options Options for the mutation
|
|
1232
1359
|
*/
|
|
1233
|
-
delete<R
|
|
1360
|
+
delete<R extends Record<string, any> = Record<string, any>>(
|
|
1361
|
+
id: string,
|
|
1362
|
+
options: AllDocumentsMutationOptions
|
|
1363
|
+
): Observable<SanityDocument<R>[]>
|
|
1234
1364
|
|
|
1235
1365
|
/**
|
|
1236
1366
|
* Deletes a document with the given document ID.
|
|
@@ -1257,7 +1387,10 @@ export class ObservableSanityClient {
|
|
|
1257
1387
|
* @param id Document ID to delete
|
|
1258
1388
|
* @param options Options for the mutation
|
|
1259
1389
|
*/
|
|
1260
|
-
delete<R
|
|
1390
|
+
delete<R extends Record<string, any> = Record<string, any>>(
|
|
1391
|
+
id: string,
|
|
1392
|
+
options?: BaseMutationOptions
|
|
1393
|
+
): Observable<SanityDocument<R>>
|
|
1261
1394
|
|
|
1262
1395
|
/**
|
|
1263
1396
|
* Deletes one or more documents matching the given query or document ID.
|
|
@@ -1266,7 +1399,7 @@ export class ObservableSanityClient {
|
|
|
1266
1399
|
* @param selection An object with either an `id` or `query` key defining what to delete
|
|
1267
1400
|
* @param options Options for the mutation
|
|
1268
1401
|
*/
|
|
1269
|
-
delete<R = any
|
|
1402
|
+
delete<R extends Record<string, any> = Record<string, any>>(
|
|
1270
1403
|
selection: MutationSelection,
|
|
1271
1404
|
options: FirstDocumentMutationOptions
|
|
1272
1405
|
): Observable<SanityDocument<R>>
|
|
@@ -1278,7 +1411,7 @@ export class ObservableSanityClient {
|
|
|
1278
1411
|
* @param selection An object with either an `id` or `query` key defining what to delete
|
|
1279
1412
|
* @param options Options for the mutation
|
|
1280
1413
|
*/
|
|
1281
|
-
delete<R = any
|
|
1414
|
+
delete<R extends Record<string, any> = Record<string, any>>(
|
|
1282
1415
|
selection: MutationSelection,
|
|
1283
1416
|
options: AllDocumentsMutationOptions
|
|
1284
1417
|
): Observable<SanityDocument<R>[]>
|
|
@@ -1314,7 +1447,7 @@ export class ObservableSanityClient {
|
|
|
1314
1447
|
* @param selection An object with either an `id` or `query` key defining what to delete
|
|
1315
1448
|
* @param options Options for the mutation
|
|
1316
1449
|
*/
|
|
1317
|
-
delete<R = any
|
|
1450
|
+
delete<R extends Record<string, any> = Record<string, any>>(
|
|
1318
1451
|
selection: MutationSelection,
|
|
1319
1452
|
options?: BaseMutationOptions
|
|
1320
1453
|
): Observable<SanityDocument<R>>
|
|
@@ -1326,7 +1459,7 @@ export class ObservableSanityClient {
|
|
|
1326
1459
|
* @param operations Mutation operations to execute
|
|
1327
1460
|
* @param options Mutation options
|
|
1328
1461
|
*/
|
|
1329
|
-
mutate<R = any
|
|
1462
|
+
mutate<R extends Record<string, any> = Record<string, any>>(
|
|
1330
1463
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
1331
1464
|
options: FirstDocumentMutationOptions
|
|
1332
1465
|
): Observable<SanityDocument<R>>
|
|
@@ -1338,7 +1471,7 @@ export class ObservableSanityClient {
|
|
|
1338
1471
|
* @param operations Mutation operations to execute
|
|
1339
1472
|
* @param options Mutation options
|
|
1340
1473
|
*/
|
|
1341
|
-
mutate<R = any
|
|
1474
|
+
mutate<R extends Record<string, any> = Record<string, any>>(
|
|
1342
1475
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
1343
1476
|
options: AllDocumentsMutationOptions
|
|
1344
1477
|
): Observable<SanityDocument<R>[]>
|
|
@@ -1350,7 +1483,7 @@ export class ObservableSanityClient {
|
|
|
1350
1483
|
* @param operations Mutation operations to execute
|
|
1351
1484
|
* @param options Mutation options
|
|
1352
1485
|
*/
|
|
1353
|
-
mutate<R = any
|
|
1486
|
+
mutate<R extends Record<string, any> = Record<string, any>>(
|
|
1354
1487
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
1355
1488
|
options: FirstDocumentIdMutationOptions
|
|
1356
1489
|
): Observable<SingleMutationResult>
|
|
@@ -1362,7 +1495,7 @@ export class ObservableSanityClient {
|
|
|
1362
1495
|
* @param operations Mutation operations to execute
|
|
1363
1496
|
* @param options Mutation options
|
|
1364
1497
|
*/
|
|
1365
|
-
mutate<R = any
|
|
1498
|
+
mutate<R extends Record<string, any> = Record<string, any>>(
|
|
1366
1499
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
1367
1500
|
options: AllDocumentIdsMutationOptions
|
|
1368
1501
|
): Observable<MultipleMutationResult>
|
|
@@ -1374,7 +1507,7 @@ export class ObservableSanityClient {
|
|
|
1374
1507
|
* @param operations Mutation operations to execute
|
|
1375
1508
|
* @param options Mutation options
|
|
1376
1509
|
*/
|
|
1377
|
-
mutate<R = any
|
|
1510
|
+
mutate<R extends Record<string, any> = Record<string, any>>(
|
|
1378
1511
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
1379
1512
|
options?: BaseMutationOptions
|
|
1380
1513
|
): Observable<SanityDocument<R>>
|
|
@@ -1385,14 +1518,16 @@ export class ObservableSanityClient {
|
|
|
1385
1518
|
* @param documentId Document ID to patch
|
|
1386
1519
|
* @param operations Optional object of patch operations to initialize the patch instance with
|
|
1387
1520
|
*/
|
|
1388
|
-
patch(documentId: string | MutationSelection, operations?: PatchOperations):
|
|
1521
|
+
patch(documentId: string | MutationSelection, operations?: PatchOperations): ObservablePatch
|
|
1389
1522
|
|
|
1390
1523
|
/**
|
|
1391
1524
|
* Create a new transaction of mutations
|
|
1392
1525
|
*
|
|
1393
1526
|
* @param operations Optional array of mutation operations to initialize the transaction instance with
|
|
1394
1527
|
*/
|
|
1395
|
-
transaction<R
|
|
1528
|
+
transaction<R extends Record<string, any> = Record<string, any>>(
|
|
1529
|
+
operations?: Mutation<R>[]
|
|
1530
|
+
): ObservableTransaction
|
|
1396
1531
|
|
|
1397
1532
|
// "Internals", should generally not be used externally
|
|
1398
1533
|
/**
|
|
@@ -1609,7 +1744,10 @@ export interface SanityClient {
|
|
|
1609
1744
|
* @param params Optional query parameters
|
|
1610
1745
|
* @param options Listener options
|
|
1611
1746
|
*/
|
|
1612
|
-
listen<R
|
|
1747
|
+
listen<R extends Record<string, any> = Record<string, any>>(
|
|
1748
|
+
query: string,
|
|
1749
|
+
params?: QueryParams
|
|
1750
|
+
): Observable<MutationEvent<R>>
|
|
1613
1751
|
|
|
1614
1752
|
/**
|
|
1615
1753
|
* Set up a listener that will be notified when mutations occur on documents matching the provided query/filter.
|
|
@@ -1618,7 +1756,7 @@ export interface SanityClient {
|
|
|
1618
1756
|
* @param params Optional query parameters
|
|
1619
1757
|
* @param options Listener options
|
|
1620
1758
|
*/
|
|
1621
|
-
listen<R = any
|
|
1759
|
+
listen<R extends Record<string, any> = Record<string, any>>(
|
|
1622
1760
|
query: string,
|
|
1623
1761
|
params?: QueryParams,
|
|
1624
1762
|
options?: ListenOptions
|
|
@@ -1629,7 +1767,7 @@ export interface SanityClient {
|
|
|
1629
1767
|
*
|
|
1630
1768
|
* @param query GROQ-query to perform
|
|
1631
1769
|
*/
|
|
1632
|
-
fetch<R = any
|
|
1770
|
+
fetch<R extends Record<string, any> = Record<string, any>>(query: string): Promise<R>
|
|
1633
1771
|
|
|
1634
1772
|
/**
|
|
1635
1773
|
* Perform a GROQ-query against the configured dataset.
|
|
@@ -1637,7 +1775,10 @@ export interface SanityClient {
|
|
|
1637
1775
|
* @param query GROQ-query to perform
|
|
1638
1776
|
* @param params Optional query parameters
|
|
1639
1777
|
*/
|
|
1640
|
-
fetch<R
|
|
1778
|
+
fetch<R extends Record<string, any> = Record<string, any>>(
|
|
1779
|
+
query: string,
|
|
1780
|
+
params: QueryParams
|
|
1781
|
+
): Promise<R>
|
|
1641
1782
|
|
|
1642
1783
|
/**
|
|
1643
1784
|
* Perform a GROQ-query against the configured dataset.
|
|
@@ -1646,7 +1787,7 @@ export interface SanityClient {
|
|
|
1646
1787
|
* @param params Optional query parameters
|
|
1647
1788
|
* @param options Request options
|
|
1648
1789
|
*/
|
|
1649
|
-
fetch<R = any
|
|
1790
|
+
fetch<R extends Record<string, any> = Record<string, any>>(
|
|
1650
1791
|
query: string,
|
|
1651
1792
|
params: QueryParams | undefined,
|
|
1652
1793
|
options: FilteredResponseQueryOptions
|
|
@@ -1659,7 +1800,7 @@ export interface SanityClient {
|
|
|
1659
1800
|
* @param params Optional query parameters
|
|
1660
1801
|
* @param options Request options
|
|
1661
1802
|
*/
|
|
1662
|
-
fetch<R = any
|
|
1803
|
+
fetch<R extends Record<string, any> = Record<string, any>>(
|
|
1663
1804
|
query: string,
|
|
1664
1805
|
params: QueryParams | undefined,
|
|
1665
1806
|
options: UnfilteredResponseQueryOptions
|
|
@@ -1671,7 +1812,10 @@ export interface SanityClient {
|
|
|
1671
1812
|
* @param id Document ID to fetch
|
|
1672
1813
|
* @param options Request options
|
|
1673
1814
|
*/
|
|
1674
|
-
getDocument<R
|
|
1815
|
+
getDocument<R extends Record<string, any> = Record<string, any>>(
|
|
1816
|
+
id: string,
|
|
1817
|
+
options?: {tag?: string}
|
|
1818
|
+
): Promise<SanityDocument<R> | undefined>
|
|
1675
1819
|
|
|
1676
1820
|
/**
|
|
1677
1821
|
* Fetch multiple documents in one request.
|
|
@@ -1682,7 +1826,7 @@ export interface SanityClient {
|
|
|
1682
1826
|
* @param ids Document IDs to fetch
|
|
1683
1827
|
* @param options Request options
|
|
1684
1828
|
*/
|
|
1685
|
-
getDocuments<R = any
|
|
1829
|
+
getDocuments<R extends Record<string, any> = Record<string, any>>(
|
|
1686
1830
|
ids: string[],
|
|
1687
1831
|
options?: {tag?: string}
|
|
1688
1832
|
): Promise<(SanityDocument<R> | null)[]>
|
|
@@ -1694,7 +1838,7 @@ export interface SanityClient {
|
|
|
1694
1838
|
* @param document Document to create
|
|
1695
1839
|
* @param options Mutation options
|
|
1696
1840
|
*/
|
|
1697
|
-
create<R = any
|
|
1841
|
+
create<R extends Record<string, any> = Record<string, any>>(
|
|
1698
1842
|
document: SanityDocumentStub<R>,
|
|
1699
1843
|
options: FirstDocumentMutationOptions
|
|
1700
1844
|
): Promise<SanityDocument<R>>
|
|
@@ -1706,7 +1850,7 @@ export interface SanityClient {
|
|
|
1706
1850
|
* @param document Document to create
|
|
1707
1851
|
* @param options Mutation options
|
|
1708
1852
|
*/
|
|
1709
|
-
create<R = any
|
|
1853
|
+
create<R extends Record<string, any> = Record<string, any>>(
|
|
1710
1854
|
document: SanityDocumentStub<R>,
|
|
1711
1855
|
options: AllDocumentsMutationOptions
|
|
1712
1856
|
): Promise<SanityDocument<R>[]>
|
|
@@ -1718,7 +1862,7 @@ export interface SanityClient {
|
|
|
1718
1862
|
* @param document Document to create
|
|
1719
1863
|
* @param options Mutation options
|
|
1720
1864
|
*/
|
|
1721
|
-
create<R = any
|
|
1865
|
+
create<R extends Record<string, any> = Record<string, any>>(
|
|
1722
1866
|
document: SanityDocumentStub<R>,
|
|
1723
1867
|
options: FirstDocumentIdMutationOptions
|
|
1724
1868
|
): Promise<SingleMutationResult>
|
|
@@ -1730,7 +1874,7 @@ export interface SanityClient {
|
|
|
1730
1874
|
* @param document Document to create
|
|
1731
1875
|
* @param options Mutation options
|
|
1732
1876
|
*/
|
|
1733
|
-
create<R = any
|
|
1877
|
+
create<R extends Record<string, any> = Record<string, any>>(
|
|
1734
1878
|
document: SanityDocumentStub<R>,
|
|
1735
1879
|
options: AllDocumentIdsMutationOptions
|
|
1736
1880
|
): Promise<MultipleMutationResult>
|
|
@@ -1742,7 +1886,7 @@ export interface SanityClient {
|
|
|
1742
1886
|
* @param document Document to create
|
|
1743
1887
|
* @param options Mutation options
|
|
1744
1888
|
*/
|
|
1745
|
-
create<R = any
|
|
1889
|
+
create<R extends Record<string, any> = Record<string, any>>(
|
|
1746
1890
|
document: SanityDocumentStub<R>,
|
|
1747
1891
|
options?: BaseMutationOptions
|
|
1748
1892
|
): Promise<SanityDocument<R>>
|
|
@@ -1754,7 +1898,7 @@ export interface SanityClient {
|
|
|
1754
1898
|
* @param document Document to create
|
|
1755
1899
|
* @param options Mutation options
|
|
1756
1900
|
*/
|
|
1757
|
-
createIfNotExists<R = any
|
|
1901
|
+
createIfNotExists<R extends Record<string, any> = Record<string, any>>(
|
|
1758
1902
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1759
1903
|
options: FirstDocumentMutationOptions
|
|
1760
1904
|
): Promise<SanityDocument<R>>
|
|
@@ -1766,7 +1910,7 @@ export interface SanityClient {
|
|
|
1766
1910
|
* @param document Document to create
|
|
1767
1911
|
* @param options Mutation options
|
|
1768
1912
|
*/
|
|
1769
|
-
createIfNotExists<R = any
|
|
1913
|
+
createIfNotExists<R extends Record<string, any> = Record<string, any>>(
|
|
1770
1914
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1771
1915
|
options: AllDocumentsMutationOptions
|
|
1772
1916
|
): Promise<SanityDocument<R>[]>
|
|
@@ -1778,7 +1922,7 @@ export interface SanityClient {
|
|
|
1778
1922
|
* @param document Document to create
|
|
1779
1923
|
* @param options Mutation options
|
|
1780
1924
|
*/
|
|
1781
|
-
createIfNotExists<R = any
|
|
1925
|
+
createIfNotExists<R extends Record<string, any> = Record<string, any>>(
|
|
1782
1926
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1783
1927
|
options: FirstDocumentIdMutationOptions
|
|
1784
1928
|
): Promise<SingleMutationResult>
|
|
@@ -1790,7 +1934,7 @@ export interface SanityClient {
|
|
|
1790
1934
|
* @param document Document to create
|
|
1791
1935
|
* @param options Mutation options
|
|
1792
1936
|
*/
|
|
1793
|
-
createIfNotExists<R = any
|
|
1937
|
+
createIfNotExists<R extends Record<string, any> = Record<string, any>>(
|
|
1794
1938
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1795
1939
|
options: AllDocumentIdsMutationOptions
|
|
1796
1940
|
): Promise<MultipleMutationResult>
|
|
@@ -1802,7 +1946,7 @@ export interface SanityClient {
|
|
|
1802
1946
|
* @param document Document to create
|
|
1803
1947
|
* @param options Mutation options
|
|
1804
1948
|
*/
|
|
1805
|
-
createIfNotExists<R = any
|
|
1949
|
+
createIfNotExists<R extends Record<string, any> = Record<string, any>>(
|
|
1806
1950
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1807
1951
|
options?: BaseMutationOptions
|
|
1808
1952
|
): Promise<SanityDocument<R>>
|
|
@@ -1814,7 +1958,7 @@ export interface SanityClient {
|
|
|
1814
1958
|
* @param document Document to either create or replace
|
|
1815
1959
|
* @param options Mutation options
|
|
1816
1960
|
*/
|
|
1817
|
-
createOrReplace<R = any
|
|
1961
|
+
createOrReplace<R extends Record<string, any> = Record<string, any>>(
|
|
1818
1962
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1819
1963
|
options: FirstDocumentMutationOptions
|
|
1820
1964
|
): Promise<SanityDocument<R>>
|
|
@@ -1826,7 +1970,7 @@ export interface SanityClient {
|
|
|
1826
1970
|
* @param document Document to either create or replace
|
|
1827
1971
|
* @param options Mutation options
|
|
1828
1972
|
*/
|
|
1829
|
-
createOrReplace<R = any
|
|
1973
|
+
createOrReplace<R extends Record<string, any> = Record<string, any>>(
|
|
1830
1974
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1831
1975
|
options: AllDocumentsMutationOptions
|
|
1832
1976
|
): Promise<SanityDocument<R>[]>
|
|
@@ -1838,7 +1982,7 @@ export interface SanityClient {
|
|
|
1838
1982
|
* @param document Document to either create or replace
|
|
1839
1983
|
* @param options Mutation options
|
|
1840
1984
|
*/
|
|
1841
|
-
createOrReplace<R = any
|
|
1985
|
+
createOrReplace<R extends Record<string, any> = Record<string, any>>(
|
|
1842
1986
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1843
1987
|
options: FirstDocumentIdMutationOptions
|
|
1844
1988
|
): Promise<SingleMutationResult>
|
|
@@ -1850,7 +1994,7 @@ export interface SanityClient {
|
|
|
1850
1994
|
* @param document Document to either create or replace
|
|
1851
1995
|
* @param options Mutation options
|
|
1852
1996
|
*/
|
|
1853
|
-
createOrReplace<R = any
|
|
1997
|
+
createOrReplace<R extends Record<string, any> = Record<string, any>>(
|
|
1854
1998
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1855
1999
|
options: AllDocumentIdsMutationOptions
|
|
1856
2000
|
): Promise<MultipleMutationResult>
|
|
@@ -1862,7 +2006,7 @@ export interface SanityClient {
|
|
|
1862
2006
|
* @param document Document to either create or replace
|
|
1863
2007
|
* @param options Mutation options
|
|
1864
2008
|
*/
|
|
1865
|
-
createOrReplace<R = any
|
|
2009
|
+
createOrReplace<R extends Record<string, any> = Record<string, any>>(
|
|
1866
2010
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1867
2011
|
options?: BaseMutationOptions
|
|
1868
2012
|
): Promise<SanityDocument<R>>
|
|
@@ -1874,7 +2018,10 @@ export interface SanityClient {
|
|
|
1874
2018
|
* @param id Document ID to delete
|
|
1875
2019
|
* @param options Options for the mutation
|
|
1876
2020
|
*/
|
|
1877
|
-
delete<R
|
|
2021
|
+
delete<R extends Record<string, any> = Record<string, any>>(
|
|
2022
|
+
id: string,
|
|
2023
|
+
options: FirstDocumentMutationOptions
|
|
2024
|
+
): Promise<SanityDocument<R>>
|
|
1878
2025
|
|
|
1879
2026
|
/**
|
|
1880
2027
|
* Deletes a document with the given document ID.
|
|
@@ -1883,7 +2030,10 @@ export interface SanityClient {
|
|
|
1883
2030
|
* @param id Document ID to delete
|
|
1884
2031
|
* @param options Options for the mutation
|
|
1885
2032
|
*/
|
|
1886
|
-
delete<R
|
|
2033
|
+
delete<R extends Record<string, any> = Record<string, any>>(
|
|
2034
|
+
id: string,
|
|
2035
|
+
options: AllDocumentsMutationOptions
|
|
2036
|
+
): Promise<SanityDocument<R>[]>
|
|
1887
2037
|
|
|
1888
2038
|
/**
|
|
1889
2039
|
* Deletes a document with the given document ID.
|
|
@@ -1910,7 +2060,10 @@ export interface SanityClient {
|
|
|
1910
2060
|
* @param id Document ID to delete
|
|
1911
2061
|
* @param options Options for the mutation
|
|
1912
2062
|
*/
|
|
1913
|
-
delete<R
|
|
2063
|
+
delete<R extends Record<string, any> = Record<string, any>>(
|
|
2064
|
+
id: string,
|
|
2065
|
+
options?: BaseMutationOptions
|
|
2066
|
+
): Promise<SanityDocument<R>>
|
|
1914
2067
|
|
|
1915
2068
|
/**
|
|
1916
2069
|
* Deletes one or more documents matching the given query or document ID.
|
|
@@ -1919,7 +2072,7 @@ export interface SanityClient {
|
|
|
1919
2072
|
* @param selection An object with either an `id` or `query` key defining what to delete
|
|
1920
2073
|
* @param options Options for the mutation
|
|
1921
2074
|
*/
|
|
1922
|
-
delete<R = any
|
|
2075
|
+
delete<R extends Record<string, any> = Record<string, any>>(
|
|
1923
2076
|
selection: MutationSelection,
|
|
1924
2077
|
options: FirstDocumentMutationOptions
|
|
1925
2078
|
): Promise<SanityDocument<R>>
|
|
@@ -1931,7 +2084,7 @@ export interface SanityClient {
|
|
|
1931
2084
|
* @param selection An object with either an `id` or `query` key defining what to delete
|
|
1932
2085
|
* @param options Options for the mutation
|
|
1933
2086
|
*/
|
|
1934
|
-
delete<R = any
|
|
2087
|
+
delete<R extends Record<string, any> = Record<string, any>>(
|
|
1935
2088
|
selection: MutationSelection,
|
|
1936
2089
|
options: AllDocumentsMutationOptions
|
|
1937
2090
|
): Promise<SanityDocument<R>[]>
|
|
@@ -1967,7 +2120,7 @@ export interface SanityClient {
|
|
|
1967
2120
|
* @param selection An object with either an `id` or `query` key defining what to delete
|
|
1968
2121
|
* @param options Options for the mutation
|
|
1969
2122
|
*/
|
|
1970
|
-
delete<R = any
|
|
2123
|
+
delete<R extends Record<string, any> = Record<string, any>>(
|
|
1971
2124
|
selection: MutationSelection,
|
|
1972
2125
|
options?: BaseMutationOptions
|
|
1973
2126
|
): Promise<SanityDocument<R>>
|
|
@@ -1979,7 +2132,7 @@ export interface SanityClient {
|
|
|
1979
2132
|
* @param operations Mutation operations to execute
|
|
1980
2133
|
* @param options Mutation options
|
|
1981
2134
|
*/
|
|
1982
|
-
mutate<R = any
|
|
2135
|
+
mutate<R extends Record<string, any> = Record<string, any>>(
|
|
1983
2136
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
1984
2137
|
options: FirstDocumentMutationOptions
|
|
1985
2138
|
): Promise<SanityDocument<R>>
|
|
@@ -1991,7 +2144,7 @@ export interface SanityClient {
|
|
|
1991
2144
|
* @param operations Mutation operations to execute
|
|
1992
2145
|
* @param options Mutation options
|
|
1993
2146
|
*/
|
|
1994
|
-
mutate<R = any
|
|
2147
|
+
mutate<R extends Record<string, any> = Record<string, any>>(
|
|
1995
2148
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
1996
2149
|
options: AllDocumentsMutationOptions
|
|
1997
2150
|
): Promise<SanityDocument<R>[]>
|
|
@@ -2003,7 +2156,7 @@ export interface SanityClient {
|
|
|
2003
2156
|
* @param operations Mutation operations to execute
|
|
2004
2157
|
* @param options Mutation options
|
|
2005
2158
|
*/
|
|
2006
|
-
mutate<R = any
|
|
2159
|
+
mutate<R extends Record<string, any> = Record<string, any>>(
|
|
2007
2160
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
2008
2161
|
options: FirstDocumentIdMutationOptions
|
|
2009
2162
|
): Promise<SingleMutationResult>
|
|
@@ -2015,7 +2168,7 @@ export interface SanityClient {
|
|
|
2015
2168
|
* @param operations Mutation operations to execute
|
|
2016
2169
|
* @param options Mutation options
|
|
2017
2170
|
*/
|
|
2018
|
-
mutate<R
|
|
2171
|
+
mutate<R extends Record<string, any>>(
|
|
2019
2172
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
2020
2173
|
options: AllDocumentIdsMutationOptions
|
|
2021
2174
|
): Promise<MultipleMutationResult>
|
|
@@ -2027,7 +2180,7 @@ export interface SanityClient {
|
|
|
2027
2180
|
* @param operations Mutation operations to execute
|
|
2028
2181
|
* @param options Mutation options
|
|
2029
2182
|
*/
|
|
2030
|
-
mutate<R = any
|
|
2183
|
+
mutate<R extends Record<string, any> = Record<string, any>>(
|
|
2031
2184
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
2032
2185
|
options?: BaseMutationOptions
|
|
2033
2186
|
): Promise<SanityDocument<R>>
|
|
@@ -2045,7 +2198,9 @@ export interface SanityClient {
|
|
|
2045
2198
|
*
|
|
2046
2199
|
* @param operations Optional array of mutation operations to initialize the transaction instance with
|
|
2047
2200
|
*/
|
|
2048
|
-
transaction<R
|
|
2201
|
+
transaction<R extends Record<string, any> = Record<string, any>>(
|
|
2202
|
+
operations?: Mutation<R>[]
|
|
2203
|
+
): Transaction
|
|
2049
2204
|
|
|
2050
2205
|
// "Internals", should generally not be used externally
|
|
2051
2206
|
/**
|