@sanity/client 5.0.0-esm.8 → 5.0.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 +247 -118
- package/dist/index.browser.cjs +84 -162
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +84 -162
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +85 -163
- package/dist/index.cjs.js +2 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +168 -169
- package/dist/index.js +85 -163
- package/dist/index.js.map +1 -1
- package/package.json +23 -24
- package/src/SanityClient.ts +97 -98
- package/src/assets/AssetsClient.ts +33 -8
- package/src/config.ts +1 -0
- package/src/data/dataMethods.ts +30 -28
- package/src/data/encodeQueryString.ts +17 -16
- package/src/data/listen.ts +13 -13
- package/src/data/patch.ts +17 -28
- package/src/data/transaction.ts +15 -12
- package/src/datasets/DatasetsClient.ts +1 -1
- package/src/generateHelpUrl.ts +1 -1
- package/src/http/errors.ts +9 -11
- package/src/http/request.ts +5 -5
- package/src/http/requestOptions.ts +4 -2
- package/src/projects/ProjectsClient.ts +1 -1
- package/src/types.ts +36 -30
- package/src/users/UsersClient.ts +1 -1
- 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 +3 -2
- package/umd/sanityClient.js +111 -414
- package/umd/sanityClient.min.js +3 -3
- package/src/auth/AuthClient.ts +0 -67
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
|
|
3
|
-
import {BaseError} from 'make-error'
|
|
4
3
|
import {Observable} from 'rxjs'
|
|
5
4
|
import {Requester} from 'get-it'
|
|
6
5
|
|
|
@@ -33,7 +32,7 @@ export declare class AssetsClient {
|
|
|
33
32
|
/**
|
|
34
33
|
* Uploads a file asset to the configured dataset
|
|
35
34
|
*
|
|
36
|
-
* @param assetType - Asset type (file
|
|
35
|
+
* @param assetType - Asset type (file)
|
|
37
36
|
* @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
|
|
38
37
|
* @param options - Options to use for the upload
|
|
39
38
|
*/
|
|
@@ -45,7 +44,7 @@ export declare class AssetsClient {
|
|
|
45
44
|
/**
|
|
46
45
|
* Uploads an image asset to the configured dataset
|
|
47
46
|
*
|
|
48
|
-
* @param assetType - Asset type (
|
|
47
|
+
* @param assetType - Asset type (image)
|
|
49
48
|
* @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
|
|
50
49
|
* @param options - Options to use for the upload
|
|
51
50
|
*/
|
|
@@ -54,25 +53,23 @@ export declare class AssetsClient {
|
|
|
54
53
|
body: File | Blob | Buffer | NodeJS.ReadableStream,
|
|
55
54
|
options?: UploadClientConfig
|
|
56
55
|
): Promise<SanityImageAssetDocument>
|
|
56
|
+
/**
|
|
57
|
+
* Uploads a file or an image asset to the configured dataset
|
|
58
|
+
*
|
|
59
|
+
* @param assetType - Asset type (file/image)
|
|
60
|
+
* @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
|
|
61
|
+
* @param options - Options to use for the upload
|
|
62
|
+
*/
|
|
63
|
+
upload(
|
|
64
|
+
assetType: 'file' | 'image',
|
|
65
|
+
body: File | Blob | Buffer | NodeJS.ReadableStream,
|
|
66
|
+
options?: UploadClientConfig
|
|
67
|
+
): Promise<SanityAssetDocument | SanityImageAssetDocument>
|
|
57
68
|
}
|
|
58
69
|
|
|
59
70
|
/** @internal */
|
|
60
71
|
export declare type AttributeSet = {
|
|
61
|
-
[key: string]:
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/** @internal */
|
|
65
|
-
export declare class AuthClient {
|
|
66
|
-
#private
|
|
67
|
-
constructor(client: SanityClient, httpRequest: HttpRequest)
|
|
68
|
-
/**
|
|
69
|
-
* Fetch available login providers
|
|
70
|
-
*/
|
|
71
|
-
getLoginProviders(): Promise<AuthProviderResponse>
|
|
72
|
-
/**
|
|
73
|
-
* Revoke the configured session/token
|
|
74
|
-
*/
|
|
75
|
-
logout(): Promise<void>
|
|
72
|
+
[key: string]: FIXME
|
|
76
73
|
}
|
|
77
74
|
|
|
78
75
|
/** @internal */
|
|
@@ -102,14 +99,6 @@ export declare class BasePatch {
|
|
|
102
99
|
protected selection: PatchSelection
|
|
103
100
|
protected operations: PatchOperations
|
|
104
101
|
constructor(selection: PatchSelection, operations?: PatchOperations)
|
|
105
|
-
/**
|
|
106
|
-
* DEPRECATED: Don't use.
|
|
107
|
-
* The operation is added to the current patch, ready to be commited by `commit()`
|
|
108
|
-
*
|
|
109
|
-
* @deprecated - Don't use.
|
|
110
|
-
* @param attrs - Attributes to replace
|
|
111
|
-
*/
|
|
112
|
-
replace(attrs: AttributeSet): this
|
|
113
102
|
/**
|
|
114
103
|
* Sets the given attributes to the document. Does NOT merge objects.
|
|
115
104
|
* The operation is added to the current patch, ready to be commited by `commit()`
|
|
@@ -157,21 +146,21 @@ export declare class BasePatch {
|
|
|
157
146
|
* @param selector - JSONPath expression, eg `comments[-1]` or `blocks[_key=="abc123"]`
|
|
158
147
|
* @param items - Array of items to insert/replace
|
|
159
148
|
*/
|
|
160
|
-
insert(at: 'before' | 'after' | 'replace', selector: string, items:
|
|
149
|
+
insert(at: 'before' | 'after' | 'replace', selector: string, items: FIXME[]): this
|
|
161
150
|
/**
|
|
162
151
|
* Append the given items to the array at the given JSONPath
|
|
163
152
|
*
|
|
164
153
|
* @param selector - Attribute/path to append to, eg `comments` or `person.hobbies`
|
|
165
154
|
* @param items - Array of items to append to the array
|
|
166
155
|
*/
|
|
167
|
-
append(selector: string, items:
|
|
156
|
+
append(selector: string, items: FIXME[]): this
|
|
168
157
|
/**
|
|
169
158
|
* Prepend the given items to the array at the given JSONPath
|
|
170
159
|
*
|
|
171
160
|
* @param selector - Attribute/path to prepend to, eg `comments` or `person.hobbies`
|
|
172
161
|
* @param items - Array of items to prepend to the array
|
|
173
162
|
*/
|
|
174
|
-
prepend(selector: string, items:
|
|
163
|
+
prepend(selector: string, items: FIXME[]): this
|
|
175
164
|
/**
|
|
176
165
|
* Change the contents of an array by removing existing elements and/or adding new elements.
|
|
177
166
|
*
|
|
@@ -180,7 +169,7 @@ export declare class BasePatch {
|
|
|
180
169
|
* @param deleteCount - An integer indicating the number of old array elements to remove.
|
|
181
170
|
* @param items - The elements to add to the array, beginning at the start index. If you don't specify any elements, splice() will only remove elements from the array.
|
|
182
171
|
*/
|
|
183
|
-
splice(selector: string, start: number, deleteCount?: number, items?:
|
|
172
|
+
splice(selector: string, start: number, deleteCount?: number, items?: FIXME[]): this
|
|
184
173
|
/**
|
|
185
174
|
* Adds a revision clause, preventing the document from being patched if the `_rev` property does not match the given value
|
|
186
175
|
*
|
|
@@ -199,8 +188,8 @@ export declare class BasePatch {
|
|
|
199
188
|
* Clears the patch of all operations
|
|
200
189
|
*/
|
|
201
190
|
reset(): this
|
|
202
|
-
protected _assign(op: keyof PatchOperations, props:
|
|
203
|
-
protected _set(op: keyof PatchOperations, props:
|
|
191
|
+
protected _assign(op: keyof PatchOperations, props: FIXME, merge?: boolean): this
|
|
192
|
+
protected _set(op: keyof PatchOperations, props: FIXME): this
|
|
204
193
|
}
|
|
205
194
|
|
|
206
195
|
/** @internal */
|
|
@@ -214,14 +203,14 @@ export declare class BaseTransaction {
|
|
|
214
203
|
*
|
|
215
204
|
* @param doc - Document to create. Requires a `_type` property.
|
|
216
205
|
*/
|
|
217
|
-
create<R extends Record<string,
|
|
206
|
+
create<R extends Record<string, FIXME> = Record<string, FIXME>>(doc: SanityDocumentStub<R>): this
|
|
218
207
|
/**
|
|
219
208
|
* Creates a new Sanity document. If a document with the same `_id` already exists, the create operation will be ignored.
|
|
220
209
|
* The operation is added to the current transaction, ready to be commited by `commit()`
|
|
221
210
|
*
|
|
222
211
|
* @param doc - Document to create if it does not already exist. Requires `_id` and `_type` properties.
|
|
223
212
|
*/
|
|
224
|
-
createIfNotExists<R extends Record<string,
|
|
213
|
+
createIfNotExists<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
225
214
|
doc: IdentifiedSanityDocumentStub<R>
|
|
226
215
|
): this
|
|
227
216
|
/**
|
|
@@ -230,7 +219,7 @@ export declare class BaseTransaction {
|
|
|
230
219
|
*
|
|
231
220
|
* @param doc - Document to create or replace. Requires `_id` and `_type` properties.
|
|
232
221
|
*/
|
|
233
|
-
createOrReplace<R extends Record<string,
|
|
222
|
+
createOrReplace<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
234
223
|
doc: IdentifiedSanityDocumentStub<R>
|
|
235
224
|
): this
|
|
236
225
|
/**
|
|
@@ -241,7 +230,7 @@ export declare class BaseTransaction {
|
|
|
241
230
|
*/
|
|
242
231
|
delete(documentId: string): this
|
|
243
232
|
/**
|
|
244
|
-
* Gets the current transaction ID, if
|
|
233
|
+
* Gets the current transaction ID, if FIXME
|
|
245
234
|
*/
|
|
246
235
|
transactionId(): string | undefined
|
|
247
236
|
/**
|
|
@@ -296,12 +285,12 @@ export declare interface ClientConfig {
|
|
|
296
285
|
}
|
|
297
286
|
|
|
298
287
|
/** @public */
|
|
299
|
-
export declare class ClientError extends
|
|
288
|
+
export declare class ClientError extends Error {
|
|
300
289
|
response: ErrorProps['response']
|
|
301
290
|
statusCode: ErrorProps['statusCode']
|
|
302
291
|
responseBody: ErrorProps['responseBody']
|
|
303
292
|
details: ErrorProps['details']
|
|
304
|
-
constructor(res:
|
|
293
|
+
constructor(res: FIXME)
|
|
305
294
|
}
|
|
306
295
|
|
|
307
296
|
/** @public */
|
|
@@ -382,10 +371,10 @@ export declare type DisconnectEvent = {
|
|
|
382
371
|
/** @public */
|
|
383
372
|
export declare interface ErrorProps {
|
|
384
373
|
message: string
|
|
385
|
-
response:
|
|
374
|
+
response: FIXME
|
|
386
375
|
statusCode: number
|
|
387
|
-
responseBody:
|
|
388
|
-
details:
|
|
376
|
+
responseBody: FIXME
|
|
377
|
+
details: FIXME
|
|
389
378
|
}
|
|
390
379
|
|
|
391
380
|
/** @internal */
|
|
@@ -405,6 +394,12 @@ export declare type FirstDocumentMutationOptions = BaseMutationOptions & {
|
|
|
405
394
|
returnDocuments?: true
|
|
406
395
|
}
|
|
407
396
|
|
|
397
|
+
/**
|
|
398
|
+
* Used to tag types that is set to `any` as a temporary measure, but should be replaced with proper typings in the future
|
|
399
|
+
* @internal
|
|
400
|
+
*/
|
|
401
|
+
export declare type FIXME = any
|
|
402
|
+
|
|
408
403
|
/** @public */
|
|
409
404
|
export declare type HttpRequest = {
|
|
410
405
|
defaultRequester: Requester
|
|
@@ -416,7 +411,7 @@ export declare type HttpRequestEvent<T = unknown> = ResponseEvent<T> | ProgressE
|
|
|
416
411
|
|
|
417
412
|
/** @public */
|
|
418
413
|
export declare type IdentifiedSanityDocumentStub<
|
|
419
|
-
T extends Record<string,
|
|
414
|
+
T extends Record<string, FIXME> = Record<string, FIXME>
|
|
420
415
|
> = {
|
|
421
416
|
[P in keyof T]: T[P]
|
|
422
417
|
} & {
|
|
@@ -430,15 +425,15 @@ export declare interface InitializedClientConfig extends ClientConfig {
|
|
|
430
425
|
useProjectHostname: boolean
|
|
431
426
|
useCdn: boolean
|
|
432
427
|
/**
|
|
433
|
-
* @deprecated
|
|
428
|
+
* @deprecated Internal, don't use
|
|
434
429
|
*/
|
|
435
430
|
isDefaultApi: boolean
|
|
436
431
|
/**
|
|
437
|
-
* @deprecated
|
|
432
|
+
* @deprecated Internal, don't use
|
|
438
433
|
*/
|
|
439
434
|
url: string
|
|
440
435
|
/**
|
|
441
|
-
* @deprecated
|
|
436
|
+
* @deprecated Internal, don't use
|
|
442
437
|
*/
|
|
443
438
|
cdnUrl: string
|
|
444
439
|
}
|
|
@@ -447,15 +442,15 @@ export declare interface InitializedClientConfig extends ClientConfig {
|
|
|
447
442
|
export declare type InsertPatch =
|
|
448
443
|
| {
|
|
449
444
|
before: string
|
|
450
|
-
items:
|
|
445
|
+
items: FIXME[]
|
|
451
446
|
}
|
|
452
447
|
| {
|
|
453
448
|
after: string
|
|
454
|
-
items:
|
|
449
|
+
items: FIXME[]
|
|
455
450
|
}
|
|
456
451
|
| {
|
|
457
452
|
replace: string
|
|
458
|
-
items:
|
|
453
|
+
items: FIXME[]
|
|
459
454
|
}
|
|
460
455
|
|
|
461
456
|
/**
|
|
@@ -466,8 +461,8 @@ export declare type InsertPatch =
|
|
|
466
461
|
* @param options - Listener options
|
|
467
462
|
* @internal
|
|
468
463
|
*/
|
|
469
|
-
export declare function _listen<R extends Record<string,
|
|
470
|
-
this: SanityClient,
|
|
464
|
+
export declare function _listen<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
465
|
+
this: SanityClient | ObservableSanityClient,
|
|
471
466
|
query: string,
|
|
472
467
|
params?: QueryParams
|
|
473
468
|
): Observable<MutationEvent_2<R>>
|
|
@@ -480,15 +475,15 @@ export declare function _listen<R extends Record<string, any> = Record<string, a
|
|
|
480
475
|
* @param options - Listener options
|
|
481
476
|
* @internal
|
|
482
477
|
*/
|
|
483
|
-
export declare function _listen<R extends Record<string,
|
|
484
|
-
this: SanityClient,
|
|
478
|
+
export declare function _listen<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
479
|
+
this: SanityClient | ObservableSanityClient,
|
|
485
480
|
query: string,
|
|
486
481
|
params?: QueryParams,
|
|
487
482
|
options?: ListenOptions
|
|
488
483
|
): Observable<ListenEvent<R>>
|
|
489
484
|
|
|
490
485
|
/** @public */
|
|
491
|
-
export declare type ListenEvent<R extends Record<string,
|
|
486
|
+
export declare type ListenEvent<R extends Record<string, FIXME>> =
|
|
492
487
|
| MutationEvent_2<R>
|
|
493
488
|
| ChannelErrorEvent
|
|
494
489
|
| DisconnectEvent
|
|
@@ -519,7 +514,7 @@ export declare interface MultipleMutationResult {
|
|
|
519
514
|
}
|
|
520
515
|
|
|
521
516
|
/** @public */
|
|
522
|
-
export declare type Mutation<R extends Record<string,
|
|
517
|
+
export declare type Mutation<R extends Record<string, FIXME> = Record<string, FIXME>> =
|
|
523
518
|
| {
|
|
524
519
|
create: SanityDocumentStub<R>
|
|
525
520
|
}
|
|
@@ -537,7 +532,7 @@ export declare type Mutation<R extends Record<string, any> = Record<string, any>
|
|
|
537
532
|
}
|
|
538
533
|
|
|
539
534
|
/** @public */
|
|
540
|
-
declare type MutationEvent_2<R extends Record<string,
|
|
535
|
+
declare type MutationEvent_2<R extends Record<string, FIXME> = Record<string, FIXME>> = {
|
|
541
536
|
type: 'mutation'
|
|
542
537
|
documentId: string
|
|
543
538
|
eventId: string
|
|
@@ -578,7 +573,7 @@ export declare class ObservableAssetsClient {
|
|
|
578
573
|
/**
|
|
579
574
|
* Uploads a file asset to the configured dataset
|
|
580
575
|
*
|
|
581
|
-
* @param assetType - Asset type (file
|
|
576
|
+
* @param assetType - Asset type (file)
|
|
582
577
|
* @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
|
|
583
578
|
* @param options - Options to use for the upload
|
|
584
579
|
*/
|
|
@@ -594,7 +589,7 @@ export declare class ObservableAssetsClient {
|
|
|
594
589
|
/**
|
|
595
590
|
* Uploads an image asset to the configured dataset
|
|
596
591
|
*
|
|
597
|
-
* @param assetType - Asset type (
|
|
592
|
+
* @param assetType - Asset type (image)
|
|
598
593
|
* @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
|
|
599
594
|
* @param options - Options to use for the upload
|
|
600
595
|
*/
|
|
@@ -607,20 +602,22 @@ export declare class ObservableAssetsClient {
|
|
|
607
602
|
document: SanityImageAssetDocument
|
|
608
603
|
}>
|
|
609
604
|
>
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
/** @internal */
|
|
613
|
-
export declare class ObservableAuthClient {
|
|
614
|
-
#private
|
|
615
|
-
constructor(client: ObservableSanityClient, httpRequest: HttpRequest)
|
|
616
605
|
/**
|
|
617
|
-
*
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
*
|
|
606
|
+
* Uploads a file or an image asset to the configured dataset
|
|
607
|
+
*
|
|
608
|
+
* @param assetType - Asset type (file/image)
|
|
609
|
+
* @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
|
|
610
|
+
* @param options - Options to use for the upload
|
|
622
611
|
*/
|
|
623
|
-
|
|
612
|
+
upload(
|
|
613
|
+
assetType: 'file' | 'image',
|
|
614
|
+
body: File | Blob | Buffer | NodeJS.ReadableStream,
|
|
615
|
+
options?: UploadClientConfig
|
|
616
|
+
): Observable<
|
|
617
|
+
HttpRequestEvent<{
|
|
618
|
+
document: SanityAssetDocument | SanityImageAssetDocument
|
|
619
|
+
}>
|
|
620
|
+
>
|
|
624
621
|
}
|
|
625
622
|
|
|
626
623
|
/** @internal */
|
|
@@ -682,7 +679,7 @@ export declare class ObservablePatch extends BasePatch {
|
|
|
682
679
|
*
|
|
683
680
|
* @param options - Options for the mutation operation
|
|
684
681
|
*/
|
|
685
|
-
commit<R extends Record<string,
|
|
682
|
+
commit<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
686
683
|
options: FirstDocumentMutationOptions
|
|
687
684
|
): Observable<SanityDocument<R>>
|
|
688
685
|
/**
|
|
@@ -690,7 +687,7 @@ export declare class ObservablePatch extends BasePatch {
|
|
|
690
687
|
*
|
|
691
688
|
* @param options - Options for the mutation operation
|
|
692
689
|
*/
|
|
693
|
-
commit<R extends Record<string,
|
|
690
|
+
commit<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
694
691
|
options: AllDocumentsMutationOptions
|
|
695
692
|
): Observable<SanityDocument<R>[]>
|
|
696
693
|
/**
|
|
@@ -710,7 +707,7 @@ export declare class ObservablePatch extends BasePatch {
|
|
|
710
707
|
*
|
|
711
708
|
* @param options - Options for the mutation operation
|
|
712
709
|
*/
|
|
713
|
-
commit<R extends Record<string,
|
|
710
|
+
commit<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
714
711
|
options?: BaseMutationOptions
|
|
715
712
|
): Observable<SanityDocument<R>>
|
|
716
713
|
}
|
|
@@ -738,10 +735,13 @@ export declare class ObservableProjectsClient {
|
|
|
738
735
|
export declare class ObservableSanityClient {
|
|
739
736
|
#private
|
|
740
737
|
assets: ObservableAssetsClient
|
|
741
|
-
auth: ObservableAuthClient
|
|
742
738
|
datasets: ObservableDatasetsClient
|
|
743
739
|
projects: ObservableProjectsClient
|
|
744
740
|
users: ObservableUsersClient
|
|
741
|
+
/**
|
|
742
|
+
* Instance properties
|
|
743
|
+
*/
|
|
744
|
+
listen: typeof _listen
|
|
745
745
|
constructor(httpRequest: HttpRequest, config?: ClientConfig)
|
|
746
746
|
/**
|
|
747
747
|
* Clone the client - returns a new instance
|
|
@@ -766,14 +766,14 @@ export declare class ObservableSanityClient {
|
|
|
766
766
|
*
|
|
767
767
|
* @param query - GROQ-query to perform
|
|
768
768
|
*/
|
|
769
|
-
fetch<R =
|
|
769
|
+
fetch<R = FIXME>(query: string): Observable<R>
|
|
770
770
|
/**
|
|
771
771
|
* Perform a GROQ-query against the configured dataset.
|
|
772
772
|
*
|
|
773
773
|
* @param query - GROQ-query to perform
|
|
774
774
|
* @param params - Query parameters
|
|
775
775
|
*/
|
|
776
|
-
fetch<R =
|
|
776
|
+
fetch<R = FIXME, Q = QueryParams>(query: string, params: Q): Observable<R>
|
|
777
777
|
/**
|
|
778
778
|
* Perform a GROQ-query against the configured dataset.
|
|
779
779
|
*
|
|
@@ -781,9 +781,9 @@ export declare class ObservableSanityClient {
|
|
|
781
781
|
* @param params - Query parameters
|
|
782
782
|
* @param options - Request options
|
|
783
783
|
*/
|
|
784
|
-
fetch<R =
|
|
784
|
+
fetch<R = FIXME, Q = QueryParams>(
|
|
785
785
|
query: string,
|
|
786
|
-
params:
|
|
786
|
+
params: Q | undefined,
|
|
787
787
|
options: FilteredResponseQueryOptions
|
|
788
788
|
): Observable<R>
|
|
789
789
|
/**
|
|
@@ -793,9 +793,9 @@ export declare class ObservableSanityClient {
|
|
|
793
793
|
* @param params - Query parameters
|
|
794
794
|
* @param options - Request options
|
|
795
795
|
*/
|
|
796
|
-
fetch<R =
|
|
796
|
+
fetch<R = FIXME, Q = QueryParams>(
|
|
797
797
|
query: string,
|
|
798
|
-
params:
|
|
798
|
+
params: Q | undefined,
|
|
799
799
|
options: UnfilteredResponseQueryOptions
|
|
800
800
|
): Observable<RawQueryResponse<R>>
|
|
801
801
|
/**
|
|
@@ -804,7 +804,7 @@ export declare class ObservableSanityClient {
|
|
|
804
804
|
* @param id - Document ID to fetch
|
|
805
805
|
* @param options - Request options
|
|
806
806
|
*/
|
|
807
|
-
getDocument<R extends Record<string,
|
|
807
|
+
getDocument<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
808
808
|
id: string,
|
|
809
809
|
options?: {
|
|
810
810
|
tag?: string
|
|
@@ -814,12 +814,12 @@ export declare class ObservableSanityClient {
|
|
|
814
814
|
* Fetch multiple documents in one request.
|
|
815
815
|
* Should be used sparingly - performing a query is usually a better option.
|
|
816
816
|
* The order/position of documents is preserved based on the original array of IDs.
|
|
817
|
-
* If
|
|
817
|
+
* If any of the documents are missing, they will be replaced by a `null` entry in the returned array
|
|
818
818
|
*
|
|
819
819
|
* @param ids - Document IDs to fetch
|
|
820
820
|
* @param options - Request options
|
|
821
821
|
*/
|
|
822
|
-
getDocuments<R extends Record<string,
|
|
822
|
+
getDocuments<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
823
823
|
ids: string[],
|
|
824
824
|
options?: {
|
|
825
825
|
tag?: string
|
|
@@ -832,7 +832,7 @@ export declare class ObservableSanityClient {
|
|
|
832
832
|
* @param document - Document to create
|
|
833
833
|
* @param options - Mutation options
|
|
834
834
|
*/
|
|
835
|
-
create<R extends Record<string,
|
|
835
|
+
create<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
836
836
|
document: SanityDocumentStub<R>,
|
|
837
837
|
options: FirstDocumentMutationOptions
|
|
838
838
|
): Observable<SanityDocument<R>>
|
|
@@ -843,7 +843,7 @@ export declare class ObservableSanityClient {
|
|
|
843
843
|
* @param document - Document to create
|
|
844
844
|
* @param options - Mutation options
|
|
845
845
|
*/
|
|
846
|
-
create<R extends Record<string,
|
|
846
|
+
create<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
847
847
|
document: SanityDocumentStub<R>,
|
|
848
848
|
options: AllDocumentsMutationOptions
|
|
849
849
|
): Observable<SanityDocument<R>[]>
|
|
@@ -854,7 +854,7 @@ export declare class ObservableSanityClient {
|
|
|
854
854
|
* @param document - Document to create
|
|
855
855
|
* @param options - Mutation options
|
|
856
856
|
*/
|
|
857
|
-
create<R extends Record<string,
|
|
857
|
+
create<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
858
858
|
document: SanityDocumentStub<R>,
|
|
859
859
|
options: FirstDocumentIdMutationOptions
|
|
860
860
|
): Observable<SingleMutationResult>
|
|
@@ -865,7 +865,7 @@ export declare class ObservableSanityClient {
|
|
|
865
865
|
* @param document - Document to create
|
|
866
866
|
* @param options - Mutation options
|
|
867
867
|
*/
|
|
868
|
-
create<R extends Record<string,
|
|
868
|
+
create<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
869
869
|
document: SanityDocumentStub<R>,
|
|
870
870
|
options: AllDocumentIdsMutationOptions
|
|
871
871
|
): Observable<MultipleMutationResult>
|
|
@@ -876,7 +876,7 @@ export declare class ObservableSanityClient {
|
|
|
876
876
|
* @param document - Document to create
|
|
877
877
|
* @param options - Mutation options
|
|
878
878
|
*/
|
|
879
|
-
create<R extends Record<string,
|
|
879
|
+
create<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
880
880
|
document: SanityDocumentStub<R>,
|
|
881
881
|
options?: BaseMutationOptions
|
|
882
882
|
): Observable<SanityDocument<R>>
|
|
@@ -887,7 +887,7 @@ export declare class ObservableSanityClient {
|
|
|
887
887
|
* @param document - Document to create
|
|
888
888
|
* @param options - Mutation options
|
|
889
889
|
*/
|
|
890
|
-
createIfNotExists<R extends Record<string,
|
|
890
|
+
createIfNotExists<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
891
891
|
document: IdentifiedSanityDocumentStub<R>,
|
|
892
892
|
options: FirstDocumentMutationOptions
|
|
893
893
|
): Observable<SanityDocument<R>>
|
|
@@ -898,7 +898,7 @@ export declare class ObservableSanityClient {
|
|
|
898
898
|
* @param document - Document to create
|
|
899
899
|
* @param options - Mutation options
|
|
900
900
|
*/
|
|
901
|
-
createIfNotExists<R extends Record<string,
|
|
901
|
+
createIfNotExists<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
902
902
|
document: IdentifiedSanityDocumentStub<R>,
|
|
903
903
|
options: AllDocumentsMutationOptions
|
|
904
904
|
): Observable<SanityDocument<R>[]>
|
|
@@ -909,7 +909,7 @@ export declare class ObservableSanityClient {
|
|
|
909
909
|
* @param document - Document to create
|
|
910
910
|
* @param options - Mutation options
|
|
911
911
|
*/
|
|
912
|
-
createIfNotExists<R extends Record<string,
|
|
912
|
+
createIfNotExists<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
913
913
|
document: IdentifiedSanityDocumentStub<R>,
|
|
914
914
|
options: FirstDocumentIdMutationOptions
|
|
915
915
|
): Observable<SingleMutationResult>
|
|
@@ -920,7 +920,7 @@ export declare class ObservableSanityClient {
|
|
|
920
920
|
* @param document - Document to create
|
|
921
921
|
* @param options - Mutation options
|
|
922
922
|
*/
|
|
923
|
-
createIfNotExists<R extends Record<string,
|
|
923
|
+
createIfNotExists<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
924
924
|
document: IdentifiedSanityDocumentStub<R>,
|
|
925
925
|
options: AllDocumentIdsMutationOptions
|
|
926
926
|
): Observable<MultipleMutationResult>
|
|
@@ -931,7 +931,7 @@ export declare class ObservableSanityClient {
|
|
|
931
931
|
* @param document - Document to create
|
|
932
932
|
* @param options - Mutation options
|
|
933
933
|
*/
|
|
934
|
-
createIfNotExists<R extends Record<string,
|
|
934
|
+
createIfNotExists<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
935
935
|
document: IdentifiedSanityDocumentStub<R>,
|
|
936
936
|
options?: BaseMutationOptions
|
|
937
937
|
): Observable<SanityDocument<R>>
|
|
@@ -942,7 +942,7 @@ export declare class ObservableSanityClient {
|
|
|
942
942
|
* @param document - Document to either create or replace
|
|
943
943
|
* @param options - Mutation options
|
|
944
944
|
*/
|
|
945
|
-
createOrReplace<R extends Record<string,
|
|
945
|
+
createOrReplace<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
946
946
|
document: IdentifiedSanityDocumentStub<R>,
|
|
947
947
|
options: FirstDocumentMutationOptions
|
|
948
948
|
): Observable<SanityDocument<R>>
|
|
@@ -953,7 +953,7 @@ export declare class ObservableSanityClient {
|
|
|
953
953
|
* @param document - Document to either create or replace
|
|
954
954
|
* @param options - Mutation options
|
|
955
955
|
*/
|
|
956
|
-
createOrReplace<R extends Record<string,
|
|
956
|
+
createOrReplace<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
957
957
|
document: IdentifiedSanityDocumentStub<R>,
|
|
958
958
|
options: AllDocumentsMutationOptions
|
|
959
959
|
): Observable<SanityDocument<R>[]>
|
|
@@ -964,7 +964,7 @@ export declare class ObservableSanityClient {
|
|
|
964
964
|
* @param document - Document to either create or replace
|
|
965
965
|
* @param options - Mutation options
|
|
966
966
|
*/
|
|
967
|
-
createOrReplace<R extends Record<string,
|
|
967
|
+
createOrReplace<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
968
968
|
document: IdentifiedSanityDocumentStub<R>,
|
|
969
969
|
options: FirstDocumentIdMutationOptions
|
|
970
970
|
): Observable<SingleMutationResult>
|
|
@@ -975,7 +975,7 @@ export declare class ObservableSanityClient {
|
|
|
975
975
|
* @param document - Document to either create or replace
|
|
976
976
|
* @param options - Mutation options
|
|
977
977
|
*/
|
|
978
|
-
createOrReplace<R extends Record<string,
|
|
978
|
+
createOrReplace<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
979
979
|
document: IdentifiedSanityDocumentStub<R>,
|
|
980
980
|
options: AllDocumentIdsMutationOptions
|
|
981
981
|
): Observable<MultipleMutationResult>
|
|
@@ -986,7 +986,7 @@ export declare class ObservableSanityClient {
|
|
|
986
986
|
* @param document - Document to either create or replace
|
|
987
987
|
* @param options - Mutation options
|
|
988
988
|
*/
|
|
989
|
-
createOrReplace<R extends Record<string,
|
|
989
|
+
createOrReplace<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
990
990
|
document: IdentifiedSanityDocumentStub<R>,
|
|
991
991
|
options?: BaseMutationOptions
|
|
992
992
|
): Observable<SanityDocument<R>>
|
|
@@ -997,7 +997,7 @@ export declare class ObservableSanityClient {
|
|
|
997
997
|
* @param id - Document ID to delete
|
|
998
998
|
* @param options - Options for the mutation
|
|
999
999
|
*/
|
|
1000
|
-
delete<R extends Record<string,
|
|
1000
|
+
delete<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1001
1001
|
id: string,
|
|
1002
1002
|
options: FirstDocumentMutationOptions
|
|
1003
1003
|
): Observable<SanityDocument<R>>
|
|
@@ -1008,7 +1008,7 @@ export declare class ObservableSanityClient {
|
|
|
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, FIXME> = Record<string, FIXME>>(
|
|
1012
1012
|
id: string,
|
|
1013
1013
|
options: AllDocumentsMutationOptions
|
|
1014
1014
|
): Observable<SanityDocument<R>[]>
|
|
@@ -1035,7 +1035,7 @@ export declare class ObservableSanityClient {
|
|
|
1035
1035
|
* @param id - Document ID to delete
|
|
1036
1036
|
* @param options - Options for the mutation
|
|
1037
1037
|
*/
|
|
1038
|
-
delete<R extends Record<string,
|
|
1038
|
+
delete<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1039
1039
|
id: string,
|
|
1040
1040
|
options?: BaseMutationOptions
|
|
1041
1041
|
): Observable<SanityDocument<R>>
|
|
@@ -1046,7 +1046,7 @@ export declare class ObservableSanityClient {
|
|
|
1046
1046
|
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
1047
1047
|
* @param options - Options for the mutation
|
|
1048
1048
|
*/
|
|
1049
|
-
delete<R extends Record<string,
|
|
1049
|
+
delete<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1050
1050
|
selection: MutationSelection,
|
|
1051
1051
|
options: FirstDocumentMutationOptions
|
|
1052
1052
|
): Observable<SanityDocument<R>>
|
|
@@ -1057,7 +1057,7 @@ export declare class ObservableSanityClient {
|
|
|
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, FIXME> = Record<string, FIXME>>(
|
|
1061
1061
|
selection: MutationSelection,
|
|
1062
1062
|
options: AllDocumentsMutationOptions
|
|
1063
1063
|
): Observable<SanityDocument<R>[]>
|
|
@@ -1090,7 +1090,7 @@ export declare class ObservableSanityClient {
|
|
|
1090
1090
|
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
1091
1091
|
* @param options - Options for the mutation
|
|
1092
1092
|
*/
|
|
1093
|
-
delete<R extends Record<string,
|
|
1093
|
+
delete<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1094
1094
|
selection: MutationSelection,
|
|
1095
1095
|
options?: BaseMutationOptions
|
|
1096
1096
|
): Observable<SanityDocument<R>>
|
|
@@ -1101,7 +1101,7 @@ export declare class ObservableSanityClient {
|
|
|
1101
1101
|
* @param operations - Mutation operations to execute
|
|
1102
1102
|
* @param options - Mutation options
|
|
1103
1103
|
*/
|
|
1104
|
-
mutate<R extends Record<string,
|
|
1104
|
+
mutate<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1105
1105
|
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
1106
1106
|
options: FirstDocumentMutationOptions
|
|
1107
1107
|
): Observable<SanityDocument<R>>
|
|
@@ -1112,7 +1112,7 @@ export declare class ObservableSanityClient {
|
|
|
1112
1112
|
* @param operations - Mutation operations to execute
|
|
1113
1113
|
* @param options - Mutation options
|
|
1114
1114
|
*/
|
|
1115
|
-
mutate<R extends Record<string,
|
|
1115
|
+
mutate<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1116
1116
|
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
1117
1117
|
options: AllDocumentsMutationOptions
|
|
1118
1118
|
): Observable<SanityDocument<R>[]>
|
|
@@ -1123,7 +1123,7 @@ export declare class ObservableSanityClient {
|
|
|
1123
1123
|
* @param operations - Mutation operations to execute
|
|
1124
1124
|
* @param options - Mutation options
|
|
1125
1125
|
*/
|
|
1126
|
-
mutate<R extends Record<string,
|
|
1126
|
+
mutate<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1127
1127
|
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
1128
1128
|
options: FirstDocumentIdMutationOptions
|
|
1129
1129
|
): Observable<SingleMutationResult>
|
|
@@ -1134,7 +1134,7 @@ export declare class ObservableSanityClient {
|
|
|
1134
1134
|
* @param operations - Mutation operations to execute
|
|
1135
1135
|
* @param options - Mutation options
|
|
1136
1136
|
*/
|
|
1137
|
-
mutate<R extends Record<string,
|
|
1137
|
+
mutate<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1138
1138
|
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
1139
1139
|
options: AllDocumentIdsMutationOptions
|
|
1140
1140
|
): Observable<MultipleMutationResult>
|
|
@@ -1145,7 +1145,7 @@ export declare class ObservableSanityClient {
|
|
|
1145
1145
|
* @param operations - Mutation operations to execute
|
|
1146
1146
|
* @param options - Mutation options
|
|
1147
1147
|
*/
|
|
1148
|
-
mutate<R extends Record<string,
|
|
1148
|
+
mutate<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1149
1149
|
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
1150
1150
|
options?: BaseMutationOptions
|
|
1151
1151
|
): Observable<SanityDocument<R>>
|
|
@@ -1161,7 +1161,7 @@ export declare class ObservableSanityClient {
|
|
|
1161
1161
|
*
|
|
1162
1162
|
* @param operations - Optional array of mutation operations to initialize the transaction instance with
|
|
1163
1163
|
*/
|
|
1164
|
-
transaction<R extends Record<string,
|
|
1164
|
+
transaction<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1165
1165
|
operations?: Mutation<R>[]
|
|
1166
1166
|
): ObservableTransaction
|
|
1167
1167
|
/**
|
|
@@ -1170,7 +1170,7 @@ export declare class ObservableSanityClient {
|
|
|
1170
1170
|
* @deprecated Use your own request library!
|
|
1171
1171
|
* @param options - Request options
|
|
1172
1172
|
*/
|
|
1173
|
-
request<R =
|
|
1173
|
+
request<R = FIXME>(options: RawRequestOptions): Observable<R>
|
|
1174
1174
|
}
|
|
1175
1175
|
|
|
1176
1176
|
/** @public */
|
|
@@ -1186,7 +1186,7 @@ export declare class ObservableTransaction extends BaseTransaction {
|
|
|
1186
1186
|
*
|
|
1187
1187
|
* @param options - Options for the mutation operation
|
|
1188
1188
|
*/
|
|
1189
|
-
commit<R extends Record<string,
|
|
1189
|
+
commit<R extends Record<string, FIXME>>(
|
|
1190
1190
|
options: TransactionFirstDocumentMutationOptions
|
|
1191
1191
|
): Observable<SanityDocument<R>>
|
|
1192
1192
|
/**
|
|
@@ -1194,7 +1194,7 @@ export declare class ObservableTransaction extends BaseTransaction {
|
|
|
1194
1194
|
*
|
|
1195
1195
|
* @param options - Options for the mutation operation
|
|
1196
1196
|
*/
|
|
1197
|
-
commit<R extends Record<string,
|
|
1197
|
+
commit<R extends Record<string, FIXME>>(
|
|
1198
1198
|
options: TransactionAllDocumentsMutationOptions
|
|
1199
1199
|
): Observable<SanityDocument<R>[]>
|
|
1200
1200
|
/**
|
|
@@ -1259,7 +1259,7 @@ export declare class Patch extends BasePatch {
|
|
|
1259
1259
|
*
|
|
1260
1260
|
* @param options - Options for the mutation operation
|
|
1261
1261
|
*/
|
|
1262
|
-
commit<R extends Record<string,
|
|
1262
|
+
commit<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1263
1263
|
options: FirstDocumentMutationOptions
|
|
1264
1264
|
): Promise<SanityDocument<R>>
|
|
1265
1265
|
/**
|
|
@@ -1267,7 +1267,7 @@ export declare class Patch extends BasePatch {
|
|
|
1267
1267
|
*
|
|
1268
1268
|
* @param options - Options for the mutation operation
|
|
1269
1269
|
*/
|
|
1270
|
-
commit<R extends Record<string,
|
|
1270
|
+
commit<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1271
1271
|
options: AllDocumentsMutationOptions
|
|
1272
1272
|
): Promise<SanityDocument<R>[]>
|
|
1273
1273
|
/**
|
|
@@ -1287,7 +1287,7 @@ export declare class Patch extends BasePatch {
|
|
|
1287
1287
|
*
|
|
1288
1288
|
* @param options - Options for the mutation operation
|
|
1289
1289
|
*/
|
|
1290
|
-
commit<R extends Record<string,
|
|
1290
|
+
commit<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1291
1291
|
options?: BaseMutationOptions
|
|
1292
1292
|
): Promise<SanityDocument<R>>
|
|
1293
1293
|
}
|
|
@@ -1301,13 +1301,13 @@ export declare type PatchMutationOperation = PatchOperations & MutationSelection
|
|
|
1301
1301
|
/** @internal */
|
|
1302
1302
|
export declare interface PatchOperations {
|
|
1303
1303
|
set?: {
|
|
1304
|
-
[key: string]:
|
|
1304
|
+
[key: string]: FIXME
|
|
1305
1305
|
}
|
|
1306
1306
|
setIfMissing?: {
|
|
1307
|
-
[key: string]:
|
|
1307
|
+
[key: string]: FIXME
|
|
1308
1308
|
}
|
|
1309
1309
|
diffMatchPatch?: {
|
|
1310
|
-
[key: string]:
|
|
1310
|
+
[key: string]: FIXME
|
|
1311
1311
|
}
|
|
1312
1312
|
unset?: string[]
|
|
1313
1313
|
inc?: {
|
|
@@ -1352,7 +1352,7 @@ export declare class ProjectsClient {
|
|
|
1352
1352
|
|
|
1353
1353
|
/** @public */
|
|
1354
1354
|
export declare type QueryParams = {
|
|
1355
|
-
[key: string]:
|
|
1355
|
+
[key: string]: FIXME
|
|
1356
1356
|
}
|
|
1357
1357
|
|
|
1358
1358
|
/** @internal */
|
|
@@ -1380,7 +1380,7 @@ export declare interface RawRequestOptions {
|
|
|
1380
1380
|
}
|
|
1381
1381
|
timeout?: number
|
|
1382
1382
|
proxy?: string
|
|
1383
|
-
body?:
|
|
1383
|
+
body?: FIXME
|
|
1384
1384
|
maxRedirects?: number
|
|
1385
1385
|
}
|
|
1386
1386
|
|
|
@@ -1407,8 +1407,8 @@ export declare interface RequestOptions {
|
|
|
1407
1407
|
tag?: string
|
|
1408
1408
|
headers?: Record<string, string>
|
|
1409
1409
|
method?: string
|
|
1410
|
-
query?:
|
|
1411
|
-
body?:
|
|
1410
|
+
query?: FIXME
|
|
1411
|
+
body?: FIXME
|
|
1412
1412
|
}
|
|
1413
1413
|
|
|
1414
1414
|
/** @public */
|
|
@@ -1439,7 +1439,6 @@ export declare interface SanityAssetDocument extends SanityDocument {
|
|
|
1439
1439
|
export declare class SanityClient {
|
|
1440
1440
|
#private
|
|
1441
1441
|
assets: AssetsClient
|
|
1442
|
-
auth: AuthClient
|
|
1443
1442
|
datasets: DatasetsClient
|
|
1444
1443
|
projects: ProjectsClient
|
|
1445
1444
|
users: UsersClient
|
|
@@ -1475,14 +1474,14 @@ export declare class SanityClient {
|
|
|
1475
1474
|
*
|
|
1476
1475
|
* @param query - GROQ-query to perform
|
|
1477
1476
|
*/
|
|
1478
|
-
fetch<R =
|
|
1477
|
+
fetch<R = FIXME>(query: string): Promise<R>
|
|
1479
1478
|
/**
|
|
1480
1479
|
* Perform a GROQ-query against the configured dataset.
|
|
1481
1480
|
*
|
|
1482
1481
|
* @param query - GROQ-query to perform
|
|
1483
1482
|
* @param params - Optional query parameters
|
|
1484
1483
|
*/
|
|
1485
|
-
fetch<R =
|
|
1484
|
+
fetch<R = FIXME, Q = QueryParams>(query: string, params: Q): Promise<R>
|
|
1486
1485
|
/**
|
|
1487
1486
|
* Perform a GROQ-query against the configured dataset.
|
|
1488
1487
|
*
|
|
@@ -1490,9 +1489,9 @@ export declare class SanityClient {
|
|
|
1490
1489
|
* @param params - Optional query parameters
|
|
1491
1490
|
* @param options - Request options
|
|
1492
1491
|
*/
|
|
1493
|
-
fetch<R =
|
|
1492
|
+
fetch<R = FIXME, Q = QueryParams>(
|
|
1494
1493
|
query: string,
|
|
1495
|
-
params:
|
|
1494
|
+
params: Q | undefined,
|
|
1496
1495
|
options: FilteredResponseQueryOptions
|
|
1497
1496
|
): Promise<R>
|
|
1498
1497
|
/**
|
|
@@ -1502,9 +1501,9 @@ export declare class SanityClient {
|
|
|
1502
1501
|
* @param params - Optional query parameters
|
|
1503
1502
|
* @param options - Request options
|
|
1504
1503
|
*/
|
|
1505
|
-
fetch<R =
|
|
1504
|
+
fetch<R = FIXME, Q = QueryParams>(
|
|
1506
1505
|
query: string,
|
|
1507
|
-
params:
|
|
1506
|
+
params: Q | undefined,
|
|
1508
1507
|
options: UnfilteredResponseQueryOptions
|
|
1509
1508
|
): Promise<RawQueryResponse<R>>
|
|
1510
1509
|
/**
|
|
@@ -1513,7 +1512,7 @@ export declare class SanityClient {
|
|
|
1513
1512
|
* @param id - Document ID to fetch
|
|
1514
1513
|
* @param options - Request options
|
|
1515
1514
|
*/
|
|
1516
|
-
getDocument<R extends Record<string,
|
|
1515
|
+
getDocument<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1517
1516
|
id: string,
|
|
1518
1517
|
options?: {
|
|
1519
1518
|
tag?: string
|
|
@@ -1523,12 +1522,12 @@ export declare class SanityClient {
|
|
|
1523
1522
|
* Fetch multiple documents in one request.
|
|
1524
1523
|
* Should be used sparingly - performing a query is usually a better option.
|
|
1525
1524
|
* The order/position of documents is preserved based on the original array of IDs.
|
|
1526
|
-
* If
|
|
1525
|
+
* If any of the documents are missing, they will be replaced by a `null` entry in the returned array
|
|
1527
1526
|
*
|
|
1528
1527
|
* @param ids - Document IDs to fetch
|
|
1529
1528
|
* @param options - Request options
|
|
1530
1529
|
*/
|
|
1531
|
-
getDocuments<R extends Record<string,
|
|
1530
|
+
getDocuments<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1532
1531
|
ids: string[],
|
|
1533
1532
|
options?: {
|
|
1534
1533
|
tag?: string
|
|
@@ -1541,7 +1540,7 @@ export declare class SanityClient {
|
|
|
1541
1540
|
* @param document - Document to create
|
|
1542
1541
|
* @param options - Mutation options
|
|
1543
1542
|
*/
|
|
1544
|
-
create<R extends Record<string,
|
|
1543
|
+
create<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1545
1544
|
document: SanityDocumentStub<R>,
|
|
1546
1545
|
options: FirstDocumentMutationOptions
|
|
1547
1546
|
): Promise<SanityDocument<R>>
|
|
@@ -1552,7 +1551,7 @@ export declare class SanityClient {
|
|
|
1552
1551
|
* @param document - Document to create
|
|
1553
1552
|
* @param options - Mutation options
|
|
1554
1553
|
*/
|
|
1555
|
-
create<R extends Record<string,
|
|
1554
|
+
create<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1556
1555
|
document: SanityDocumentStub<R>,
|
|
1557
1556
|
options: AllDocumentsMutationOptions
|
|
1558
1557
|
): Promise<SanityDocument<R>[]>
|
|
@@ -1563,7 +1562,7 @@ export declare class SanityClient {
|
|
|
1563
1562
|
* @param document - Document to create
|
|
1564
1563
|
* @param options - Mutation options
|
|
1565
1564
|
*/
|
|
1566
|
-
create<R extends Record<string,
|
|
1565
|
+
create<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1567
1566
|
document: SanityDocumentStub<R>,
|
|
1568
1567
|
options: FirstDocumentIdMutationOptions
|
|
1569
1568
|
): Promise<SingleMutationResult>
|
|
@@ -1574,7 +1573,7 @@ export declare class SanityClient {
|
|
|
1574
1573
|
* @param document - Document to create
|
|
1575
1574
|
* @param options - Mutation options
|
|
1576
1575
|
*/
|
|
1577
|
-
create<R extends Record<string,
|
|
1576
|
+
create<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1578
1577
|
document: SanityDocumentStub<R>,
|
|
1579
1578
|
options: AllDocumentIdsMutationOptions
|
|
1580
1579
|
): Promise<MultipleMutationResult>
|
|
@@ -1585,7 +1584,7 @@ export declare class SanityClient {
|
|
|
1585
1584
|
* @param document - Document to create
|
|
1586
1585
|
* @param options - Mutation options
|
|
1587
1586
|
*/
|
|
1588
|
-
create<R extends Record<string,
|
|
1587
|
+
create<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1589
1588
|
document: SanityDocumentStub<R>,
|
|
1590
1589
|
options?: BaseMutationOptions
|
|
1591
1590
|
): Promise<SanityDocument<R>>
|
|
@@ -1596,7 +1595,7 @@ export declare class SanityClient {
|
|
|
1596
1595
|
* @param document - Document to create
|
|
1597
1596
|
* @param options - Mutation options
|
|
1598
1597
|
*/
|
|
1599
|
-
createIfNotExists<R extends Record<string,
|
|
1598
|
+
createIfNotExists<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1600
1599
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1601
1600
|
options: FirstDocumentMutationOptions
|
|
1602
1601
|
): Promise<SanityDocument<R>>
|
|
@@ -1607,7 +1606,7 @@ export declare class SanityClient {
|
|
|
1607
1606
|
* @param document - Document to create
|
|
1608
1607
|
* @param options - Mutation options
|
|
1609
1608
|
*/
|
|
1610
|
-
createIfNotExists<R extends Record<string,
|
|
1609
|
+
createIfNotExists<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1611
1610
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1612
1611
|
options: AllDocumentsMutationOptions
|
|
1613
1612
|
): Promise<SanityDocument<R>[]>
|
|
@@ -1618,7 +1617,7 @@ export declare class SanityClient {
|
|
|
1618
1617
|
* @param document - Document to create
|
|
1619
1618
|
* @param options - Mutation options
|
|
1620
1619
|
*/
|
|
1621
|
-
createIfNotExists<R extends Record<string,
|
|
1620
|
+
createIfNotExists<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1622
1621
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1623
1622
|
options: FirstDocumentIdMutationOptions
|
|
1624
1623
|
): Promise<SingleMutationResult>
|
|
@@ -1629,7 +1628,7 @@ export declare class SanityClient {
|
|
|
1629
1628
|
* @param document - Document to create
|
|
1630
1629
|
* @param options - Mutation options
|
|
1631
1630
|
*/
|
|
1632
|
-
createIfNotExists<R extends Record<string,
|
|
1631
|
+
createIfNotExists<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1633
1632
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1634
1633
|
options: AllDocumentIdsMutationOptions
|
|
1635
1634
|
): Promise<MultipleMutationResult>
|
|
@@ -1640,7 +1639,7 @@ export declare class SanityClient {
|
|
|
1640
1639
|
* @param document - Document to create
|
|
1641
1640
|
* @param options - Mutation options
|
|
1642
1641
|
*/
|
|
1643
|
-
createIfNotExists<R extends Record<string,
|
|
1642
|
+
createIfNotExists<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1644
1643
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1645
1644
|
options?: BaseMutationOptions
|
|
1646
1645
|
): Promise<SanityDocument<R>>
|
|
@@ -1651,7 +1650,7 @@ export declare class SanityClient {
|
|
|
1651
1650
|
* @param document - Document to either create or replace
|
|
1652
1651
|
* @param options - Mutation options
|
|
1653
1652
|
*/
|
|
1654
|
-
createOrReplace<R extends Record<string,
|
|
1653
|
+
createOrReplace<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1655
1654
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1656
1655
|
options: FirstDocumentMutationOptions
|
|
1657
1656
|
): Promise<SanityDocument<R>>
|
|
@@ -1662,7 +1661,7 @@ export declare class SanityClient {
|
|
|
1662
1661
|
* @param document - Document to either create or replace
|
|
1663
1662
|
* @param options - Mutation options
|
|
1664
1663
|
*/
|
|
1665
|
-
createOrReplace<R extends Record<string,
|
|
1664
|
+
createOrReplace<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1666
1665
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1667
1666
|
options: AllDocumentsMutationOptions
|
|
1668
1667
|
): Promise<SanityDocument<R>[]>
|
|
@@ -1673,7 +1672,7 @@ export declare class SanityClient {
|
|
|
1673
1672
|
* @param document - Document to either create or replace
|
|
1674
1673
|
* @param options - Mutation options
|
|
1675
1674
|
*/
|
|
1676
|
-
createOrReplace<R extends Record<string,
|
|
1675
|
+
createOrReplace<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1677
1676
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1678
1677
|
options: FirstDocumentIdMutationOptions
|
|
1679
1678
|
): Promise<SingleMutationResult>
|
|
@@ -1684,7 +1683,7 @@ export declare class SanityClient {
|
|
|
1684
1683
|
* @param document - Document to either create or replace
|
|
1685
1684
|
* @param options - Mutation options
|
|
1686
1685
|
*/
|
|
1687
|
-
createOrReplace<R extends Record<string,
|
|
1686
|
+
createOrReplace<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1688
1687
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1689
1688
|
options: AllDocumentIdsMutationOptions
|
|
1690
1689
|
): Promise<MultipleMutationResult>
|
|
@@ -1695,7 +1694,7 @@ export declare class SanityClient {
|
|
|
1695
1694
|
* @param document - Document to either create or replace
|
|
1696
1695
|
* @param options - Mutation options
|
|
1697
1696
|
*/
|
|
1698
|
-
createOrReplace<R extends Record<string,
|
|
1697
|
+
createOrReplace<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1699
1698
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1700
1699
|
options?: BaseMutationOptions
|
|
1701
1700
|
): Promise<SanityDocument<R>>
|
|
@@ -1706,7 +1705,7 @@ export declare class SanityClient {
|
|
|
1706
1705
|
* @param id - Document ID to delete
|
|
1707
1706
|
* @param options - Options for the mutation
|
|
1708
1707
|
*/
|
|
1709
|
-
delete<R extends Record<string,
|
|
1708
|
+
delete<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1710
1709
|
id: string,
|
|
1711
1710
|
options: FirstDocumentMutationOptions
|
|
1712
1711
|
): Promise<SanityDocument<R>>
|
|
@@ -1717,7 +1716,7 @@ export declare class SanityClient {
|
|
|
1717
1716
|
* @param id - Document ID to delete
|
|
1718
1717
|
* @param options - Options for the mutation
|
|
1719
1718
|
*/
|
|
1720
|
-
delete<R extends Record<string,
|
|
1719
|
+
delete<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1721
1720
|
id: string,
|
|
1722
1721
|
options: AllDocumentsMutationOptions
|
|
1723
1722
|
): Promise<SanityDocument<R>[]>
|
|
@@ -1744,7 +1743,7 @@ export declare class SanityClient {
|
|
|
1744
1743
|
* @param id - Document ID to delete
|
|
1745
1744
|
* @param options - Options for the mutation
|
|
1746
1745
|
*/
|
|
1747
|
-
delete<R extends Record<string,
|
|
1746
|
+
delete<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1748
1747
|
id: string,
|
|
1749
1748
|
options?: BaseMutationOptions
|
|
1750
1749
|
): Promise<SanityDocument<R>>
|
|
@@ -1755,7 +1754,7 @@ export declare class SanityClient {
|
|
|
1755
1754
|
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
1756
1755
|
* @param options - Options for the mutation
|
|
1757
1756
|
*/
|
|
1758
|
-
delete<R extends Record<string,
|
|
1757
|
+
delete<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1759
1758
|
selection: MutationSelection,
|
|
1760
1759
|
options: FirstDocumentMutationOptions
|
|
1761
1760
|
): Promise<SanityDocument<R>>
|
|
@@ -1766,7 +1765,7 @@ export declare class SanityClient {
|
|
|
1766
1765
|
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
1767
1766
|
* @param options - Options for the mutation
|
|
1768
1767
|
*/
|
|
1769
|
-
delete<R extends Record<string,
|
|
1768
|
+
delete<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1770
1769
|
selection: MutationSelection,
|
|
1771
1770
|
options: AllDocumentsMutationOptions
|
|
1772
1771
|
): Promise<SanityDocument<R>[]>
|
|
@@ -1799,7 +1798,7 @@ export declare class SanityClient {
|
|
|
1799
1798
|
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
1800
1799
|
* @param options - Options for the mutation
|
|
1801
1800
|
*/
|
|
1802
|
-
delete<R extends Record<string,
|
|
1801
|
+
delete<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1803
1802
|
selection: MutationSelection,
|
|
1804
1803
|
options?: BaseMutationOptions
|
|
1805
1804
|
): Promise<SanityDocument<R>>
|
|
@@ -1810,7 +1809,7 @@ export declare class SanityClient {
|
|
|
1810
1809
|
* @param operations - Mutation operations to execute
|
|
1811
1810
|
* @param options - Mutation options
|
|
1812
1811
|
*/
|
|
1813
|
-
mutate<R extends Record<string,
|
|
1812
|
+
mutate<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1814
1813
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
1815
1814
|
options: FirstDocumentMutationOptions
|
|
1816
1815
|
): Promise<SanityDocument<R>>
|
|
@@ -1821,7 +1820,7 @@ export declare class SanityClient {
|
|
|
1821
1820
|
* @param operations - Mutation operations to execute
|
|
1822
1821
|
* @param options - Mutation options
|
|
1823
1822
|
*/
|
|
1824
|
-
mutate<R extends Record<string,
|
|
1823
|
+
mutate<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1825
1824
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
1826
1825
|
options: AllDocumentsMutationOptions
|
|
1827
1826
|
): Promise<SanityDocument<R>[]>
|
|
@@ -1832,7 +1831,7 @@ export declare class SanityClient {
|
|
|
1832
1831
|
* @param operations - Mutation operations to execute
|
|
1833
1832
|
* @param options - Mutation options
|
|
1834
1833
|
*/
|
|
1835
|
-
mutate<R extends Record<string,
|
|
1834
|
+
mutate<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1836
1835
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
1837
1836
|
options: FirstDocumentIdMutationOptions
|
|
1838
1837
|
): Promise<SingleMutationResult>
|
|
@@ -1843,7 +1842,7 @@ export declare class SanityClient {
|
|
|
1843
1842
|
* @param operations - Mutation operations to execute
|
|
1844
1843
|
* @param options - Mutation options
|
|
1845
1844
|
*/
|
|
1846
|
-
mutate<R extends Record<string,
|
|
1845
|
+
mutate<R extends Record<string, FIXME>>(
|
|
1847
1846
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
1848
1847
|
options: AllDocumentIdsMutationOptions
|
|
1849
1848
|
): Promise<MultipleMutationResult>
|
|
@@ -1854,7 +1853,7 @@ export declare class SanityClient {
|
|
|
1854
1853
|
* @param operations - Mutation operations to execute
|
|
1855
1854
|
* @param options - Mutation options
|
|
1856
1855
|
*/
|
|
1857
|
-
mutate<R extends Record<string,
|
|
1856
|
+
mutate<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1858
1857
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
1859
1858
|
options?: BaseMutationOptions
|
|
1860
1859
|
): Promise<SanityDocument<R>>
|
|
@@ -1870,7 +1869,7 @@ export declare class SanityClient {
|
|
|
1870
1869
|
*
|
|
1871
1870
|
* @param operations - Optional array of mutation operations to initialize the transaction instance with
|
|
1872
1871
|
*/
|
|
1873
|
-
transaction<R extends Record<string,
|
|
1872
|
+
transaction<R extends Record<string, FIXME> = Record<string, FIXME>>(
|
|
1874
1873
|
operations?: Mutation<R>[]
|
|
1875
1874
|
): Transaction
|
|
1876
1875
|
/**
|
|
@@ -1879,7 +1878,7 @@ export declare class SanityClient {
|
|
|
1879
1878
|
* @deprecated Use your own request library!
|
|
1880
1879
|
* @param options - Request options
|
|
1881
1880
|
*/
|
|
1882
|
-
request<R =
|
|
1881
|
+
request<R = FIXME>(options: RawRequestOptions): Promise<R>
|
|
1883
1882
|
/**
|
|
1884
1883
|
* DEPRECATED: Perform an HTTP request a `/data` sub-endpoint
|
|
1885
1884
|
*
|
|
@@ -1888,11 +1887,11 @@ export declare class SanityClient {
|
|
|
1888
1887
|
* @param body - Request body
|
|
1889
1888
|
* @param options - Request options
|
|
1890
1889
|
*/
|
|
1891
|
-
dataRequest(endpoint: string, body: unknown, options?: BaseMutationOptions): Promise<
|
|
1890
|
+
dataRequest(endpoint: string, body: unknown, options?: BaseMutationOptions): Promise<FIXME>
|
|
1892
1891
|
}
|
|
1893
1892
|
|
|
1894
1893
|
/** @internal */
|
|
1895
|
-
export declare type SanityDocument<T extends Record<string,
|
|
1894
|
+
export declare type SanityDocument<T extends Record<string, FIXME> = Record<string, FIXME>> = {
|
|
1896
1895
|
[P in keyof T]: T[P]
|
|
1897
1896
|
} & {
|
|
1898
1897
|
_id: string
|
|
@@ -1903,7 +1902,7 @@ export declare type SanityDocument<T extends Record<string, any> = Record<string
|
|
|
1903
1902
|
}
|
|
1904
1903
|
|
|
1905
1904
|
/** @public */
|
|
1906
|
-
export declare type SanityDocumentStub<T extends Record<string,
|
|
1905
|
+
export declare type SanityDocumentStub<T extends Record<string, FIXME> = Record<string, FIXME>> = {
|
|
1907
1906
|
[P in keyof T]: T[P]
|
|
1908
1907
|
} & {
|
|
1909
1908
|
_type: string
|
|
@@ -1935,11 +1934,11 @@ export declare interface SanityImageAssetDocument extends SanityAssetDocument {
|
|
|
1935
1934
|
}
|
|
1936
1935
|
image?: {
|
|
1937
1936
|
_type: 'sanity.imageExifTags'
|
|
1938
|
-
[key: string]:
|
|
1937
|
+
[key: string]: FIXME
|
|
1939
1938
|
}
|
|
1940
1939
|
exif?: {
|
|
1941
1940
|
_type: 'sanity.imageExifMetadata'
|
|
1942
|
-
[key: string]:
|
|
1941
|
+
[key: string]: FIXME
|
|
1943
1942
|
}
|
|
1944
1943
|
}
|
|
1945
1944
|
}
|
|
@@ -1999,12 +1998,12 @@ export declare interface SanityUser {
|
|
|
1999
1998
|
}
|
|
2000
1999
|
|
|
2001
2000
|
/** @public */
|
|
2002
|
-
export declare class ServerError extends
|
|
2001
|
+
export declare class ServerError extends Error {
|
|
2003
2002
|
response: ErrorProps['response']
|
|
2004
2003
|
statusCode: ErrorProps['statusCode']
|
|
2005
2004
|
responseBody: ErrorProps['responseBody']
|
|
2006
2005
|
details: ErrorProps['details']
|
|
2007
|
-
constructor(res:
|
|
2006
|
+
constructor(res: FIXME)
|
|
2008
2007
|
}
|
|
2009
2008
|
|
|
2010
2009
|
/** @internal */
|
|
@@ -2030,7 +2029,7 @@ export declare class Transaction extends BaseTransaction {
|
|
|
2030
2029
|
*
|
|
2031
2030
|
* @param options - Options for the mutation operation
|
|
2032
2031
|
*/
|
|
2033
|
-
commit<R extends Record<string,
|
|
2032
|
+
commit<R extends Record<string, FIXME>>(
|
|
2034
2033
|
options: TransactionFirstDocumentMutationOptions
|
|
2035
2034
|
): Promise<SanityDocument<R>>
|
|
2036
2035
|
/**
|
|
@@ -2038,7 +2037,7 @@ export declare class Transaction extends BaseTransaction {
|
|
|
2038
2037
|
*
|
|
2039
2038
|
* @param options - Options for the mutation operation
|
|
2040
2039
|
*/
|
|
2041
|
-
commit<R extends Record<string,
|
|
2040
|
+
commit<R extends Record<string, FIXME>>(
|
|
2042
2041
|
options: TransactionAllDocumentsMutationOptions
|
|
2043
2042
|
): Promise<SanityDocument<R>[]>
|
|
2044
2043
|
/**
|