@sanity/client 5.0.0-esm.3 → 5.0.0-esm.4
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 +442 -17
- package/dist/index.browser.cjs +9 -7
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +9 -7
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +10 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +297 -213
- package/dist/index.js +10 -8
- package/dist/index.js.map +1 -1
- package/package.json +24 -21
- package/src/SanityClient.ts +172 -167
- package/src/assets/AssetsClient.ts +14 -12
- package/src/auth/AuthClient.ts +2 -0
- package/src/config.ts +2 -2
- package/src/data/dataMethods.ts +4 -1
- package/src/data/listen.ts +6 -6
- package/src/data/patch.ts +34 -31
- package/src/data/transaction.ts +5 -0
- package/src/datasets/DatasetsClient.ts +2 -0
- package/src/http/errors.ts +2 -0
- package/src/http/request.ts +1 -3
- package/src/index.browser.ts +3 -3
- package/src/index.ts +3 -42
- package/src/projects/ProjectsClient.ts +2 -0
- package/src/types.ts +60 -0
- package/src/users/UsersClient.ts +2 -2
- package/src/validators.ts +4 -2
- package/umd/sanityClient.js +5449 -5470
- package/umd/sanityClient.min.js +12 -12
package/dist/index.d.ts
CHANGED
|
@@ -4,16 +4,19 @@ import {BaseError} from 'make-error'
|
|
|
4
4
|
import {Observable} from 'rxjs'
|
|
5
5
|
import {Requester} from 'get-it'
|
|
6
6
|
|
|
7
|
+
/** @internal */
|
|
7
8
|
export declare type AllDocumentIdsMutationOptions = BaseMutationOptions & {
|
|
8
9
|
returnFirst: false
|
|
9
10
|
returnDocuments: false
|
|
10
11
|
}
|
|
11
12
|
|
|
13
|
+
/** @internal */
|
|
12
14
|
export declare type AllDocumentsMutationOptions = BaseMutationOptions & {
|
|
13
15
|
returnFirst: false
|
|
14
16
|
returnDocuments?: true
|
|
15
17
|
}
|
|
16
18
|
|
|
19
|
+
/** @public */
|
|
17
20
|
export declare type AssetMetadataType =
|
|
18
21
|
| 'location'
|
|
19
22
|
| 'exif'
|
|
@@ -23,15 +26,16 @@ export declare type AssetMetadataType =
|
|
|
23
26
|
| 'blurhash'
|
|
24
27
|
| 'none'
|
|
25
28
|
|
|
29
|
+
/** @internal */
|
|
26
30
|
export declare class AssetsClient {
|
|
27
31
|
#private
|
|
28
32
|
constructor(client: SanityClient, httpRequest: HttpRequest)
|
|
29
33
|
/**
|
|
30
34
|
* Uploads a file asset to the configured dataset
|
|
31
35
|
*
|
|
32
|
-
* @param assetType Asset type (file/image)
|
|
33
|
-
* @param body Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
|
|
34
|
-
* @param options Options to use for the upload
|
|
36
|
+
* @param assetType - Asset type (file/image)
|
|
37
|
+
* @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
|
|
38
|
+
* @param options - Options to use for the upload
|
|
35
39
|
*/
|
|
36
40
|
upload(
|
|
37
41
|
assetType: 'file',
|
|
@@ -41,9 +45,9 @@ export declare class AssetsClient {
|
|
|
41
45
|
/**
|
|
42
46
|
* Uploads an image asset to the configured dataset
|
|
43
47
|
*
|
|
44
|
-
* @param assetType Asset type (file/image)
|
|
45
|
-
* @param body Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
|
|
46
|
-
* @param options Options to use for the upload
|
|
48
|
+
* @param assetType - Asset type (file/image)
|
|
49
|
+
* @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
|
|
50
|
+
* @param options - Options to use for the upload
|
|
47
51
|
*/
|
|
48
52
|
upload(
|
|
49
53
|
assetType: 'image',
|
|
@@ -52,10 +56,12 @@ export declare class AssetsClient {
|
|
|
52
56
|
): Promise<SanityImageAssetDocument>
|
|
53
57
|
}
|
|
54
58
|
|
|
59
|
+
/** @internal */
|
|
55
60
|
export declare type AttributeSet = {
|
|
56
61
|
[key: string]: any
|
|
57
62
|
}
|
|
58
63
|
|
|
64
|
+
/** @internal */
|
|
59
65
|
export declare class AuthClient {
|
|
60
66
|
#private
|
|
61
67
|
constructor(client: SanityClient, httpRequest: HttpRequest)
|
|
@@ -69,16 +75,19 @@ export declare class AuthClient {
|
|
|
69
75
|
logout(): Promise<void>
|
|
70
76
|
}
|
|
71
77
|
|
|
78
|
+
/** @internal */
|
|
72
79
|
export declare interface AuthProvider {
|
|
73
80
|
name: string
|
|
74
81
|
title: string
|
|
75
82
|
url: string
|
|
76
83
|
}
|
|
77
84
|
|
|
85
|
+
/** @internal */
|
|
78
86
|
export declare type AuthProviderResponse = {
|
|
79
87
|
providers: AuthProvider[]
|
|
80
88
|
}
|
|
81
89
|
|
|
90
|
+
/** @internal */
|
|
82
91
|
export declare type BaseMutationOptions = RequestOptions & {
|
|
83
92
|
visibility?: 'sync' | 'async' | 'deferred'
|
|
84
93
|
returnDocuments?: boolean
|
|
@@ -88,6 +97,7 @@ export declare type BaseMutationOptions = RequestOptions & {
|
|
|
88
97
|
skipCrossDatasetReferenceValidation?: boolean
|
|
89
98
|
}
|
|
90
99
|
|
|
100
|
+
/** @internal */
|
|
91
101
|
export declare class BasePatch {
|
|
92
102
|
protected selection: PatchSelection
|
|
93
103
|
protected operations: PatchOperations
|
|
@@ -96,85 +106,85 @@ export declare class BasePatch {
|
|
|
96
106
|
* DEPRECATED: Don't use.
|
|
97
107
|
* The operation is added to the current patch, ready to be commited by `commit()`
|
|
98
108
|
*
|
|
99
|
-
* @deprecated
|
|
100
|
-
* @param attrs Attributes to replace
|
|
109
|
+
* @deprecated - Don't use.
|
|
110
|
+
* @param attrs - Attributes to replace
|
|
101
111
|
*/
|
|
102
112
|
replace(attrs: AttributeSet): this
|
|
103
113
|
/**
|
|
104
114
|
* Sets the given attributes to the document. Does NOT merge objects.
|
|
105
115
|
* The operation is added to the current patch, ready to be commited by `commit()`
|
|
106
116
|
*
|
|
107
|
-
* @param attrs Attributes to set. To set a deep attribute, use JSONMatch, eg: {"nested.prop": "value"}
|
|
117
|
+
* @param attrs - Attributes to set. To set a deep attribute, use JSONMatch, eg: \{"nested.prop": "value"\}
|
|
108
118
|
*/
|
|
109
119
|
set(attrs: AttributeSet): this
|
|
110
120
|
/**
|
|
111
121
|
* Sets the given attributes to the document if they are not currently set. Does NOT merge objects.
|
|
112
122
|
* The operation is added to the current patch, ready to be commited by `commit()`
|
|
113
123
|
*
|
|
114
|
-
* @param attrs Attributes to set. To set a deep attribute, use JSONMatch, eg: {"nested.prop": "value"}
|
|
124
|
+
* @param attrs - Attributes to set. To set a deep attribute, use JSONMatch, eg: \{"nested.prop": "value"\}
|
|
115
125
|
*/
|
|
116
126
|
setIfMissing(attrs: AttributeSet): this
|
|
117
127
|
/**
|
|
118
128
|
* Performs a "diff-match-patch" operation on the string attributes provided.
|
|
119
129
|
* The operation is added to the current patch, ready to be commited by `commit()`
|
|
120
130
|
*
|
|
121
|
-
* @param attrs Attributes to perform operation on. To set a deep attribute, use JSONMatch, eg: {"nested.prop": "dmp"}
|
|
131
|
+
* @param attrs - Attributes to perform operation on. To set a deep attribute, use JSONMatch, eg: \{"nested.prop": "dmp"\}
|
|
122
132
|
*/
|
|
123
133
|
diffMatchPatch(attrs: AttributeSet): this
|
|
124
134
|
/**
|
|
125
135
|
* Unsets the attribute paths provided.
|
|
126
136
|
* The operation is added to the current patch, ready to be commited by `commit()`
|
|
127
137
|
*
|
|
128
|
-
* @param attrs Attribute paths to unset.
|
|
138
|
+
* @param attrs - Attribute paths to unset.
|
|
129
139
|
*/
|
|
130
140
|
unset(attrs: string[]): this
|
|
131
141
|
/**
|
|
132
142
|
* Increment a numeric value. Each entry in the argument is either an attribute or a JSON path. The value may be a positive or negative integer or floating-point value. The operation will fail if target value is not a numeric value, or doesn't exist.
|
|
133
143
|
*
|
|
134
|
-
* @param attrs Object of attribute paths to increment, values representing the number to increment by.
|
|
144
|
+
* @param attrs - Object of attribute paths to increment, values representing the number to increment by.
|
|
135
145
|
*/
|
|
136
146
|
inc(attrs: {[key: string]: number}): this
|
|
137
147
|
/**
|
|
138
148
|
* Decrement a numeric value. Each entry in the argument is either an attribute or a JSON path. The value may be a positive or negative integer or floating-point value. The operation will fail if target value is not a numeric value, or doesn't exist.
|
|
139
149
|
*
|
|
140
|
-
* @param attrs Object of attribute paths to decrement, values representing the number to decrement by.
|
|
150
|
+
* @param attrs - Object of attribute paths to decrement, values representing the number to decrement by.
|
|
141
151
|
*/
|
|
142
152
|
dec(attrs: {[key: string]: number}): this
|
|
143
153
|
/**
|
|
144
154
|
* Provides methods for modifying arrays, by inserting, appending and replacing elements via a JSONPath expression.
|
|
145
155
|
*
|
|
146
|
-
* @param at Location to insert at, relative to the given selector, or 'replace' the matched path
|
|
147
|
-
* @param selector JSONPath expression, eg `comments[-1]` or `blocks[_key=="abc123"]`
|
|
148
|
-
* @param items Array of items to insert/replace
|
|
156
|
+
* @param at - Location to insert at, relative to the given selector, or 'replace' the matched path
|
|
157
|
+
* @param selector - JSONPath expression, eg `comments[-1]` or `blocks[_key=="abc123"]`
|
|
158
|
+
* @param items - Array of items to insert/replace
|
|
149
159
|
*/
|
|
150
160
|
insert(at: 'before' | 'after' | 'replace', selector: string, items: any[]): this
|
|
151
161
|
/**
|
|
152
162
|
* Append the given items to the array at the given JSONPath
|
|
153
163
|
*
|
|
154
|
-
* @param selector Attribute/path to append to, eg `comments` or `person.hobbies`
|
|
155
|
-
* @param items Array of items to append to the array
|
|
164
|
+
* @param selector - Attribute/path to append to, eg `comments` or `person.hobbies`
|
|
165
|
+
* @param items - Array of items to append to the array
|
|
156
166
|
*/
|
|
157
167
|
append(selector: string, items: any[]): this
|
|
158
168
|
/**
|
|
159
169
|
* Prepend the given items to the array at the given JSONPath
|
|
160
170
|
*
|
|
161
|
-
* @param selector Attribute/path to prepend to, eg `comments` or `person.hobbies`
|
|
162
|
-
* @param items Array of items to prepend to the array
|
|
171
|
+
* @param selector - Attribute/path to prepend to, eg `comments` or `person.hobbies`
|
|
172
|
+
* @param items - Array of items to prepend to the array
|
|
163
173
|
*/
|
|
164
174
|
prepend(selector: string, items: any[]): this
|
|
165
175
|
/**
|
|
166
176
|
* Change the contents of an array by removing existing elements and/or adding new elements.
|
|
167
177
|
*
|
|
168
|
-
* @param selector Attribute or JSONPath expression for array
|
|
169
|
-
* @param start Index at which to start changing the array (with origin 0). If greater than the length of the array, actual starting index will be set to the length of the array. If negative, will begin that many elements from the end of the array (with origin -1) and will be set to 0 if absolute value is greater than the length of the array.x
|
|
170
|
-
* @param deleteCount An integer indicating the number of old array elements to remove.
|
|
171
|
-
* @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.
|
|
178
|
+
* @param selector - Attribute or JSONPath expression for array
|
|
179
|
+
* @param start - Index at which to start changing the array (with origin 0). If greater than the length of the array, actual starting index will be set to the length of the array. If negative, will begin that many elements from the end of the array (with origin -1) and will be set to 0 if absolute value is greater than the length of the array.x
|
|
180
|
+
* @param deleteCount - An integer indicating the number of old array elements to remove.
|
|
181
|
+
* @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.
|
|
172
182
|
*/
|
|
173
|
-
splice(selector: string, start: number, deleteCount
|
|
183
|
+
splice(selector: string, start: number, deleteCount?: number, items?: any[]): this
|
|
174
184
|
/**
|
|
175
185
|
* Adds a revision clause, preventing the document from being patched if the `_rev` property does not match the given value
|
|
176
186
|
*
|
|
177
|
-
* @param rev Revision to lock the patch to
|
|
187
|
+
* @param rev - Revision to lock the patch to
|
|
178
188
|
*/
|
|
179
189
|
ifRevisionId(rev: string): this
|
|
180
190
|
/**
|
|
@@ -193,6 +203,7 @@ export declare class BasePatch {
|
|
|
193
203
|
protected _set(op: keyof PatchOperations, props: any): this
|
|
194
204
|
}
|
|
195
205
|
|
|
206
|
+
/** @internal */
|
|
196
207
|
export declare class BaseTransaction {
|
|
197
208
|
protected operations: Mutation[]
|
|
198
209
|
protected trxId?: string
|
|
@@ -254,11 +265,13 @@ export declare class BaseTransaction {
|
|
|
254
265
|
protected _add(mut: Mutation): this
|
|
255
266
|
}
|
|
256
267
|
|
|
268
|
+
/** @public */
|
|
257
269
|
export declare type ChannelErrorEvent = {
|
|
258
270
|
type: 'channelError'
|
|
259
271
|
message: string
|
|
260
272
|
}
|
|
261
273
|
|
|
274
|
+
/** @public */
|
|
262
275
|
export declare interface ClientConfig {
|
|
263
276
|
projectId?: string
|
|
264
277
|
dataset?: string
|
|
@@ -282,6 +295,7 @@ export declare interface ClientConfig {
|
|
|
282
295
|
requester?: Requester
|
|
283
296
|
}
|
|
284
297
|
|
|
298
|
+
/** @public */
|
|
285
299
|
export declare class ClientError extends BaseError {
|
|
286
300
|
response: ErrorProps['response']
|
|
287
301
|
statusCode: ErrorProps['statusCode']
|
|
@@ -290,8 +304,10 @@ export declare class ClientError extends BaseError {
|
|
|
290
304
|
constructor(res: any)
|
|
291
305
|
}
|
|
292
306
|
|
|
293
|
-
|
|
307
|
+
/** @public */
|
|
308
|
+
export declare const createClient: (config: ClientConfig) => SanityClient
|
|
294
309
|
|
|
310
|
+
/** @internal */
|
|
295
311
|
export declare interface CurrentSanityUser {
|
|
296
312
|
id: string
|
|
297
313
|
name: string
|
|
@@ -300,13 +316,16 @@ export declare interface CurrentSanityUser {
|
|
|
300
316
|
role: string
|
|
301
317
|
}
|
|
302
318
|
|
|
319
|
+
/** @internal */
|
|
303
320
|
export declare type DatasetAclMode = 'public' | 'private' | 'custom'
|
|
304
321
|
|
|
322
|
+
/** @internal */
|
|
305
323
|
export declare type DatasetResponse = {
|
|
306
324
|
datasetName: string
|
|
307
325
|
aclMode: DatasetAclMode
|
|
308
326
|
}
|
|
309
327
|
|
|
328
|
+
/** @internal */
|
|
310
329
|
export declare class DatasetsClient {
|
|
311
330
|
#private
|
|
312
331
|
constructor(client: SanityClient, httpRequest: HttpRequest)
|
|
@@ -348,16 +367,19 @@ export declare class DatasetsClient {
|
|
|
348
367
|
list(): Promise<DatasetsResponse>
|
|
349
368
|
}
|
|
350
369
|
|
|
370
|
+
/** @internal */
|
|
351
371
|
export declare type DatasetsResponse = {
|
|
352
372
|
name: string
|
|
353
373
|
aclMode: DatasetAclMode
|
|
354
374
|
}[]
|
|
355
375
|
|
|
376
|
+
/** @public */
|
|
356
377
|
export declare type DisconnectEvent = {
|
|
357
378
|
type: 'disconnect'
|
|
358
379
|
reason: string
|
|
359
380
|
}
|
|
360
381
|
|
|
382
|
+
/** @public */
|
|
361
383
|
export declare interface ErrorProps {
|
|
362
384
|
message: string
|
|
363
385
|
response: any
|
|
@@ -366,27 +388,33 @@ export declare interface ErrorProps {
|
|
|
366
388
|
details: any
|
|
367
389
|
}
|
|
368
390
|
|
|
391
|
+
/** @internal */
|
|
369
392
|
export declare type FilteredResponseQueryOptions = RequestOptions & {
|
|
370
393
|
filterResponse?: true
|
|
371
394
|
}
|
|
372
395
|
|
|
396
|
+
/** @internal */
|
|
373
397
|
export declare type FirstDocumentIdMutationOptions = BaseMutationOptions & {
|
|
374
398
|
returnFirst?: true
|
|
375
399
|
returnDocuments: false
|
|
376
400
|
}
|
|
377
401
|
|
|
402
|
+
/** @internal */
|
|
378
403
|
export declare type FirstDocumentMutationOptions = BaseMutationOptions & {
|
|
379
404
|
returnFirst?: true
|
|
380
405
|
returnDocuments?: true
|
|
381
406
|
}
|
|
382
407
|
|
|
408
|
+
/** @public */
|
|
383
409
|
export declare type HttpRequest = {
|
|
384
410
|
defaultRequester: Requester
|
|
385
411
|
(options: RequestOptions, requester: Requester): ReturnType<Requester>
|
|
386
412
|
}
|
|
387
413
|
|
|
414
|
+
/** @public */
|
|
388
415
|
export declare type HttpRequestEvent<T = unknown> = ResponseEvent<T> | ProgressEvent_2
|
|
389
416
|
|
|
417
|
+
/** @public */
|
|
390
418
|
export declare type IdentifiedSanityDocumentStub<
|
|
391
419
|
T extends Record<string, any> = Record<string, any>
|
|
392
420
|
> = {
|
|
@@ -395,6 +423,7 @@ export declare type IdentifiedSanityDocumentStub<
|
|
|
395
423
|
_id: string
|
|
396
424
|
} & SanityDocumentStub
|
|
397
425
|
|
|
426
|
+
/** @public */
|
|
398
427
|
export declare interface InitializedClientConfig extends ClientConfig {
|
|
399
428
|
apiHost: string
|
|
400
429
|
apiVersion: string
|
|
@@ -414,6 +443,7 @@ export declare interface InitializedClientConfig extends ClientConfig {
|
|
|
414
443
|
cdnUrl: string
|
|
415
444
|
}
|
|
416
445
|
|
|
446
|
+
/** @internal */
|
|
417
447
|
export declare type InsertPatch =
|
|
418
448
|
| {
|
|
419
449
|
before: string
|
|
@@ -431,9 +461,9 @@ export declare type InsertPatch =
|
|
|
431
461
|
/**
|
|
432
462
|
* Set up a listener that will be notified when mutations occur on documents matching the provided query/filter.
|
|
433
463
|
*
|
|
434
|
-
* @param query GROQ-filter to listen to changes for
|
|
435
|
-
* @param params Optional query parameters
|
|
436
|
-
* @param options Listener options
|
|
464
|
+
* @param query - GROQ-filter to listen to changes for
|
|
465
|
+
* @param params - Optional query parameters
|
|
466
|
+
* @param options - Listener options
|
|
437
467
|
* @internal
|
|
438
468
|
*/
|
|
439
469
|
export declare function _listen<R extends Record<string, any> = Record<string, any>>(
|
|
@@ -445,9 +475,9 @@ export declare function _listen<R extends Record<string, any> = Record<string, a
|
|
|
445
475
|
/**
|
|
446
476
|
* Set up a listener that will be notified when mutations occur on documents matching the provided query/filter.
|
|
447
477
|
*
|
|
448
|
-
* @param query GROQ-filter to listen to changes for
|
|
449
|
-
* @param params Optional query parameters
|
|
450
|
-
* @param options Listener options
|
|
478
|
+
* @param query - GROQ-filter to listen to changes for
|
|
479
|
+
* @param params - Optional query parameters
|
|
480
|
+
* @param options - Listener options
|
|
451
481
|
* @internal
|
|
452
482
|
*/
|
|
453
483
|
export declare function _listen<R extends Record<string, any> = Record<string, any>>(
|
|
@@ -457,6 +487,7 @@ export declare function _listen<R extends Record<string, any> = Record<string, a
|
|
|
457
487
|
options?: ListenOptions
|
|
458
488
|
): Observable<ListenEvent<R>>
|
|
459
489
|
|
|
490
|
+
/** @public */
|
|
460
491
|
export declare type ListenEvent<R extends Record<string, any>> =
|
|
461
492
|
| MutationEvent_2<R>
|
|
462
493
|
| ChannelErrorEvent
|
|
@@ -464,8 +495,10 @@ export declare type ListenEvent<R extends Record<string, any>> =
|
|
|
464
495
|
| ReconnectEvent
|
|
465
496
|
| WelcomeEvent
|
|
466
497
|
|
|
498
|
+
/** @public */
|
|
467
499
|
export declare type ListenEventName = 'mutation' | 'welcome' | 'reconnect'
|
|
468
500
|
|
|
501
|
+
/** @public */
|
|
469
502
|
export declare interface ListenOptions {
|
|
470
503
|
includeResult?: boolean
|
|
471
504
|
includePreviousRevision?: boolean
|
|
@@ -475,6 +508,7 @@ export declare interface ListenOptions {
|
|
|
475
508
|
tag?: string
|
|
476
509
|
}
|
|
477
510
|
|
|
511
|
+
/** @internal */
|
|
478
512
|
export declare interface MultipleMutationResult {
|
|
479
513
|
transactionId: string
|
|
480
514
|
documentIds: string[]
|
|
@@ -484,6 +518,7 @@ export declare interface MultipleMutationResult {
|
|
|
484
518
|
}[]
|
|
485
519
|
}
|
|
486
520
|
|
|
521
|
+
/** @public */
|
|
487
522
|
export declare type Mutation<R extends Record<string, any> = Record<string, any>> =
|
|
488
523
|
| {
|
|
489
524
|
create: SanityDocumentStub<R>
|
|
@@ -501,6 +536,7 @@ export declare type Mutation<R extends Record<string, any> = Record<string, any>
|
|
|
501
536
|
patch: PatchMutationOperation
|
|
502
537
|
}
|
|
503
538
|
|
|
539
|
+
/** @public */
|
|
504
540
|
declare type MutationEvent_2<R extends Record<string, any> = Record<string, any>> = {
|
|
505
541
|
type: 'mutation'
|
|
506
542
|
documentId: string
|
|
@@ -522,8 +558,10 @@ declare type MutationEvent_2<R extends Record<string, any> = Record<string, any>
|
|
|
522
558
|
}
|
|
523
559
|
export {MutationEvent_2 as MutationEvent}
|
|
524
560
|
|
|
561
|
+
/** @internal */
|
|
525
562
|
export declare type MutationOperation = 'create' | 'delete' | 'update' | 'none'
|
|
526
563
|
|
|
564
|
+
/** @internal */
|
|
527
565
|
export declare type MutationSelection =
|
|
528
566
|
| {
|
|
529
567
|
query: string
|
|
@@ -533,15 +571,16 @@ export declare type MutationSelection =
|
|
|
533
571
|
id: string | string[]
|
|
534
572
|
}
|
|
535
573
|
|
|
574
|
+
/** @internal */
|
|
536
575
|
export declare class ObservableAssetsClient {
|
|
537
576
|
#private
|
|
538
577
|
constructor(client: ObservableSanityClient, httpRequest: HttpRequest)
|
|
539
578
|
/**
|
|
540
579
|
* Uploads a file asset to the configured dataset
|
|
541
580
|
*
|
|
542
|
-
* @param assetType Asset type (file/image)
|
|
543
|
-
* @param body Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
|
|
544
|
-
* @param options Options to use for the upload
|
|
581
|
+
* @param assetType - Asset type (file/image)
|
|
582
|
+
* @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
|
|
583
|
+
* @param options - Options to use for the upload
|
|
545
584
|
*/
|
|
546
585
|
upload(
|
|
547
586
|
assetType: 'file',
|
|
@@ -555,9 +594,9 @@ export declare class ObservableAssetsClient {
|
|
|
555
594
|
/**
|
|
556
595
|
* Uploads an image asset to the configured dataset
|
|
557
596
|
*
|
|
558
|
-
* @param assetType Asset type (file/image)
|
|
559
|
-
* @param body Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
|
|
560
|
-
* @param options Options to use for the upload
|
|
597
|
+
* @param assetType - Asset type (file/image)
|
|
598
|
+
* @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
|
|
599
|
+
* @param options - Options to use for the upload
|
|
561
600
|
*/
|
|
562
601
|
upload(
|
|
563
602
|
assetType: 'image',
|
|
@@ -570,6 +609,7 @@ export declare class ObservableAssetsClient {
|
|
|
570
609
|
>
|
|
571
610
|
}
|
|
572
611
|
|
|
612
|
+
/** @internal */
|
|
573
613
|
export declare class ObservableAuthClient {
|
|
574
614
|
#private
|
|
575
615
|
constructor(client: ObservableSanityClient, httpRequest: HttpRequest)
|
|
@@ -583,6 +623,7 @@ export declare class ObservableAuthClient {
|
|
|
583
623
|
logout(): Observable<void>
|
|
584
624
|
}
|
|
585
625
|
|
|
626
|
+
/** @internal */
|
|
586
627
|
export declare class ObservableDatasetsClient {
|
|
587
628
|
#private
|
|
588
629
|
constructor(client: ObservableSanityClient, httpRequest: HttpRequest)
|
|
@@ -624,6 +665,7 @@ export declare class ObservableDatasetsClient {
|
|
|
624
665
|
list(): Observable<DatasetsResponse>
|
|
625
666
|
}
|
|
626
667
|
|
|
668
|
+
/** @public */
|
|
627
669
|
export declare class ObservablePatch extends BasePatch {
|
|
628
670
|
#private
|
|
629
671
|
constructor(
|
|
@@ -638,7 +680,7 @@ export declare class ObservablePatch extends BasePatch {
|
|
|
638
680
|
/**
|
|
639
681
|
* Commit the patch, returning an observable that produces the first patched document
|
|
640
682
|
*
|
|
641
|
-
* @param options Options for the mutation operation
|
|
683
|
+
* @param options - Options for the mutation operation
|
|
642
684
|
*/
|
|
643
685
|
commit<R extends Record<string, any> = Record<string, any>>(
|
|
644
686
|
options: FirstDocumentMutationOptions
|
|
@@ -646,7 +688,7 @@ export declare class ObservablePatch extends BasePatch {
|
|
|
646
688
|
/**
|
|
647
689
|
* Commit the patch, returning an observable that produces an array of the mutated documents
|
|
648
690
|
*
|
|
649
|
-
* @param options Options for the mutation operation
|
|
691
|
+
* @param options - Options for the mutation operation
|
|
650
692
|
*/
|
|
651
693
|
commit<R extends Record<string, any> = Record<string, any>>(
|
|
652
694
|
options: AllDocumentsMutationOptions
|
|
@@ -654,27 +696,29 @@ export declare class ObservablePatch extends BasePatch {
|
|
|
654
696
|
/**
|
|
655
697
|
* Commit the patch, returning an observable that produces a mutation result object
|
|
656
698
|
*
|
|
657
|
-
* @param options Options for the mutation operation
|
|
699
|
+
* @param options - Options for the mutation operation
|
|
658
700
|
*/
|
|
659
701
|
commit(options: FirstDocumentIdMutationOptions): Observable<SingleMutationResult>
|
|
660
702
|
/**
|
|
661
703
|
* Commit the patch, returning an observable that produces a mutation result object
|
|
662
704
|
*
|
|
663
|
-
* @param options Options for the mutation operation
|
|
705
|
+
* @param options - Options for the mutation operation
|
|
664
706
|
*/
|
|
665
707
|
commit(options: AllDocumentIdsMutationOptions): Observable<MultipleMutationResult>
|
|
666
708
|
/**
|
|
667
709
|
* Commit the patch, returning an observable that produces the first patched document
|
|
668
710
|
*
|
|
669
|
-
* @param options Options for the mutation operation
|
|
711
|
+
* @param options - Options for the mutation operation
|
|
670
712
|
*/
|
|
671
713
|
commit<R extends Record<string, any> = Record<string, any>>(
|
|
672
714
|
options?: BaseMutationOptions
|
|
673
715
|
): Observable<SanityDocument<R>>
|
|
674
716
|
}
|
|
675
717
|
|
|
718
|
+
/** @public */
|
|
676
719
|
export declare type ObservablePatchBuilder = (patch: ObservablePatch) => ObservablePatch
|
|
677
720
|
|
|
721
|
+
/** @internal */
|
|
678
722
|
export declare class ObservableProjectsClient {
|
|
679
723
|
#private
|
|
680
724
|
constructor(client: ObservableSanityClient, httpRequest: HttpRequest)
|
|
@@ -690,6 +734,7 @@ export declare class ObservableProjectsClient {
|
|
|
690
734
|
getById(projectId: string): Observable<SanityProject>
|
|
691
735
|
}
|
|
692
736
|
|
|
737
|
+
/** @public */
|
|
693
738
|
export declare class ObservableSanityClient {
|
|
694
739
|
#private
|
|
695
740
|
assets: ObservableAssetsClient
|
|
@@ -697,7 +742,7 @@ export declare class ObservableSanityClient {
|
|
|
697
742
|
datasets: ObservableDatasetsClient
|
|
698
743
|
projects: ObservableProjectsClient
|
|
699
744
|
users: ObservableUsersClient
|
|
700
|
-
constructor(httpRequest: HttpRequest, config
|
|
745
|
+
constructor(httpRequest: HttpRequest, config?: ClientConfig)
|
|
701
746
|
/**
|
|
702
747
|
* Clone the client - returns a new instance
|
|
703
748
|
*/
|
|
@@ -713,28 +758,28 @@ export declare class ObservableSanityClient {
|
|
|
713
758
|
/**
|
|
714
759
|
* Clone the client with a new (partial) configuration.
|
|
715
760
|
*
|
|
716
|
-
* @param newConfig New client configuration properties, shallowly merged with existing configuration
|
|
761
|
+
* @param newConfig - New client configuration properties, shallowly merged with existing configuration
|
|
717
762
|
*/
|
|
718
763
|
withConfig(newConfig?: Partial<ClientConfig>): ObservableSanityClient
|
|
719
764
|
/**
|
|
720
765
|
* Perform a GROQ-query against the configured dataset.
|
|
721
766
|
*
|
|
722
|
-
* @param query GROQ-query to perform
|
|
767
|
+
* @param query - GROQ-query to perform
|
|
723
768
|
*/
|
|
724
769
|
fetch<R = any>(query: string): Observable<R>
|
|
725
770
|
/**
|
|
726
771
|
* Perform a GROQ-query against the configured dataset.
|
|
727
772
|
*
|
|
728
|
-
* @param query GROQ-query to perform
|
|
729
|
-
* @param params Query parameters
|
|
773
|
+
* @param query - GROQ-query to perform
|
|
774
|
+
* @param params - Query parameters
|
|
730
775
|
*/
|
|
731
776
|
fetch<R = any>(query: string, params: QueryParams): Observable<R>
|
|
732
777
|
/**
|
|
733
778
|
* Perform a GROQ-query against the configured dataset.
|
|
734
779
|
*
|
|
735
|
-
* @param query GROQ-query to perform
|
|
736
|
-
* @param params Query parameters
|
|
737
|
-
* @param options Request options
|
|
780
|
+
* @param query - GROQ-query to perform
|
|
781
|
+
* @param params - Query parameters
|
|
782
|
+
* @param options - Request options
|
|
738
783
|
*/
|
|
739
784
|
fetch<R = any>(
|
|
740
785
|
query: string,
|
|
@@ -744,9 +789,9 @@ export declare class ObservableSanityClient {
|
|
|
744
789
|
/**
|
|
745
790
|
* Perform a GROQ-query against the configured dataset.
|
|
746
791
|
*
|
|
747
|
-
* @param query GROQ-query to perform
|
|
748
|
-
* @param params Query parameters
|
|
749
|
-
* @param options Request options
|
|
792
|
+
* @param query - GROQ-query to perform
|
|
793
|
+
* @param params - Query parameters
|
|
794
|
+
* @param options - Request options
|
|
750
795
|
*/
|
|
751
796
|
fetch<R = any>(
|
|
752
797
|
query: string,
|
|
@@ -756,8 +801,8 @@ export declare class ObservableSanityClient {
|
|
|
756
801
|
/**
|
|
757
802
|
* Fetch a single document with the given ID.
|
|
758
803
|
*
|
|
759
|
-
* @param id Document ID to fetch
|
|
760
|
-
* @param options Request options
|
|
804
|
+
* @param id - Document ID to fetch
|
|
805
|
+
* @param options - Request options
|
|
761
806
|
*/
|
|
762
807
|
getDocument<R extends Record<string, any> = Record<string, any>>(
|
|
763
808
|
id: string,
|
|
@@ -771,8 +816,8 @@ export declare class ObservableSanityClient {
|
|
|
771
816
|
* The order/position of documents is preserved based on the original array of IDs.
|
|
772
817
|
* If a any of the documents are missing, they will be replaced by a `null` entry in the returned array
|
|
773
818
|
*
|
|
774
|
-
* @param ids Document IDs to fetch
|
|
775
|
-
* @param options Request options
|
|
819
|
+
* @param ids - Document IDs to fetch
|
|
820
|
+
* @param options - Request options
|
|
776
821
|
*/
|
|
777
822
|
getDocuments<R extends Record<string, any> = Record<string, any>>(
|
|
778
823
|
ids: string[],
|
|
@@ -784,8 +829,8 @@ export declare class ObservableSanityClient {
|
|
|
784
829
|
* Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
|
|
785
830
|
* Returns an observable that resolves to the created document.
|
|
786
831
|
*
|
|
787
|
-
* @param document Document to create
|
|
788
|
-
* @param options Mutation options
|
|
832
|
+
* @param document - Document to create
|
|
833
|
+
* @param options - Mutation options
|
|
789
834
|
*/
|
|
790
835
|
create<R extends Record<string, any> = Record<string, any>>(
|
|
791
836
|
document: SanityDocumentStub<R>,
|
|
@@ -795,8 +840,8 @@ export declare class ObservableSanityClient {
|
|
|
795
840
|
* Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
|
|
796
841
|
* Returns an observable that resolves to an array containing the created document.
|
|
797
842
|
*
|
|
798
|
-
* @param document Document to create
|
|
799
|
-
* @param options Mutation options
|
|
843
|
+
* @param document - Document to create
|
|
844
|
+
* @param options - Mutation options
|
|
800
845
|
*/
|
|
801
846
|
create<R extends Record<string, any> = Record<string, any>>(
|
|
802
847
|
document: SanityDocumentStub<R>,
|
|
@@ -806,8 +851,8 @@ export declare class ObservableSanityClient {
|
|
|
806
851
|
* Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
|
|
807
852
|
* Returns an observable that resolves to a mutation result object containing the ID of the created document.
|
|
808
853
|
*
|
|
809
|
-
* @param document Document to create
|
|
810
|
-
* @param options Mutation options
|
|
854
|
+
* @param document - Document to create
|
|
855
|
+
* @param options - Mutation options
|
|
811
856
|
*/
|
|
812
857
|
create<R extends Record<string, any> = Record<string, any>>(
|
|
813
858
|
document: SanityDocumentStub<R>,
|
|
@@ -817,8 +862,8 @@ export declare class ObservableSanityClient {
|
|
|
817
862
|
* Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
|
|
818
863
|
* Returns an observable that resolves to a mutation result object containing the ID of the created document.
|
|
819
864
|
*
|
|
820
|
-
* @param document Document to create
|
|
821
|
-
* @param options Mutation options
|
|
865
|
+
* @param document - Document to create
|
|
866
|
+
* @param options - Mutation options
|
|
822
867
|
*/
|
|
823
868
|
create<R extends Record<string, any> = Record<string, any>>(
|
|
824
869
|
document: SanityDocumentStub<R>,
|
|
@@ -828,8 +873,8 @@ export declare class ObservableSanityClient {
|
|
|
828
873
|
* Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
|
|
829
874
|
* Returns an observable that resolves to the created document.
|
|
830
875
|
*
|
|
831
|
-
* @param document Document to create
|
|
832
|
-
* @param options Mutation options
|
|
876
|
+
* @param document - Document to create
|
|
877
|
+
* @param options - Mutation options
|
|
833
878
|
*/
|
|
834
879
|
create<R extends Record<string, any> = Record<string, any>>(
|
|
835
880
|
document: SanityDocumentStub<R>,
|
|
@@ -839,8 +884,8 @@ export declare class ObservableSanityClient {
|
|
|
839
884
|
* Create a document if no document with the same ID already exists.
|
|
840
885
|
* Returns an observable that resolves to the created document.
|
|
841
886
|
*
|
|
842
|
-
* @param document Document to create
|
|
843
|
-
* @param options Mutation options
|
|
887
|
+
* @param document - Document to create
|
|
888
|
+
* @param options - Mutation options
|
|
844
889
|
*/
|
|
845
890
|
createIfNotExists<R extends Record<string, any> = Record<string, any>>(
|
|
846
891
|
document: IdentifiedSanityDocumentStub<R>,
|
|
@@ -850,8 +895,8 @@ export declare class ObservableSanityClient {
|
|
|
850
895
|
* Create a document if no document with the same ID already exists.
|
|
851
896
|
* Returns an observable that resolves to an array containing the created document.
|
|
852
897
|
*
|
|
853
|
-
* @param document Document to create
|
|
854
|
-
* @param options Mutation options
|
|
898
|
+
* @param document - Document to create
|
|
899
|
+
* @param options - Mutation options
|
|
855
900
|
*/
|
|
856
901
|
createIfNotExists<R extends Record<string, any> = Record<string, any>>(
|
|
857
902
|
document: IdentifiedSanityDocumentStub<R>,
|
|
@@ -861,8 +906,8 @@ export declare class ObservableSanityClient {
|
|
|
861
906
|
* Create a document if no document with the same ID already exists.
|
|
862
907
|
* Returns an observable that resolves to a mutation result object containing the ID of the created document.
|
|
863
908
|
*
|
|
864
|
-
* @param document Document to create
|
|
865
|
-
* @param options Mutation options
|
|
909
|
+
* @param document - Document to create
|
|
910
|
+
* @param options - Mutation options
|
|
866
911
|
*/
|
|
867
912
|
createIfNotExists<R extends Record<string, any> = Record<string, any>>(
|
|
868
913
|
document: IdentifiedSanityDocumentStub<R>,
|
|
@@ -872,8 +917,8 @@ export declare class ObservableSanityClient {
|
|
|
872
917
|
* Create a document if no document with the same ID already exists.
|
|
873
918
|
* Returns an observable that resolves to a mutation result object containing the ID of the created document.
|
|
874
919
|
*
|
|
875
|
-
* @param document Document to create
|
|
876
|
-
* @param options Mutation options
|
|
920
|
+
* @param document - Document to create
|
|
921
|
+
* @param options - Mutation options
|
|
877
922
|
*/
|
|
878
923
|
createIfNotExists<R extends Record<string, any> = Record<string, any>>(
|
|
879
924
|
document: IdentifiedSanityDocumentStub<R>,
|
|
@@ -883,8 +928,8 @@ export declare class ObservableSanityClient {
|
|
|
883
928
|
* Create a document if no document with the same ID already exists.
|
|
884
929
|
* Returns an observable that resolves to the created document.
|
|
885
930
|
*
|
|
886
|
-
* @param document Document to create
|
|
887
|
-
* @param options Mutation options
|
|
931
|
+
* @param document - Document to create
|
|
932
|
+
* @param options - Mutation options
|
|
888
933
|
*/
|
|
889
934
|
createIfNotExists<R extends Record<string, any> = Record<string, any>>(
|
|
890
935
|
document: IdentifiedSanityDocumentStub<R>,
|
|
@@ -894,8 +939,8 @@ export declare class ObservableSanityClient {
|
|
|
894
939
|
* Create a document if it does not exist, or replace a document with the same document ID
|
|
895
940
|
* Returns an observable that resolves to the created document.
|
|
896
941
|
*
|
|
897
|
-
* @param document Document to either create or replace
|
|
898
|
-
* @param options Mutation options
|
|
942
|
+
* @param document - Document to either create or replace
|
|
943
|
+
* @param options - Mutation options
|
|
899
944
|
*/
|
|
900
945
|
createOrReplace<R extends Record<string, any> = Record<string, any>>(
|
|
901
946
|
document: IdentifiedSanityDocumentStub<R>,
|
|
@@ -905,8 +950,8 @@ export declare class ObservableSanityClient {
|
|
|
905
950
|
* Create a document if it does not exist, or replace a document with the same document ID
|
|
906
951
|
* Returns an observable that resolves to an array containing the created document.
|
|
907
952
|
*
|
|
908
|
-
* @param document Document to either create or replace
|
|
909
|
-
* @param options Mutation options
|
|
953
|
+
* @param document - Document to either create or replace
|
|
954
|
+
* @param options - Mutation options
|
|
910
955
|
*/
|
|
911
956
|
createOrReplace<R extends Record<string, any> = Record<string, any>>(
|
|
912
957
|
document: IdentifiedSanityDocumentStub<R>,
|
|
@@ -916,8 +961,8 @@ export declare class ObservableSanityClient {
|
|
|
916
961
|
* Create a document if it does not exist, or replace a document with the same document ID
|
|
917
962
|
* Returns an observable that resolves to a mutation result object containing the ID of the created document.
|
|
918
963
|
*
|
|
919
|
-
* @param document Document to either create or replace
|
|
920
|
-
* @param options Mutation options
|
|
964
|
+
* @param document - Document to either create or replace
|
|
965
|
+
* @param options - Mutation options
|
|
921
966
|
*/
|
|
922
967
|
createOrReplace<R extends Record<string, any> = Record<string, any>>(
|
|
923
968
|
document: IdentifiedSanityDocumentStub<R>,
|
|
@@ -927,8 +972,8 @@ export declare class ObservableSanityClient {
|
|
|
927
972
|
* Create a document if it does not exist, or replace a document with the same document ID
|
|
928
973
|
* Returns an observable that resolves to a mutation result object containing the created document ID.
|
|
929
974
|
*
|
|
930
|
-
* @param document Document to either create or replace
|
|
931
|
-
* @param options Mutation options
|
|
975
|
+
* @param document - Document to either create or replace
|
|
976
|
+
* @param options - Mutation options
|
|
932
977
|
*/
|
|
933
978
|
createOrReplace<R extends Record<string, any> = Record<string, any>>(
|
|
934
979
|
document: IdentifiedSanityDocumentStub<R>,
|
|
@@ -938,8 +983,8 @@ export declare class ObservableSanityClient {
|
|
|
938
983
|
* Create a document if it does not exist, or replace a document with the same document ID
|
|
939
984
|
* Returns an observable that resolves to the created document.
|
|
940
985
|
*
|
|
941
|
-
* @param document Document to either create or replace
|
|
942
|
-
* @param options Mutation options
|
|
986
|
+
* @param document - Document to either create or replace
|
|
987
|
+
* @param options - Mutation options
|
|
943
988
|
*/
|
|
944
989
|
createOrReplace<R extends Record<string, any> = Record<string, any>>(
|
|
945
990
|
document: IdentifiedSanityDocumentStub<R>,
|
|
@@ -949,8 +994,8 @@ export declare class ObservableSanityClient {
|
|
|
949
994
|
* Deletes a document with the given document ID.
|
|
950
995
|
* Returns an observable that resolves to the deleted document.
|
|
951
996
|
*
|
|
952
|
-
* @param id Document ID to delete
|
|
953
|
-
* @param options Options for the mutation
|
|
997
|
+
* @param id - Document ID to delete
|
|
998
|
+
* @param options - Options for the mutation
|
|
954
999
|
*/
|
|
955
1000
|
delete<R extends Record<string, any> = Record<string, any>>(
|
|
956
1001
|
id: string,
|
|
@@ -960,8 +1005,8 @@ export declare class ObservableSanityClient {
|
|
|
960
1005
|
* Deletes a document with the given document ID.
|
|
961
1006
|
* Returns an observable that resolves to an array containing the deleted document.
|
|
962
1007
|
*
|
|
963
|
-
* @param id Document ID to delete
|
|
964
|
-
* @param options Options for the mutation
|
|
1008
|
+
* @param id - Document ID to delete
|
|
1009
|
+
* @param options - Options for the mutation
|
|
965
1010
|
*/
|
|
966
1011
|
delete<R extends Record<string, any> = Record<string, any>>(
|
|
967
1012
|
id: string,
|
|
@@ -971,24 +1016,24 @@ export declare class ObservableSanityClient {
|
|
|
971
1016
|
* Deletes a document with the given document ID.
|
|
972
1017
|
* Returns an observable that resolves to a mutation result object containing the deleted document ID.
|
|
973
1018
|
*
|
|
974
|
-
* @param id Document ID to delete
|
|
975
|
-
* @param options Options for the mutation
|
|
1019
|
+
* @param id - Document ID to delete
|
|
1020
|
+
* @param options - Options for the mutation
|
|
976
1021
|
*/
|
|
977
1022
|
delete(id: string, options: FirstDocumentIdMutationOptions): Observable<SingleMutationResult>
|
|
978
1023
|
/**
|
|
979
1024
|
* Deletes a document with the given document ID.
|
|
980
1025
|
* Returns an observable that resolves to a mutation result object containing the deleted document ID.
|
|
981
1026
|
*
|
|
982
|
-
* @param id Document ID to delete
|
|
983
|
-
* @param options Options for the mutation
|
|
1027
|
+
* @param id - Document ID to delete
|
|
1028
|
+
* @param options - Options for the mutation
|
|
984
1029
|
*/
|
|
985
1030
|
delete(id: string, options: AllDocumentIdsMutationOptions): Observable<MultipleMutationResult>
|
|
986
1031
|
/**
|
|
987
1032
|
* Deletes a document with the given document ID.
|
|
988
1033
|
* Returns an observable that resolves to the deleted document.
|
|
989
1034
|
*
|
|
990
|
-
* @param id Document ID to delete
|
|
991
|
-
* @param options Options for the mutation
|
|
1035
|
+
* @param id - Document ID to delete
|
|
1036
|
+
* @param options - Options for the mutation
|
|
992
1037
|
*/
|
|
993
1038
|
delete<R extends Record<string, any> = Record<string, any>>(
|
|
994
1039
|
id: string,
|
|
@@ -998,8 +1043,8 @@ export declare class ObservableSanityClient {
|
|
|
998
1043
|
* Deletes one or more documents matching the given query or document ID.
|
|
999
1044
|
* Returns an observable that resolves to first deleted document.
|
|
1000
1045
|
*
|
|
1001
|
-
* @param selection An object with either an `id` or `query` key defining what to delete
|
|
1002
|
-
* @param options Options for the mutation
|
|
1046
|
+
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
1047
|
+
* @param options - Options for the mutation
|
|
1003
1048
|
*/
|
|
1004
1049
|
delete<R extends Record<string, any> = Record<string, any>>(
|
|
1005
1050
|
selection: MutationSelection,
|
|
@@ -1009,8 +1054,8 @@ export declare class ObservableSanityClient {
|
|
|
1009
1054
|
* Deletes one or more documents matching the given query or document ID.
|
|
1010
1055
|
* Returns an observable that resolves to an array containing the deleted documents.
|
|
1011
1056
|
*
|
|
1012
|
-
* @param selection An object with either an `id` or `query` key defining what to delete
|
|
1013
|
-
* @param options Options for the mutation
|
|
1057
|
+
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
1058
|
+
* @param options - Options for the mutation
|
|
1014
1059
|
*/
|
|
1015
1060
|
delete<R extends Record<string, any> = Record<string, any>>(
|
|
1016
1061
|
selection: MutationSelection,
|
|
@@ -1020,8 +1065,8 @@ export declare class ObservableSanityClient {
|
|
|
1020
1065
|
* Deletes one or more documents matching the given query or document ID.
|
|
1021
1066
|
* Returns an observable that resolves to a mutation result object containing the ID of the first deleted document.
|
|
1022
1067
|
*
|
|
1023
|
-
* @param selection An object with either an `id` or `query` key defining what to delete
|
|
1024
|
-
* @param options Options for the mutation
|
|
1068
|
+
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
1069
|
+
* @param options - Options for the mutation
|
|
1025
1070
|
*/
|
|
1026
1071
|
delete(
|
|
1027
1072
|
selection: MutationSelection,
|
|
@@ -1031,8 +1076,8 @@ export declare class ObservableSanityClient {
|
|
|
1031
1076
|
* Deletes one or more documents matching the given query or document ID.
|
|
1032
1077
|
* Returns an observable that resolves to a mutation result object containing the document IDs that were deleted.
|
|
1033
1078
|
*
|
|
1034
|
-
* @param selection An object with either an `id` or `query` key defining what to delete
|
|
1035
|
-
* @param options Options for the mutation
|
|
1079
|
+
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
1080
|
+
* @param options - Options for the mutation
|
|
1036
1081
|
*/
|
|
1037
1082
|
delete(
|
|
1038
1083
|
selection: MutationSelection,
|
|
@@ -1042,8 +1087,8 @@ export declare class ObservableSanityClient {
|
|
|
1042
1087
|
* Deletes one or more documents matching the given query or document ID.
|
|
1043
1088
|
* Returns an observable that resolves to first deleted document.
|
|
1044
1089
|
*
|
|
1045
|
-
* @param selection An object with either an `id` or `query` key defining what to delete
|
|
1046
|
-
* @param options Options for the mutation
|
|
1090
|
+
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
1091
|
+
* @param options - Options for the mutation
|
|
1047
1092
|
*/
|
|
1048
1093
|
delete<R extends Record<string, any> = Record<string, any>>(
|
|
1049
1094
|
selection: MutationSelection,
|
|
@@ -1053,8 +1098,8 @@ export declare class ObservableSanityClient {
|
|
|
1053
1098
|
* Perform mutation operations against the configured dataset
|
|
1054
1099
|
* Returns an observable that resolves to the first mutated document.
|
|
1055
1100
|
*
|
|
1056
|
-
* @param operations Mutation operations to execute
|
|
1057
|
-
* @param options Mutation options
|
|
1101
|
+
* @param operations - Mutation operations to execute
|
|
1102
|
+
* @param options - Mutation options
|
|
1058
1103
|
*/
|
|
1059
1104
|
mutate<R extends Record<string, any> = Record<string, any>>(
|
|
1060
1105
|
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
@@ -1064,8 +1109,8 @@ export declare class ObservableSanityClient {
|
|
|
1064
1109
|
* Perform mutation operations against the configured dataset.
|
|
1065
1110
|
* Returns an observable that resolves to an array of the mutated documents.
|
|
1066
1111
|
*
|
|
1067
|
-
* @param operations Mutation operations to execute
|
|
1068
|
-
* @param options Mutation options
|
|
1112
|
+
* @param operations - Mutation operations to execute
|
|
1113
|
+
* @param options - Mutation options
|
|
1069
1114
|
*/
|
|
1070
1115
|
mutate<R extends Record<string, any> = Record<string, any>>(
|
|
1071
1116
|
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
@@ -1075,8 +1120,8 @@ export declare class ObservableSanityClient {
|
|
|
1075
1120
|
* Perform mutation operations against the configured dataset
|
|
1076
1121
|
* Returns an observable that resolves to a mutation result object containing the document ID of the first mutated document.
|
|
1077
1122
|
*
|
|
1078
|
-
* @param operations Mutation operations to execute
|
|
1079
|
-
* @param options Mutation options
|
|
1123
|
+
* @param operations - Mutation operations to execute
|
|
1124
|
+
* @param options - Mutation options
|
|
1080
1125
|
*/
|
|
1081
1126
|
mutate<R extends Record<string, any> = Record<string, any>>(
|
|
1082
1127
|
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
@@ -1086,8 +1131,8 @@ export declare class ObservableSanityClient {
|
|
|
1086
1131
|
* Perform mutation operations against the configured dataset
|
|
1087
1132
|
* Returns an observable that resolves to a mutation result object containing the mutated document IDs.
|
|
1088
1133
|
*
|
|
1089
|
-
* @param operations Mutation operations to execute
|
|
1090
|
-
* @param options Mutation options
|
|
1134
|
+
* @param operations - Mutation operations to execute
|
|
1135
|
+
* @param options - Mutation options
|
|
1091
1136
|
*/
|
|
1092
1137
|
mutate<R extends Record<string, any> = Record<string, any>>(
|
|
1093
1138
|
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
@@ -1097,8 +1142,8 @@ export declare class ObservableSanityClient {
|
|
|
1097
1142
|
* Perform mutation operations against the configured dataset
|
|
1098
1143
|
* Returns an observable that resolves to the first mutated document.
|
|
1099
1144
|
*
|
|
1100
|
-
* @param operations Mutation operations to execute
|
|
1101
|
-
* @param options Mutation options
|
|
1145
|
+
* @param operations - Mutation operations to execute
|
|
1146
|
+
* @param options - Mutation options
|
|
1102
1147
|
*/
|
|
1103
1148
|
mutate<R extends Record<string, any> = Record<string, any>>(
|
|
1104
1149
|
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
@@ -1107,14 +1152,14 @@ export declare class ObservableSanityClient {
|
|
|
1107
1152
|
/**
|
|
1108
1153
|
* Create a new buildable patch of operations to perform
|
|
1109
1154
|
*
|
|
1110
|
-
* @param documentId Document ID to patch
|
|
1111
|
-
* @param operations Optional object of patch operations to initialize the patch instance with
|
|
1155
|
+
* @param documentId - Document ID(s) to patch
|
|
1156
|
+
* @param operations - Optional object of patch operations to initialize the patch instance with
|
|
1112
1157
|
*/
|
|
1113
|
-
patch(documentId:
|
|
1158
|
+
patch(documentId: PatchSelection, operations?: PatchOperations): ObservablePatch
|
|
1114
1159
|
/**
|
|
1115
1160
|
* Create a new transaction of mutations
|
|
1116
1161
|
*
|
|
1117
|
-
* @param operations Optional array of mutation operations to initialize the transaction instance with
|
|
1162
|
+
* @param operations - Optional array of mutation operations to initialize the transaction instance with
|
|
1118
1163
|
*/
|
|
1119
1164
|
transaction<R extends Record<string, any> = Record<string, any>>(
|
|
1120
1165
|
operations?: Mutation<R>[]
|
|
@@ -1123,11 +1168,12 @@ export declare class ObservableSanityClient {
|
|
|
1123
1168
|
* DEPRECATED: Perform an HTTP request against the Sanity API
|
|
1124
1169
|
*
|
|
1125
1170
|
* @deprecated Use your own request library!
|
|
1126
|
-
* @param options Request options
|
|
1171
|
+
* @param options - Request options
|
|
1127
1172
|
*/
|
|
1128
1173
|
request<R = any>(options: RawRequestOptions): Observable<R>
|
|
1129
1174
|
}
|
|
1130
1175
|
|
|
1176
|
+
/** @public */
|
|
1131
1177
|
export declare class ObservableTransaction extends BaseTransaction {
|
|
1132
1178
|
#private
|
|
1133
1179
|
constructor(operations?: Mutation[], client?: ObservableSanityClient, transactionId?: string)
|
|
@@ -1186,6 +1232,7 @@ export declare class ObservableTransaction extends BaseTransaction {
|
|
|
1186
1232
|
patch(patch: ObservablePatch): this
|
|
1187
1233
|
}
|
|
1188
1234
|
|
|
1235
|
+
/** @public */
|
|
1189
1236
|
export declare class ObservableUsersClient {
|
|
1190
1237
|
#private
|
|
1191
1238
|
constructor(client: ObservableSanityClient, httpRequest: HttpRequest)
|
|
@@ -1199,6 +1246,7 @@ export declare class ObservableUsersClient {
|
|
|
1199
1246
|
): Observable<T extends 'me' ? CurrentSanityUser : SanityUser>
|
|
1200
1247
|
}
|
|
1201
1248
|
|
|
1249
|
+
/** @public */
|
|
1202
1250
|
export declare class Patch extends BasePatch {
|
|
1203
1251
|
#private
|
|
1204
1252
|
constructor(selection: PatchSelection, operations?: PatchOperations, client?: SanityClient)
|
|
@@ -1209,7 +1257,7 @@ export declare class Patch extends BasePatch {
|
|
|
1209
1257
|
/**
|
|
1210
1258
|
* Commit the patch, returning a promise that resolves to the first patched document
|
|
1211
1259
|
*
|
|
1212
|
-
* @param options Options for the mutation operation
|
|
1260
|
+
* @param options - Options for the mutation operation
|
|
1213
1261
|
*/
|
|
1214
1262
|
commit<R extends Record<string, any> = Record<string, any>>(
|
|
1215
1263
|
options: FirstDocumentMutationOptions
|
|
@@ -1217,7 +1265,7 @@ export declare class Patch extends BasePatch {
|
|
|
1217
1265
|
/**
|
|
1218
1266
|
* Commit the patch, returning a promise that resolves to an array of the mutated documents
|
|
1219
1267
|
*
|
|
1220
|
-
* @param options Options for the mutation operation
|
|
1268
|
+
* @param options - Options for the mutation operation
|
|
1221
1269
|
*/
|
|
1222
1270
|
commit<R extends Record<string, any> = Record<string, any>>(
|
|
1223
1271
|
options: AllDocumentsMutationOptions
|
|
@@ -1225,29 +1273,32 @@ export declare class Patch extends BasePatch {
|
|
|
1225
1273
|
/**
|
|
1226
1274
|
* Commit the patch, returning a promise that resolves to a mutation result object
|
|
1227
1275
|
*
|
|
1228
|
-
* @param options Options for the mutation operation
|
|
1276
|
+
* @param options - Options for the mutation operation
|
|
1229
1277
|
*/
|
|
1230
1278
|
commit(options: FirstDocumentIdMutationOptions): Promise<SingleMutationResult>
|
|
1231
1279
|
/**
|
|
1232
1280
|
* Commit the patch, returning a promise that resolves to a mutation result object
|
|
1233
1281
|
*
|
|
1234
|
-
* @param options Options for the mutation operation
|
|
1282
|
+
* @param options - Options for the mutation operation
|
|
1235
1283
|
*/
|
|
1236
1284
|
commit(options: AllDocumentIdsMutationOptions): Promise<MultipleMutationResult>
|
|
1237
1285
|
/**
|
|
1238
1286
|
* Commit the patch, returning a promise that resolves to the first patched document
|
|
1239
1287
|
*
|
|
1240
|
-
* @param options Options for the mutation operation
|
|
1288
|
+
* @param options - Options for the mutation operation
|
|
1241
1289
|
*/
|
|
1242
1290
|
commit<R extends Record<string, any> = Record<string, any>>(
|
|
1243
1291
|
options?: BaseMutationOptions
|
|
1244
1292
|
): Promise<SanityDocument<R>>
|
|
1245
1293
|
}
|
|
1246
1294
|
|
|
1295
|
+
/** @public */
|
|
1247
1296
|
export declare type PatchBuilder = (patch: Patch) => Patch
|
|
1248
1297
|
|
|
1298
|
+
/** @internal */
|
|
1249
1299
|
export declare type PatchMutationOperation = PatchOperations & MutationSelection
|
|
1250
1300
|
|
|
1301
|
+
/** @internal */
|
|
1251
1302
|
export declare interface PatchOperations {
|
|
1252
1303
|
set?: {
|
|
1253
1304
|
[key: string]: any
|
|
@@ -1269,8 +1320,10 @@ export declare interface PatchOperations {
|
|
|
1269
1320
|
ifRevisionID?: string
|
|
1270
1321
|
}
|
|
1271
1322
|
|
|
1323
|
+
/** @internal */
|
|
1272
1324
|
export declare type PatchSelection = string | string[] | MutationSelection
|
|
1273
1325
|
|
|
1326
|
+
/** @public */
|
|
1274
1327
|
declare interface ProgressEvent_2 {
|
|
1275
1328
|
type: 'progress'
|
|
1276
1329
|
stage: 'upload' | 'download'
|
|
@@ -1281,6 +1334,7 @@ declare interface ProgressEvent_2 {
|
|
|
1281
1334
|
}
|
|
1282
1335
|
export {ProgressEvent_2 as ProgressEvent}
|
|
1283
1336
|
|
|
1337
|
+
/** @internal */
|
|
1284
1338
|
export declare class ProjectsClient {
|
|
1285
1339
|
#private
|
|
1286
1340
|
constructor(client: SanityClient, httpRequest: HttpRequest)
|
|
@@ -1296,16 +1350,19 @@ export declare class ProjectsClient {
|
|
|
1296
1350
|
getById(projectId: string): Promise<SanityProject>
|
|
1297
1351
|
}
|
|
1298
1352
|
|
|
1353
|
+
/** @public */
|
|
1299
1354
|
export declare type QueryParams = {
|
|
1300
1355
|
[key: string]: any
|
|
1301
1356
|
}
|
|
1302
1357
|
|
|
1358
|
+
/** @internal */
|
|
1303
1359
|
export declare interface RawQueryResponse<R> {
|
|
1304
1360
|
q: string
|
|
1305
1361
|
ms: number
|
|
1306
1362
|
result: R
|
|
1307
1363
|
}
|
|
1308
1364
|
|
|
1365
|
+
/** @internal */
|
|
1309
1366
|
export declare interface RawRequestOptions {
|
|
1310
1367
|
url?: string
|
|
1311
1368
|
uri?: string
|
|
@@ -1327,12 +1384,15 @@ export declare interface RawRequestOptions {
|
|
|
1327
1384
|
maxRedirects?: number
|
|
1328
1385
|
}
|
|
1329
1386
|
|
|
1387
|
+
/** @public */
|
|
1330
1388
|
export declare type ReconnectEvent = {
|
|
1331
1389
|
type: 'reconnect'
|
|
1332
1390
|
}
|
|
1333
1391
|
|
|
1392
|
+
/** @public */
|
|
1334
1393
|
export declare const requester: Requester
|
|
1335
1394
|
|
|
1395
|
+
/** @internal */
|
|
1336
1396
|
export declare interface RequestObservableOptions extends Omit<RequestOptions, 'url'> {
|
|
1337
1397
|
url?: string
|
|
1338
1398
|
uri?: string
|
|
@@ -1340,6 +1400,7 @@ export declare interface RequestObservableOptions extends Omit<RequestOptions, '
|
|
|
1340
1400
|
tag?: string
|
|
1341
1401
|
}
|
|
1342
1402
|
|
|
1403
|
+
/** @public */
|
|
1343
1404
|
export declare interface RequestOptions {
|
|
1344
1405
|
timeout?: number
|
|
1345
1406
|
token?: string
|
|
@@ -1350,6 +1411,7 @@ export declare interface RequestOptions {
|
|
|
1350
1411
|
body?: any
|
|
1351
1412
|
}
|
|
1352
1413
|
|
|
1414
|
+
/** @public */
|
|
1353
1415
|
export declare interface ResponseEvent<T = unknown> {
|
|
1354
1416
|
type: 'response'
|
|
1355
1417
|
body: T
|
|
@@ -1360,6 +1422,7 @@ export declare interface ResponseEvent<T = unknown> {
|
|
|
1360
1422
|
headers: Record<string, string>
|
|
1361
1423
|
}
|
|
1362
1424
|
|
|
1425
|
+
/** @internal */
|
|
1363
1426
|
export declare interface SanityAssetDocument extends SanityDocument {
|
|
1364
1427
|
url: string
|
|
1365
1428
|
path: string
|
|
@@ -1372,6 +1435,7 @@ export declare interface SanityAssetDocument extends SanityDocument {
|
|
|
1372
1435
|
originalFilename?: string
|
|
1373
1436
|
}
|
|
1374
1437
|
|
|
1438
|
+
/** @public */
|
|
1375
1439
|
export declare class SanityClient {
|
|
1376
1440
|
#private
|
|
1377
1441
|
assets: AssetsClient
|
|
@@ -1387,7 +1451,7 @@ export declare class SanityClient {
|
|
|
1387
1451
|
* Instance properties
|
|
1388
1452
|
*/
|
|
1389
1453
|
listen: typeof _listen
|
|
1390
|
-
constructor(httpRequest: HttpRequest, config
|
|
1454
|
+
constructor(httpRequest: HttpRequest, config?: ClientConfig)
|
|
1391
1455
|
/**
|
|
1392
1456
|
* Clone the client - returns a new instance
|
|
1393
1457
|
*/
|
|
@@ -1403,28 +1467,28 @@ export declare class SanityClient {
|
|
|
1403
1467
|
/**
|
|
1404
1468
|
* Clone the client with a new (partial) configuration.
|
|
1405
1469
|
*
|
|
1406
|
-
* @param newConfig New client configuration properties, shallowly merged with existing configuration
|
|
1470
|
+
* @param newConfig - New client configuration properties, shallowly merged with existing configuration
|
|
1407
1471
|
*/
|
|
1408
1472
|
withConfig(newConfig?: Partial<ClientConfig>): SanityClient
|
|
1409
1473
|
/**
|
|
1410
1474
|
* Perform a GROQ-query against the configured dataset.
|
|
1411
1475
|
*
|
|
1412
|
-
* @param query GROQ-query to perform
|
|
1476
|
+
* @param query - GROQ-query to perform
|
|
1413
1477
|
*/
|
|
1414
1478
|
fetch<R = any>(query: string): Promise<R>
|
|
1415
1479
|
/**
|
|
1416
1480
|
* Perform a GROQ-query against the configured dataset.
|
|
1417
1481
|
*
|
|
1418
|
-
* @param query GROQ-query to perform
|
|
1419
|
-
* @param params Optional query parameters
|
|
1482
|
+
* @param query - GROQ-query to perform
|
|
1483
|
+
* @param params - Optional query parameters
|
|
1420
1484
|
*/
|
|
1421
1485
|
fetch<R = any>(query: string, params: QueryParams): Promise<R>
|
|
1422
1486
|
/**
|
|
1423
1487
|
* Perform a GROQ-query against the configured dataset.
|
|
1424
1488
|
*
|
|
1425
|
-
* @param query GROQ-query to perform
|
|
1426
|
-
* @param params Optional query parameters
|
|
1427
|
-
* @param options Request options
|
|
1489
|
+
* @param query - GROQ-query to perform
|
|
1490
|
+
* @param params - Optional query parameters
|
|
1491
|
+
* @param options - Request options
|
|
1428
1492
|
*/
|
|
1429
1493
|
fetch<R = any>(
|
|
1430
1494
|
query: string,
|
|
@@ -1434,9 +1498,9 @@ export declare class SanityClient {
|
|
|
1434
1498
|
/**
|
|
1435
1499
|
* Perform a GROQ-query against the configured dataset.
|
|
1436
1500
|
*
|
|
1437
|
-
* @param query GROQ-query to perform
|
|
1438
|
-
* @param params Optional query parameters
|
|
1439
|
-
* @param options Request options
|
|
1501
|
+
* @param query - GROQ-query to perform
|
|
1502
|
+
* @param params - Optional query parameters
|
|
1503
|
+
* @param options - Request options
|
|
1440
1504
|
*/
|
|
1441
1505
|
fetch<R = any>(
|
|
1442
1506
|
query: string,
|
|
@@ -1446,8 +1510,8 @@ export declare class SanityClient {
|
|
|
1446
1510
|
/**
|
|
1447
1511
|
* Fetch a single document with the given ID.
|
|
1448
1512
|
*
|
|
1449
|
-
* @param id Document ID to fetch
|
|
1450
|
-
* @param options Request options
|
|
1513
|
+
* @param id - Document ID to fetch
|
|
1514
|
+
* @param options - Request options
|
|
1451
1515
|
*/
|
|
1452
1516
|
getDocument<R extends Record<string, any> = Record<string, any>>(
|
|
1453
1517
|
id: string,
|
|
@@ -1461,8 +1525,8 @@ export declare class SanityClient {
|
|
|
1461
1525
|
* The order/position of documents is preserved based on the original array of IDs.
|
|
1462
1526
|
* If a any of the documents are missing, they will be replaced by a `null` entry in the returned array
|
|
1463
1527
|
*
|
|
1464
|
-
* @param ids Document IDs to fetch
|
|
1465
|
-
* @param options Request options
|
|
1528
|
+
* @param ids - Document IDs to fetch
|
|
1529
|
+
* @param options - Request options
|
|
1466
1530
|
*/
|
|
1467
1531
|
getDocuments<R extends Record<string, any> = Record<string, any>>(
|
|
1468
1532
|
ids: string[],
|
|
@@ -1474,8 +1538,8 @@ export declare class SanityClient {
|
|
|
1474
1538
|
* Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
|
|
1475
1539
|
* Returns a promise that resolves to the created document.
|
|
1476
1540
|
*
|
|
1477
|
-
* @param document Document to create
|
|
1478
|
-
* @param options Mutation options
|
|
1541
|
+
* @param document - Document to create
|
|
1542
|
+
* @param options - Mutation options
|
|
1479
1543
|
*/
|
|
1480
1544
|
create<R extends Record<string, any> = Record<string, any>>(
|
|
1481
1545
|
document: SanityDocumentStub<R>,
|
|
@@ -1485,8 +1549,8 @@ export declare class SanityClient {
|
|
|
1485
1549
|
* Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
|
|
1486
1550
|
* Returns a promise that resolves to an array containing the created document.
|
|
1487
1551
|
*
|
|
1488
|
-
* @param document Document to create
|
|
1489
|
-
* @param options Mutation options
|
|
1552
|
+
* @param document - Document to create
|
|
1553
|
+
* @param options - Mutation options
|
|
1490
1554
|
*/
|
|
1491
1555
|
create<R extends Record<string, any> = Record<string, any>>(
|
|
1492
1556
|
document: SanityDocumentStub<R>,
|
|
@@ -1496,8 +1560,8 @@ export declare class SanityClient {
|
|
|
1496
1560
|
* Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
|
|
1497
1561
|
* Returns a promise that resolves to a mutation result object containing the ID of the created document.
|
|
1498
1562
|
*
|
|
1499
|
-
* @param document Document to create
|
|
1500
|
-
* @param options Mutation options
|
|
1563
|
+
* @param document - Document to create
|
|
1564
|
+
* @param options - Mutation options
|
|
1501
1565
|
*/
|
|
1502
1566
|
create<R extends Record<string, any> = Record<string, any>>(
|
|
1503
1567
|
document: SanityDocumentStub<R>,
|
|
@@ -1507,8 +1571,8 @@ export declare class SanityClient {
|
|
|
1507
1571
|
* Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
|
|
1508
1572
|
* Returns a promise that resolves to a mutation result object containing the ID of the created document.
|
|
1509
1573
|
*
|
|
1510
|
-
* @param document Document to create
|
|
1511
|
-
* @param options Mutation options
|
|
1574
|
+
* @param document - Document to create
|
|
1575
|
+
* @param options - Mutation options
|
|
1512
1576
|
*/
|
|
1513
1577
|
create<R extends Record<string, any> = Record<string, any>>(
|
|
1514
1578
|
document: SanityDocumentStub<R>,
|
|
@@ -1518,8 +1582,8 @@ export declare class SanityClient {
|
|
|
1518
1582
|
* Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
|
|
1519
1583
|
* Returns a promise that resolves to the created document.
|
|
1520
1584
|
*
|
|
1521
|
-
* @param document Document to create
|
|
1522
|
-
* @param options Mutation options
|
|
1585
|
+
* @param document - Document to create
|
|
1586
|
+
* @param options - Mutation options
|
|
1523
1587
|
*/
|
|
1524
1588
|
create<R extends Record<string, any> = Record<string, any>>(
|
|
1525
1589
|
document: SanityDocumentStub<R>,
|
|
@@ -1529,8 +1593,8 @@ export declare class SanityClient {
|
|
|
1529
1593
|
* Create a document if no document with the same ID already exists.
|
|
1530
1594
|
* Returns a promise that resolves to the created document.
|
|
1531
1595
|
*
|
|
1532
|
-
* @param document Document to create
|
|
1533
|
-
* @param options Mutation options
|
|
1596
|
+
* @param document - Document to create
|
|
1597
|
+
* @param options - Mutation options
|
|
1534
1598
|
*/
|
|
1535
1599
|
createIfNotExists<R extends Record<string, any> = Record<string, any>>(
|
|
1536
1600
|
document: IdentifiedSanityDocumentStub<R>,
|
|
@@ -1540,8 +1604,8 @@ export declare class SanityClient {
|
|
|
1540
1604
|
* Create a document if no document with the same ID already exists.
|
|
1541
1605
|
* Returns a promise that resolves to an array containing the created document.
|
|
1542
1606
|
*
|
|
1543
|
-
* @param document Document to create
|
|
1544
|
-
* @param options Mutation options
|
|
1607
|
+
* @param document - Document to create
|
|
1608
|
+
* @param options - Mutation options
|
|
1545
1609
|
*/
|
|
1546
1610
|
createIfNotExists<R extends Record<string, any> = Record<string, any>>(
|
|
1547
1611
|
document: IdentifiedSanityDocumentStub<R>,
|
|
@@ -1551,8 +1615,8 @@ export declare class SanityClient {
|
|
|
1551
1615
|
* Create a document if no document with the same ID already exists.
|
|
1552
1616
|
* Returns a promise that resolves to a mutation result object containing the ID of the created document.
|
|
1553
1617
|
*
|
|
1554
|
-
* @param document Document to create
|
|
1555
|
-
* @param options Mutation options
|
|
1618
|
+
* @param document - Document to create
|
|
1619
|
+
* @param options - Mutation options
|
|
1556
1620
|
*/
|
|
1557
1621
|
createIfNotExists<R extends Record<string, any> = Record<string, any>>(
|
|
1558
1622
|
document: IdentifiedSanityDocumentStub<R>,
|
|
@@ -1562,8 +1626,8 @@ export declare class SanityClient {
|
|
|
1562
1626
|
* Create a document if no document with the same ID already exists.
|
|
1563
1627
|
* Returns a promise that resolves to a mutation result object containing the ID of the created document.
|
|
1564
1628
|
*
|
|
1565
|
-
* @param document Document to create
|
|
1566
|
-
* @param options Mutation options
|
|
1629
|
+
* @param document - Document to create
|
|
1630
|
+
* @param options - Mutation options
|
|
1567
1631
|
*/
|
|
1568
1632
|
createIfNotExists<R extends Record<string, any> = Record<string, any>>(
|
|
1569
1633
|
document: IdentifiedSanityDocumentStub<R>,
|
|
@@ -1573,8 +1637,8 @@ export declare class SanityClient {
|
|
|
1573
1637
|
* Create a document if no document with the same ID already exists.
|
|
1574
1638
|
* Returns a promise that resolves to the created document.
|
|
1575
1639
|
*
|
|
1576
|
-
* @param document Document to create
|
|
1577
|
-
* @param options Mutation options
|
|
1640
|
+
* @param document - Document to create
|
|
1641
|
+
* @param options - Mutation options
|
|
1578
1642
|
*/
|
|
1579
1643
|
createIfNotExists<R extends Record<string, any> = Record<string, any>>(
|
|
1580
1644
|
document: IdentifiedSanityDocumentStub<R>,
|
|
@@ -1584,8 +1648,8 @@ export declare class SanityClient {
|
|
|
1584
1648
|
* Create a document if it does not exist, or replace a document with the same document ID
|
|
1585
1649
|
* Returns a promise that resolves to the created document.
|
|
1586
1650
|
*
|
|
1587
|
-
* @param document Document to either create or replace
|
|
1588
|
-
* @param options Mutation options
|
|
1651
|
+
* @param document - Document to either create or replace
|
|
1652
|
+
* @param options - Mutation options
|
|
1589
1653
|
*/
|
|
1590
1654
|
createOrReplace<R extends Record<string, any> = Record<string, any>>(
|
|
1591
1655
|
document: IdentifiedSanityDocumentStub<R>,
|
|
@@ -1595,8 +1659,8 @@ export declare class SanityClient {
|
|
|
1595
1659
|
* Create a document if it does not exist, or replace a document with the same document ID
|
|
1596
1660
|
* Returns a promise that resolves to an array containing the created document.
|
|
1597
1661
|
*
|
|
1598
|
-
* @param document Document to either create or replace
|
|
1599
|
-
* @param options Mutation options
|
|
1662
|
+
* @param document - Document to either create or replace
|
|
1663
|
+
* @param options - Mutation options
|
|
1600
1664
|
*/
|
|
1601
1665
|
createOrReplace<R extends Record<string, any> = Record<string, any>>(
|
|
1602
1666
|
document: IdentifiedSanityDocumentStub<R>,
|
|
@@ -1606,8 +1670,8 @@ export declare class SanityClient {
|
|
|
1606
1670
|
* Create a document if it does not exist, or replace a document with the same document ID
|
|
1607
1671
|
* Returns a promise that resolves to a mutation result object containing the ID of the created document.
|
|
1608
1672
|
*
|
|
1609
|
-
* @param document Document to either create or replace
|
|
1610
|
-
* @param options Mutation options
|
|
1673
|
+
* @param document - Document to either create or replace
|
|
1674
|
+
* @param options - Mutation options
|
|
1611
1675
|
*/
|
|
1612
1676
|
createOrReplace<R extends Record<string, any> = Record<string, any>>(
|
|
1613
1677
|
document: IdentifiedSanityDocumentStub<R>,
|
|
@@ -1617,8 +1681,8 @@ export declare class SanityClient {
|
|
|
1617
1681
|
* Create a document if it does not exist, or replace a document with the same document ID
|
|
1618
1682
|
* Returns a promise that resolves to a mutation result object containing the created document ID.
|
|
1619
1683
|
*
|
|
1620
|
-
* @param document Document to either create or replace
|
|
1621
|
-
* @param options Mutation options
|
|
1684
|
+
* @param document - Document to either create or replace
|
|
1685
|
+
* @param options - Mutation options
|
|
1622
1686
|
*/
|
|
1623
1687
|
createOrReplace<R extends Record<string, any> = Record<string, any>>(
|
|
1624
1688
|
document: IdentifiedSanityDocumentStub<R>,
|
|
@@ -1628,8 +1692,8 @@ export declare class SanityClient {
|
|
|
1628
1692
|
* Create a document if it does not exist, or replace a document with the same document ID
|
|
1629
1693
|
* Returns a promise that resolves to the created document.
|
|
1630
1694
|
*
|
|
1631
|
-
* @param document Document to either create or replace
|
|
1632
|
-
* @param options Mutation options
|
|
1695
|
+
* @param document - Document to either create or replace
|
|
1696
|
+
* @param options - Mutation options
|
|
1633
1697
|
*/
|
|
1634
1698
|
createOrReplace<R extends Record<string, any> = Record<string, any>>(
|
|
1635
1699
|
document: IdentifiedSanityDocumentStub<R>,
|
|
@@ -1639,8 +1703,8 @@ export declare class SanityClient {
|
|
|
1639
1703
|
* Deletes a document with the given document ID.
|
|
1640
1704
|
* Returns a promise that resolves to the deleted document.
|
|
1641
1705
|
*
|
|
1642
|
-
* @param id Document ID to delete
|
|
1643
|
-
* @param options Options for the mutation
|
|
1706
|
+
* @param id - Document ID to delete
|
|
1707
|
+
* @param options - Options for the mutation
|
|
1644
1708
|
*/
|
|
1645
1709
|
delete<R extends Record<string, any> = Record<string, any>>(
|
|
1646
1710
|
id: string,
|
|
@@ -1650,8 +1714,8 @@ export declare class SanityClient {
|
|
|
1650
1714
|
* Deletes a document with the given document ID.
|
|
1651
1715
|
* Returns a promise that resolves to an array containing the deleted document.
|
|
1652
1716
|
*
|
|
1653
|
-
* @param id Document ID to delete
|
|
1654
|
-
* @param options Options for the mutation
|
|
1717
|
+
* @param id - Document ID to delete
|
|
1718
|
+
* @param options - Options for the mutation
|
|
1655
1719
|
*/
|
|
1656
1720
|
delete<R extends Record<string, any> = Record<string, any>>(
|
|
1657
1721
|
id: string,
|
|
@@ -1661,24 +1725,24 @@ export declare class SanityClient {
|
|
|
1661
1725
|
* Deletes a document with the given document ID.
|
|
1662
1726
|
* Returns a promise that resolves to a mutation result object containing the deleted document ID.
|
|
1663
1727
|
*
|
|
1664
|
-
* @param id Document ID to delete
|
|
1665
|
-
* @param options Options for the mutation
|
|
1728
|
+
* @param id - Document ID to delete
|
|
1729
|
+
* @param options - Options for the mutation
|
|
1666
1730
|
*/
|
|
1667
1731
|
delete(id: string, options: FirstDocumentIdMutationOptions): Promise<SingleMutationResult>
|
|
1668
1732
|
/**
|
|
1669
1733
|
* Deletes a document with the given document ID.
|
|
1670
1734
|
* Returns a promise that resolves to a mutation result object containing the deleted document ID.
|
|
1671
1735
|
*
|
|
1672
|
-
* @param id Document ID to delete
|
|
1673
|
-
* @param options Options for the mutation
|
|
1736
|
+
* @param id - Document ID to delete
|
|
1737
|
+
* @param options - Options for the mutation
|
|
1674
1738
|
*/
|
|
1675
1739
|
delete(id: string, options: AllDocumentIdsMutationOptions): Promise<MultipleMutationResult>
|
|
1676
1740
|
/**
|
|
1677
1741
|
* Deletes a document with the given document ID.
|
|
1678
1742
|
* Returns a promise that resolves to the deleted document.
|
|
1679
1743
|
*
|
|
1680
|
-
* @param id Document ID to delete
|
|
1681
|
-
* @param options Options for the mutation
|
|
1744
|
+
* @param id - Document ID to delete
|
|
1745
|
+
* @param options - Options for the mutation
|
|
1682
1746
|
*/
|
|
1683
1747
|
delete<R extends Record<string, any> = Record<string, any>>(
|
|
1684
1748
|
id: string,
|
|
@@ -1688,8 +1752,8 @@ export declare class SanityClient {
|
|
|
1688
1752
|
* Deletes one or more documents matching the given query or document ID.
|
|
1689
1753
|
* Returns a promise that resolves to first deleted document.
|
|
1690
1754
|
*
|
|
1691
|
-
* @param selection An object with either an `id` or `query` key defining what to delete
|
|
1692
|
-
* @param options Options for the mutation
|
|
1755
|
+
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
1756
|
+
* @param options - Options for the mutation
|
|
1693
1757
|
*/
|
|
1694
1758
|
delete<R extends Record<string, any> = Record<string, any>>(
|
|
1695
1759
|
selection: MutationSelection,
|
|
@@ -1699,8 +1763,8 @@ export declare class SanityClient {
|
|
|
1699
1763
|
* Deletes one or more documents matching the given query or document ID.
|
|
1700
1764
|
* Returns a promise that resolves to an array containing the deleted documents.
|
|
1701
1765
|
*
|
|
1702
|
-
* @param selection An object with either an `id` or `query` key defining what to delete
|
|
1703
|
-
* @param options Options for the mutation
|
|
1766
|
+
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
1767
|
+
* @param options - Options for the mutation
|
|
1704
1768
|
*/
|
|
1705
1769
|
delete<R extends Record<string, any> = Record<string, any>>(
|
|
1706
1770
|
selection: MutationSelection,
|
|
@@ -1710,8 +1774,8 @@ export declare class SanityClient {
|
|
|
1710
1774
|
* Deletes one or more documents matching the given query or document ID.
|
|
1711
1775
|
* Returns a promise that resolves to a mutation result object containing the ID of the first deleted document.
|
|
1712
1776
|
*
|
|
1713
|
-
* @param selection An object with either an `id` or `query` key defining what to delete
|
|
1714
|
-
* @param options Options for the mutation
|
|
1777
|
+
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
1778
|
+
* @param options - Options for the mutation
|
|
1715
1779
|
*/
|
|
1716
1780
|
delete(
|
|
1717
1781
|
selection: MutationSelection,
|
|
@@ -1721,8 +1785,8 @@ export declare class SanityClient {
|
|
|
1721
1785
|
* Deletes one or more documents matching the given query or document ID.
|
|
1722
1786
|
* Returns a promise that resolves to a mutation result object containing the document IDs that were deleted.
|
|
1723
1787
|
*
|
|
1724
|
-
* @param selection An object with either an `id` or `query` key defining what to delete
|
|
1725
|
-
* @param options Options for the mutation
|
|
1788
|
+
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
1789
|
+
* @param options - Options for the mutation
|
|
1726
1790
|
*/
|
|
1727
1791
|
delete(
|
|
1728
1792
|
selection: MutationSelection,
|
|
@@ -1732,8 +1796,8 @@ export declare class SanityClient {
|
|
|
1732
1796
|
* Deletes one or more documents matching the given query or document ID.
|
|
1733
1797
|
* Returns a promise that resolves to first deleted document.
|
|
1734
1798
|
*
|
|
1735
|
-
* @param selection An object with either an `id` or `query` key defining what to delete
|
|
1736
|
-
* @param options Options for the mutation
|
|
1799
|
+
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
1800
|
+
* @param options - Options for the mutation
|
|
1737
1801
|
*/
|
|
1738
1802
|
delete<R extends Record<string, any> = Record<string, any>>(
|
|
1739
1803
|
selection: MutationSelection,
|
|
@@ -1743,8 +1807,8 @@ export declare class SanityClient {
|
|
|
1743
1807
|
* Perform mutation operations against the configured dataset
|
|
1744
1808
|
* Returns a promise that resolves to the first mutated document.
|
|
1745
1809
|
*
|
|
1746
|
-
* @param operations Mutation operations to execute
|
|
1747
|
-
* @param options Mutation options
|
|
1810
|
+
* @param operations - Mutation operations to execute
|
|
1811
|
+
* @param options - Mutation options
|
|
1748
1812
|
*/
|
|
1749
1813
|
mutate<R extends Record<string, any> = Record<string, any>>(
|
|
1750
1814
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
@@ -1754,8 +1818,8 @@ export declare class SanityClient {
|
|
|
1754
1818
|
* Perform mutation operations against the configured dataset.
|
|
1755
1819
|
* Returns a promise that resolves to an array of the mutated documents.
|
|
1756
1820
|
*
|
|
1757
|
-
* @param operations Mutation operations to execute
|
|
1758
|
-
* @param options Mutation options
|
|
1821
|
+
* @param operations - Mutation operations to execute
|
|
1822
|
+
* @param options - Mutation options
|
|
1759
1823
|
*/
|
|
1760
1824
|
mutate<R extends Record<string, any> = Record<string, any>>(
|
|
1761
1825
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
@@ -1765,8 +1829,8 @@ export declare class SanityClient {
|
|
|
1765
1829
|
* Perform mutation operations against the configured dataset
|
|
1766
1830
|
* Returns a promise that resolves to a mutation result object containing the document ID of the first mutated document.
|
|
1767
1831
|
*
|
|
1768
|
-
* @param operations Mutation operations to execute
|
|
1769
|
-
* @param options Mutation options
|
|
1832
|
+
* @param operations - Mutation operations to execute
|
|
1833
|
+
* @param options - Mutation options
|
|
1770
1834
|
*/
|
|
1771
1835
|
mutate<R extends Record<string, any> = Record<string, any>>(
|
|
1772
1836
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
@@ -1776,8 +1840,8 @@ export declare class SanityClient {
|
|
|
1776
1840
|
* Perform mutation operations against the configured dataset
|
|
1777
1841
|
* Returns a promise that resolves to a mutation result object containing the mutated document IDs.
|
|
1778
1842
|
*
|
|
1779
|
-
* @param operations Mutation operations to execute
|
|
1780
|
-
* @param options Mutation options
|
|
1843
|
+
* @param operations - Mutation operations to execute
|
|
1844
|
+
* @param options - Mutation options
|
|
1781
1845
|
*/
|
|
1782
1846
|
mutate<R extends Record<string, any>>(
|
|
1783
1847
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
@@ -1787,8 +1851,8 @@ export declare class SanityClient {
|
|
|
1787
1851
|
* Perform mutation operations against the configured dataset
|
|
1788
1852
|
* Returns a promise that resolves to the first mutated document.
|
|
1789
1853
|
*
|
|
1790
|
-
* @param operations Mutation operations to execute
|
|
1791
|
-
* @param options Mutation options
|
|
1854
|
+
* @param operations - Mutation operations to execute
|
|
1855
|
+
* @param options - Mutation options
|
|
1792
1856
|
*/
|
|
1793
1857
|
mutate<R extends Record<string, any> = Record<string, any>>(
|
|
1794
1858
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
@@ -1797,14 +1861,14 @@ export declare class SanityClient {
|
|
|
1797
1861
|
/**
|
|
1798
1862
|
* Create a new buildable patch of operations to perform
|
|
1799
1863
|
*
|
|
1800
|
-
* @param documentId Document ID
|
|
1801
|
-
* @param operations Optional object of patch operations to initialize the patch instance with
|
|
1864
|
+
* @param documentId - Document ID(s)to patch
|
|
1865
|
+
* @param operations - Optional object of patch operations to initialize the patch instance with
|
|
1802
1866
|
*/
|
|
1803
|
-
patch(documentId:
|
|
1867
|
+
patch(documentId: PatchSelection, operations?: PatchOperations): Patch
|
|
1804
1868
|
/**
|
|
1805
1869
|
* Create a new transaction of mutations
|
|
1806
1870
|
*
|
|
1807
|
-
* @param operations Optional array of mutation operations to initialize the transaction instance with
|
|
1871
|
+
* @param operations - Optional array of mutation operations to initialize the transaction instance with
|
|
1808
1872
|
*/
|
|
1809
1873
|
transaction<R extends Record<string, any> = Record<string, any>>(
|
|
1810
1874
|
operations?: Mutation<R>[]
|
|
@@ -1813,20 +1877,21 @@ export declare class SanityClient {
|
|
|
1813
1877
|
* DEPRECATED: Perform an HTTP request against the Sanity API
|
|
1814
1878
|
*
|
|
1815
1879
|
* @deprecated Use your own request library!
|
|
1816
|
-
* @param options Request options
|
|
1880
|
+
* @param options - Request options
|
|
1817
1881
|
*/
|
|
1818
1882
|
request<R = any>(options: RawRequestOptions): Promise<R>
|
|
1819
1883
|
/**
|
|
1820
1884
|
* DEPRECATED: Perform an HTTP request a `/data` sub-endpoint
|
|
1821
1885
|
*
|
|
1822
1886
|
* @deprecated Use your own request library!
|
|
1823
|
-
* @param endpoint Endpoint to hit (mutate, query etc)
|
|
1824
|
-
* @param body Request body
|
|
1825
|
-
* @param options Request options
|
|
1887
|
+
* @param endpoint - Endpoint to hit (mutate, query etc)
|
|
1888
|
+
* @param body - Request body
|
|
1889
|
+
* @param options - Request options
|
|
1826
1890
|
*/
|
|
1827
1891
|
dataRequest(endpoint: string, body: unknown, options?: BaseMutationOptions): Promise<any>
|
|
1828
1892
|
}
|
|
1829
1893
|
|
|
1894
|
+
/** @internal */
|
|
1830
1895
|
export declare type SanityDocument<T extends Record<string, any> = Record<string, any>> = {
|
|
1831
1896
|
[P in keyof T]: T[P]
|
|
1832
1897
|
} & {
|
|
@@ -1837,12 +1902,14 @@ export declare type SanityDocument<T extends Record<string, any> = Record<string
|
|
|
1837
1902
|
_updatedAt: string
|
|
1838
1903
|
}
|
|
1839
1904
|
|
|
1905
|
+
/** @public */
|
|
1840
1906
|
export declare type SanityDocumentStub<T extends Record<string, any> = Record<string, any>> = {
|
|
1841
1907
|
[P in keyof T]: T[P]
|
|
1842
1908
|
} & {
|
|
1843
1909
|
_type: string
|
|
1844
1910
|
}
|
|
1845
1911
|
|
|
1912
|
+
/** @internal */
|
|
1846
1913
|
export declare interface SanityImageAssetDocument extends SanityAssetDocument {
|
|
1847
1914
|
metadata: {
|
|
1848
1915
|
_type: 'sanity.imageMetadata'
|
|
@@ -1877,6 +1944,7 @@ export declare interface SanityImageAssetDocument extends SanityAssetDocument {
|
|
|
1877
1944
|
}
|
|
1878
1945
|
}
|
|
1879
1946
|
|
|
1947
|
+
/** @internal */
|
|
1880
1948
|
export declare interface SanityImagePalette {
|
|
1881
1949
|
background: string
|
|
1882
1950
|
foreground: string
|
|
@@ -1884,6 +1952,7 @@ export declare interface SanityImagePalette {
|
|
|
1884
1952
|
title: string
|
|
1885
1953
|
}
|
|
1886
1954
|
|
|
1955
|
+
/** @internal */
|
|
1887
1956
|
export declare interface SanityProject {
|
|
1888
1957
|
id: string
|
|
1889
1958
|
displayName: string
|
|
@@ -1902,6 +1971,7 @@ export declare interface SanityProject {
|
|
|
1902
1971
|
}
|
|
1903
1972
|
}
|
|
1904
1973
|
|
|
1974
|
+
/** @internal */
|
|
1905
1975
|
export declare interface SanityProjectMember {
|
|
1906
1976
|
id: string
|
|
1907
1977
|
role: string
|
|
@@ -1909,10 +1979,12 @@ export declare interface SanityProjectMember {
|
|
|
1909
1979
|
isCurrentUser: boolean
|
|
1910
1980
|
}
|
|
1911
1981
|
|
|
1982
|
+
/** @internal */
|
|
1912
1983
|
export declare interface SanityReference {
|
|
1913
1984
|
_ref: string
|
|
1914
1985
|
}
|
|
1915
1986
|
|
|
1987
|
+
/** @internal */
|
|
1916
1988
|
export declare interface SanityUser {
|
|
1917
1989
|
id: string
|
|
1918
1990
|
projectId: string
|
|
@@ -1926,6 +1998,7 @@ export declare interface SanityUser {
|
|
|
1926
1998
|
isCurrentUser: boolean
|
|
1927
1999
|
}
|
|
1928
2000
|
|
|
2001
|
+
/** @public */
|
|
1929
2002
|
export declare class ServerError extends BaseError {
|
|
1930
2003
|
response: ErrorProps['response']
|
|
1931
2004
|
statusCode: ErrorProps['statusCode']
|
|
@@ -1934,6 +2007,7 @@ export declare class ServerError extends BaseError {
|
|
|
1934
2007
|
constructor(res: any)
|
|
1935
2008
|
}
|
|
1936
2009
|
|
|
2010
|
+
/** @internal */
|
|
1937
2011
|
export declare interface SingleMutationResult {
|
|
1938
2012
|
transactionId: string
|
|
1939
2013
|
documentId: string
|
|
@@ -1943,6 +2017,7 @@ export declare interface SingleMutationResult {
|
|
|
1943
2017
|
}[]
|
|
1944
2018
|
}
|
|
1945
2019
|
|
|
2020
|
+
/** @public */
|
|
1946
2021
|
export declare class Transaction extends BaseTransaction {
|
|
1947
2022
|
#private
|
|
1948
2023
|
constructor(operations?: Mutation[], client?: SanityClient, transactionId?: string)
|
|
@@ -2001,36 +2076,43 @@ export declare class Transaction extends BaseTransaction {
|
|
|
2001
2076
|
patch(patch: Patch): this
|
|
2002
2077
|
}
|
|
2003
2078
|
|
|
2079
|
+
/** @internal */
|
|
2004
2080
|
export declare type TransactionAllDocumentIdsMutationOptions = BaseMutationOptions & {
|
|
2005
2081
|
returnFirst?: false
|
|
2006
2082
|
returnDocuments?: false
|
|
2007
2083
|
}
|
|
2008
2084
|
|
|
2085
|
+
/** @internal */
|
|
2009
2086
|
export declare type TransactionAllDocumentsMutationOptions = BaseMutationOptions & {
|
|
2010
2087
|
returnFirst?: false
|
|
2011
2088
|
returnDocuments: true
|
|
2012
2089
|
}
|
|
2013
2090
|
|
|
2091
|
+
/** @internal */
|
|
2014
2092
|
export declare type TransactionFirstDocumentIdMutationOptions = BaseMutationOptions & {
|
|
2015
2093
|
returnFirst: true
|
|
2016
2094
|
returnDocuments?: false
|
|
2017
2095
|
}
|
|
2018
2096
|
|
|
2097
|
+
/** @internal */
|
|
2019
2098
|
export declare type TransactionFirstDocumentMutationOptions = BaseMutationOptions & {
|
|
2020
2099
|
returnFirst: true
|
|
2021
2100
|
returnDocuments: true
|
|
2022
2101
|
}
|
|
2023
2102
|
|
|
2103
|
+
/** @internal */
|
|
2024
2104
|
export declare type TransactionMutationOptions =
|
|
2025
2105
|
| TransactionFirstDocumentMutationOptions
|
|
2026
2106
|
| TransactionFirstDocumentIdMutationOptions
|
|
2027
2107
|
| TransactionAllDocumentsMutationOptions
|
|
2028
2108
|
| TransactionAllDocumentIdsMutationOptions
|
|
2029
2109
|
|
|
2110
|
+
/** @internal */
|
|
2030
2111
|
export declare type UnfilteredResponseQueryOptions = RequestOptions & {
|
|
2031
2112
|
filterResponse: false
|
|
2032
2113
|
}
|
|
2033
2114
|
|
|
2115
|
+
/** @public */
|
|
2034
2116
|
export declare interface UploadClientConfig {
|
|
2035
2117
|
/**
|
|
2036
2118
|
* Optional request tag for the upload
|
|
@@ -2091,6 +2173,7 @@ export declare interface UploadClientConfig {
|
|
|
2091
2173
|
}
|
|
2092
2174
|
}
|
|
2093
2175
|
|
|
2176
|
+
/** @public */
|
|
2094
2177
|
export declare class UsersClient {
|
|
2095
2178
|
#private
|
|
2096
2179
|
constructor(client: SanityClient, httpRequest: HttpRequest)
|
|
@@ -2102,6 +2185,7 @@ export declare class UsersClient {
|
|
|
2102
2185
|
getById<T extends 'me' | string>(id: T): Promise<T extends 'me' ? CurrentSanityUser : SanityUser>
|
|
2103
2186
|
}
|
|
2104
2187
|
|
|
2188
|
+
/** @public */
|
|
2105
2189
|
export declare type WelcomeEvent = {
|
|
2106
2190
|
type: 'welcome'
|
|
2107
2191
|
}
|