@sanity/client 7.0.1-canary.2 → 7.2.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 +516 -40
- package/dist/_chunks-cjs/config.cjs +14 -0
- package/dist/_chunks-cjs/config.cjs.map +1 -1
- package/dist/_chunks-es/config.js +15 -1
- package/dist/_chunks-es/config.js.map +1 -1
- package/dist/index.browser.cjs +850 -7
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.d.cts +2601 -1622
- package/dist/index.browser.d.ts +2601 -1622
- package/dist/index.browser.js +852 -7
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +839 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2601 -1622
- package/dist/index.d.ts +2601 -1622
- package/dist/index.js +842 -9
- package/dist/index.js.map +1 -1
- package/dist/stega.browser.d.cts +2612 -1633
- package/dist/stega.browser.d.ts +2612 -1633
- package/dist/stega.d.cts +2612 -1633
- package/dist/stega.d.ts +2612 -1633
- package/package.json +3 -1
- package/src/SanityClient.ts +626 -1106
- package/src/agent/actions/AgentActionsClient.ts +111 -0
- package/src/agent/actions/commonTypes.ts +336 -0
- package/src/agent/actions/generate.ts +274 -0
- package/src/agent/actions/transform.ts +215 -0
- package/src/agent/actions/translate.ts +165 -0
- package/src/assets/AssetsClient.ts +2 -86
- package/src/data/dataMethods.ts +127 -3
- package/src/data/transaction.ts +1 -1
- package/src/datasets/DatasetsClient.ts +2 -64
- package/src/projects/ProjectsClient.ts +4 -46
- package/src/releases/ReleasesClient.ts +687 -0
- package/src/releases/createRelease.ts +53 -0
- package/src/types.ts +245 -1
- package/src/users/UsersClient.ts +2 -24
- package/src/util/createVersionId.ts +79 -0
- package/src/validators.ts +23 -1
- package/umd/sanityClient.js +915 -6
- package/umd/sanityClient.min.js +2 -2
package/dist/index.browser.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ export declare type Action =
|
|
|
19
19
|
| DiscardAction
|
|
20
20
|
| PublishAction
|
|
21
21
|
| UnpublishAction
|
|
22
|
+
| VersionAction
|
|
23
|
+
| ReleaseAction
|
|
22
24
|
|
|
23
25
|
/** @internal */
|
|
24
26
|
export declare interface ActionError {
|
|
@@ -39,6 +41,262 @@ export declare interface ActionErrorItem {
|
|
|
39
41
|
index: number
|
|
40
42
|
}
|
|
41
43
|
|
|
44
|
+
/** @beta */
|
|
45
|
+
declare interface AgentActionAsync {
|
|
46
|
+
/**
|
|
47
|
+
* When async: true, requests responds with status 201 and \{_id\} as response body as soon as the request is validated.
|
|
48
|
+
* The instruction operation will carry on in the background.
|
|
49
|
+
*
|
|
50
|
+
* When async: false (default), requests respond with status 200 and the document value after instruction has been applied.
|
|
51
|
+
*
|
|
52
|
+
* async: true is incompatible with noWrite, as async: true does not return the resulting document
|
|
53
|
+
*/
|
|
54
|
+
async: true
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** @beta */
|
|
58
|
+
export declare type AgentActionParam =
|
|
59
|
+
| string
|
|
60
|
+
| ConstantAgentActionParam
|
|
61
|
+
| FieldAgentActionParam
|
|
62
|
+
| DocumentAgentActionParam
|
|
63
|
+
| GroqAgentActionParam
|
|
64
|
+
|
|
65
|
+
/** @beta */
|
|
66
|
+
export declare type AgentActionParams = Record<string, AgentActionParam>
|
|
67
|
+
|
|
68
|
+
/** @beta */
|
|
69
|
+
export declare type AgentActionPath = AgentActionPathSegment[]
|
|
70
|
+
|
|
71
|
+
/** @beta */
|
|
72
|
+
export declare type AgentActionPathSegment =
|
|
73
|
+
| string
|
|
74
|
+
| {
|
|
75
|
+
_key: string
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** @beta */
|
|
79
|
+
declare interface AgentActionRequestBase {
|
|
80
|
+
/** schemaId as reported by sanity deploy / sanity schema store */
|
|
81
|
+
schemaId: string
|
|
82
|
+
/**
|
|
83
|
+
* When a type or field in the schema has a function set for `hidden` or `readOnly`, it is conditional.
|
|
84
|
+
*
|
|
85
|
+
* By default, Generate will not output to conditional `readOnly` and `hidden` fields,
|
|
86
|
+
* ie, they are considered to resolve to `readOnly: true` / `hidden: true`.
|
|
87
|
+
*
|
|
88
|
+
* `conditionalPaths` param allows setting the default conditional value for
|
|
89
|
+
* `hidden` and `readOnly` to false,
|
|
90
|
+
* or individually set `hidden` and `readOnly` state for individual document paths.
|
|
91
|
+
*
|
|
92
|
+
* Note: fields and types with explicit readOnly: true or hidden: true in the schema, are not available to Generate,
|
|
93
|
+
* and cannot be changed via conditionalPaths
|
|
94
|
+
*
|
|
95
|
+
* conditionalPaths state only apply to fields and types that have conditional `hidden` or `readOnly` in their schema definition.
|
|
96
|
+
*
|
|
97
|
+
* Consider using `hidden: () => true` in schema config, if a field should be writeable only by Generate and never
|
|
98
|
+
* visible in the studio – then make the field visible to the Generate using `conditionalPaths`.
|
|
99
|
+
*
|
|
100
|
+
* @see GenerateRequestBase#target
|
|
101
|
+
*/
|
|
102
|
+
conditionalPaths?: {
|
|
103
|
+
defaultReadOnly?: boolean
|
|
104
|
+
defaultHidden?: boolean
|
|
105
|
+
paths?: {
|
|
106
|
+
/** path here is not a relative path: it must be the full document path, regardless of `path` param used in targets */
|
|
107
|
+
path: AgentActionPath
|
|
108
|
+
readOnly: boolean
|
|
109
|
+
hidden: boolean
|
|
110
|
+
}[]
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* When localeSettings is provided on the request, instruct can write to date and datetime fields.
|
|
114
|
+
* Otherwise, such fields will be ignored.
|
|
115
|
+
*/
|
|
116
|
+
localeSettings?: {
|
|
117
|
+
/**
|
|
118
|
+
* A valid Unicode BCP 47 locale identifier used to interpret and format
|
|
119
|
+
* natural language inputs and date output. Examples include "en-US", "fr-FR", or "ja-JP".
|
|
120
|
+
*
|
|
121
|
+
* This affects how phrases like "next Friday" or "in two weeks" are parsed,
|
|
122
|
+
* and how resulting dates are presented (e.g., 12-hour vs 24-hour format).
|
|
123
|
+
*
|
|
124
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#getcanonicalocales
|
|
125
|
+
*/
|
|
126
|
+
locale: string
|
|
127
|
+
/**
|
|
128
|
+
* A valid IANA time zone identifier used to resolve relative and absolute
|
|
129
|
+
* date expressions to a specific point in time. Examples include
|
|
130
|
+
* "America/New_York", "Europe/Paris", or "Asia/Tokyo".
|
|
131
|
+
*
|
|
132
|
+
* This ensures phrases like "tomorrow at 9am" are interpreted correctly
|
|
133
|
+
* based on the user's local time.
|
|
134
|
+
*
|
|
135
|
+
* @see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
|
136
|
+
*/
|
|
137
|
+
timeZone: string
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Controls how much variance the instructions will run with.
|
|
141
|
+
*
|
|
142
|
+
* Value must be in the range [0, 1] (inclusive).
|
|
143
|
+
*
|
|
144
|
+
* Defaults:
|
|
145
|
+
* - generate: 0.3
|
|
146
|
+
* - translate: 0
|
|
147
|
+
* - transform: 0
|
|
148
|
+
*/
|
|
149
|
+
temperature?: number
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** @public */
|
|
153
|
+
declare class AgentActionsClient {
|
|
154
|
+
#private
|
|
155
|
+
constructor(client: SanityClient, httpRequest: HttpRequest)
|
|
156
|
+
/**
|
|
157
|
+
* Run an instruction to generate content in a target document.
|
|
158
|
+
* @param request - instruction request
|
|
159
|
+
*/
|
|
160
|
+
generate<DocumentShape extends Record<string, Any>>(
|
|
161
|
+
request: GenerateInstruction<DocumentShape>,
|
|
162
|
+
): Promise<
|
|
163
|
+
(typeof request)['async'] extends true
|
|
164
|
+
? {
|
|
165
|
+
_id: string
|
|
166
|
+
}
|
|
167
|
+
: IdentifiedSanityDocumentStub & DocumentShape
|
|
168
|
+
>
|
|
169
|
+
/**
|
|
170
|
+
* Transform a target document based on a source.
|
|
171
|
+
* @param request - translation request
|
|
172
|
+
*/
|
|
173
|
+
transform<DocumentShape extends Record<string, Any>>(
|
|
174
|
+
request: TransformDocument<DocumentShape>,
|
|
175
|
+
): Promise<
|
|
176
|
+
(typeof request)['async'] extends true
|
|
177
|
+
? {
|
|
178
|
+
_id: string
|
|
179
|
+
}
|
|
180
|
+
: IdentifiedSanityDocumentStub & DocumentShape
|
|
181
|
+
>
|
|
182
|
+
/**
|
|
183
|
+
* Translate a target document based on a source.
|
|
184
|
+
* @param request - translation request
|
|
185
|
+
*/
|
|
186
|
+
translate<DocumentShape extends Record<string, Any>>(
|
|
187
|
+
request: TranslateDocument<DocumentShape>,
|
|
188
|
+
): Promise<
|
|
189
|
+
(typeof request)['async'] extends true
|
|
190
|
+
? {
|
|
191
|
+
_id: string
|
|
192
|
+
}
|
|
193
|
+
: IdentifiedSanityDocumentStub & DocumentShape
|
|
194
|
+
>
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/** @beta */
|
|
198
|
+
declare interface AgentActionSync {
|
|
199
|
+
/**
|
|
200
|
+
* By default, noWrite: false.
|
|
201
|
+
* Write enabled operations will mutate the target document, and emit AI presence in the studio.
|
|
202
|
+
*
|
|
203
|
+
* When noWrite: true, the api will not mutate any documents nor emit presence.
|
|
204
|
+
* Ie, when true, no changes will be made to content-lake
|
|
205
|
+
*
|
|
206
|
+
* noWrite: true is incompatible with async: true,
|
|
207
|
+
* as noWrite implies that you will use the return value of the operation
|
|
208
|
+
*/
|
|
209
|
+
noWrite?: boolean
|
|
210
|
+
/**
|
|
211
|
+
* When async: true, requests responds with status 201 and \{_id\} as response body as soon as the request is validated.
|
|
212
|
+
* The instruction operation will carry on in the background.
|
|
213
|
+
*
|
|
214
|
+
* When async: false (default), requests respond with status 200 and the document value after instruction has been applied.
|
|
215
|
+
*
|
|
216
|
+
* async: true is incompatible with noWrite: true, as async: true does not return the resulting document
|
|
217
|
+
*/
|
|
218
|
+
async?: false
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* @beta
|
|
223
|
+
*/
|
|
224
|
+
export declare interface AgentActionTarget {
|
|
225
|
+
/**
|
|
226
|
+
* Root target path.
|
|
227
|
+
*
|
|
228
|
+
* Use this to have the instruction only affect a part of the document.
|
|
229
|
+
*
|
|
230
|
+
* To further control the behavior of individual paths under the root, use `include`, `exclude`, `types.include`
|
|
231
|
+
* and `types.exclude`.
|
|
232
|
+
*
|
|
233
|
+
* Example:
|
|
234
|
+
*
|
|
235
|
+
* `path: ['body', {_key: 'someKey'}, 'nestedObject']`
|
|
236
|
+
*
|
|
237
|
+
* Here, the instruction will only write to fields under the nestedObject.
|
|
238
|
+
*
|
|
239
|
+
* Default: [] = the document itself
|
|
240
|
+
*
|
|
241
|
+
* @see #AgentActionPathSegment
|
|
242
|
+
* @see #AgentActionPath
|
|
243
|
+
* */
|
|
244
|
+
path?: AgentActionPathSegment | AgentActionPath
|
|
245
|
+
/**
|
|
246
|
+
* maxPathDepth controls how deep into the schema from the target root the instruction will affect.
|
|
247
|
+
*
|
|
248
|
+
* Depth is based on path segments:
|
|
249
|
+
* - `title` has depth 1
|
|
250
|
+
* - `array[_key="no"].title` has depth 3
|
|
251
|
+
*
|
|
252
|
+
* Be careful not to set this too high in studios with recursive document schemas, as it could have
|
|
253
|
+
* negative impact on performance; both for runtime and quality of responses.
|
|
254
|
+
*
|
|
255
|
+
* Default: 4
|
|
256
|
+
*/
|
|
257
|
+
maxPathDepth?: number
|
|
258
|
+
/**
|
|
259
|
+
* By default, all children up to `target.maxPathDepth` are included.
|
|
260
|
+
* Fields or array items not on the exclude list, are implicitly included.
|
|
261
|
+
*/
|
|
262
|
+
exclude?: AgentActionPathSegment[]
|
|
263
|
+
/**
|
|
264
|
+
* Types can be used to exclude array item types or all fields directly under the target path of a certain type.
|
|
265
|
+
* If you do exclude: ['string'] all string fields under the target will be excluded, for instance.
|
|
266
|
+
*
|
|
267
|
+
* `types.include` and `types.exclude` are mutually exclusive.
|
|
268
|
+
*/
|
|
269
|
+
types?: AgentActionTypeConfig
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/** @beta */
|
|
273
|
+
declare interface AgentActionTargetInclude {
|
|
274
|
+
path: AgentActionPathSegment | AgentActionPath
|
|
275
|
+
/**
|
|
276
|
+
* By default, all children up to `target.maxPathDepth` are included.
|
|
277
|
+
* Fields or array items not on the exclude list, are implicitly included.
|
|
278
|
+
*/
|
|
279
|
+
exclude?: AgentActionPathSegment[]
|
|
280
|
+
/**
|
|
281
|
+
* Types can be used to exclude array item types or all fields directly under the target path of a certain type.
|
|
282
|
+
* If you do exclude: ['string'] all string fields under the target will be excluded, for instance.
|
|
283
|
+
*
|
|
284
|
+
* `types.include` and `types.exclude` are mutually exclusive.
|
|
285
|
+
*/
|
|
286
|
+
types?: AgentActionTypeConfig
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/** @beta */
|
|
290
|
+
declare type AgentActionTypeConfig =
|
|
291
|
+
| {
|
|
292
|
+
include: string[]
|
|
293
|
+
exclude?: never
|
|
294
|
+
}
|
|
295
|
+
| {
|
|
296
|
+
exclude: string[]
|
|
297
|
+
include?: never
|
|
298
|
+
}
|
|
299
|
+
|
|
42
300
|
/** @internal */
|
|
43
301
|
export declare type AllDocumentIdsMutationOptions = BaseMutationOptions & {
|
|
44
302
|
returnFirst: false
|
|
@@ -64,6 +322,16 @@ export declare interface ApiError {
|
|
|
64
322
|
statusCode: number
|
|
65
323
|
}
|
|
66
324
|
|
|
325
|
+
/**
|
|
326
|
+
* Archives an `active` release, and deletes all the release documents.
|
|
327
|
+
*
|
|
328
|
+
* @public
|
|
329
|
+
*/
|
|
330
|
+
export declare interface ArchiveReleaseAction {
|
|
331
|
+
actionType: 'sanity.action.release.archive'
|
|
332
|
+
releaseId: string
|
|
333
|
+
}
|
|
334
|
+
|
|
67
335
|
/** @public */
|
|
68
336
|
export declare type AssetMetadataType =
|
|
69
337
|
| 'location'
|
|
@@ -75,7 +343,7 @@ export declare type AssetMetadataType =
|
|
|
75
343
|
| 'none'
|
|
76
344
|
|
|
77
345
|
/** @internal */
|
|
78
|
-
export declare class AssetsClient
|
|
346
|
+
export declare class AssetsClient {
|
|
79
347
|
#private
|
|
80
348
|
constructor(client: SanityClient, httpRequest: HttpRequest)
|
|
81
349
|
/**
|
|
@@ -116,46 +384,6 @@ export declare class AssetsClient implements AssetsClientType {
|
|
|
116
384
|
): Promise<SanityAssetDocument | SanityImageAssetDocument>
|
|
117
385
|
}
|
|
118
386
|
|
|
119
|
-
/** @internal */
|
|
120
|
-
declare interface AssetsClientType {
|
|
121
|
-
/**
|
|
122
|
-
* Uploads a file asset to the configured dataset
|
|
123
|
-
*
|
|
124
|
-
* @param assetType - Asset type (file)
|
|
125
|
-
* @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
|
|
126
|
-
* @param options - Options to use for the upload
|
|
127
|
-
*/
|
|
128
|
-
upload(
|
|
129
|
-
assetType: 'file',
|
|
130
|
-
body: UploadBody,
|
|
131
|
-
options?: UploadClientConfig,
|
|
132
|
-
): Promise<SanityAssetDocument>
|
|
133
|
-
/**
|
|
134
|
-
* Uploads an image asset to the configured dataset
|
|
135
|
-
*
|
|
136
|
-
* @param assetType - Asset type (image)
|
|
137
|
-
* @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
|
|
138
|
-
* @param options - Options to use for the upload
|
|
139
|
-
*/
|
|
140
|
-
upload(
|
|
141
|
-
assetType: 'image',
|
|
142
|
-
body: UploadBody,
|
|
143
|
-
options?: UploadClientConfig,
|
|
144
|
-
): Promise<SanityImageAssetDocument>
|
|
145
|
-
/**
|
|
146
|
-
* Uploads a file or an image asset to the configured dataset
|
|
147
|
-
*
|
|
148
|
-
* @param assetType - Asset type (file/image)
|
|
149
|
-
* @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
|
|
150
|
-
* @param options - Options to use for the upload
|
|
151
|
-
*/
|
|
152
|
-
upload(
|
|
153
|
-
assetType: 'file' | 'image',
|
|
154
|
-
body: UploadBody,
|
|
155
|
-
options?: UploadClientConfig,
|
|
156
|
-
): Promise<SanityAssetDocument | SanityImageAssetDocument>
|
|
157
|
-
}
|
|
158
|
-
|
|
159
387
|
/** @internal */
|
|
160
388
|
export declare type AttributeSet = {
|
|
161
389
|
[key: string]: Any
|
|
@@ -515,6 +743,43 @@ export declare class ConnectionFailedError extends Error {
|
|
|
515
743
|
readonly name = 'ConnectionFailedError'
|
|
516
744
|
}
|
|
517
745
|
|
|
746
|
+
/**
|
|
747
|
+
* Include a string in the instruction: do not have to escape $ signs in the string.
|
|
748
|
+
*
|
|
749
|
+
* ```ts
|
|
750
|
+
* client.agent.action.generate({
|
|
751
|
+
* schemaId,
|
|
752
|
+
* documentId,
|
|
753
|
+
* instruction: 'Give the following topic:\n $topic \n ---\nGenerate the full article.',
|
|
754
|
+
* instructionParams: {
|
|
755
|
+
* topic: {
|
|
756
|
+
* type: 'constant',
|
|
757
|
+
* value: 'Grapefruit'
|
|
758
|
+
* },
|
|
759
|
+
* },
|
|
760
|
+
* })
|
|
761
|
+
* ```
|
|
762
|
+
*
|
|
763
|
+
* `type: 'constant'` can also be provided directly as a string, as a shorthand:
|
|
764
|
+
*
|
|
765
|
+
* ```ts
|
|
766
|
+
* client.agent.action.generate({
|
|
767
|
+
* schemaId,
|
|
768
|
+
* documentId,
|
|
769
|
+
* instruction: 'Give the following topic:\n $topic \n ---\nGenerate the full article.',
|
|
770
|
+
* instructionParams: {
|
|
771
|
+
* topic: 'Grapefruit'
|
|
772
|
+
* },
|
|
773
|
+
* })
|
|
774
|
+
* ```
|
|
775
|
+
*
|
|
776
|
+
* @beta
|
|
777
|
+
* */
|
|
778
|
+
export declare interface ConstantAgentActionParam {
|
|
779
|
+
type: 'constant'
|
|
780
|
+
value: string
|
|
781
|
+
}
|
|
782
|
+
|
|
518
783
|
/** @public */
|
|
519
784
|
export declare interface ContentSourceMap {
|
|
520
785
|
mappings: ContentSourceMapMappings
|
|
@@ -634,6 +899,29 @@ export declare type CreateAction = {
|
|
|
634
899
|
/** @public */
|
|
635
900
|
export declare const createClient: (config: ClientConfig) => SanityClient
|
|
636
901
|
|
|
902
|
+
/**
|
|
903
|
+
* Creates a new release under the given id, with metadata.
|
|
904
|
+
*
|
|
905
|
+
* @public
|
|
906
|
+
*/
|
|
907
|
+
export declare interface CreateReleaseAction {
|
|
908
|
+
actionType: 'sanity.action.release.create'
|
|
909
|
+
releaseId: string
|
|
910
|
+
metadata?: Partial<ReleaseDocument['metadata']>
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
/**
|
|
914
|
+
* Creates a new version of an existing document, attached to the release as given
|
|
915
|
+
* by `document._id`
|
|
916
|
+
*
|
|
917
|
+
* @public
|
|
918
|
+
*/
|
|
919
|
+
export declare interface CreateVersionAction {
|
|
920
|
+
actionType: 'sanity.action.document.version.create'
|
|
921
|
+
publishedId: string
|
|
922
|
+
document: IdentifiedSanityDocumentStub
|
|
923
|
+
}
|
|
924
|
+
|
|
637
925
|
/** @public */
|
|
638
926
|
export declare interface CurrentSanityUser {
|
|
639
927
|
id: string
|
|
@@ -653,7 +941,7 @@ export declare type DatasetResponse = {
|
|
|
653
941
|
}
|
|
654
942
|
|
|
655
943
|
/** @internal */
|
|
656
|
-
export declare class DatasetsClient
|
|
944
|
+
export declare class DatasetsClient {
|
|
657
945
|
#private
|
|
658
946
|
constructor(client: SanityClient, httpRequest: HttpRequest)
|
|
659
947
|
/**
|
|
@@ -694,46 +982,6 @@ export declare class DatasetsClient implements DatasetsClientType {
|
|
|
694
982
|
list(): Promise<DatasetsResponse>
|
|
695
983
|
}
|
|
696
984
|
|
|
697
|
-
/** @internal */
|
|
698
|
-
declare interface DatasetsClientType {
|
|
699
|
-
/**
|
|
700
|
-
* Create a new dataset with the given name
|
|
701
|
-
*
|
|
702
|
-
* @param name - Name of the dataset to create
|
|
703
|
-
* @param options - Options for the dataset
|
|
704
|
-
*/
|
|
705
|
-
create(
|
|
706
|
-
name: string,
|
|
707
|
-
options?: {
|
|
708
|
-
aclMode?: DatasetAclMode
|
|
709
|
-
},
|
|
710
|
-
): Promise<DatasetResponse>
|
|
711
|
-
/**
|
|
712
|
-
* Edit a dataset with the given name
|
|
713
|
-
*
|
|
714
|
-
* @param name - Name of the dataset to edit
|
|
715
|
-
* @param options - New options for the dataset
|
|
716
|
-
*/
|
|
717
|
-
edit(
|
|
718
|
-
name: string,
|
|
719
|
-
options?: {
|
|
720
|
-
aclMode?: DatasetAclMode
|
|
721
|
-
},
|
|
722
|
-
): Promise<DatasetResponse>
|
|
723
|
-
/**
|
|
724
|
-
* Delete a dataset with the given name
|
|
725
|
-
*
|
|
726
|
-
* @param name - Name of the dataset to delete
|
|
727
|
-
*/
|
|
728
|
-
delete(name: string): Promise<{
|
|
729
|
-
deleted: true
|
|
730
|
-
}>
|
|
731
|
-
/**
|
|
732
|
-
* Fetch a list of datasets for the configured project
|
|
733
|
-
*/
|
|
734
|
-
list(): Promise<DatasetsResponse>
|
|
735
|
-
}
|
|
736
|
-
|
|
737
985
|
/** @public */
|
|
738
986
|
export declare type DatasetsResponse = {
|
|
739
987
|
name: string
|
|
@@ -769,6 +1017,16 @@ export declare type DeleteAction = {
|
|
|
769
1017
|
purge?: boolean
|
|
770
1018
|
}
|
|
771
1019
|
|
|
1020
|
+
/**
|
|
1021
|
+
* Deletes a `archived` or `published` release, and all the release documents versions.
|
|
1022
|
+
*
|
|
1023
|
+
* @public
|
|
1024
|
+
*/
|
|
1025
|
+
export declare interface DeleteReleaseAction {
|
|
1026
|
+
actionType: 'sanity.action.release.delete'
|
|
1027
|
+
releaseId: string
|
|
1028
|
+
}
|
|
1029
|
+
|
|
772
1030
|
/**
|
|
773
1031
|
* @public
|
|
774
1032
|
* @deprecated Use the named export `createClient` instead of the `default` export
|
|
@@ -786,6 +1044,7 @@ declare type DeprecatedPreviewDrafts = 'previewDrafts'
|
|
|
786
1044
|
* It is an error if it does not exist. If the purge flag is set, the document history is also deleted.
|
|
787
1045
|
*
|
|
788
1046
|
* @public
|
|
1047
|
+
* @deprecated Use {@link DiscardVersionAction} instead
|
|
789
1048
|
*/
|
|
790
1049
|
export declare type DiscardAction = {
|
|
791
1050
|
actionType: 'sanity.action.document.discard'
|
|
@@ -799,6 +1058,17 @@ export declare type DiscardAction = {
|
|
|
799
1058
|
purge?: boolean
|
|
800
1059
|
}
|
|
801
1060
|
|
|
1061
|
+
/**
|
|
1062
|
+
* Delete a version of a document.
|
|
1063
|
+
*
|
|
1064
|
+
* @public
|
|
1065
|
+
*/
|
|
1066
|
+
export declare interface DiscardVersionAction {
|
|
1067
|
+
actionType: 'sanity.action.document.version.discard'
|
|
1068
|
+
versionId: string
|
|
1069
|
+
purge?: boolean
|
|
1070
|
+
}
|
|
1071
|
+
|
|
802
1072
|
/**
|
|
803
1073
|
* The listener has been told to explicitly disconnect.
|
|
804
1074
|
* This is a rare situation, but may occur if the API knows reconnect attempts will fail,
|
|
@@ -825,6 +1095,43 @@ export declare type DisconnectEvent = {
|
|
|
825
1095
|
reason: string
|
|
826
1096
|
}
|
|
827
1097
|
|
|
1098
|
+
/**
|
|
1099
|
+
*
|
|
1100
|
+
* Includes a LLM-friendly version of the document in the instruction
|
|
1101
|
+
*
|
|
1102
|
+
* ```ts
|
|
1103
|
+
* client.agent.action.generate({
|
|
1104
|
+
* schemaId,
|
|
1105
|
+
* documentId,
|
|
1106
|
+
* instruction: 'Give the following document value:\n $document \n ---\nGenerate keywords.',
|
|
1107
|
+
* instructionParams: {
|
|
1108
|
+
* document: {
|
|
1109
|
+
* type: 'document',
|
|
1110
|
+
* },
|
|
1111
|
+
* },
|
|
1112
|
+
* target: {path: 'keywords' }
|
|
1113
|
+
* })
|
|
1114
|
+
* ```
|
|
1115
|
+
*
|
|
1116
|
+
* @beta
|
|
1117
|
+
* */
|
|
1118
|
+
export declare interface DocumentAgentActionParam {
|
|
1119
|
+
type: 'document'
|
|
1120
|
+
/**
|
|
1121
|
+
* If omitted, implicitly uses the documentId of the instruction target
|
|
1122
|
+
*/
|
|
1123
|
+
documentId?: string
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
/** @internal */
|
|
1127
|
+
export declare type EditableReleaseDocument = Omit<
|
|
1128
|
+
PartialExcept<ReleaseDocument, '_id'>,
|
|
1129
|
+
'metadata' | '_type'
|
|
1130
|
+
> & {
|
|
1131
|
+
_id: string
|
|
1132
|
+
metadata: Partial<ReleaseDocument['metadata']>
|
|
1133
|
+
}
|
|
1134
|
+
|
|
828
1135
|
/**
|
|
829
1136
|
* Modifies an existing draft document.
|
|
830
1137
|
* It applies the given patch to the document referenced by draftId.
|
|
@@ -848,6 +1155,17 @@ export declare type EditAction = {
|
|
|
848
1155
|
patch: PatchOperations
|
|
849
1156
|
}
|
|
850
1157
|
|
|
1158
|
+
/**
|
|
1159
|
+
* Edits an existing release, updating the metadata.
|
|
1160
|
+
*
|
|
1161
|
+
* @public
|
|
1162
|
+
*/
|
|
1163
|
+
export declare interface EditReleaseAction {
|
|
1164
|
+
actionType: 'sanity.action.release.edit'
|
|
1165
|
+
releaseId: string
|
|
1166
|
+
patch: PatchOperations
|
|
1167
|
+
}
|
|
1168
|
+
|
|
851
1169
|
/** @public */
|
|
852
1170
|
export declare interface ErrorProps {
|
|
853
1171
|
message: string
|
|
@@ -867,6 +1185,41 @@ export declare type EventSourceEvent<Name extends string> = ServerSentEvent<Name
|
|
|
867
1185
|
*/
|
|
868
1186
|
export declare type EventSourceInstance = InstanceType<typeof globalThis.EventSource>
|
|
869
1187
|
|
|
1188
|
+
/**
|
|
1189
|
+
*
|
|
1190
|
+
*
|
|
1191
|
+
* Includes a LLM-friendly version of the field value in the instruction
|
|
1192
|
+
*
|
|
1193
|
+
* ```ts
|
|
1194
|
+
* client.agent.action.generate({
|
|
1195
|
+
* schemaId,
|
|
1196
|
+
* documentId,
|
|
1197
|
+
* instruction: 'Give the following field value:\n $pte \n ---\nGenerate keywords.',
|
|
1198
|
+
* instructionParams: {
|
|
1199
|
+
* pte: {
|
|
1200
|
+
* type: 'field',
|
|
1201
|
+
* path: ['pteField'],
|
|
1202
|
+
* },
|
|
1203
|
+
* },
|
|
1204
|
+
* target: {path: 'keywords' }
|
|
1205
|
+
* })
|
|
1206
|
+
*
|
|
1207
|
+
* ```
|
|
1208
|
+
*
|
|
1209
|
+
* @beta
|
|
1210
|
+
* */
|
|
1211
|
+
export declare interface FieldAgentActionParam {
|
|
1212
|
+
type: 'field'
|
|
1213
|
+
/**
|
|
1214
|
+
* Examples: 'title', ['array', \{_key: 'arrayItemKey'\}, 'field']
|
|
1215
|
+
*/
|
|
1216
|
+
path: AgentActionPathSegment | AgentActionPath
|
|
1217
|
+
/**
|
|
1218
|
+
* If omitted, implicitly uses the documentId of the instruction target
|
|
1219
|
+
*/
|
|
1220
|
+
documentId?: string
|
|
1221
|
+
}
|
|
1222
|
+
|
|
870
1223
|
/** @public */
|
|
871
1224
|
export declare type FilterDefault = (props: {
|
|
872
1225
|
/**
|
|
@@ -933,18 +1286,286 @@ export declare type FirstDocumentMutationOptions = BaseMutationOptions & {
|
|
|
933
1286
|
returnDocuments?: true
|
|
934
1287
|
}
|
|
935
1288
|
|
|
936
|
-
/** @
|
|
937
|
-
|
|
938
|
-
|
|
1289
|
+
/** @beta */
|
|
1290
|
+
declare type GenerateAsyncInstruction<T extends Record<string, Any> = Record<string, Any>> = (
|
|
1291
|
+
| GenerateExistingDocumentRequest
|
|
1292
|
+
| GenerateTargetDocumentRequest<T>
|
|
1293
|
+
) &
|
|
1294
|
+
GenerateRequestBase &
|
|
1295
|
+
AgentActionAsync
|
|
1296
|
+
|
|
1297
|
+
/**
|
|
1298
|
+
* Instruction for an existing document.
|
|
1299
|
+
* @beta
|
|
1300
|
+
*/
|
|
1301
|
+
declare interface GenerateExistingDocumentRequest {
|
|
1302
|
+
documentId: string
|
|
1303
|
+
createDocument?: never
|
|
939
1304
|
}
|
|
940
1305
|
|
|
941
|
-
/** @
|
|
942
|
-
export declare type
|
|
1306
|
+
/** @beta */
|
|
1307
|
+
export declare type GenerateInstruction<T extends Record<string, Any> = Record<string, Any>> =
|
|
1308
|
+
| GenerateSyncInstruction<T>
|
|
1309
|
+
| GenerateAsyncInstruction<T>
|
|
1310
|
+
|
|
1311
|
+
/** @beta */
|
|
1312
|
+
export declare type GenerateOperation = 'set' | 'append' | 'mixed'
|
|
1313
|
+
|
|
1314
|
+
/** @beta */
|
|
1315
|
+
declare interface GenerateRequestBase extends AgentActionRequestBase {
|
|
1316
|
+
/** schemaId as reported by sanity deploy / sanity schema store */
|
|
1317
|
+
schemaId: string
|
|
1318
|
+
/**
|
|
1319
|
+
* Instruct the LLM how it should generate content. Be as specific and detailed as needed.
|
|
1320
|
+
*
|
|
1321
|
+
* The LLM only has access to information in the instruction, plus the target schema.
|
|
1322
|
+
*
|
|
1323
|
+
* string template using $variable
|
|
1324
|
+
* */
|
|
1325
|
+
instruction: string
|
|
1326
|
+
/**
|
|
1327
|
+
* param values for the string template, keys are the variable name, ie if the template has "$variable", one key must be "variable"
|
|
1328
|
+
*
|
|
1329
|
+
* ### Examples
|
|
1330
|
+
*
|
|
1331
|
+
* #### Constant
|
|
1332
|
+
*
|
|
1333
|
+
* ##### Shorthand
|
|
1334
|
+
* ```ts
|
|
1335
|
+
* client.agent.action.generate({
|
|
1336
|
+
* schemaId,
|
|
1337
|
+
* documentId,
|
|
1338
|
+
* instruction: 'Give the following topic:\n $topic \n ---\nGenerate the full article.',
|
|
1339
|
+
* instructionParams: {
|
|
1340
|
+
* topic: 'Grapefruit'
|
|
1341
|
+
* },
|
|
1342
|
+
* })
|
|
1343
|
+
* ```
|
|
1344
|
+
* ##### Object-form
|
|
1345
|
+
*
|
|
1346
|
+
* ```ts
|
|
1347
|
+
* client.agent.action.generate({
|
|
1348
|
+
* schemaId,
|
|
1349
|
+
* documentId,
|
|
1350
|
+
* instruction: 'Give the following topic:\n $topic \n ---\nGenerate the full article.',
|
|
1351
|
+
* instructionParams: {
|
|
1352
|
+
* topic: {
|
|
1353
|
+
* type: 'constant',
|
|
1354
|
+
* value: 'Grapefruit'
|
|
1355
|
+
* },
|
|
1356
|
+
* },
|
|
1357
|
+
* })
|
|
1358
|
+
* ```
|
|
1359
|
+
* #### Field
|
|
1360
|
+
* ```ts
|
|
1361
|
+
* client.agent.action.generate({
|
|
1362
|
+
* schemaId,
|
|
1363
|
+
* documentId,
|
|
1364
|
+
* instruction: 'Give the following field value:\n $pte \n ---\nGenerate keywords.',
|
|
1365
|
+
* instructionParams: {
|
|
1366
|
+
* pte: {
|
|
1367
|
+
* type: 'field',
|
|
1368
|
+
* path: ['pteField'],
|
|
1369
|
+
* },
|
|
1370
|
+
* },
|
|
1371
|
+
* target: {path: 'keywords' }
|
|
1372
|
+
* })
|
|
1373
|
+
* ```
|
|
1374
|
+
* #### Document
|
|
1375
|
+
* ```ts
|
|
1376
|
+
* client.agent.action.generate({
|
|
1377
|
+
* schemaId,
|
|
1378
|
+
* documentId,
|
|
1379
|
+
* instruction: 'Give the following document value:\n $document \n ---\nGenerate keywords.',
|
|
1380
|
+
* instructionParams: {
|
|
1381
|
+
* document: {
|
|
1382
|
+
* type: 'document',
|
|
1383
|
+
* },
|
|
1384
|
+
* },
|
|
1385
|
+
* target: {path: 'keywords' }
|
|
1386
|
+
* })
|
|
1387
|
+
* ```
|
|
1388
|
+
*
|
|
1389
|
+
* #### GROQ
|
|
1390
|
+
* ```ts
|
|
1391
|
+
* client.agent.action.generate({
|
|
1392
|
+
* schemaId,
|
|
1393
|
+
* documentId,
|
|
1394
|
+
* instruction: 'Give the following list of titles:\n $list \n ---\nGenerate a similar title.',
|
|
1395
|
+
* instructionParams: {
|
|
1396
|
+
* list: {
|
|
1397
|
+
* type: 'groq',
|
|
1398
|
+
* query: '* [_type==$type].title',
|
|
1399
|
+
* params: {type: 'article'}
|
|
1400
|
+
* },
|
|
1401
|
+
* },
|
|
1402
|
+
* target: {path: 'title' }
|
|
1403
|
+
* })
|
|
1404
|
+
* ```
|
|
1405
|
+
* */
|
|
1406
|
+
instructionParams?: AgentActionParams
|
|
1407
|
+
/**
|
|
1408
|
+
* Target defines which parts of the document will be affected by the instruction.
|
|
1409
|
+
* It can be an array, so multiple parts of the document can be separately configured in detail.
|
|
1410
|
+
*
|
|
1411
|
+
* Omitting target implies that the document itself is the root.
|
|
1412
|
+
*
|
|
1413
|
+
* Notes:
|
|
1414
|
+
* - instruction can only affect fields up to `maxPathDepth`
|
|
1415
|
+
* - when multiple targets are provided, they will be coalesced into a single target sharing a common target root.
|
|
1416
|
+
* It is therefor an error to provide conflicting include/exclude across targets (ie, include title in one, and exclude it in another)
|
|
1417
|
+
*
|
|
1418
|
+
* @see AgentActionRequestBase#conditionalPaths
|
|
1419
|
+
*/
|
|
1420
|
+
target?: GenerateTarget | GenerateTarget[]
|
|
1421
|
+
}
|
|
943
1422
|
|
|
944
|
-
/** @
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
>
|
|
1423
|
+
/** @beta */
|
|
1424
|
+
declare type GenerateSyncInstruction<T extends Record<string, Any> = Record<string, Any>> = (
|
|
1425
|
+
| GenerateExistingDocumentRequest
|
|
1426
|
+
| GenerateTargetDocumentRequest<T>
|
|
1427
|
+
) &
|
|
1428
|
+
GenerateRequestBase &
|
|
1429
|
+
AgentActionSync
|
|
1430
|
+
|
|
1431
|
+
/** @beta */
|
|
1432
|
+
export declare interface GenerateTarget extends AgentActionTarget {
|
|
1433
|
+
/**
|
|
1434
|
+
* Sets the default operation for all paths in the target.
|
|
1435
|
+
* Generate runs in `'mixed'` operation mode by default:
|
|
1436
|
+
* Changes are set in all non-array fields, and append to all array fields.
|
|
1437
|
+
*
|
|
1438
|
+
* ### Operation types
|
|
1439
|
+
* - `'set'` – an *overwriting* operation, and replaces the full field value.
|
|
1440
|
+
* - `'append'`:
|
|
1441
|
+
* – array fields: appends new items to the end of the array,
|
|
1442
|
+
* - string fields: '"existing content" "new content"'
|
|
1443
|
+
* - text fields: '"existing content"\\n"new content"'
|
|
1444
|
+
* - number fields: existing + new
|
|
1445
|
+
* - other field types not mentioned will set instead (dates, url)
|
|
1446
|
+
* - `'mixed'` – (default) sets non-array fields, and appends to array fields
|
|
1447
|
+
*
|
|
1448
|
+
* The default operation can be overridden on a per-path basis using `include`.
|
|
1449
|
+
*
|
|
1450
|
+
* Nested fields inherit the operation specified by their parent and falls back to the
|
|
1451
|
+
* top level target operation if not otherwise specified.
|
|
1452
|
+
*
|
|
1453
|
+
* Use `include` to change the `operation` of individual fields or items.
|
|
1454
|
+
*
|
|
1455
|
+
* #### Appending in the middle of arrays
|
|
1456
|
+
* `target: {path: ['array'], operation: 'append'}` will append the output of the instruction to the end of the array.
|
|
1457
|
+
*
|
|
1458
|
+
* To insert in the middle of the array, use `target: {path: ['array', {_key: 'appendAfterKey'}], operation: 'append'}`.
|
|
1459
|
+
* Here, the output of the instruction will be appended after the array item with key `'appendAfterKey'`.
|
|
1460
|
+
*
|
|
1461
|
+
* @see #AgentActionTargetInclude.operation
|
|
1462
|
+
* @see #include
|
|
1463
|
+
* @see #AgentActionTargetInclude.include
|
|
1464
|
+
*/
|
|
1465
|
+
operation?: GenerateOperation
|
|
1466
|
+
/**
|
|
1467
|
+
* By default, all children up to `target.maxPathDepth` are included.
|
|
1468
|
+
*
|
|
1469
|
+
* When `include` is specified, only segments explicitly listed will be included.
|
|
1470
|
+
*
|
|
1471
|
+
* Fields or array items not on the include list, are implicitly excluded.
|
|
1472
|
+
*/
|
|
1473
|
+
include?: (AgentActionPathSegment | GenerateTargetInclude)[]
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
/** @beta */
|
|
1477
|
+
export declare type GenerateTargetDocument<T extends Record<string, Any> = Record<string, Any>> =
|
|
1478
|
+
| {
|
|
1479
|
+
operation: 'edit'
|
|
1480
|
+
_id: string
|
|
1481
|
+
}
|
|
1482
|
+
| {
|
|
1483
|
+
operation: 'create'
|
|
1484
|
+
_id?: string
|
|
1485
|
+
_type: string
|
|
1486
|
+
initialValues?: T
|
|
1487
|
+
}
|
|
1488
|
+
| {
|
|
1489
|
+
operation: 'createIfNotExists'
|
|
1490
|
+
_id: string
|
|
1491
|
+
_type: string
|
|
1492
|
+
initialValues?: T
|
|
1493
|
+
}
|
|
1494
|
+
| {
|
|
1495
|
+
operation: 'createOrReplace'
|
|
1496
|
+
_id: string
|
|
1497
|
+
_type: string
|
|
1498
|
+
initialValues?: T
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
/**
|
|
1502
|
+
* Instruction to create a new document
|
|
1503
|
+
* @beta
|
|
1504
|
+
*/
|
|
1505
|
+
declare interface GenerateTargetDocumentRequest<
|
|
1506
|
+
T extends Record<string, Any> = Record<string, Any>,
|
|
1507
|
+
> {
|
|
1508
|
+
targetDocument: GenerateTargetDocument<T>
|
|
1509
|
+
documentId?: never
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
/** @beta */
|
|
1513
|
+
export declare interface GenerateTargetInclude extends AgentActionTargetInclude {
|
|
1514
|
+
/**
|
|
1515
|
+
* Sets the operation for this path, and all its children.
|
|
1516
|
+
* This overrides any operation set parents or the root target.
|
|
1517
|
+
* @see #GenerateTarget.operation
|
|
1518
|
+
* @see #include
|
|
1519
|
+
*/
|
|
1520
|
+
operation?: GenerateOperation
|
|
1521
|
+
/**
|
|
1522
|
+
* By default, all children up to `target.maxPathDepth` are included.
|
|
1523
|
+
*
|
|
1524
|
+
* When `include` is specified, only segments explicitly listed will be included.
|
|
1525
|
+
*
|
|
1526
|
+
* Fields or array items not on the include list, are implicitly excluded.
|
|
1527
|
+
*/
|
|
1528
|
+
include?: (AgentActionPathSegment | GenerateTargetInclude)[]
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
/**
|
|
1532
|
+
* Includes a LLM-friendly version of GROQ query result in the instruction
|
|
1533
|
+
*
|
|
1534
|
+
* ```ts
|
|
1535
|
+
* client.agent.action.generate({
|
|
1536
|
+
* schemaId,
|
|
1537
|
+
* documentId,
|
|
1538
|
+
* instruction: 'Give the following list of titles:\n $list \n ---\nGenerate a similar title.',
|
|
1539
|
+
* instructionParams: {
|
|
1540
|
+
* list: {
|
|
1541
|
+
* type: 'groq',
|
|
1542
|
+
* query: '* [_type==$type].title',
|
|
1543
|
+
* params: {type: 'article'}
|
|
1544
|
+
* },
|
|
1545
|
+
* },
|
|
1546
|
+
* target: {path: 'title' }
|
|
1547
|
+
* })
|
|
1548
|
+
* ```
|
|
1549
|
+
* @beta
|
|
1550
|
+
* */
|
|
1551
|
+
export declare interface GroqAgentActionParam {
|
|
1552
|
+
type: 'groq'
|
|
1553
|
+
query: string
|
|
1554
|
+
params?: Record<string, string>
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1557
|
+
/** @public */
|
|
1558
|
+
export declare type HttpRequest = {
|
|
1559
|
+
(options: RequestOptions, requester: Requester): ReturnType<Requester>
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
/** @public */
|
|
1563
|
+
export declare type HttpRequestEvent<T = unknown> = ResponseEvent<T> | ProgressEvent_2
|
|
1564
|
+
|
|
1565
|
+
/** @public */
|
|
1566
|
+
export declare type IdentifiedSanityDocumentStub<
|
|
1567
|
+
T extends Record<string, Any> = Record<string, Any>,
|
|
1568
|
+
> = {
|
|
948
1569
|
[P in keyof T]: T[P]
|
|
949
1570
|
} & {
|
|
950
1571
|
_id: string
|
|
@@ -1062,15 +1683,6 @@ export declare interface ListenOptions {
|
|
|
1062
1683
|
* @defaultValue `false`
|
|
1063
1684
|
*/
|
|
1064
1685
|
includePreviousRevision?: boolean
|
|
1065
|
-
/**
|
|
1066
|
-
* Whether to include events for drafts and versions. As of API Version >= v2025-02-19, only events
|
|
1067
|
-
* for published documents will be included by default (see {@link https://www.sanity.io/changelog/676aaa9d-2da6-44fb-abe5-580f28047c10|Changelog})
|
|
1068
|
-
* If you need events from drafts and versions, set this to `true`.
|
|
1069
|
-
* Note: Keep in mind that additional document variants may be introduced in the future, so it's
|
|
1070
|
-
* recommended to respond to events in a way that's tolerant of potential future variants, e.g. by
|
|
1071
|
-
* explicitly checking whether the event is for a draft or a version.
|
|
1072
|
-
* @defaultValue `false`
|
|
1073
|
-
*/
|
|
1074
1686
|
includeAllVersions?: boolean
|
|
1075
1687
|
/**
|
|
1076
1688
|
* Whether events should be sent as soon as a transaction has been committed (`transaction`, default),
|
|
@@ -1365,62 +1977,55 @@ export declare type MutationSelectionQueryParams = {
|
|
|
1365
1977
|
[key: string]: Any
|
|
1366
1978
|
}
|
|
1367
1979
|
|
|
1368
|
-
/** @
|
|
1369
|
-
|
|
1980
|
+
/** @public */
|
|
1981
|
+
declare class ObservableAgentsActionClient {
|
|
1370
1982
|
#private
|
|
1371
1983
|
constructor(client: ObservableSanityClient, httpRequest: HttpRequest)
|
|
1372
1984
|
/**
|
|
1373
|
-
*
|
|
1374
|
-
*
|
|
1375
|
-
* @param assetType - Asset type (file)
|
|
1376
|
-
* @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
|
|
1377
|
-
* @param options - Options to use for the upload
|
|
1985
|
+
* Run an instruction to generate content in a target document.
|
|
1986
|
+
* @param request - instruction request
|
|
1378
1987
|
*/
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
body: UploadBody,
|
|
1382
|
-
options?: UploadClientConfig,
|
|
1988
|
+
generate<DocumentShape extends Record<string, Any>>(
|
|
1989
|
+
request: GenerateInstruction<DocumentShape>,
|
|
1383
1990
|
): Observable<
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1991
|
+
(typeof request)['async'] extends true
|
|
1992
|
+
? {
|
|
1993
|
+
_id: string
|
|
1994
|
+
}
|
|
1995
|
+
: IdentifiedSanityDocumentStub & DocumentShape
|
|
1387
1996
|
>
|
|
1388
1997
|
/**
|
|
1389
|
-
*
|
|
1390
|
-
*
|
|
1391
|
-
* @param assetType - Asset type (image)
|
|
1392
|
-
* @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
|
|
1393
|
-
* @param options - Options to use for the upload
|
|
1998
|
+
* Transform a target document based on a source.
|
|
1999
|
+
* @param request - translation request
|
|
1394
2000
|
*/
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
body: UploadBody,
|
|
1398
|
-
options?: UploadClientConfig,
|
|
2001
|
+
transform<DocumentShape extends Record<string, Any>>(
|
|
2002
|
+
request: TransformDocument<DocumentShape>,
|
|
1399
2003
|
): Observable<
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
2004
|
+
(typeof request)['async'] extends true
|
|
2005
|
+
? {
|
|
2006
|
+
_id: string
|
|
2007
|
+
}
|
|
2008
|
+
: IdentifiedSanityDocumentStub & DocumentShape
|
|
1403
2009
|
>
|
|
1404
2010
|
/**
|
|
1405
|
-
*
|
|
1406
|
-
*
|
|
1407
|
-
* @param assetType - Asset type (file/image)
|
|
1408
|
-
* @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
|
|
1409
|
-
* @param options - Options to use for the upload
|
|
2011
|
+
* Translate a target document based on a source.
|
|
2012
|
+
* @param request - translation request
|
|
1410
2013
|
*/
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
body: UploadBody,
|
|
1414
|
-
options?: UploadClientConfig,
|
|
2014
|
+
translate<DocumentShape extends Record<string, Any>>(
|
|
2015
|
+
request: TranslateDocument<DocumentShape>,
|
|
1415
2016
|
): Observable<
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
2017
|
+
(typeof request)['async'] extends true
|
|
2018
|
+
? {
|
|
2019
|
+
_id: string
|
|
2020
|
+
}
|
|
2021
|
+
: IdentifiedSanityDocumentStub & DocumentShape
|
|
1419
2022
|
>
|
|
1420
2023
|
}
|
|
1421
2024
|
|
|
1422
2025
|
/** @internal */
|
|
1423
|
-
declare
|
|
2026
|
+
export declare class ObservableAssetsClient {
|
|
2027
|
+
#private
|
|
2028
|
+
constructor(client: ObservableSanityClient, httpRequest: HttpRequest)
|
|
1424
2029
|
/**
|
|
1425
2030
|
* Uploads a file asset to the configured dataset
|
|
1426
2031
|
*
|
|
@@ -1472,7 +2077,7 @@ declare interface ObservableAssetsClientType {
|
|
|
1472
2077
|
}
|
|
1473
2078
|
|
|
1474
2079
|
/** @internal */
|
|
1475
|
-
export declare class ObservableDatasetsClient
|
|
2080
|
+
export declare class ObservableDatasetsClient {
|
|
1476
2081
|
#private
|
|
1477
2082
|
constructor(client: ObservableSanityClient, httpRequest: HttpRequest)
|
|
1478
2083
|
/**
|
|
@@ -1513,46 +2118,6 @@ export declare class ObservableDatasetsClient implements ObservableDatasetsClien
|
|
|
1513
2118
|
list(): Observable<DatasetsResponse>
|
|
1514
2119
|
}
|
|
1515
2120
|
|
|
1516
|
-
/** @internal */
|
|
1517
|
-
declare interface ObservableDatasetsClientType {
|
|
1518
|
-
/**
|
|
1519
|
-
* Create a new dataset with the given name
|
|
1520
|
-
*
|
|
1521
|
-
* @param name - Name of the dataset to create
|
|
1522
|
-
* @param options - Options for the dataset
|
|
1523
|
-
*/
|
|
1524
|
-
create(
|
|
1525
|
-
name: string,
|
|
1526
|
-
options?: {
|
|
1527
|
-
aclMode?: DatasetAclMode
|
|
1528
|
-
},
|
|
1529
|
-
): Observable<DatasetResponse>
|
|
1530
|
-
/**
|
|
1531
|
-
* Edit a dataset with the given name
|
|
1532
|
-
*
|
|
1533
|
-
* @param name - Name of the dataset to edit
|
|
1534
|
-
* @param options - New options for the dataset
|
|
1535
|
-
*/
|
|
1536
|
-
edit(
|
|
1537
|
-
name: string,
|
|
1538
|
-
options?: {
|
|
1539
|
-
aclMode?: DatasetAclMode
|
|
1540
|
-
},
|
|
1541
|
-
): Observable<DatasetResponse>
|
|
1542
|
-
/**
|
|
1543
|
-
* Delete a dataset with the given name
|
|
1544
|
-
*
|
|
1545
|
-
* @param name - Name of the dataset to delete
|
|
1546
|
-
*/
|
|
1547
|
-
delete(name: string): Observable<{
|
|
1548
|
-
deleted: true
|
|
1549
|
-
}>
|
|
1550
|
-
/**
|
|
1551
|
-
* Fetch a list of datasets for the configured project
|
|
1552
|
-
*/
|
|
1553
|
-
list(): Observable<DatasetsResponse>
|
|
1554
|
-
}
|
|
1555
|
-
|
|
1556
2121
|
/** @public */
|
|
1557
2122
|
export declare class ObservablePatch extends BasePatch {
|
|
1558
2123
|
#private
|
|
@@ -1607,14 +2172,14 @@ export declare class ObservablePatch extends BasePatch {
|
|
|
1607
2172
|
export declare type ObservablePatchBuilder = (patch: ObservablePatch) => ObservablePatch
|
|
1608
2173
|
|
|
1609
2174
|
/** @internal */
|
|
1610
|
-
export declare class ObservableProjectsClient
|
|
2175
|
+
export declare class ObservableProjectsClient {
|
|
1611
2176
|
#private
|
|
1612
2177
|
constructor(client: ObservableSanityClient, httpRequest: HttpRequest)
|
|
1613
2178
|
/**
|
|
1614
2179
|
* Fetch a list of projects the authenticated user has access to.
|
|
1615
2180
|
*
|
|
1616
2181
|
* @param options - Options for the list request
|
|
1617
|
-
*
|
|
2182
|
+
* - `includeMembers` - Whether to include members in the response (default: true)
|
|
1618
2183
|
*/
|
|
1619
2184
|
list(options?: {includeMembers?: true}): Observable<SanityProject[]>
|
|
1620
2185
|
list(options?: {includeMembers?: false}): Observable<Omit<SanityProject, 'members'>[]>
|
|
@@ -1626,35 +2191,321 @@ export declare class ObservableProjectsClient implements ObservableProjectsClien
|
|
|
1626
2191
|
getById(projectId: string): Observable<SanityProject>
|
|
1627
2192
|
}
|
|
1628
2193
|
|
|
1629
|
-
/** @
|
|
1630
|
-
declare
|
|
2194
|
+
/** @public */
|
|
2195
|
+
declare class ObservableReleasesClient {
|
|
2196
|
+
#private
|
|
2197
|
+
constructor(client: ObservableSanityClient, httpRequest: HttpRequest)
|
|
1631
2198
|
/**
|
|
1632
|
-
*
|
|
2199
|
+
* @public
|
|
2200
|
+
*
|
|
2201
|
+
* Retrieve a release by id.
|
|
2202
|
+
*
|
|
2203
|
+
* @category Releases
|
|
2204
|
+
*
|
|
2205
|
+
* @param params - Release action parameters:
|
|
2206
|
+
* - `releaseId` - The id of the release to retrieve.
|
|
2207
|
+
* @param options - Additional query options including abort signal and query tag.
|
|
2208
|
+
* @returns An observable that resolves to the release document {@link ReleaseDocument}.
|
|
2209
|
+
*
|
|
2210
|
+
* @example Retrieving a release by id
|
|
2211
|
+
* ```ts
|
|
2212
|
+
* client.observable.releases.get({releaseId: 'my-release'}).pipe(
|
|
2213
|
+
* tap((release) => console.log(release)),
|
|
2214
|
+
* // {
|
|
2215
|
+
* // _id: '_.releases.my-release',
|
|
2216
|
+
* // name: 'my-release'
|
|
2217
|
+
* // _type: 'system.release',
|
|
2218
|
+
* // metadata: {releaseType: 'asap'},
|
|
2219
|
+
* // _createdAt: '2021-01-01T00:00:00.000Z',
|
|
2220
|
+
* // ...
|
|
2221
|
+
* // }
|
|
2222
|
+
* ).subscribe()
|
|
2223
|
+
* ```
|
|
2224
|
+
*/
|
|
2225
|
+
get(
|
|
2226
|
+
{
|
|
2227
|
+
releaseId,
|
|
2228
|
+
}: {
|
|
2229
|
+
releaseId: string
|
|
2230
|
+
},
|
|
2231
|
+
options?: {
|
|
2232
|
+
signal?: AbortSignal
|
|
2233
|
+
tag?: string
|
|
2234
|
+
},
|
|
2235
|
+
): Observable<ReleaseDocument | undefined>
|
|
2236
|
+
/**
|
|
2237
|
+
* @public
|
|
1633
2238
|
*
|
|
1634
|
-
*
|
|
1635
|
-
*
|
|
2239
|
+
* Creates a new release under the given id, with metadata.
|
|
2240
|
+
*
|
|
2241
|
+
* @remarks
|
|
2242
|
+
* * If no releaseId is provided, a release id will be generated.
|
|
2243
|
+
* * If no metadata is provided, then an `undecided` releaseType will be used.
|
|
2244
|
+
*
|
|
2245
|
+
* @category Releases
|
|
2246
|
+
*
|
|
2247
|
+
* @param params - Release action parameters:
|
|
2248
|
+
* - `releaseId` - The id of the release to create.
|
|
2249
|
+
* - `metadata` - The metadata to associate with the release {@link ReleaseDocument}.
|
|
2250
|
+
* @param options - Additional action options.
|
|
2251
|
+
* @returns An observable that resolves to the `transactionId` and the release id and metadata.
|
|
2252
|
+
*
|
|
2253
|
+
* @example Creating a release with a custom id and metadata
|
|
2254
|
+
* ```ts
|
|
2255
|
+
* const releaseId = 'my-release'
|
|
2256
|
+
* const metadata: ReleaseDocument['metadata'] = {
|
|
2257
|
+
* releaseType: 'asap',
|
|
2258
|
+
* }
|
|
2259
|
+
*
|
|
2260
|
+
* client.observable.releases.create({releaseId, metadata}).pipe(
|
|
2261
|
+
* tap(({transactionId, releaseId, metadata}) => console.log(transactionId, releaseId, metadata)),
|
|
2262
|
+
* // {
|
|
2263
|
+
* // transactionId: 'transaction-id',
|
|
2264
|
+
* // releaseId: 'my-release',
|
|
2265
|
+
* // metadata: {releaseType: 'asap'},
|
|
2266
|
+
* // }
|
|
2267
|
+
* ).subscribe()
|
|
2268
|
+
* ```
|
|
2269
|
+
*
|
|
2270
|
+
* @example Creating a release with generated id and metadata
|
|
2271
|
+
* ```ts
|
|
2272
|
+
* client.observable.releases.create().pipe(
|
|
2273
|
+
* tap(({metadata}) => console.log(metadata)),
|
|
2274
|
+
* // {
|
|
2275
|
+
* // metadata: {releaseType: 'undecided'},
|
|
2276
|
+
* // }
|
|
2277
|
+
* ).subscribe()
|
|
2278
|
+
* ```
|
|
2279
|
+
*
|
|
2280
|
+
* @example Creating a release using a custom transaction id
|
|
2281
|
+
* ```ts
|
|
2282
|
+
* client.observable.releases.create({transactionId: 'my-transaction-id'}).pipe(
|
|
2283
|
+
* tap(({transactionId, metadata}) => console.log(transactionId, metadata)),
|
|
2284
|
+
* // {
|
|
2285
|
+
* // transactionId: 'my-transaction-id',
|
|
2286
|
+
* // metadata: {releaseType: 'undecided'},
|
|
2287
|
+
* // }
|
|
2288
|
+
* ).subscribe()
|
|
2289
|
+
* ```
|
|
2290
|
+
*/
|
|
2291
|
+
create(options: BaseActionOptions): Observable<
|
|
2292
|
+
SingleActionResult & {
|
|
2293
|
+
releaseId: string
|
|
2294
|
+
metadata: ReleaseDocument['metadata']
|
|
2295
|
+
}
|
|
2296
|
+
>
|
|
2297
|
+
create(
|
|
2298
|
+
release: {
|
|
2299
|
+
releaseId?: string
|
|
2300
|
+
metadata?: Partial<ReleaseDocument['metadata']>
|
|
2301
|
+
},
|
|
2302
|
+
options?: BaseActionOptions,
|
|
2303
|
+
): Observable<
|
|
2304
|
+
SingleActionResult & {
|
|
2305
|
+
releaseId: string
|
|
2306
|
+
metadata: ReleaseDocument['metadata']
|
|
2307
|
+
}
|
|
2308
|
+
>
|
|
2309
|
+
/**
|
|
2310
|
+
* @public
|
|
2311
|
+
*
|
|
2312
|
+
* Edits an existing release, updating the metadata.
|
|
2313
|
+
*
|
|
2314
|
+
* @category Releases
|
|
2315
|
+
*
|
|
2316
|
+
* @param params - Release action parameters:
|
|
2317
|
+
* - `releaseId` - The id of the release to edit.
|
|
2318
|
+
* - `patch` - The patch operation to apply on the release metadata {@link PatchMutationOperation}.
|
|
2319
|
+
* @param options - Additional action options.
|
|
2320
|
+
* @returns An observable that resolves to the `transactionId`.
|
|
1636
2321
|
*/
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
2322
|
+
edit(
|
|
2323
|
+
{
|
|
2324
|
+
releaseId,
|
|
2325
|
+
patch,
|
|
2326
|
+
}: {
|
|
2327
|
+
releaseId: string
|
|
2328
|
+
patch: PatchOperations
|
|
2329
|
+
},
|
|
2330
|
+
options?: BaseActionOptions,
|
|
2331
|
+
): Observable<SingleActionResult>
|
|
1642
2332
|
/**
|
|
1643
|
-
*
|
|
2333
|
+
* @public
|
|
1644
2334
|
*
|
|
1645
|
-
*
|
|
2335
|
+
* Publishes all documents in a release at once. For larger releases the effect of the publish
|
|
2336
|
+
* will be visible immediately when querying but the removal of the `versions.<releasesId>.*`
|
|
2337
|
+
* documents and creation of the corresponding published documents with the new content may
|
|
2338
|
+
* take some time.
|
|
2339
|
+
*
|
|
2340
|
+
* During this period both the source and target documents are locked and cannot be
|
|
2341
|
+
* modified through any other means.
|
|
2342
|
+
*
|
|
2343
|
+
* @category Releases
|
|
2344
|
+
*
|
|
2345
|
+
* @param params - Release action parameters:
|
|
2346
|
+
* - `releaseId` - The id of the release to publish.
|
|
2347
|
+
* @param options - Additional action options.
|
|
2348
|
+
* @returns An observable that resolves to the `transactionId`.
|
|
1646
2349
|
*/
|
|
1647
|
-
|
|
2350
|
+
publish(
|
|
2351
|
+
{
|
|
2352
|
+
releaseId,
|
|
2353
|
+
}: {
|
|
2354
|
+
releaseId: string
|
|
2355
|
+
},
|
|
2356
|
+
options?: BaseActionOptions,
|
|
2357
|
+
): Observable<SingleActionResult>
|
|
2358
|
+
/**
|
|
2359
|
+
* @public
|
|
2360
|
+
*
|
|
2361
|
+
* An archive action removes an active release. The documents that comprise the release
|
|
2362
|
+
* are deleted and therefore no longer queryable.
|
|
2363
|
+
*
|
|
2364
|
+
* While the documents remain in retention the last version can still be accessed using document history endpoint.
|
|
2365
|
+
*
|
|
2366
|
+
* @category Releases
|
|
2367
|
+
*
|
|
2368
|
+
* @param params - Release action parameters:
|
|
2369
|
+
* - `releaseId` - The id of the release to archive.
|
|
2370
|
+
* @param options - Additional action options.
|
|
2371
|
+
* @returns An observable that resolves to the `transactionId`.
|
|
2372
|
+
*/
|
|
2373
|
+
archive(
|
|
2374
|
+
{
|
|
2375
|
+
releaseId,
|
|
2376
|
+
}: {
|
|
2377
|
+
releaseId: string
|
|
2378
|
+
},
|
|
2379
|
+
options?: BaseActionOptions,
|
|
2380
|
+
): Observable<SingleActionResult>
|
|
2381
|
+
/**
|
|
2382
|
+
* @public
|
|
2383
|
+
*
|
|
2384
|
+
* An unarchive action restores an archived release and all documents
|
|
2385
|
+
* with the content they had just prior to archiving.
|
|
2386
|
+
*
|
|
2387
|
+
* @category Releases
|
|
2388
|
+
*
|
|
2389
|
+
* @param params - Release action parameters:
|
|
2390
|
+
* - `releaseId` - The id of the release to unarchive.
|
|
2391
|
+
* @param options - Additional action options.
|
|
2392
|
+
* @returns An observable that resolves to the `transactionId`.
|
|
2393
|
+
*/
|
|
2394
|
+
unarchive(
|
|
2395
|
+
{
|
|
2396
|
+
releaseId,
|
|
2397
|
+
}: {
|
|
2398
|
+
releaseId: string
|
|
2399
|
+
},
|
|
2400
|
+
options?: BaseActionOptions,
|
|
2401
|
+
): Observable<SingleActionResult>
|
|
2402
|
+
/**
|
|
2403
|
+
* @public
|
|
2404
|
+
*
|
|
2405
|
+
* A schedule action queues a release for publishing at the given future time.
|
|
2406
|
+
* The release is locked such that no documents in the release can be modified and
|
|
2407
|
+
* no documents that it references can be deleted as this would make the publish fail.
|
|
2408
|
+
* At the given time, the same logic as for the publish action is triggered.
|
|
2409
|
+
*
|
|
2410
|
+
* @category Releases
|
|
2411
|
+
*
|
|
2412
|
+
* @param params - Release action parameters:
|
|
2413
|
+
* - `releaseId` - The id of the release to schedule.
|
|
2414
|
+
* - `publishAt` - The serialised date and time to publish the release. If the `publishAt` is in the past, the release will be published immediately.
|
|
2415
|
+
* @param options - Additional action options.
|
|
2416
|
+
* @returns An observable that resolves to the `transactionId`.
|
|
2417
|
+
*/
|
|
2418
|
+
schedule(
|
|
2419
|
+
{
|
|
2420
|
+
releaseId,
|
|
2421
|
+
publishAt,
|
|
2422
|
+
}: {
|
|
2423
|
+
releaseId: string
|
|
2424
|
+
publishAt: string
|
|
2425
|
+
},
|
|
2426
|
+
options?: BaseActionOptions,
|
|
2427
|
+
): Observable<SingleActionResult>
|
|
2428
|
+
/**
|
|
2429
|
+
* @public
|
|
2430
|
+
*
|
|
2431
|
+
* An unschedule action stops a release from being published.
|
|
2432
|
+
* The documents in the release are considered unlocked and can be edited again.
|
|
2433
|
+
* This may fail if another release is scheduled to be published after this one and
|
|
2434
|
+
* has a reference to a document created by this one.
|
|
2435
|
+
*
|
|
2436
|
+
* @category Releases
|
|
2437
|
+
*
|
|
2438
|
+
* @param params - Release action parameters:
|
|
2439
|
+
* - `releaseId` - The id of the release to unschedule.
|
|
2440
|
+
* @param options - Additional action options.
|
|
2441
|
+
* @returns An observable that resolves to the `transactionId`.
|
|
2442
|
+
*/
|
|
2443
|
+
unschedule(
|
|
2444
|
+
{
|
|
2445
|
+
releaseId,
|
|
2446
|
+
}: {
|
|
2447
|
+
releaseId: string
|
|
2448
|
+
},
|
|
2449
|
+
options?: BaseActionOptions,
|
|
2450
|
+
): Observable<SingleActionResult>
|
|
2451
|
+
/**
|
|
2452
|
+
* @public
|
|
2453
|
+
*
|
|
2454
|
+
* A delete action removes a published or archived release.
|
|
2455
|
+
* The backing system document will be removed from the dataset.
|
|
2456
|
+
*
|
|
2457
|
+
* @category Releases
|
|
2458
|
+
*
|
|
2459
|
+
* @param params - Release action parameters:
|
|
2460
|
+
* - `releaseId` - The id of the release to delete.
|
|
2461
|
+
* @param options - Additional action options.
|
|
2462
|
+
* @returns An observable that resolves to the `transactionId`.
|
|
2463
|
+
*/
|
|
2464
|
+
delete(
|
|
2465
|
+
{
|
|
2466
|
+
releaseId,
|
|
2467
|
+
}: {
|
|
2468
|
+
releaseId: string
|
|
2469
|
+
},
|
|
2470
|
+
options?: BaseActionOptions,
|
|
2471
|
+
): Observable<SingleActionResult>
|
|
2472
|
+
/**
|
|
2473
|
+
* @public
|
|
2474
|
+
*
|
|
2475
|
+
* Fetch the documents in a release by release id.
|
|
2476
|
+
*
|
|
2477
|
+
* @category Releases
|
|
2478
|
+
*
|
|
2479
|
+
* @param params - Release action parameters:
|
|
2480
|
+
* - `releaseId` - The id of the release to fetch documents for.
|
|
2481
|
+
* @param options - Additional mutation options {@link BaseMutationOptions}.
|
|
2482
|
+
* @returns An observable that resolves to the documents in the release.
|
|
2483
|
+
*/
|
|
2484
|
+
fetchDocuments(
|
|
2485
|
+
{
|
|
2486
|
+
releaseId,
|
|
2487
|
+
}: {
|
|
2488
|
+
releaseId: string
|
|
2489
|
+
},
|
|
2490
|
+
options?: BaseMutationOptions,
|
|
2491
|
+
): Observable<RawQueryResponse<SanityDocument[]>>
|
|
1648
2492
|
}
|
|
1649
2493
|
|
|
1650
2494
|
/** @public */
|
|
1651
|
-
export declare class ObservableSanityClient
|
|
2495
|
+
export declare class ObservableSanityClient {
|
|
1652
2496
|
#private
|
|
1653
2497
|
assets: ObservableAssetsClient
|
|
1654
2498
|
datasets: ObservableDatasetsClient
|
|
1655
2499
|
live: LiveClient
|
|
1656
2500
|
projects: ObservableProjectsClient
|
|
1657
2501
|
users: ObservableUsersClient
|
|
2502
|
+
agent: {
|
|
2503
|
+
action: ObservableAgentsActionClient
|
|
2504
|
+
}
|
|
2505
|
+
releases: ObservableReleasesClient
|
|
2506
|
+
/**
|
|
2507
|
+
* Instance properties
|
|
2508
|
+
*/
|
|
1658
2509
|
listen: typeof _listen
|
|
1659
2510
|
constructor(httpRequest: HttpRequest, config?: ClientConfig)
|
|
1660
2511
|
/**
|
|
@@ -1713,7 +2564,7 @@ export declare class ObservableSanityClient implements ObservableSanityClientTyp
|
|
|
1713
2564
|
Q extends QueryWithoutParams | QueryParams = QueryParams,
|
|
1714
2565
|
const G extends string = string,
|
|
1715
2566
|
>(
|
|
1716
|
-
query:
|
|
2567
|
+
query: string,
|
|
1717
2568
|
params: Q extends QueryWithoutParams ? QueryWithoutParams : Q,
|
|
1718
2569
|
options: UnfilteredResponseQueryOptions,
|
|
1719
2570
|
): Observable<RawQueryResponse<ClientReturn<G, R>>>
|
|
@@ -1742,7 +2593,9 @@ export declare class ObservableSanityClient implements ObservableSanityClientTyp
|
|
|
1742
2593
|
getDocument<R extends Record<string, Any> = Record<string, Any>>(
|
|
1743
2594
|
id: string,
|
|
1744
2595
|
options?: {
|
|
2596
|
+
signal?: AbortSignal
|
|
1745
2597
|
tag?: string
|
|
2598
|
+
releaseId?: string
|
|
1746
2599
|
},
|
|
1747
2600
|
): Observable<SanityDocument<R> | undefined>
|
|
1748
2601
|
/**
|
|
@@ -1925,6 +2778,90 @@ export declare class ObservableSanityClient implements ObservableSanityClientTyp
|
|
|
1925
2778
|
document: IdentifiedSanityDocumentStub<R>,
|
|
1926
2779
|
options?: BaseMutationOptions,
|
|
1927
2780
|
): Observable<SanityDocument<R>>
|
|
2781
|
+
/**
|
|
2782
|
+
* @public
|
|
2783
|
+
*
|
|
2784
|
+
* Creates a new version of a published document.
|
|
2785
|
+
*
|
|
2786
|
+
* @remarks
|
|
2787
|
+
* * Requires a document with a `_type` property.
|
|
2788
|
+
* * Creating a version with no `releaseId` will create a new draft version of the published document.
|
|
2789
|
+
* * If the `document._id` is defined, it should be a draft or release version ID that matches the version ID generated from `publishedId` and `releaseId`.
|
|
2790
|
+
* * If the `document._id` is not defined, it will be generated from `publishedId` and `releaseId`.
|
|
2791
|
+
* * To create a version of an unpublished document, use the `client.create` method.
|
|
2792
|
+
*
|
|
2793
|
+
* @category Versions
|
|
2794
|
+
*
|
|
2795
|
+
* @param params - Version action parameters:
|
|
2796
|
+
* - `document` - The document to create as a new version (must include `_type`).
|
|
2797
|
+
* - `publishedId` - The ID of the published document being versioned.
|
|
2798
|
+
* - `releaseId` - The ID of the release to create the version for.
|
|
2799
|
+
* @param options - Additional action options.
|
|
2800
|
+
* @returns an observable that resolves to the `transactionId`.
|
|
2801
|
+
*
|
|
2802
|
+
* @example Creating a new version of a published document with a generated version ID
|
|
2803
|
+
* ```ts
|
|
2804
|
+
* client.observable.createVersion({
|
|
2805
|
+
* // The document does not need to include an `_id` property since it will be generated from `publishedId` and `releaseId`
|
|
2806
|
+
* document: {_type: 'myDocument', title: 'My Document'},
|
|
2807
|
+
* publishedId: 'myDocument',
|
|
2808
|
+
* releaseId: 'myRelease',
|
|
2809
|
+
* })
|
|
2810
|
+
*
|
|
2811
|
+
* // The following document will be created:
|
|
2812
|
+
* // {
|
|
2813
|
+
* // _id: 'versions.myRelease.myDocument',
|
|
2814
|
+
* // _type: 'myDocument',
|
|
2815
|
+
* // title: 'My Document',
|
|
2816
|
+
* // }
|
|
2817
|
+
* ```
|
|
2818
|
+
*
|
|
2819
|
+
* @example Creating a new version of a published document with a specified version ID
|
|
2820
|
+
* ```ts
|
|
2821
|
+
* client.observable.createVersion({
|
|
2822
|
+
* document: {_type: 'myDocument', _id: 'versions.myRelease.myDocument', title: 'My Document'},
|
|
2823
|
+
* // `publishedId` and `releaseId` are not required since `document._id` has been specified
|
|
2824
|
+
* })
|
|
2825
|
+
*
|
|
2826
|
+
* // The following document will be created:
|
|
2827
|
+
* // {
|
|
2828
|
+
* // _id: 'versions.myRelease.myDocument',
|
|
2829
|
+
* // _type: 'myDocument',
|
|
2830
|
+
* // title: 'My Document',
|
|
2831
|
+
* // }
|
|
2832
|
+
* ```
|
|
2833
|
+
*
|
|
2834
|
+
* @example Creating a new draft version of a published document
|
|
2835
|
+
* ```ts
|
|
2836
|
+
* client.observable.createVersion({
|
|
2837
|
+
* document: {_type: 'myDocument', title: 'My Document'},
|
|
2838
|
+
* publishedId: 'myDocument',
|
|
2839
|
+
* })
|
|
2840
|
+
*
|
|
2841
|
+
* // The following document will be created:
|
|
2842
|
+
* // {
|
|
2843
|
+
* // _id: 'drafts.myDocument',
|
|
2844
|
+
* // _type: 'myDocument',
|
|
2845
|
+
* // title: 'My Document',
|
|
2846
|
+
* // }
|
|
2847
|
+
* ```
|
|
2848
|
+
*/
|
|
2849
|
+
createVersion<R extends Record<string, Any>>(
|
|
2850
|
+
args: {
|
|
2851
|
+
document: SanityDocumentStub<R>
|
|
2852
|
+
publishedId: string
|
|
2853
|
+
releaseId?: string
|
|
2854
|
+
},
|
|
2855
|
+
options?: BaseActionOptions,
|
|
2856
|
+
): Observable<SingleActionResult | MultipleActionResult>
|
|
2857
|
+
createVersion<R extends Record<string, Any>>(
|
|
2858
|
+
args: {
|
|
2859
|
+
document: IdentifiedSanityDocumentStub<R>
|
|
2860
|
+
publishedId?: string
|
|
2861
|
+
releaseId?: string
|
|
2862
|
+
},
|
|
2863
|
+
options?: BaseActionOptions,
|
|
2864
|
+
): Observable<SingleActionResult | MultipleActionResult>
|
|
1928
2865
|
/**
|
|
1929
2866
|
* Deletes a document with the given document ID.
|
|
1930
2867
|
* Returns an observable that resolves to the deleted document.
|
|
@@ -2029,6 +2966,157 @@ export declare class ObservableSanityClient implements ObservableSanityClientTyp
|
|
|
2029
2966
|
selection: MutationSelection,
|
|
2030
2967
|
options?: BaseMutationOptions,
|
|
2031
2968
|
): Observable<SanityDocument<R>>
|
|
2969
|
+
/**
|
|
2970
|
+
* @public
|
|
2971
|
+
*
|
|
2972
|
+
* Deletes the draft or release version of a document.
|
|
2973
|
+
*
|
|
2974
|
+
* @remarks
|
|
2975
|
+
* * Discarding a version with no `releaseId` will discard the draft version of the published document.
|
|
2976
|
+
* * If the draft or release version does not exist, any error will throw.
|
|
2977
|
+
*
|
|
2978
|
+
* @param params - Version action parameters:
|
|
2979
|
+
* - `releaseId` - The ID of the release to discard the document from.
|
|
2980
|
+
* - `publishedId` - The published ID of the document to discard.
|
|
2981
|
+
* @param purge - if `true` the document history is also discarded.
|
|
2982
|
+
* @param options - Additional action options.
|
|
2983
|
+
* @returns an observable that resolves to the `transactionId`.
|
|
2984
|
+
*
|
|
2985
|
+
* @example Discarding a release version of a document
|
|
2986
|
+
* ```ts
|
|
2987
|
+
* client.observable.discardVersion({publishedId: 'myDocument', releaseId: 'myRelease'})
|
|
2988
|
+
* // The document with the ID `versions.myRelease.myDocument` will be discarded.
|
|
2989
|
+
* ```
|
|
2990
|
+
*
|
|
2991
|
+
* @example Discarding a draft version of a document
|
|
2992
|
+
* ```ts
|
|
2993
|
+
* client.observable.discardVersion({publishedId: 'myDocument'})
|
|
2994
|
+
* // The document with the ID `drafts.myDocument` will be discarded.
|
|
2995
|
+
* ```
|
|
2996
|
+
*/
|
|
2997
|
+
discardVersion(
|
|
2998
|
+
{
|
|
2999
|
+
releaseId,
|
|
3000
|
+
publishedId,
|
|
3001
|
+
}: {
|
|
3002
|
+
releaseId?: string
|
|
3003
|
+
publishedId: string
|
|
3004
|
+
},
|
|
3005
|
+
purge?: boolean,
|
|
3006
|
+
options?: BaseActionOptions,
|
|
3007
|
+
): Observable<SingleActionResult | MultipleActionResult>
|
|
3008
|
+
/**
|
|
3009
|
+
* @public
|
|
3010
|
+
*
|
|
3011
|
+
* Replaces an existing version document.
|
|
3012
|
+
*
|
|
3013
|
+
* @remarks
|
|
3014
|
+
* * Requires a document with a `_type` property.
|
|
3015
|
+
* * If the `document._id` is defined, it should be a draft or release version ID that matches the version ID generated from `publishedId` and `releaseId`.
|
|
3016
|
+
* * If the `document._id` is not defined, it will be generated from `publishedId` and `releaseId`.
|
|
3017
|
+
* * Replacing a version with no `releaseId` will replace the draft version of the published document.
|
|
3018
|
+
* * At least one of the **version** or **published** documents must exist.
|
|
3019
|
+
*
|
|
3020
|
+
* @param params - Version action parameters:
|
|
3021
|
+
* - `document` - The new document to replace the version with.
|
|
3022
|
+
* - `releaseId` - The ID of the release where the document version is replaced.
|
|
3023
|
+
* - `publishedId` - The ID of the published document to replace.
|
|
3024
|
+
* @param options - Additional action options.
|
|
3025
|
+
* @returns an observable that resolves to the `transactionId`.
|
|
3026
|
+
*
|
|
3027
|
+
* @example Replacing a release version of a published document with a generated version ID
|
|
3028
|
+
* ```ts
|
|
3029
|
+
* client.observable.replaceVersion({
|
|
3030
|
+
* document: {_type: 'myDocument', title: 'My Document'},
|
|
3031
|
+
* publishedId: 'myDocument',
|
|
3032
|
+
* releaseId: 'myRelease',
|
|
3033
|
+
* })
|
|
3034
|
+
*
|
|
3035
|
+
* // The following document will be patched:
|
|
3036
|
+
* // {
|
|
3037
|
+
* // _id: 'versions.myRelease.myDocument',
|
|
3038
|
+
* // _type: 'myDocument',
|
|
3039
|
+
* // title: 'My Document',
|
|
3040
|
+
* // }
|
|
3041
|
+
* ```
|
|
3042
|
+
*
|
|
3043
|
+
* @example Replacing a release version of a published document with a specified version ID
|
|
3044
|
+
* ```ts
|
|
3045
|
+
* client.observable.replaceVersion({
|
|
3046
|
+
* document: {_type: 'myDocument', _id: 'versions.myRelease.myDocument', title: 'My Document'},
|
|
3047
|
+
* // `publishedId` and `releaseId` are not required since `document._id` has been specified
|
|
3048
|
+
* })
|
|
3049
|
+
*
|
|
3050
|
+
* // The following document will be patched:
|
|
3051
|
+
* // {
|
|
3052
|
+
* // _id: 'versions.myRelease.myDocument',
|
|
3053
|
+
* // _type: 'myDocument',
|
|
3054
|
+
* // title: 'My Document',
|
|
3055
|
+
* // }
|
|
3056
|
+
* ```
|
|
3057
|
+
*
|
|
3058
|
+
* @example Replacing a draft version of a published document
|
|
3059
|
+
* ```ts
|
|
3060
|
+
* client.observable.replaceVersion({
|
|
3061
|
+
* document: {_type: 'myDocument', title: 'My Document'},
|
|
3062
|
+
* publishedId: 'myDocument',
|
|
3063
|
+
* })
|
|
3064
|
+
*
|
|
3065
|
+
* // The following document will be patched:
|
|
3066
|
+
* // {
|
|
3067
|
+
* // _id: 'drafts.myDocument',
|
|
3068
|
+
* // _type: 'myDocument',
|
|
3069
|
+
* // title: 'My Document',
|
|
3070
|
+
* // }
|
|
3071
|
+
* ```
|
|
3072
|
+
*/
|
|
3073
|
+
replaceVersion<R extends Record<string, Any>>(
|
|
3074
|
+
args: {
|
|
3075
|
+
document: SanityDocumentStub<R>
|
|
3076
|
+
publishedId: string
|
|
3077
|
+
releaseId?: string
|
|
3078
|
+
},
|
|
3079
|
+
options?: BaseActionOptions,
|
|
3080
|
+
): Observable<SingleActionResult | MultipleActionResult>
|
|
3081
|
+
replaceVersion<R extends Record<string, Any>>(
|
|
3082
|
+
args: {
|
|
3083
|
+
document: IdentifiedSanityDocumentStub<R>
|
|
3084
|
+
publishedId?: string
|
|
3085
|
+
releaseId?: string
|
|
3086
|
+
},
|
|
3087
|
+
options?: BaseActionOptions,
|
|
3088
|
+
): Observable<SingleActionResult | MultipleActionResult>
|
|
3089
|
+
/**
|
|
3090
|
+
* @public
|
|
3091
|
+
*
|
|
3092
|
+
* Used to indicate when a document within a release should be unpublished when
|
|
3093
|
+
* the release is run.
|
|
3094
|
+
*
|
|
3095
|
+
* @remarks
|
|
3096
|
+
* * If the published document does not exist, an error will be thrown.
|
|
3097
|
+
*
|
|
3098
|
+
* @param params - Version action parameters:
|
|
3099
|
+
* - `releaseId` - The ID of the release to unpublish the document from.
|
|
3100
|
+
* - `publishedId` - The published ID of the document to unpublish.
|
|
3101
|
+
* @param options - Additional action options.
|
|
3102
|
+
* @returns an observable that resolves to the `transactionId`.
|
|
3103
|
+
*
|
|
3104
|
+
* @example Unpublishing a release version of a published document
|
|
3105
|
+
* ```ts
|
|
3106
|
+
* client.observable.unpublishVersion({publishedId: 'myDocument', releaseId: 'myRelease'})
|
|
3107
|
+
* // The document with the ID `versions.myRelease.myDocument` will be unpublished. when `myRelease` is run.
|
|
3108
|
+
* ```
|
|
3109
|
+
*/
|
|
3110
|
+
unpublishVersion(
|
|
3111
|
+
{
|
|
3112
|
+
releaseId,
|
|
3113
|
+
publishedId,
|
|
3114
|
+
}: {
|
|
3115
|
+
releaseId: string
|
|
3116
|
+
publishedId: string
|
|
3117
|
+
},
|
|
3118
|
+
options?: BaseActionOptions,
|
|
3119
|
+
): Observable<SingleActionResult | MultipleActionResult>
|
|
2032
3120
|
/**
|
|
2033
3121
|
* Perform mutation operations against the configured dataset
|
|
2034
3122
|
* Returns an observable that resolves to the first mutated document.
|
|
@@ -2148,1516 +3236,825 @@ export declare class ObservableSanityClient implements ObservableSanityClientTyp
|
|
|
2148
3236
|
getDataUrl(operation: string, path?: string): string
|
|
2149
3237
|
}
|
|
2150
3238
|
|
|
2151
|
-
/**
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
* in cases where you might have multiple `@sanity/client` instances in your node_modules.
|
|
2156
|
-
* @public
|
|
2157
|
-
*/
|
|
2158
|
-
export declare interface ObservableSanityClientType extends SanityClientBase {
|
|
2159
|
-
assets: ObservableAssetsClientType
|
|
2160
|
-
datasets: ObservableDatasetsClientType
|
|
2161
|
-
projects: ObservableProjectsClientType
|
|
2162
|
-
users: ObservableUsersClientType
|
|
3239
|
+
/** @public */
|
|
3240
|
+
export declare class ObservableTransaction extends BaseTransaction {
|
|
3241
|
+
#private
|
|
3242
|
+
constructor(operations?: Mutation[], client?: ObservableSanityClient, transactionId?: string)
|
|
2163
3243
|
/**
|
|
2164
|
-
*
|
|
3244
|
+
* Clones the transaction
|
|
2165
3245
|
*/
|
|
2166
|
-
clone():
|
|
3246
|
+
clone(): ObservableTransaction
|
|
2167
3247
|
/**
|
|
2168
|
-
*
|
|
3248
|
+
* Commit the transaction, returning an observable that produces the first mutated document
|
|
3249
|
+
*
|
|
3250
|
+
* @param options - Options for the mutation operation
|
|
2169
3251
|
*/
|
|
2170
|
-
|
|
3252
|
+
commit<R extends Record<string, Any>>(
|
|
3253
|
+
options: TransactionFirstDocumentMutationOptions,
|
|
3254
|
+
): Observable<SanityDocument<R>>
|
|
2171
3255
|
/**
|
|
2172
|
-
*
|
|
3256
|
+
* Commit the transaction, returning an observable that produces an array of the mutated documents
|
|
3257
|
+
*
|
|
3258
|
+
* @param options - Options for the mutation operation
|
|
2173
3259
|
*/
|
|
2174
|
-
|
|
3260
|
+
commit<R extends Record<string, Any>>(
|
|
3261
|
+
options: TransactionAllDocumentsMutationOptions,
|
|
3262
|
+
): Observable<SanityDocument<R>[]>
|
|
2175
3263
|
/**
|
|
2176
|
-
*
|
|
3264
|
+
* Commit the transaction, returning an observable that produces a mutation result object
|
|
2177
3265
|
*
|
|
2178
|
-
* @param
|
|
3266
|
+
* @param options - Options for the mutation operation
|
|
2179
3267
|
*/
|
|
2180
|
-
|
|
3268
|
+
commit(options: TransactionFirstDocumentIdMutationOptions): Observable<SingleMutationResult>
|
|
2181
3269
|
/**
|
|
2182
|
-
*
|
|
3270
|
+
* Commit the transaction, returning an observable that produces a mutation result object
|
|
2183
3271
|
*
|
|
2184
|
-
* @param
|
|
3272
|
+
* @param options - Options for the mutation operation
|
|
2185
3273
|
*/
|
|
2186
|
-
|
|
2187
|
-
R = Any,
|
|
2188
|
-
Q extends QueryWithoutParams = QueryWithoutParams,
|
|
2189
|
-
const G extends string = string,
|
|
2190
|
-
>(
|
|
2191
|
-
query: G,
|
|
2192
|
-
params?: Q | QueryWithoutParams,
|
|
2193
|
-
): Observable<ClientReturn<G, R>>
|
|
3274
|
+
commit(options: TransactionAllDocumentIdsMutationOptions): Observable<MultipleMutationResult>
|
|
2194
3275
|
/**
|
|
2195
|
-
*
|
|
3276
|
+
* Commit the transaction, returning an observable that produces a mutation result object
|
|
2196
3277
|
*
|
|
2197
|
-
* @param
|
|
2198
|
-
* @param params - Optional query parameters
|
|
2199
|
-
* @param options - Optional request options
|
|
3278
|
+
* @param options - Options for the mutation operation
|
|
2200
3279
|
*/
|
|
2201
|
-
|
|
2202
|
-
R = Any,
|
|
2203
|
-
Q extends QueryWithoutParams | QueryParams = QueryParams,
|
|
2204
|
-
const G extends string = string,
|
|
2205
|
-
>(
|
|
2206
|
-
query: G,
|
|
2207
|
-
params: Q extends QueryWithoutParams ? QueryWithoutParams : Q,
|
|
2208
|
-
options?: FilteredResponseQueryOptions,
|
|
2209
|
-
): Observable<ClientReturn<G, R>>
|
|
3280
|
+
commit(options?: BaseMutationOptions): Observable<MultipleMutationResult>
|
|
2210
3281
|
/**
|
|
2211
|
-
*
|
|
3282
|
+
* Performs a patch on the given document ID. Can either be a builder function or an object of patch operations.
|
|
3283
|
+
* The operation is added to the current transaction, ready to be commited by `commit()`
|
|
2212
3284
|
*
|
|
2213
|
-
* @param
|
|
2214
|
-
* @param
|
|
2215
|
-
* @param options - Request options
|
|
3285
|
+
* @param documentId - Document ID to perform the patch operation on
|
|
3286
|
+
* @param patchOps - Operations to perform, or a builder function
|
|
2216
3287
|
*/
|
|
2217
|
-
|
|
2218
|
-
R = Any,
|
|
2219
|
-
Q extends QueryWithoutParams | QueryParams = QueryParams,
|
|
2220
|
-
const G extends string = string,
|
|
2221
|
-
>(
|
|
2222
|
-
query: G,
|
|
2223
|
-
params: Q extends QueryWithoutParams ? QueryWithoutParams : Q,
|
|
2224
|
-
options: UnfilteredResponseQueryOptions,
|
|
2225
|
-
): Observable<RawQueryResponse<ClientReturn<G, R>>>
|
|
3288
|
+
patch(documentId: string, patchOps?: ObservablePatchBuilder | PatchOperations): this
|
|
2226
3289
|
/**
|
|
2227
|
-
*
|
|
3290
|
+
* Adds the given patch instance to the transaction.
|
|
3291
|
+
* The operation is added to the current transaction, ready to be commited by `commit()`
|
|
2228
3292
|
*
|
|
2229
|
-
* @param
|
|
2230
|
-
* @param params - Optional query parameters
|
|
2231
|
-
* @param options - Request options
|
|
3293
|
+
* @param patch - ObservablePatch to execute
|
|
2232
3294
|
*/
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
options: UnfilteredResponseWithoutQuery,
|
|
2241
|
-
): Observable<RawQuerylessQueryResponse<ClientReturn<G, R>>>
|
|
3295
|
+
patch(patch: ObservablePatch): this
|
|
3296
|
+
}
|
|
3297
|
+
|
|
3298
|
+
/** @public */
|
|
3299
|
+
export declare class ObservableUsersClient {
|
|
3300
|
+
#private
|
|
3301
|
+
constructor(client: ObservableSanityClient, httpRequest: HttpRequest)
|
|
2242
3302
|
/**
|
|
2243
|
-
* Fetch a
|
|
3303
|
+
* Fetch a user by user ID
|
|
2244
3304
|
*
|
|
2245
|
-
* @param id -
|
|
2246
|
-
* @param options - Request options
|
|
3305
|
+
* @param id - User ID of the user to fetch. If `me` is provided, a minimal response including the users role is returned.
|
|
2247
3306
|
*/
|
|
2248
|
-
|
|
2249
|
-
id:
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
3307
|
+
getById<T extends 'me' | string>(
|
|
3308
|
+
id: T,
|
|
3309
|
+
): Observable<T extends 'me' ? CurrentSanityUser : SanityUser>
|
|
3310
|
+
}
|
|
3311
|
+
|
|
3312
|
+
/**
|
|
3313
|
+
* The listener connection has been established
|
|
3314
|
+
* note: it's usually a better option to use the 'welcome' event
|
|
3315
|
+
* @public
|
|
3316
|
+
*/
|
|
3317
|
+
export declare type OpenEvent = {
|
|
3318
|
+
type: 'open'
|
|
3319
|
+
}
|
|
3320
|
+
|
|
3321
|
+
/** @internal */
|
|
3322
|
+
export declare type PartialExcept<T, K extends keyof T> = Pick<T, K> & Partial<Omit<T, K>>
|
|
3323
|
+
|
|
3324
|
+
/** @public */
|
|
3325
|
+
export declare class Patch extends BasePatch {
|
|
3326
|
+
#private
|
|
3327
|
+
constructor(selection: PatchSelection, operations?: PatchOperations, client?: SanityClient)
|
|
2254
3328
|
/**
|
|
2255
|
-
*
|
|
2256
|
-
* Should be used sparingly - performing a query is usually a better option.
|
|
2257
|
-
* The order/position of documents is preserved based on the original array of IDs.
|
|
2258
|
-
* If any of the documents are missing, they will be replaced by a `null` entry in the returned array
|
|
2259
|
-
*
|
|
2260
|
-
* @param ids - Document IDs to fetch
|
|
2261
|
-
* @param options - Request options
|
|
3329
|
+
* Clones the patch
|
|
2262
3330
|
*/
|
|
2263
|
-
|
|
2264
|
-
ids: string[],
|
|
2265
|
-
options?: {
|
|
2266
|
-
tag?: string
|
|
2267
|
-
},
|
|
2268
|
-
): Observable<(SanityDocument<R> | null)[]>
|
|
3331
|
+
clone(): Patch
|
|
2269
3332
|
/**
|
|
2270
|
-
*
|
|
2271
|
-
* Returns an observable that resolves to the created document.
|
|
3333
|
+
* Commit the patch, returning a promise that resolves to the first patched document
|
|
2272
3334
|
*
|
|
2273
|
-
* @param
|
|
2274
|
-
* @param options - Mutation options
|
|
3335
|
+
* @param options - Options for the mutation operation
|
|
2275
3336
|
*/
|
|
2276
|
-
|
|
2277
|
-
document: SanityDocumentStub<R>,
|
|
3337
|
+
commit<R extends Record<string, Any> = Record<string, Any>>(
|
|
2278
3338
|
options: FirstDocumentMutationOptions,
|
|
2279
|
-
):
|
|
3339
|
+
): Promise<SanityDocument<R>>
|
|
2280
3340
|
/**
|
|
2281
|
-
*
|
|
2282
|
-
* Returns an observable that resolves to an array containing the created document.
|
|
3341
|
+
* Commit the patch, returning a promise that resolves to an array of the mutated documents
|
|
2283
3342
|
*
|
|
2284
|
-
* @param
|
|
2285
|
-
* @param options - Mutation options
|
|
3343
|
+
* @param options - Options for the mutation operation
|
|
2286
3344
|
*/
|
|
2287
|
-
|
|
2288
|
-
document: SanityDocumentStub<R>,
|
|
3345
|
+
commit<R extends Record<string, Any> = Record<string, Any>>(
|
|
2289
3346
|
options: AllDocumentsMutationOptions,
|
|
2290
|
-
):
|
|
3347
|
+
): Promise<SanityDocument<R>[]>
|
|
2291
3348
|
/**
|
|
2292
|
-
*
|
|
2293
|
-
* Returns an observable that resolves to a mutation result object containing the ID of the created document.
|
|
3349
|
+
* Commit the patch, returning a promise that resolves to a mutation result object
|
|
2294
3350
|
*
|
|
2295
|
-
* @param
|
|
2296
|
-
* @param options - Mutation options
|
|
3351
|
+
* @param options - Options for the mutation operation
|
|
2297
3352
|
*/
|
|
2298
|
-
|
|
2299
|
-
document: SanityDocumentStub<R>,
|
|
2300
|
-
options: FirstDocumentIdMutationOptions,
|
|
2301
|
-
): Observable<SingleMutationResult>
|
|
3353
|
+
commit(options: FirstDocumentIdMutationOptions): Promise<SingleMutationResult>
|
|
2302
3354
|
/**
|
|
2303
|
-
*
|
|
2304
|
-
* Returns an observable that resolves to a mutation result object containing the ID of the created document.
|
|
3355
|
+
* Commit the patch, returning a promise that resolves to a mutation result object
|
|
2305
3356
|
*
|
|
2306
|
-
* @param
|
|
2307
|
-
* @param options - Mutation options
|
|
3357
|
+
* @param options - Options for the mutation operation
|
|
2308
3358
|
*/
|
|
2309
|
-
|
|
2310
|
-
document: SanityDocumentStub<R>,
|
|
2311
|
-
options: AllDocumentIdsMutationOptions,
|
|
2312
|
-
): Observable<MultipleMutationResult>
|
|
3359
|
+
commit(options: AllDocumentIdsMutationOptions): Promise<MultipleMutationResult>
|
|
2313
3360
|
/**
|
|
2314
|
-
*
|
|
2315
|
-
* Returns an observable that resolves to the created document.
|
|
3361
|
+
* Commit the patch, returning a promise that resolves to the first patched document
|
|
2316
3362
|
*
|
|
2317
|
-
* @param
|
|
2318
|
-
* @param options - Mutation options
|
|
3363
|
+
* @param options - Options for the mutation operation
|
|
2319
3364
|
*/
|
|
2320
|
-
|
|
2321
|
-
document: SanityDocumentStub<R>,
|
|
3365
|
+
commit<R extends Record<string, Any> = Record<string, Any>>(
|
|
2322
3366
|
options?: BaseMutationOptions,
|
|
2323
|
-
):
|
|
3367
|
+
): Promise<SanityDocument<R>>
|
|
3368
|
+
}
|
|
3369
|
+
|
|
3370
|
+
/** @public */
|
|
3371
|
+
export declare type PatchBuilder = (patch: Patch) => Patch
|
|
3372
|
+
|
|
3373
|
+
/** @internal */
|
|
3374
|
+
export declare type PatchMutationOperation = PatchOperations & MutationSelection
|
|
3375
|
+
|
|
3376
|
+
/** @internal */
|
|
3377
|
+
export declare interface PatchOperations {
|
|
3378
|
+
set?: {
|
|
3379
|
+
[key: string]: Any
|
|
3380
|
+
}
|
|
3381
|
+
setIfMissing?: {
|
|
3382
|
+
[key: string]: Any
|
|
3383
|
+
}
|
|
3384
|
+
diffMatchPatch?: {
|
|
3385
|
+
[key: string]: Any
|
|
3386
|
+
}
|
|
3387
|
+
unset?: string[]
|
|
3388
|
+
inc?: {
|
|
3389
|
+
[key: string]: number
|
|
3390
|
+
}
|
|
3391
|
+
dec?: {
|
|
3392
|
+
[key: string]: number
|
|
3393
|
+
}
|
|
3394
|
+
insert?: InsertPatch
|
|
3395
|
+
ifRevisionID?: string
|
|
3396
|
+
}
|
|
3397
|
+
|
|
3398
|
+
/** @internal */
|
|
3399
|
+
export declare type PatchSelection = string | string[] | MutationSelection
|
|
3400
|
+
|
|
3401
|
+
/** @public */
|
|
3402
|
+
declare interface ProgressEvent_2 {
|
|
3403
|
+
type: 'progress'
|
|
3404
|
+
stage: 'upload' | 'download'
|
|
3405
|
+
percent: number
|
|
3406
|
+
total?: number
|
|
3407
|
+
loaded?: number
|
|
3408
|
+
lengthComputable: boolean
|
|
3409
|
+
}
|
|
3410
|
+
export {ProgressEvent_2 as ProgressEvent}
|
|
3411
|
+
|
|
3412
|
+
/** @internal */
|
|
3413
|
+
export declare class ProjectsClient {
|
|
3414
|
+
#private
|
|
3415
|
+
constructor(client: SanityClient, httpRequest: HttpRequest)
|
|
2324
3416
|
/**
|
|
2325
|
-
*
|
|
2326
|
-
* Returns an observable that resolves to the created document.
|
|
3417
|
+
* Fetch a list of projects the authenticated user has access to.
|
|
2327
3418
|
*
|
|
2328
|
-
* @param
|
|
2329
|
-
*
|
|
3419
|
+
* @param options - Options for the list request
|
|
3420
|
+
* - `includeMembers` - Whether to include members in the response (default: true)
|
|
2330
3421
|
*/
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
options: FirstDocumentMutationOptions,
|
|
2334
|
-
): Observable<SanityDocument<R>>
|
|
3422
|
+
list(options?: {includeMembers?: true}): Promise<SanityProject[]>
|
|
3423
|
+
list(options?: {includeMembers?: false}): Promise<Omit<SanityProject, 'members'>[]>
|
|
2335
3424
|
/**
|
|
2336
|
-
*
|
|
2337
|
-
* Returns an observable that resolves to an array containing the created document.
|
|
2338
|
-
*
|
|
2339
|
-
* @param document - Document to create
|
|
2340
|
-
* @param options - Mutation options
|
|
2341
|
-
*/
|
|
2342
|
-
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
2343
|
-
document: IdentifiedSanityDocumentStub<R>,
|
|
2344
|
-
options: AllDocumentsMutationOptions,
|
|
2345
|
-
): Observable<SanityDocument<R>[]>
|
|
2346
|
-
/**
|
|
2347
|
-
* Create a document if no document with the same ID already exists.
|
|
2348
|
-
* Returns an observable that resolves to a mutation result object containing the ID of the created document.
|
|
2349
|
-
*
|
|
2350
|
-
* @param document - Document to create
|
|
2351
|
-
* @param options - Mutation options
|
|
2352
|
-
*/
|
|
2353
|
-
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
2354
|
-
document: IdentifiedSanityDocumentStub<R>,
|
|
2355
|
-
options: FirstDocumentIdMutationOptions,
|
|
2356
|
-
): Observable<SingleMutationResult>
|
|
2357
|
-
/**
|
|
2358
|
-
* Create a document if no document with the same ID already exists.
|
|
2359
|
-
* Returns an observable that resolves to a mutation result object containing the ID of the created document.
|
|
2360
|
-
*
|
|
2361
|
-
* @param document - Document to create
|
|
2362
|
-
* @param options - Mutation options
|
|
2363
|
-
*/
|
|
2364
|
-
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
2365
|
-
document: IdentifiedSanityDocumentStub<R>,
|
|
2366
|
-
options: AllDocumentIdsMutationOptions,
|
|
2367
|
-
): Observable<MultipleMutationResult>
|
|
2368
|
-
/**
|
|
2369
|
-
* Create a document if no document with the same ID already exists.
|
|
2370
|
-
* Returns an observable that resolves to the created document.
|
|
2371
|
-
*
|
|
2372
|
-
* @param document - Document to create
|
|
2373
|
-
* @param options - Mutation options
|
|
2374
|
-
*/
|
|
2375
|
-
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
2376
|
-
document: IdentifiedSanityDocumentStub<R>,
|
|
2377
|
-
options?: BaseMutationOptions,
|
|
2378
|
-
): Observable<SanityDocument<R>>
|
|
2379
|
-
/**
|
|
2380
|
-
* Create a document if it does not exist, or replace a document with the same document ID
|
|
2381
|
-
* Returns an observable that resolves to the created document.
|
|
2382
|
-
*
|
|
2383
|
-
* @param document - Document to either create or replace
|
|
2384
|
-
* @param options - Mutation options
|
|
2385
|
-
*/
|
|
2386
|
-
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
2387
|
-
document: IdentifiedSanityDocumentStub<R>,
|
|
2388
|
-
options: FirstDocumentMutationOptions,
|
|
2389
|
-
): Observable<SanityDocument<R>>
|
|
2390
|
-
/**
|
|
2391
|
-
* Create a document if it does not exist, or replace a document with the same document ID
|
|
2392
|
-
* Returns an observable that resolves to an array containing the created document.
|
|
2393
|
-
*
|
|
2394
|
-
* @param document - Document to either create or replace
|
|
2395
|
-
* @param options - Mutation options
|
|
2396
|
-
*/
|
|
2397
|
-
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
2398
|
-
document: IdentifiedSanityDocumentStub<R>,
|
|
2399
|
-
options: AllDocumentsMutationOptions,
|
|
2400
|
-
): Observable<SanityDocument<R>[]>
|
|
2401
|
-
/**
|
|
2402
|
-
* Create a document if it does not exist, or replace a document with the same document ID
|
|
2403
|
-
* Returns an observable that resolves to a mutation result object containing the ID of the created document.
|
|
2404
|
-
*
|
|
2405
|
-
* @param document - Document to either create or replace
|
|
2406
|
-
* @param options - Mutation options
|
|
2407
|
-
*/
|
|
2408
|
-
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
2409
|
-
document: IdentifiedSanityDocumentStub<R>,
|
|
2410
|
-
options: FirstDocumentIdMutationOptions,
|
|
2411
|
-
): Observable<SingleMutationResult>
|
|
2412
|
-
/**
|
|
2413
|
-
* Create a document if it does not exist, or replace a document with the same document ID
|
|
2414
|
-
* Returns an observable that resolves to a mutation result object containing the created document ID.
|
|
2415
|
-
*
|
|
2416
|
-
* @param document - Document to either create or replace
|
|
2417
|
-
* @param options - Mutation options
|
|
2418
|
-
*/
|
|
2419
|
-
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
2420
|
-
document: IdentifiedSanityDocumentStub<R>,
|
|
2421
|
-
options: AllDocumentIdsMutationOptions,
|
|
2422
|
-
): Observable<MultipleMutationResult>
|
|
2423
|
-
/**
|
|
2424
|
-
* Create a document if it does not exist, or replace a document with the same document ID
|
|
2425
|
-
* Returns an observable that resolves to the created document.
|
|
2426
|
-
*
|
|
2427
|
-
* @param document - Document to either create or replace
|
|
2428
|
-
* @param options - Mutation options
|
|
2429
|
-
*/
|
|
2430
|
-
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
2431
|
-
document: IdentifiedSanityDocumentStub<R>,
|
|
2432
|
-
options?: BaseMutationOptions,
|
|
2433
|
-
): Observable<SanityDocument<R>>
|
|
2434
|
-
/**
|
|
2435
|
-
* Deletes a document with the given document ID.
|
|
2436
|
-
* Returns an observable that resolves to the deleted document.
|
|
2437
|
-
*
|
|
2438
|
-
* @param id - Document ID to delete
|
|
2439
|
-
* @param options - Options for the mutation
|
|
2440
|
-
*/
|
|
2441
|
-
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
2442
|
-
id: string,
|
|
2443
|
-
options: FirstDocumentMutationOptions,
|
|
2444
|
-
): Observable<SanityDocument<R>>
|
|
2445
|
-
/**
|
|
2446
|
-
* Deletes a document with the given document ID.
|
|
2447
|
-
* Returns an observable that resolves to an array containing the deleted document.
|
|
2448
|
-
*
|
|
2449
|
-
* @param id - Document ID to delete
|
|
2450
|
-
* @param options - Options for the mutation
|
|
2451
|
-
*/
|
|
2452
|
-
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
2453
|
-
id: string,
|
|
2454
|
-
options: AllDocumentsMutationOptions,
|
|
2455
|
-
): Observable<SanityDocument<R>[]>
|
|
2456
|
-
/**
|
|
2457
|
-
* Deletes a document with the given document ID.
|
|
2458
|
-
* Returns an observable that resolves to a mutation result object containing the deleted document ID.
|
|
2459
|
-
*
|
|
2460
|
-
* @param id - Document ID to delete
|
|
2461
|
-
* @param options - Options for the mutation
|
|
2462
|
-
*/
|
|
2463
|
-
delete(id: string, options: FirstDocumentIdMutationOptions): Observable<SingleMutationResult>
|
|
2464
|
-
/**
|
|
2465
|
-
* Deletes a document with the given document ID.
|
|
2466
|
-
* Returns an observable that resolves to a mutation result object containing the deleted document ID.
|
|
2467
|
-
*
|
|
2468
|
-
* @param id - Document ID to delete
|
|
2469
|
-
* @param options - Options for the mutation
|
|
2470
|
-
*/
|
|
2471
|
-
delete(id: string, options: AllDocumentIdsMutationOptions): Observable<MultipleMutationResult>
|
|
2472
|
-
/**
|
|
2473
|
-
* Deletes a document with the given document ID.
|
|
2474
|
-
* Returns an observable that resolves to the deleted document.
|
|
2475
|
-
*
|
|
2476
|
-
* @param id - Document ID to delete
|
|
2477
|
-
* @param options - Options for the mutation
|
|
2478
|
-
*/
|
|
2479
|
-
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
2480
|
-
id: string,
|
|
2481
|
-
options?: BaseMutationOptions,
|
|
2482
|
-
): Observable<SanityDocument<R>>
|
|
2483
|
-
/**
|
|
2484
|
-
* Deletes one or more documents matching the given query or document ID.
|
|
2485
|
-
* Returns an observable that resolves to first deleted document.
|
|
2486
|
-
*
|
|
2487
|
-
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
2488
|
-
* @param options - Options for the mutation
|
|
2489
|
-
*/
|
|
2490
|
-
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
2491
|
-
selection: MutationSelection,
|
|
2492
|
-
options: FirstDocumentMutationOptions,
|
|
2493
|
-
): Observable<SanityDocument<R>>
|
|
2494
|
-
/**
|
|
2495
|
-
* Deletes one or more documents matching the given query or document ID.
|
|
2496
|
-
* Returns an observable that resolves to an array containing the deleted documents.
|
|
2497
|
-
*
|
|
2498
|
-
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
2499
|
-
* @param options - Options for the mutation
|
|
2500
|
-
*/
|
|
2501
|
-
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
2502
|
-
selection: MutationSelection,
|
|
2503
|
-
options: AllDocumentsMutationOptions,
|
|
2504
|
-
): Observable<SanityDocument<R>[]>
|
|
2505
|
-
/**
|
|
2506
|
-
* Deletes one or more documents matching the given query or document ID.
|
|
2507
|
-
* Returns an observable that resolves to a mutation result object containing the ID of the first deleted document.
|
|
2508
|
-
*
|
|
2509
|
-
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
2510
|
-
* @param options - Options for the mutation
|
|
2511
|
-
*/
|
|
2512
|
-
delete(
|
|
2513
|
-
selection: MutationSelection,
|
|
2514
|
-
options: FirstDocumentIdMutationOptions,
|
|
2515
|
-
): Observable<SingleMutationResult>
|
|
2516
|
-
/**
|
|
2517
|
-
* Deletes one or more documents matching the given query or document ID.
|
|
2518
|
-
* Returns an observable that resolves to a mutation result object containing the document IDs that were deleted.
|
|
2519
|
-
*
|
|
2520
|
-
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
2521
|
-
* @param options - Options for the mutation
|
|
2522
|
-
*/
|
|
2523
|
-
delete(
|
|
2524
|
-
selection: MutationSelection,
|
|
2525
|
-
options: AllDocumentIdsMutationOptions,
|
|
2526
|
-
): Observable<MultipleMutationResult>
|
|
2527
|
-
/**
|
|
2528
|
-
* Deletes one or more documents matching the given query or document ID.
|
|
2529
|
-
* Returns an observable that resolves to first deleted document.
|
|
2530
|
-
*
|
|
2531
|
-
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
2532
|
-
* @param options - Options for the mutation
|
|
2533
|
-
*/
|
|
2534
|
-
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
2535
|
-
selection: MutationSelection,
|
|
2536
|
-
options?: BaseMutationOptions,
|
|
2537
|
-
): Observable<SanityDocument<R>>
|
|
2538
|
-
/**
|
|
2539
|
-
* Perform mutation operations against the configured dataset
|
|
2540
|
-
* Returns an observable that resolves to the first mutated document.
|
|
2541
|
-
*
|
|
2542
|
-
* @param operations - Mutation operations to execute
|
|
2543
|
-
* @param options - Mutation options
|
|
2544
|
-
*/
|
|
2545
|
-
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
2546
|
-
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
2547
|
-
options: FirstDocumentMutationOptions,
|
|
2548
|
-
): Observable<SanityDocument<R>>
|
|
2549
|
-
/**
|
|
2550
|
-
* Perform mutation operations against the configured dataset.
|
|
2551
|
-
* Returns an observable that resolves to an array of the mutated documents.
|
|
2552
|
-
*
|
|
2553
|
-
* @param operations - Mutation operations to execute
|
|
2554
|
-
* @param options - Mutation options
|
|
2555
|
-
*/
|
|
2556
|
-
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
2557
|
-
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
2558
|
-
options: AllDocumentsMutationOptions,
|
|
2559
|
-
): Observable<SanityDocument<R>[]>
|
|
2560
|
-
/**
|
|
2561
|
-
* Perform mutation operations against the configured dataset
|
|
2562
|
-
* Returns an observable that resolves to a mutation result object containing the document ID of the first mutated document.
|
|
2563
|
-
*
|
|
2564
|
-
* @param operations - Mutation operations to execute
|
|
2565
|
-
* @param options - Mutation options
|
|
2566
|
-
*/
|
|
2567
|
-
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
2568
|
-
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
2569
|
-
options: FirstDocumentIdMutationOptions,
|
|
2570
|
-
): Observable<SingleMutationResult>
|
|
2571
|
-
/**
|
|
2572
|
-
* Perform mutation operations against the configured dataset
|
|
2573
|
-
* Returns an observable that resolves to a mutation result object containing the mutated document IDs.
|
|
2574
|
-
*
|
|
2575
|
-
* @param operations - Mutation operations to execute
|
|
2576
|
-
* @param options - Mutation options
|
|
2577
|
-
*/
|
|
2578
|
-
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
2579
|
-
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
2580
|
-
options: AllDocumentIdsMutationOptions,
|
|
2581
|
-
): Observable<MultipleMutationResult>
|
|
2582
|
-
/**
|
|
2583
|
-
* Perform mutation operations against the configured dataset
|
|
2584
|
-
* Returns an observable that resolves to the first mutated document.
|
|
2585
|
-
*
|
|
2586
|
-
* @param operations - Mutation operations to execute
|
|
2587
|
-
* @param options - Mutation options
|
|
2588
|
-
*/
|
|
2589
|
-
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
2590
|
-
operations: Mutation<R>[] | ObservablePatch | ObservableTransaction,
|
|
2591
|
-
options?: BaseMutationOptions,
|
|
2592
|
-
): Observable<SanityDocument<R>>
|
|
2593
|
-
/**
|
|
2594
|
-
* Create a new buildable patch of operations to perform
|
|
2595
|
-
*
|
|
2596
|
-
* @param documentId - Document ID to patch
|
|
2597
|
-
* @param operations - Optional object of patch operations to initialize the patch instance with
|
|
2598
|
-
* @returns Patch instance - call `.commit()` to perform the operations defined
|
|
2599
|
-
*/
|
|
2600
|
-
patch(documentId: string, operations?: PatchOperations): ObservablePatch
|
|
2601
|
-
/**
|
|
2602
|
-
* Create a new buildable patch of operations to perform
|
|
2603
|
-
*
|
|
2604
|
-
* @param documentIds - Array of document IDs to patch
|
|
2605
|
-
* @param operations - Optional object of patch operations to initialize the patch instance with
|
|
2606
|
-
* @returns Patch instance - call `.commit()` to perform the operations defined
|
|
2607
|
-
*/
|
|
2608
|
-
patch(documentIds: string[], operations?: PatchOperations): ObservablePatch
|
|
2609
|
-
/**
|
|
2610
|
-
* Create a new buildable patch of operations to perform
|
|
2611
|
-
*
|
|
2612
|
-
* @param selection - An object with `query` and optional `params`, defining which document(s) to patch
|
|
2613
|
-
* @param operations - Optional object of patch operations to initialize the patch instance with
|
|
2614
|
-
* @returns Patch instance - call `.commit()` to perform the operations defined
|
|
2615
|
-
*/
|
|
2616
|
-
patch(selection: MutationSelection, operations?: PatchOperations): ObservablePatch
|
|
2617
|
-
/**
|
|
2618
|
-
* Create a new buildable patch of operations to perform
|
|
2619
|
-
*
|
|
2620
|
-
* @param selection - Document ID, an array of document IDs, or an object with `query` and optional `params`, defining which document(s) to patch
|
|
2621
|
-
* @param operations - Optional object of patch operations to initialize the patch instance with
|
|
2622
|
-
* @returns Patch instance - call `.commit()` to perform the operations defined
|
|
2623
|
-
*/
|
|
2624
|
-
patch(selection: PatchSelection, operations?: PatchOperations): ObservablePatch
|
|
2625
|
-
/**
|
|
2626
|
-
* Create a new transaction of mutations
|
|
2627
|
-
*
|
|
2628
|
-
* @param operations - Optional array of mutation operations to initialize the transaction instance with
|
|
2629
|
-
*/
|
|
2630
|
-
transaction<R extends Record<string, Any> = Record<string, Any>>(
|
|
2631
|
-
operations?: Mutation<R>[],
|
|
2632
|
-
): ObservableTransaction
|
|
2633
|
-
/**
|
|
2634
|
-
* Perform action operations against the configured dataset
|
|
2635
|
-
*
|
|
2636
|
-
* @param operations - Action operation(s) to execute
|
|
2637
|
-
* @param options - Action options
|
|
2638
|
-
*/
|
|
2639
|
-
action(
|
|
2640
|
-
operations: Action | Action[],
|
|
2641
|
-
options?: BaseActionOptions,
|
|
2642
|
-
): Observable<SingleActionResult | MultipleActionResult>
|
|
2643
|
-
/**
|
|
2644
|
-
* Perform an HTTP request against the Sanity API
|
|
2645
|
-
*
|
|
2646
|
-
* @param options - Request options
|
|
2647
|
-
*/
|
|
2648
|
-
request<R = Any>(options: RawRequestOptions): Observable<R>
|
|
2649
|
-
}
|
|
2650
|
-
|
|
2651
|
-
/** @public */
|
|
2652
|
-
export declare class ObservableTransaction extends BaseTransaction {
|
|
2653
|
-
#private
|
|
2654
|
-
constructor(operations?: Mutation[], client?: ObservableSanityClient, transactionId?: string)
|
|
2655
|
-
/**
|
|
2656
|
-
* Clones the transaction
|
|
2657
|
-
*/
|
|
2658
|
-
clone(): ObservableTransaction
|
|
2659
|
-
/**
|
|
2660
|
-
* Commit the transaction, returning an observable that produces the first mutated document
|
|
2661
|
-
*
|
|
2662
|
-
* @param options - Options for the mutation operation
|
|
2663
|
-
*/
|
|
2664
|
-
commit<R extends Record<string, Any>>(
|
|
2665
|
-
options: TransactionFirstDocumentMutationOptions,
|
|
2666
|
-
): Observable<SanityDocument<R>>
|
|
2667
|
-
/**
|
|
2668
|
-
* Commit the transaction, returning an observable that produces an array of the mutated documents
|
|
2669
|
-
*
|
|
2670
|
-
* @param options - Options for the mutation operation
|
|
2671
|
-
*/
|
|
2672
|
-
commit<R extends Record<string, Any>>(
|
|
2673
|
-
options: TransactionAllDocumentsMutationOptions,
|
|
2674
|
-
): Observable<SanityDocument<R>[]>
|
|
2675
|
-
/**
|
|
2676
|
-
* Commit the transaction, returning an observable that produces a mutation result object
|
|
2677
|
-
*
|
|
2678
|
-
* @param options - Options for the mutation operation
|
|
2679
|
-
*/
|
|
2680
|
-
commit(options: TransactionFirstDocumentIdMutationOptions): Observable<SingleMutationResult>
|
|
2681
|
-
/**
|
|
2682
|
-
* Commit the transaction, returning an observable that produces a mutation result object
|
|
2683
|
-
*
|
|
2684
|
-
* @param options - Options for the mutation operation
|
|
2685
|
-
*/
|
|
2686
|
-
commit(options: TransactionAllDocumentIdsMutationOptions): Observable<MultipleMutationResult>
|
|
2687
|
-
/**
|
|
2688
|
-
* Commit the transaction, returning an observable that produces a mutation result object
|
|
2689
|
-
*
|
|
2690
|
-
* @param options - Options for the mutation operation
|
|
2691
|
-
*/
|
|
2692
|
-
commit(options?: BaseMutationOptions): Observable<MultipleMutationResult>
|
|
2693
|
-
/**
|
|
2694
|
-
* Performs a patch on the given document ID. Can either be a builder function or an object of patch operations.
|
|
2695
|
-
* The operation is added to the current transaction, ready to be commited by `commit()`
|
|
2696
|
-
*
|
|
2697
|
-
* @param documentId - Document ID to perform the patch operation on
|
|
2698
|
-
* @param patchOps - Operations to perform, or a builder function
|
|
2699
|
-
*/
|
|
2700
|
-
patch(documentId: string, patchOps?: ObservablePatchBuilder | PatchOperations): this
|
|
2701
|
-
/**
|
|
2702
|
-
* Adds the given patch instance to the transaction.
|
|
2703
|
-
* The operation is added to the current transaction, ready to be commited by `commit()`
|
|
2704
|
-
*
|
|
2705
|
-
* @param patch - ObservablePatch to execute
|
|
2706
|
-
*/
|
|
2707
|
-
patch(patch: ObservablePatch): this
|
|
2708
|
-
}
|
|
2709
|
-
|
|
2710
|
-
/** @public */
|
|
2711
|
-
export declare class ObservableUsersClient implements ObservableUsersClientType {
|
|
2712
|
-
#private
|
|
2713
|
-
constructor(client: ObservableSanityClient, httpRequest: HttpRequest)
|
|
2714
|
-
/**
|
|
2715
|
-
* Fetch a user by user ID
|
|
2716
|
-
*
|
|
2717
|
-
* @param id - User ID of the user to fetch. If `me` is provided, a minimal response including the users role is returned.
|
|
2718
|
-
*/
|
|
2719
|
-
getById<T extends 'me' | string>(
|
|
2720
|
-
id: T,
|
|
2721
|
-
): Observable<T extends 'me' ? CurrentSanityUser : SanityUser>
|
|
2722
|
-
}
|
|
2723
|
-
|
|
2724
|
-
/** @internal */
|
|
2725
|
-
declare interface ObservableUsersClientType {
|
|
2726
|
-
/**
|
|
2727
|
-
* Fetch a user by user ID
|
|
2728
|
-
*
|
|
2729
|
-
* @param id - User ID of the user to fetch. If `me` is provided, a minimal response including the users role is returned.
|
|
2730
|
-
*/
|
|
2731
|
-
getById<T extends 'me' | string>(
|
|
2732
|
-
id: T,
|
|
2733
|
-
): Observable<T extends 'me' ? CurrentSanityUser : SanityUser>
|
|
2734
|
-
}
|
|
2735
|
-
|
|
2736
|
-
/**
|
|
2737
|
-
* The listener connection has been established
|
|
2738
|
-
* note: it's usually a better option to use the 'welcome' event
|
|
2739
|
-
* @public
|
|
2740
|
-
*/
|
|
2741
|
-
export declare type OpenEvent = {
|
|
2742
|
-
type: 'open'
|
|
2743
|
-
}
|
|
2744
|
-
|
|
2745
|
-
/** @public */
|
|
2746
|
-
export declare class Patch extends BasePatch {
|
|
2747
|
-
#private
|
|
2748
|
-
constructor(selection: PatchSelection, operations?: PatchOperations, client?: SanityClient)
|
|
2749
|
-
/**
|
|
2750
|
-
* Clones the patch
|
|
2751
|
-
*/
|
|
2752
|
-
clone(): Patch
|
|
2753
|
-
/**
|
|
2754
|
-
* Commit the patch, returning a promise that resolves to the first patched document
|
|
2755
|
-
*
|
|
2756
|
-
* @param options - Options for the mutation operation
|
|
2757
|
-
*/
|
|
2758
|
-
commit<R extends Record<string, Any> = Record<string, Any>>(
|
|
2759
|
-
options: FirstDocumentMutationOptions,
|
|
2760
|
-
): Promise<SanityDocument<R>>
|
|
2761
|
-
/**
|
|
2762
|
-
* Commit the patch, returning a promise that resolves to an array of the mutated documents
|
|
2763
|
-
*
|
|
2764
|
-
* @param options - Options for the mutation operation
|
|
2765
|
-
*/
|
|
2766
|
-
commit<R extends Record<string, Any> = Record<string, Any>>(
|
|
2767
|
-
options: AllDocumentsMutationOptions,
|
|
2768
|
-
): Promise<SanityDocument<R>[]>
|
|
2769
|
-
/**
|
|
2770
|
-
* Commit the patch, returning a promise that resolves to a mutation result object
|
|
2771
|
-
*
|
|
2772
|
-
* @param options - Options for the mutation operation
|
|
2773
|
-
*/
|
|
2774
|
-
commit(options: FirstDocumentIdMutationOptions): Promise<SingleMutationResult>
|
|
2775
|
-
/**
|
|
2776
|
-
* Commit the patch, returning a promise that resolves to a mutation result object
|
|
2777
|
-
*
|
|
2778
|
-
* @param options - Options for the mutation operation
|
|
2779
|
-
*/
|
|
2780
|
-
commit(options: AllDocumentIdsMutationOptions): Promise<MultipleMutationResult>
|
|
2781
|
-
/**
|
|
2782
|
-
* Commit the patch, returning a promise that resolves to the first patched document
|
|
2783
|
-
*
|
|
2784
|
-
* @param options - Options for the mutation operation
|
|
2785
|
-
*/
|
|
2786
|
-
commit<R extends Record<string, Any> = Record<string, Any>>(
|
|
2787
|
-
options?: BaseMutationOptions,
|
|
2788
|
-
): Promise<SanityDocument<R>>
|
|
2789
|
-
}
|
|
2790
|
-
|
|
2791
|
-
/** @public */
|
|
2792
|
-
export declare type PatchBuilder = (patch: Patch) => Patch
|
|
2793
|
-
|
|
2794
|
-
/** @internal */
|
|
2795
|
-
export declare type PatchMutationOperation = PatchOperations & MutationSelection
|
|
2796
|
-
|
|
2797
|
-
/** @internal */
|
|
2798
|
-
export declare interface PatchOperations {
|
|
2799
|
-
set?: {
|
|
2800
|
-
[key: string]: Any
|
|
2801
|
-
}
|
|
2802
|
-
setIfMissing?: {
|
|
2803
|
-
[key: string]: Any
|
|
2804
|
-
}
|
|
2805
|
-
diffMatchPatch?: {
|
|
2806
|
-
[key: string]: Any
|
|
2807
|
-
}
|
|
2808
|
-
unset?: string[]
|
|
2809
|
-
inc?: {
|
|
2810
|
-
[key: string]: number
|
|
2811
|
-
}
|
|
2812
|
-
dec?: {
|
|
2813
|
-
[key: string]: number
|
|
2814
|
-
}
|
|
2815
|
-
insert?: InsertPatch
|
|
2816
|
-
ifRevisionID?: string
|
|
2817
|
-
}
|
|
2818
|
-
|
|
2819
|
-
/** @internal */
|
|
2820
|
-
export declare type PatchSelection = string | string[] | MutationSelection
|
|
2821
|
-
|
|
2822
|
-
/** @public */
|
|
2823
|
-
declare interface ProgressEvent_2 {
|
|
2824
|
-
type: 'progress'
|
|
2825
|
-
stage: 'upload' | 'download'
|
|
2826
|
-
percent: number
|
|
2827
|
-
total?: number
|
|
2828
|
-
loaded?: number
|
|
2829
|
-
lengthComputable: boolean
|
|
2830
|
-
}
|
|
2831
|
-
export {ProgressEvent_2 as ProgressEvent}
|
|
2832
|
-
|
|
2833
|
-
/** @internal */
|
|
2834
|
-
export declare class ProjectsClient implements ProjectsClientType {
|
|
2835
|
-
#private
|
|
2836
|
-
constructor(client: SanityClient, httpRequest: HttpRequest)
|
|
2837
|
-
/**
|
|
2838
|
-
* Fetch a list of projects the authenticated user has access to.
|
|
2839
|
-
*
|
|
2840
|
-
* @param options - Options for the list request
|
|
2841
|
-
* @param options.includeMembers - Whether to include members in the response (default: true)
|
|
2842
|
-
*/
|
|
2843
|
-
list(options?: {includeMembers?: true}): Promise<SanityProject[]>
|
|
2844
|
-
list(options?: {includeMembers?: false}): Promise<Omit<SanityProject, 'members'>[]>
|
|
2845
|
-
/**
|
|
2846
|
-
* Fetch a project by project ID
|
|
2847
|
-
*
|
|
2848
|
-
* @param projectId - ID of the project to fetch
|
|
2849
|
-
*/
|
|
2850
|
-
getById(projectId: string): Promise<SanityProject>
|
|
2851
|
-
}
|
|
2852
|
-
|
|
2853
|
-
/** @internal */
|
|
2854
|
-
declare interface ProjectsClientType {
|
|
2855
|
-
/**
|
|
2856
|
-
* Fetch a list of projects the authenticated user has access to.
|
|
2857
|
-
*
|
|
2858
|
-
* @param options - Options for the list request
|
|
2859
|
-
* @param options.includeMembers - Whether to include members in the response (default: true)
|
|
2860
|
-
*/
|
|
2861
|
-
list(options?: {includeMembers?: true}): Promise<SanityProject[]>
|
|
2862
|
-
list(options?: {includeMembers?: false}): Promise<Omit<SanityProject, 'members'>[]>
|
|
2863
|
-
list(options?: {includeMembers?: boolean}): Promise<SanityProject[]>
|
|
2864
|
-
/**
|
|
2865
|
-
* Fetch a project by project ID
|
|
2866
|
-
*
|
|
2867
|
-
* @param projectId - ID of the project to fetch
|
|
2868
|
-
*/
|
|
2869
|
-
getById(projectId: string): Promise<SanityProject>
|
|
2870
|
-
}
|
|
2871
|
-
|
|
2872
|
-
/**
|
|
2873
|
-
* Publishes a draft document.
|
|
2874
|
-
* If a published version of the document already exists this is replaced by the current draft document.
|
|
2875
|
-
* In either case the draft document is deleted.
|
|
2876
|
-
* The optional revision id parameters can be used for optimistic locking to ensure
|
|
2877
|
-
* that the draft and/or published versions of the document have not been changed by another client.
|
|
2878
|
-
*
|
|
2879
|
-
* @public
|
|
2880
|
-
*/
|
|
2881
|
-
export declare type PublishAction = {
|
|
2882
|
-
actionType: 'sanity.action.document.publish'
|
|
2883
|
-
/**
|
|
2884
|
-
* Draft document ID to publish
|
|
2885
|
-
*/
|
|
2886
|
-
draftId: string
|
|
2887
|
-
/**
|
|
2888
|
-
* Draft revision ID to match
|
|
2889
|
-
*/
|
|
2890
|
-
ifDraftRevisionId?: string
|
|
2891
|
-
/**
|
|
2892
|
-
* Published document ID to replace
|
|
2893
|
-
*/
|
|
2894
|
-
publishedId: string
|
|
2895
|
-
/**
|
|
2896
|
-
* Published revision ID to match
|
|
2897
|
-
*/
|
|
2898
|
-
ifPublishedRevisionId?: string
|
|
2899
|
-
}
|
|
2900
|
-
|
|
2901
|
-
/** @public */
|
|
2902
|
-
export declare type QueryOptions =
|
|
2903
|
-
| FilteredResponseQueryOptions
|
|
2904
|
-
| UnfilteredResponseQueryOptions
|
|
2905
|
-
| UnfilteredResponseWithoutQuery
|
|
2906
|
-
|
|
2907
|
-
/** @public */
|
|
2908
|
-
export declare interface QueryParams {
|
|
2909
|
-
[key: string]: any
|
|
2910
|
-
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
2911
|
-
body?: never
|
|
2912
|
-
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
2913
|
-
cache?: 'next' extends keyof RequestInit ? never : any
|
|
2914
|
-
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
2915
|
-
filterResponse?: never
|
|
2916
|
-
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
2917
|
-
headers?: never
|
|
2918
|
-
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
2919
|
-
method?: never
|
|
2920
|
-
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
2921
|
-
next?: 'next' extends keyof RequestInit ? never : any
|
|
2922
|
-
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
2923
|
-
perspective?: never
|
|
2924
|
-
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
2925
|
-
query?: never
|
|
2926
|
-
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
2927
|
-
resultSourceMap?: never
|
|
2928
|
-
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
2929
|
-
returnQuery?: never
|
|
2930
|
-
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
2931
|
-
signal?: never
|
|
2932
|
-
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
2933
|
-
stega?: never
|
|
2934
|
-
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
2935
|
-
tag?: never
|
|
2936
|
-
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
2937
|
-
timeout?: never
|
|
2938
|
-
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
2939
|
-
token?: never
|
|
2940
|
-
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
2941
|
-
useCdn?: never
|
|
2942
|
-
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
2943
|
-
lastLiveEventId?: never
|
|
2944
|
-
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
2945
|
-
cacheMode?: never
|
|
2946
|
-
}
|
|
2947
|
-
|
|
2948
|
-
/**
|
|
2949
|
-
* This type can be used with `client.fetch` to indicate that the query has no GROQ parameters.
|
|
2950
|
-
* @public
|
|
2951
|
-
*/
|
|
2952
|
-
export declare type QueryWithoutParams = Record<string, never> | undefined
|
|
2953
|
-
|
|
2954
|
-
/** @public */
|
|
2955
|
-
export declare type RawQuerylessQueryResponse<R> = Omit<RawQueryResponse<R>, 'query'>
|
|
2956
|
-
|
|
2957
|
-
/** @public */
|
|
2958
|
-
export declare interface RawQueryResponse<R> {
|
|
2959
|
-
query: string
|
|
2960
|
-
ms: number
|
|
2961
|
-
result: R
|
|
2962
|
-
resultSourceMap?: ContentSourceMap
|
|
2963
|
-
/** Requires `apiVersion` to be `2021-03-25` or later. */
|
|
2964
|
-
syncTags?: SyncTag[]
|
|
2965
|
-
}
|
|
2966
|
-
|
|
2967
|
-
/** @internal */
|
|
2968
|
-
export declare interface RawRequestOptions {
|
|
2969
|
-
url?: string
|
|
2970
|
-
uri?: string
|
|
2971
|
-
method?: string
|
|
2972
|
-
token?: string
|
|
2973
|
-
json?: boolean
|
|
2974
|
-
tag?: string
|
|
2975
|
-
useGlobalApi?: boolean
|
|
2976
|
-
withCredentials?: boolean
|
|
2977
|
-
query?: {
|
|
2978
|
-
[key: string]: string | string[]
|
|
2979
|
-
}
|
|
2980
|
-
headers?: {
|
|
2981
|
-
[key: string]: string
|
|
2982
|
-
}
|
|
2983
|
-
timeout?: number
|
|
2984
|
-
proxy?: string
|
|
2985
|
-
body?: Any
|
|
2986
|
-
maxRedirects?: number
|
|
2987
|
-
signal?: AbortSignal
|
|
2988
|
-
}
|
|
2989
|
-
|
|
2990
|
-
/**
|
|
2991
|
-
* The listener has been disconnected, and a reconnect attempt is scheduled.
|
|
2992
|
-
*
|
|
2993
|
-
* @public
|
|
2994
|
-
*/
|
|
2995
|
-
export declare type ReconnectEvent = {
|
|
2996
|
-
type: 'reconnect'
|
|
2997
|
-
}
|
|
2998
|
-
|
|
2999
|
-
/**
|
|
3000
|
-
* @public
|
|
3001
|
-
* @deprecated – The `r`-prefix is not required, use `string` instead
|
|
3002
|
-
*/
|
|
3003
|
-
export declare type ReleaseId = `r${string}`
|
|
3004
|
-
|
|
3005
|
-
/**
|
|
3006
|
-
* Replaces an existing draft document.
|
|
3007
|
-
* At least one of the draft or published versions of the document must exist.
|
|
3008
|
-
*
|
|
3009
|
-
* @public
|
|
3010
|
-
*/
|
|
3011
|
-
export declare type ReplaceDraftAction = {
|
|
3012
|
-
actionType: 'sanity.action.document.replaceDraft'
|
|
3013
|
-
/**
|
|
3014
|
-
* Published document ID to create draft from, if draft does not exist
|
|
3015
|
-
*/
|
|
3016
|
-
publishedId: string
|
|
3017
|
-
/**
|
|
3018
|
-
* Document to create if it does not already exist. Requires `_id` and `_type` properties.
|
|
3019
|
-
*/
|
|
3020
|
-
attributes: IdentifiedSanityDocumentStub
|
|
3021
|
-
}
|
|
3022
|
-
|
|
3023
|
-
/** @public */
|
|
3024
|
-
export declare const requester: Requester
|
|
3025
|
-
|
|
3026
|
-
/** @internal */
|
|
3027
|
-
export declare interface RequestObservableOptions extends Omit<RequestOptions, 'url'> {
|
|
3028
|
-
url?: string
|
|
3029
|
-
uri?: string
|
|
3030
|
-
canUseCdn?: boolean
|
|
3031
|
-
useCdn?: boolean
|
|
3032
|
-
tag?: string
|
|
3033
|
-
returnQuery?: boolean
|
|
3034
|
-
resultSourceMap?: boolean | 'withKeyArraySelector'
|
|
3035
|
-
perspective?: ClientPerspective
|
|
3036
|
-
lastLiveEventId?: string
|
|
3037
|
-
cacheMode?: 'noStale'
|
|
3038
|
-
}
|
|
3039
|
-
|
|
3040
|
-
/** @public */
|
|
3041
|
-
export declare interface RequestOptions {
|
|
3042
|
-
timeout?: number
|
|
3043
|
-
token?: string
|
|
3044
|
-
tag?: string
|
|
3045
|
-
headers?: Record<string, string>
|
|
3046
|
-
method?: string
|
|
3047
|
-
query?: Any
|
|
3048
|
-
body?: Any
|
|
3049
|
-
signal?: AbortSignal
|
|
3050
|
-
}
|
|
3051
|
-
|
|
3052
|
-
export {ResolveStudioUrl}
|
|
3053
|
-
|
|
3054
|
-
/** @public */
|
|
3055
|
-
export declare interface ResponseEvent<T = unknown> {
|
|
3056
|
-
type: 'response'
|
|
3057
|
-
body: T
|
|
3058
|
-
url: string
|
|
3059
|
-
method: string
|
|
3060
|
-
statusCode: number
|
|
3061
|
-
statusMessage?: string
|
|
3062
|
-
headers: Record<string, string>
|
|
3063
|
-
}
|
|
3064
|
-
|
|
3065
|
-
/** @public */
|
|
3066
|
-
export declare interface ResponseQueryOptions extends RequestOptions {
|
|
3067
|
-
perspective?: ClientPerspective
|
|
3068
|
-
resultSourceMap?: boolean | 'withKeyArraySelector'
|
|
3069
|
-
returnQuery?: boolean
|
|
3070
|
-
useCdn?: boolean
|
|
3071
|
-
stega?: boolean | StegaConfig
|
|
3072
|
-
cache?: 'next' extends keyof RequestInit ? RequestInit['cache'] : never
|
|
3073
|
-
next?: ('next' extends keyof RequestInit ? RequestInit : never)['next']
|
|
3074
|
-
lastLiveEventId?: string | string[] | null
|
|
3075
|
-
/**
|
|
3076
|
-
* When set to `noStale`, APICDN will not return a cached response if the content is stale.
|
|
3077
|
-
* Tradeoff between latency and freshness of content.
|
|
3078
|
-
*
|
|
3079
|
-
* Only to be used with live content queries and when useCdn is true.
|
|
3080
|
-
*/
|
|
3081
|
-
cacheMode?: 'noStale'
|
|
3082
|
-
}
|
|
3083
|
-
|
|
3084
|
-
/** @internal */
|
|
3085
|
-
export declare interface SanityAssetDocument extends SanityDocument {
|
|
3086
|
-
url: string
|
|
3087
|
-
path: string
|
|
3088
|
-
size: number
|
|
3089
|
-
assetId: string
|
|
3090
|
-
mimeType: string
|
|
3091
|
-
sha1hash: string
|
|
3092
|
-
extension: string
|
|
3093
|
-
uploadId?: string
|
|
3094
|
-
originalFilename?: string
|
|
3095
|
-
}
|
|
3096
|
-
|
|
3097
|
-
/** @public */
|
|
3098
|
-
export declare class SanityClient implements SanityClientType {
|
|
3099
|
-
#private
|
|
3100
|
-
assets: AssetsClient
|
|
3101
|
-
datasets: DatasetsClient
|
|
3102
|
-
live: LiveClient
|
|
3103
|
-
projects: ProjectsClient
|
|
3104
|
-
users: UsersClient
|
|
3105
|
-
/**
|
|
3106
|
-
* Observable version of the Sanity client, with the same configuration as the promise-based one
|
|
3107
|
-
*/
|
|
3108
|
-
observable: ObservableSanityClient
|
|
3109
|
-
listen: typeof _listen
|
|
3110
|
-
constructor(httpRequest: HttpRequest, config?: ClientConfig)
|
|
3111
|
-
/**
|
|
3112
|
-
* Clone the client - returns a new instance
|
|
3113
|
-
*/
|
|
3114
|
-
clone(): SanityClient
|
|
3115
|
-
/**
|
|
3116
|
-
* Returns the current client configuration
|
|
3117
|
-
*/
|
|
3118
|
-
config(): InitializedClientConfig
|
|
3119
|
-
/**
|
|
3120
|
-
* Reconfigure the client. Note that this _mutates_ the current client.
|
|
3121
|
-
*/
|
|
3122
|
-
config(newConfig?: Partial<ClientConfig>): this
|
|
3123
|
-
/**
|
|
3124
|
-
* Clone the client with a new (partial) configuration.
|
|
3125
|
-
*
|
|
3126
|
-
* @param newConfig - New client configuration properties, shallowly merged with existing configuration
|
|
3127
|
-
*/
|
|
3128
|
-
withConfig(newConfig?: Partial<ClientConfig>): SanityClient
|
|
3129
|
-
/**
|
|
3130
|
-
* Perform a GROQ-query against the configured dataset.
|
|
3131
|
-
*
|
|
3132
|
-
* @param query - GROQ-query to perform
|
|
3133
|
-
*/
|
|
3134
|
-
fetch<
|
|
3135
|
-
R = Any,
|
|
3136
|
-
Q extends QueryWithoutParams = QueryWithoutParams,
|
|
3137
|
-
const G extends string = string,
|
|
3138
|
-
>(query: G, params?: Q | QueryWithoutParams): Promise<ClientReturn<G, R>>
|
|
3139
|
-
/**
|
|
3140
|
-
* Perform a GROQ-query against the configured dataset.
|
|
3141
|
-
*
|
|
3142
|
-
* @param query - GROQ-query to perform
|
|
3143
|
-
* @param params - Optional query parameters
|
|
3144
|
-
* @param options - Optional request options
|
|
3145
|
-
*/
|
|
3146
|
-
fetch<
|
|
3147
|
-
R = Any,
|
|
3148
|
-
Q extends QueryWithoutParams | QueryParams = QueryParams,
|
|
3149
|
-
const G extends string = string,
|
|
3150
|
-
>(
|
|
3151
|
-
query: G,
|
|
3152
|
-
params: Q extends QueryWithoutParams ? QueryWithoutParams : Q,
|
|
3153
|
-
options?: FilteredResponseQueryOptions,
|
|
3154
|
-
): Promise<ClientReturn<G, R>>
|
|
3155
|
-
/**
|
|
3156
|
-
* Perform a GROQ-query against the configured dataset.
|
|
3157
|
-
*
|
|
3158
|
-
* @param query - GROQ-query to perform
|
|
3159
|
-
* @param params - Optional query parameters
|
|
3160
|
-
* @param options - Request options
|
|
3161
|
-
*/
|
|
3162
|
-
fetch<
|
|
3163
|
-
R = Any,
|
|
3164
|
-
Q extends QueryWithoutParams | QueryParams = QueryParams,
|
|
3165
|
-
const G extends string = string,
|
|
3166
|
-
>(
|
|
3167
|
-
query: G,
|
|
3168
|
-
params: Q extends QueryWithoutParams ? QueryWithoutParams : Q,
|
|
3169
|
-
options: UnfilteredResponseQueryOptions,
|
|
3170
|
-
): Promise<RawQueryResponse<ClientReturn<G, R>>>
|
|
3171
|
-
/**
|
|
3172
|
-
* Perform a GROQ-query against the configured dataset.
|
|
3173
|
-
*
|
|
3174
|
-
* @param query - GROQ-query to perform
|
|
3175
|
-
* @param params - Optional query parameters
|
|
3176
|
-
* @param options - Request options
|
|
3177
|
-
*/
|
|
3178
|
-
fetch<
|
|
3179
|
-
R = Any,
|
|
3180
|
-
Q extends QueryWithoutParams | QueryParams = QueryParams,
|
|
3181
|
-
const G extends string = string,
|
|
3182
|
-
>(
|
|
3183
|
-
query: G,
|
|
3184
|
-
params: Q extends QueryWithoutParams ? QueryWithoutParams : Q,
|
|
3185
|
-
options: UnfilteredResponseWithoutQuery,
|
|
3186
|
-
): Promise<RawQuerylessQueryResponse<ClientReturn<G, R>>>
|
|
3187
|
-
/**
|
|
3188
|
-
* Fetch a single document with the given ID.
|
|
3189
|
-
*
|
|
3190
|
-
* @param id - Document ID to fetch
|
|
3191
|
-
* @param options - Request options
|
|
3192
|
-
*/
|
|
3193
|
-
getDocument<R extends Record<string, Any> = Record<string, Any>>(
|
|
3194
|
-
id: string,
|
|
3195
|
-
options?: {
|
|
3196
|
-
signal?: AbortSignal
|
|
3197
|
-
tag?: string
|
|
3198
|
-
},
|
|
3199
|
-
): Promise<SanityDocument<R> | undefined>
|
|
3200
|
-
/**
|
|
3201
|
-
* Fetch multiple documents in one request.
|
|
3202
|
-
* Should be used sparingly - performing a query is usually a better option.
|
|
3203
|
-
* The order/position of documents is preserved based on the original array of IDs.
|
|
3204
|
-
* If any of the documents are missing, they will be replaced by a `null` entry in the returned array
|
|
3205
|
-
*
|
|
3206
|
-
* @param ids - Document IDs to fetch
|
|
3207
|
-
* @param options - Request options
|
|
3208
|
-
*/
|
|
3209
|
-
getDocuments<R extends Record<string, Any> = Record<string, Any>>(
|
|
3210
|
-
ids: string[],
|
|
3211
|
-
options?: {
|
|
3212
|
-
signal?: AbortSignal
|
|
3213
|
-
tag?: string
|
|
3214
|
-
},
|
|
3215
|
-
): Promise<(SanityDocument<R> | null)[]>
|
|
3216
|
-
/**
|
|
3217
|
-
* Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
|
|
3218
|
-
* Returns a promise that resolves to the created document.
|
|
3219
|
-
*
|
|
3220
|
-
* @param document - Document to create
|
|
3221
|
-
* @param options - Mutation options
|
|
3222
|
-
*/
|
|
3223
|
-
create<R extends Record<string, Any> = Record<string, Any>>(
|
|
3224
|
-
document: SanityDocumentStub<R>,
|
|
3225
|
-
options: FirstDocumentMutationOptions,
|
|
3226
|
-
): Promise<SanityDocument<R>>
|
|
3227
|
-
/**
|
|
3228
|
-
* Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
|
|
3229
|
-
* Returns a promise that resolves to an array containing the created document.
|
|
3230
|
-
*
|
|
3231
|
-
* @param document - Document to create
|
|
3232
|
-
* @param options - Mutation options
|
|
3233
|
-
*/
|
|
3234
|
-
create<R extends Record<string, Any> = Record<string, Any>>(
|
|
3235
|
-
document: SanityDocumentStub<R>,
|
|
3236
|
-
options: AllDocumentsMutationOptions,
|
|
3237
|
-
): Promise<SanityDocument<R>[]>
|
|
3238
|
-
/**
|
|
3239
|
-
* Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
|
|
3240
|
-
* Returns a promise that resolves to a mutation result object containing the ID of the created document.
|
|
3241
|
-
*
|
|
3242
|
-
* @param document - Document to create
|
|
3243
|
-
* @param options - Mutation options
|
|
3244
|
-
*/
|
|
3245
|
-
create<R extends Record<string, Any> = Record<string, Any>>(
|
|
3246
|
-
document: SanityDocumentStub<R>,
|
|
3247
|
-
options: FirstDocumentIdMutationOptions,
|
|
3248
|
-
): Promise<SingleMutationResult>
|
|
3249
|
-
/**
|
|
3250
|
-
* Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
|
|
3251
|
-
* Returns a promise that resolves to a mutation result object containing the ID of the created document.
|
|
3252
|
-
*
|
|
3253
|
-
* @param document - Document to create
|
|
3254
|
-
* @param options - Mutation options
|
|
3255
|
-
*/
|
|
3256
|
-
create<R extends Record<string, Any> = Record<string, Any>>(
|
|
3257
|
-
document: SanityDocumentStub<R>,
|
|
3258
|
-
options: AllDocumentIdsMutationOptions,
|
|
3259
|
-
): Promise<MultipleMutationResult>
|
|
3260
|
-
/**
|
|
3261
|
-
* Create a document. Requires a `_type` property. If no `_id` is provided, it will be generated by the database.
|
|
3262
|
-
* Returns a promise that resolves to the created document.
|
|
3263
|
-
*
|
|
3264
|
-
* @param document - Document to create
|
|
3265
|
-
* @param options - Mutation options
|
|
3266
|
-
*/
|
|
3267
|
-
create<R extends Record<string, Any> = Record<string, Any>>(
|
|
3268
|
-
document: SanityDocumentStub<R>,
|
|
3269
|
-
options?: BaseMutationOptions,
|
|
3270
|
-
): Promise<SanityDocument<R>>
|
|
3271
|
-
/**
|
|
3272
|
-
* Create a document if no document with the same ID already exists.
|
|
3273
|
-
* Returns a promise that resolves to the created document.
|
|
3274
|
-
*
|
|
3275
|
-
* @param document - Document to create
|
|
3276
|
-
* @param options - Mutation options
|
|
3277
|
-
*/
|
|
3278
|
-
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
3279
|
-
document: IdentifiedSanityDocumentStub<R>,
|
|
3280
|
-
options: FirstDocumentMutationOptions,
|
|
3281
|
-
): Promise<SanityDocument<R>>
|
|
3282
|
-
/**
|
|
3283
|
-
* Create a document if no document with the same ID already exists.
|
|
3284
|
-
* Returns a promise that resolves to an array containing the created document.
|
|
3285
|
-
*
|
|
3286
|
-
* @param document - Document to create
|
|
3287
|
-
* @param options - Mutation options
|
|
3288
|
-
*/
|
|
3289
|
-
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
3290
|
-
document: IdentifiedSanityDocumentStub<R>,
|
|
3291
|
-
options: AllDocumentsMutationOptions,
|
|
3292
|
-
): Promise<SanityDocument<R>[]>
|
|
3293
|
-
/**
|
|
3294
|
-
* Create a document if no document with the same ID already exists.
|
|
3295
|
-
* Returns a promise that resolves to a mutation result object containing the ID of the created document.
|
|
3296
|
-
*
|
|
3297
|
-
* @param document - Document to create
|
|
3298
|
-
* @param options - Mutation options
|
|
3299
|
-
*/
|
|
3300
|
-
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
3301
|
-
document: IdentifiedSanityDocumentStub<R>,
|
|
3302
|
-
options: FirstDocumentIdMutationOptions,
|
|
3303
|
-
): Promise<SingleMutationResult>
|
|
3304
|
-
/**
|
|
3305
|
-
* Create a document if no document with the same ID already exists.
|
|
3306
|
-
* Returns a promise that resolves to a mutation result object containing the ID of the created document.
|
|
3307
|
-
*
|
|
3308
|
-
* @param document - Document to create
|
|
3309
|
-
* @param options - Mutation options
|
|
3310
|
-
*/
|
|
3311
|
-
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
3312
|
-
document: IdentifiedSanityDocumentStub<R>,
|
|
3313
|
-
options: AllDocumentIdsMutationOptions,
|
|
3314
|
-
): Promise<MultipleMutationResult>
|
|
3315
|
-
/**
|
|
3316
|
-
* Create a document if no document with the same ID already exists.
|
|
3317
|
-
* Returns a promise that resolves to the created document.
|
|
3318
|
-
*
|
|
3319
|
-
* @param document - Document to create
|
|
3320
|
-
* @param options - Mutation options
|
|
3321
|
-
*/
|
|
3322
|
-
createIfNotExists<R extends Record<string, Any> = Record<string, Any>>(
|
|
3323
|
-
document: IdentifiedSanityDocumentStub<R>,
|
|
3324
|
-
options?: BaseMutationOptions,
|
|
3325
|
-
): Promise<SanityDocument<R>>
|
|
3326
|
-
/**
|
|
3327
|
-
* Create a document if it does not exist, or replace a document with the same document ID
|
|
3328
|
-
* Returns a promise that resolves to the created document.
|
|
3329
|
-
*
|
|
3330
|
-
* @param document - Document to either create or replace
|
|
3331
|
-
* @param options - Mutation options
|
|
3332
|
-
*/
|
|
3333
|
-
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
3334
|
-
document: IdentifiedSanityDocumentStub<R>,
|
|
3335
|
-
options: FirstDocumentMutationOptions,
|
|
3336
|
-
): Promise<SanityDocument<R>>
|
|
3337
|
-
/**
|
|
3338
|
-
* Create a document if it does not exist, or replace a document with the same document ID
|
|
3339
|
-
* Returns a promise that resolves to an array containing the created document.
|
|
3340
|
-
*
|
|
3341
|
-
* @param document - Document to either create or replace
|
|
3342
|
-
* @param options - Mutation options
|
|
3343
|
-
*/
|
|
3344
|
-
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
3345
|
-
document: IdentifiedSanityDocumentStub<R>,
|
|
3346
|
-
options: AllDocumentsMutationOptions,
|
|
3347
|
-
): Promise<SanityDocument<R>[]>
|
|
3348
|
-
/**
|
|
3349
|
-
* Create a document if it does not exist, or replace a document with the same document ID
|
|
3350
|
-
* Returns a promise that resolves to a mutation result object containing the ID of the created document.
|
|
3351
|
-
*
|
|
3352
|
-
* @param document - Document to either create or replace
|
|
3353
|
-
* @param options - Mutation options
|
|
3354
|
-
*/
|
|
3355
|
-
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
3356
|
-
document: IdentifiedSanityDocumentStub<R>,
|
|
3357
|
-
options: FirstDocumentIdMutationOptions,
|
|
3358
|
-
): Promise<SingleMutationResult>
|
|
3359
|
-
/**
|
|
3360
|
-
* Create a document if it does not exist, or replace a document with the same document ID
|
|
3361
|
-
* Returns a promise that resolves to a mutation result object containing the created document ID.
|
|
3362
|
-
*
|
|
3363
|
-
* @param document - Document to either create or replace
|
|
3364
|
-
* @param options - Mutation options
|
|
3365
|
-
*/
|
|
3366
|
-
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
3367
|
-
document: IdentifiedSanityDocumentStub<R>,
|
|
3368
|
-
options: AllDocumentIdsMutationOptions,
|
|
3369
|
-
): Promise<MultipleMutationResult>
|
|
3370
|
-
/**
|
|
3371
|
-
* Create a document if it does not exist, or replace a document with the same document ID
|
|
3372
|
-
* Returns a promise that resolves to the created document.
|
|
3373
|
-
*
|
|
3374
|
-
* @param document - Document to either create or replace
|
|
3375
|
-
* @param options - Mutation options
|
|
3376
|
-
*/
|
|
3377
|
-
createOrReplace<R extends Record<string, Any> = Record<string, Any>>(
|
|
3378
|
-
document: IdentifiedSanityDocumentStub<R>,
|
|
3379
|
-
options?: BaseMutationOptions,
|
|
3380
|
-
): Promise<SanityDocument<R>>
|
|
3381
|
-
/**
|
|
3382
|
-
* Deletes a document with the given document ID.
|
|
3383
|
-
* Returns a promise that resolves to the deleted document.
|
|
3384
|
-
*
|
|
3385
|
-
* @param id - Document ID to delete
|
|
3386
|
-
* @param options - Options for the mutation
|
|
3387
|
-
*/
|
|
3388
|
-
delete<R extends Record<string, Any> = Record<string, Any>>(
|
|
3389
|
-
id: string,
|
|
3390
|
-
options: FirstDocumentMutationOptions,
|
|
3391
|
-
): Promise<SanityDocument<R>>
|
|
3392
|
-
/**
|
|
3393
|
-
* Deletes a document with the given document ID.
|
|
3394
|
-
* Returns a promise that resolves to an array containing the deleted document.
|
|
3425
|
+
* Fetch a project by project ID
|
|
3395
3426
|
*
|
|
3396
|
-
* @param
|
|
3397
|
-
* @param options - Options for the mutation
|
|
3427
|
+
* @param projectId - ID of the project to fetch
|
|
3398
3428
|
*/
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3429
|
+
getById(projectId: string): Promise<SanityProject>
|
|
3430
|
+
}
|
|
3431
|
+
|
|
3432
|
+
/**
|
|
3433
|
+
* Publishes a draft document.
|
|
3434
|
+
* If a published version of the document already exists this is replaced by the current draft document.
|
|
3435
|
+
* In either case the draft document is deleted.
|
|
3436
|
+
* The optional revision id parameters can be used for optimistic locking to ensure
|
|
3437
|
+
* that the draft and/or published versions of the document have not been changed by another client.
|
|
3438
|
+
*
|
|
3439
|
+
* @public
|
|
3440
|
+
*/
|
|
3441
|
+
export declare type PublishAction = {
|
|
3442
|
+
actionType: 'sanity.action.document.publish'
|
|
3403
3443
|
/**
|
|
3404
|
-
*
|
|
3405
|
-
* Returns a promise that resolves to a mutation result object containing the deleted document ID.
|
|
3406
|
-
*
|
|
3407
|
-
* @param id - Document ID to delete
|
|
3408
|
-
* @param options - Options for the mutation
|
|
3444
|
+
* Draft document ID to publish
|
|
3409
3445
|
*/
|
|
3410
|
-
|
|
3446
|
+
draftId: string
|
|
3411
3447
|
/**
|
|
3412
|
-
*
|
|
3413
|
-
* Returns a promise that resolves to a mutation result object containing the deleted document ID.
|
|
3414
|
-
*
|
|
3415
|
-
* @param id - Document ID to delete
|
|
3416
|
-
* @param options - Options for the mutation
|
|
3448
|
+
* Draft revision ID to match
|
|
3417
3449
|
*/
|
|
3418
|
-
|
|
3450
|
+
ifDraftRevisionId?: string
|
|
3419
3451
|
/**
|
|
3420
|
-
*
|
|
3421
|
-
* Returns a promise that resolves to the deleted document.
|
|
3422
|
-
*
|
|
3423
|
-
* @param id - Document ID to delete
|
|
3424
|
-
* @param options - Options for the mutation
|
|
3452
|
+
* Published document ID to replace
|
|
3425
3453
|
*/
|
|
3426
|
-
|
|
3427
|
-
id: string,
|
|
3428
|
-
options?: BaseMutationOptions,
|
|
3429
|
-
): Promise<SanityDocument<R>>
|
|
3454
|
+
publishedId: string
|
|
3430
3455
|
/**
|
|
3431
|
-
*
|
|
3432
|
-
* Returns a promise that resolves to first deleted document.
|
|
3433
|
-
*
|
|
3434
|
-
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
3435
|
-
* @param options - Options for the mutation
|
|
3456
|
+
* Published revision ID to match
|
|
3436
3457
|
*/
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3458
|
+
ifPublishedRevisionId?: string
|
|
3459
|
+
}
|
|
3460
|
+
|
|
3461
|
+
/**
|
|
3462
|
+
* Publishes all documents in a release at once.
|
|
3463
|
+
*
|
|
3464
|
+
* @public
|
|
3465
|
+
*/
|
|
3466
|
+
export declare interface PublishReleaseAction {
|
|
3467
|
+
actionType: 'sanity.action.release.publish'
|
|
3468
|
+
releaseId: string
|
|
3469
|
+
}
|
|
3470
|
+
|
|
3471
|
+
/** @public */
|
|
3472
|
+
export declare type QueryOptions =
|
|
3473
|
+
| FilteredResponseQueryOptions
|
|
3474
|
+
| UnfilteredResponseQueryOptions
|
|
3475
|
+
| UnfilteredResponseWithoutQuery
|
|
3476
|
+
|
|
3477
|
+
/** @public */
|
|
3478
|
+
export declare interface QueryParams {
|
|
3479
|
+
[key: string]: any
|
|
3480
|
+
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
3481
|
+
body?: never
|
|
3482
|
+
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
3483
|
+
cache?: 'next' extends keyof RequestInit ? never : any
|
|
3484
|
+
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
3485
|
+
filterResponse?: never
|
|
3486
|
+
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
3487
|
+
headers?: never
|
|
3488
|
+
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
3489
|
+
method?: never
|
|
3490
|
+
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
3491
|
+
next?: 'next' extends keyof RequestInit ? never : any
|
|
3492
|
+
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
3493
|
+
perspective?: never
|
|
3494
|
+
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
3495
|
+
query?: never
|
|
3496
|
+
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
3497
|
+
resultSourceMap?: never
|
|
3498
|
+
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
3499
|
+
returnQuery?: never
|
|
3500
|
+
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
3501
|
+
signal?: never
|
|
3502
|
+
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
3503
|
+
stega?: never
|
|
3504
|
+
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
3505
|
+
tag?: never
|
|
3506
|
+
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
3507
|
+
timeout?: never
|
|
3508
|
+
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
3509
|
+
token?: never
|
|
3510
|
+
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
3511
|
+
useCdn?: never
|
|
3512
|
+
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
3513
|
+
lastLiveEventId?: never
|
|
3514
|
+
/** @deprecated you're using a fetch option as a GROQ parameter, this is likely a mistake */
|
|
3515
|
+
cacheMode?: never
|
|
3516
|
+
}
|
|
3517
|
+
|
|
3518
|
+
/**
|
|
3519
|
+
* This type can be used with `client.fetch` to indicate that the query has no GROQ parameters.
|
|
3520
|
+
* @public
|
|
3521
|
+
*/
|
|
3522
|
+
export declare type QueryWithoutParams = Record<string, never> | undefined
|
|
3523
|
+
|
|
3524
|
+
/** @public */
|
|
3525
|
+
export declare type RawQuerylessQueryResponse<R> = Omit<RawQueryResponse<R>, 'query'>
|
|
3526
|
+
|
|
3527
|
+
/** @public */
|
|
3528
|
+
export declare interface RawQueryResponse<R> {
|
|
3529
|
+
query: string
|
|
3530
|
+
ms: number
|
|
3531
|
+
result: R
|
|
3532
|
+
resultSourceMap?: ContentSourceMap
|
|
3533
|
+
/** Requires `apiVersion` to be `2021-03-25` or later. */
|
|
3534
|
+
syncTags?: SyncTag[]
|
|
3535
|
+
}
|
|
3536
|
+
|
|
3537
|
+
/** @internal */
|
|
3538
|
+
export declare interface RawRequestOptions {
|
|
3539
|
+
url?: string
|
|
3540
|
+
uri?: string
|
|
3541
|
+
method?: string
|
|
3542
|
+
token?: string
|
|
3543
|
+
json?: boolean
|
|
3544
|
+
tag?: string
|
|
3545
|
+
useGlobalApi?: boolean
|
|
3546
|
+
withCredentials?: boolean
|
|
3547
|
+
query?: {
|
|
3548
|
+
[key: string]: string | string[]
|
|
3549
|
+
}
|
|
3550
|
+
headers?: {
|
|
3551
|
+
[key: string]: string
|
|
3552
|
+
}
|
|
3553
|
+
timeout?: number
|
|
3554
|
+
proxy?: string
|
|
3555
|
+
body?: Any
|
|
3556
|
+
maxRedirects?: number
|
|
3557
|
+
signal?: AbortSignal
|
|
3558
|
+
}
|
|
3559
|
+
|
|
3560
|
+
/**
|
|
3561
|
+
* The listener has been disconnected, and a reconnect attempt is scheduled.
|
|
3562
|
+
*
|
|
3563
|
+
* @public
|
|
3564
|
+
*/
|
|
3565
|
+
export declare type ReconnectEvent = {
|
|
3566
|
+
type: 'reconnect'
|
|
3567
|
+
}
|
|
3568
|
+
|
|
3569
|
+
/** @public */
|
|
3570
|
+
export declare type ReleaseAction =
|
|
3571
|
+
| CreateReleaseAction
|
|
3572
|
+
| EditReleaseAction
|
|
3573
|
+
| PublishReleaseAction
|
|
3574
|
+
| ArchiveReleaseAction
|
|
3575
|
+
| UnarchiveReleaseAction
|
|
3576
|
+
| ScheduleReleaseAction
|
|
3577
|
+
| UnscheduleReleaseAction
|
|
3578
|
+
| DeleteReleaseAction
|
|
3579
|
+
|
|
3580
|
+
/** @internal */
|
|
3581
|
+
export declare interface ReleaseDocument extends SanityDocument {
|
|
3441
3582
|
/**
|
|
3442
|
-
*
|
|
3443
|
-
*
|
|
3444
|
-
*
|
|
3445
|
-
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
3446
|
-
* @param options - Options for the mutation
|
|
3583
|
+
* typically
|
|
3584
|
+
* `_.releases.<name>`
|
|
3447
3585
|
*/
|
|
3448
|
-
|
|
3449
|
-
selection: MutationSelection,
|
|
3450
|
-
options: AllDocumentsMutationOptions,
|
|
3451
|
-
): Promise<SanityDocument<R>[]>
|
|
3586
|
+
_id: string
|
|
3452
3587
|
/**
|
|
3453
|
-
*
|
|
3454
|
-
* Returns a promise that resolves to a mutation result object containing the ID of the first deleted document.
|
|
3455
|
-
*
|
|
3456
|
-
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
3457
|
-
* @param options - Options for the mutation
|
|
3588
|
+
* where a release has _id `_.releases.foo`, the name is `foo`
|
|
3458
3589
|
*/
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3590
|
+
name: string
|
|
3591
|
+
_type: 'system.release'
|
|
3592
|
+
_createdAt: string
|
|
3593
|
+
_updatedAt: string
|
|
3594
|
+
_rev: string
|
|
3595
|
+
state: ReleaseState
|
|
3596
|
+
error?: {
|
|
3597
|
+
message: string
|
|
3598
|
+
}
|
|
3599
|
+
finalDocumentStates?: {
|
|
3600
|
+
/** Document ID */
|
|
3601
|
+
id: string
|
|
3602
|
+
}[]
|
|
3463
3603
|
/**
|
|
3464
|
-
*
|
|
3465
|
-
* Returns a promise that resolves to a mutation result object containing the document IDs that were deleted.
|
|
3466
|
-
*
|
|
3467
|
-
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
3468
|
-
* @param options - Options for the mutation
|
|
3604
|
+
* If defined, it takes precedence over the intendedPublishAt, the state should be 'scheduled'
|
|
3469
3605
|
*/
|
|
3470
|
-
|
|
3471
|
-
selection: MutationSelection,
|
|
3472
|
-
options: AllDocumentIdsMutationOptions,
|
|
3473
|
-
): Promise<MultipleMutationResult>
|
|
3606
|
+
publishAt?: string
|
|
3474
3607
|
/**
|
|
3475
|
-
*
|
|
3476
|
-
* Returns a promise that resolves to first deleted document.
|
|
3477
|
-
*
|
|
3478
|
-
* @param selection - An object with either an `id` or `query` key defining what to delete
|
|
3479
|
-
* @param options - Options for the mutation
|
|
3608
|
+
* If defined, it provides the time the release was actually published
|
|
3480
3609
|
*/
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3610
|
+
publishedAt?: string
|
|
3611
|
+
metadata: {
|
|
3612
|
+
title?: string
|
|
3613
|
+
description?: string
|
|
3614
|
+
intendedPublishAt?: string
|
|
3615
|
+
releaseType: ReleaseType
|
|
3616
|
+
}
|
|
3617
|
+
}
|
|
3618
|
+
|
|
3619
|
+
/**
|
|
3620
|
+
* @public
|
|
3621
|
+
* @deprecated – The `r`-prefix is not required, use `string` instead
|
|
3622
|
+
*/
|
|
3623
|
+
export declare type ReleaseId = `r${string}`
|
|
3624
|
+
|
|
3625
|
+
/** @public */
|
|
3626
|
+
declare class ReleasesClient {
|
|
3627
|
+
#private
|
|
3628
|
+
constructor(client: SanityClient, httpRequest: HttpRequest)
|
|
3485
3629
|
/**
|
|
3486
|
-
*
|
|
3487
|
-
*
|
|
3488
|
-
*
|
|
3489
|
-
*
|
|
3490
|
-
* @
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3630
|
+
* @public
|
|
3631
|
+
*
|
|
3632
|
+
* Retrieve a release by id.
|
|
3633
|
+
*
|
|
3634
|
+
* @category Releases
|
|
3635
|
+
*
|
|
3636
|
+
* @param params - Release action parameters:
|
|
3637
|
+
* - `releaseId` - The id of the release to retrieve.
|
|
3638
|
+
* @param options - Additional query options including abort signal and query tag.
|
|
3639
|
+
* @returns A promise that resolves to the release document {@link ReleaseDocument}.
|
|
3640
|
+
*
|
|
3641
|
+
* @example Retrieving a release by id
|
|
3642
|
+
* ```ts
|
|
3643
|
+
* const release = await client.releases.get({releaseId: 'my-release'})
|
|
3644
|
+
* console.log(release)
|
|
3645
|
+
* // {
|
|
3646
|
+
* // _id: '_.releases.my-release',
|
|
3647
|
+
* // name: 'my-release'
|
|
3648
|
+
* // _type: 'system.release',
|
|
3649
|
+
* // metadata: {releaseType: 'asap'},
|
|
3650
|
+
* // _createdAt: '2021-01-01T00:00:00.000Z',
|
|
3651
|
+
* // ...
|
|
3652
|
+
* // }
|
|
3653
|
+
* ```
|
|
3654
|
+
*/
|
|
3655
|
+
get(
|
|
3656
|
+
{
|
|
3657
|
+
releaseId,
|
|
3658
|
+
}: {
|
|
3659
|
+
releaseId: string
|
|
3660
|
+
},
|
|
3661
|
+
options?: {
|
|
3662
|
+
signal?: AbortSignal
|
|
3663
|
+
tag?: string
|
|
3664
|
+
},
|
|
3665
|
+
): Promise<ReleaseDocument | undefined>
|
|
3496
3666
|
/**
|
|
3497
|
-
*
|
|
3498
|
-
* Returns a promise that resolves to an array of the mutated documents.
|
|
3667
|
+
* @public
|
|
3499
3668
|
*
|
|
3500
|
-
*
|
|
3501
|
-
* @param options - Mutation options
|
|
3502
|
-
*/
|
|
3503
|
-
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
3504
|
-
operations: Mutation<R>[] | Patch | Transaction,
|
|
3505
|
-
options: AllDocumentsMutationOptions,
|
|
3506
|
-
): Promise<SanityDocument<R>[]>
|
|
3507
|
-
/**
|
|
3508
|
-
* Perform mutation operations against the configured dataset
|
|
3509
|
-
* Returns a promise that resolves to a mutation result object containing the document ID of the first mutated document.
|
|
3669
|
+
* Creates a new release under the given id, with metadata.
|
|
3510
3670
|
*
|
|
3511
|
-
* @
|
|
3512
|
-
*
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3671
|
+
* @remarks
|
|
3672
|
+
* * If no releaseId is provided, a release id will be generated.
|
|
3673
|
+
* * If no metadata is provided, then an `undecided` releaseType will be used.
|
|
3674
|
+
*
|
|
3675
|
+
* @category Releases
|
|
3676
|
+
*
|
|
3677
|
+
* @param params - Release action parameters:
|
|
3678
|
+
* - `releaseId` - The id of the release to create.
|
|
3679
|
+
* - `metadata` - The metadata to associate with the release {@link ReleaseDocument}.
|
|
3680
|
+
* @param options - Additional action options.
|
|
3681
|
+
* @returns A promise that resolves to the `transactionId` and the release id and metadata.
|
|
3682
|
+
*
|
|
3683
|
+
* @example Creating a release with a custom id and metadata
|
|
3684
|
+
* ```ts
|
|
3685
|
+
* const releaseId = 'my-release'
|
|
3686
|
+
* const releaseMetadata: ReleaseDocument['metadata'] = {
|
|
3687
|
+
* releaseType: 'asap',
|
|
3688
|
+
* }
|
|
3689
|
+
*
|
|
3690
|
+
* const result =
|
|
3691
|
+
* await client.releases.create({releaseId, metadata: releaseMetadata})
|
|
3692
|
+
* console.log(result)
|
|
3693
|
+
* // {
|
|
3694
|
+
* // transactionId: 'transaction-id',
|
|
3695
|
+
* // releaseId: 'my-release',
|
|
3696
|
+
* // metadata: {releaseType: 'asap'},
|
|
3697
|
+
* // }
|
|
3698
|
+
* ```
|
|
3699
|
+
*
|
|
3700
|
+
* @example Creating a release with generated id and metadata
|
|
3701
|
+
* ```ts
|
|
3702
|
+
* const {metadata} = await client.releases.create()
|
|
3703
|
+
* console.log(metadata.releaseType) // 'undecided'
|
|
3704
|
+
* ```
|
|
3705
|
+
*
|
|
3706
|
+
* @example Creating a release with a custom transaction id
|
|
3707
|
+
* ```ts
|
|
3708
|
+
* const {transactionId, metadata} = await client.releases.create({transactionId: 'my-transaction-id'})
|
|
3709
|
+
* console.log(metadata.releaseType) // 'undecided'
|
|
3710
|
+
* console.log(transactionId) // 'my-transaction-id'
|
|
3711
|
+
* ```
|
|
3712
|
+
*/
|
|
3713
|
+
create(options: BaseActionOptions): Promise<
|
|
3714
|
+
SingleActionResult & {
|
|
3715
|
+
releaseId: string
|
|
3716
|
+
metadata: ReleaseDocument['metadata']
|
|
3717
|
+
}
|
|
3718
|
+
>
|
|
3719
|
+
create(
|
|
3720
|
+
release: {
|
|
3721
|
+
releaseId?: string
|
|
3722
|
+
metadata?: Partial<ReleaseDocument['metadata']>
|
|
3723
|
+
},
|
|
3724
|
+
options?: BaseActionOptions,
|
|
3725
|
+
): Promise<
|
|
3726
|
+
SingleActionResult & {
|
|
3727
|
+
releaseId: string
|
|
3728
|
+
metadata: ReleaseDocument['metadata']
|
|
3729
|
+
}
|
|
3730
|
+
>
|
|
3518
3731
|
/**
|
|
3519
|
-
*
|
|
3520
|
-
* Returns a promise that resolves to a mutation result object containing the mutated document IDs.
|
|
3732
|
+
* @public
|
|
3521
3733
|
*
|
|
3522
|
-
*
|
|
3523
|
-
* @param options - Mutation options
|
|
3524
|
-
*/
|
|
3525
|
-
mutate<R extends Record<string, Any>>(
|
|
3526
|
-
operations: Mutation<R>[] | Patch | Transaction,
|
|
3527
|
-
options: AllDocumentIdsMutationOptions,
|
|
3528
|
-
): Promise<MultipleMutationResult>
|
|
3529
|
-
/**
|
|
3530
|
-
* Perform mutation operations against the configured dataset
|
|
3531
|
-
* Returns a promise that resolves to the first mutated document.
|
|
3734
|
+
* Edits an existing release, updating the metadata.
|
|
3532
3735
|
*
|
|
3533
|
-
* @
|
|
3534
|
-
* @param options - Mutation options
|
|
3535
|
-
*/
|
|
3536
|
-
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
3537
|
-
operations: Mutation<R>[] | Patch | Transaction,
|
|
3538
|
-
options?: BaseMutationOptions,
|
|
3539
|
-
): Promise<SanityDocument<R>>
|
|
3540
|
-
/**
|
|
3541
|
-
* Create a new buildable patch of operations to perform
|
|
3736
|
+
* @category Releases
|
|
3542
3737
|
*
|
|
3543
|
-
* @param
|
|
3544
|
-
*
|
|
3545
|
-
*
|
|
3738
|
+
* @param params - Release action parameters:
|
|
3739
|
+
* - `releaseId` - The id of the release to edit.
|
|
3740
|
+
* - `patch` - The patch operation to apply on the release metadata {@link PatchMutationOperation}.
|
|
3741
|
+
* @param options - Additional action options.
|
|
3742
|
+
* @returns A promise that resolves to the `transactionId`.
|
|
3546
3743
|
*/
|
|
3547
|
-
|
|
3744
|
+
edit(
|
|
3745
|
+
{
|
|
3746
|
+
releaseId,
|
|
3747
|
+
patch,
|
|
3748
|
+
}: {
|
|
3749
|
+
releaseId: string
|
|
3750
|
+
patch: PatchOperations
|
|
3751
|
+
},
|
|
3752
|
+
options?: BaseActionOptions,
|
|
3753
|
+
): Promise<SingleActionResult>
|
|
3548
3754
|
/**
|
|
3549
|
-
*
|
|
3755
|
+
* @public
|
|
3550
3756
|
*
|
|
3551
|
-
*
|
|
3552
|
-
*
|
|
3553
|
-
*
|
|
3757
|
+
* Publishes all documents in a release at once. For larger releases the effect of the publish
|
|
3758
|
+
* will be visible immediately when querying but the removal of the `versions.<releasesId>.*`
|
|
3759
|
+
* documents and creation of the corresponding published documents with the new content may
|
|
3760
|
+
* take some time.
|
|
3761
|
+
*
|
|
3762
|
+
* During this period both the source and target documents are locked and cannot be
|
|
3763
|
+
* modified through any other means.
|
|
3764
|
+
*
|
|
3765
|
+
* @category Releases
|
|
3766
|
+
*
|
|
3767
|
+
* @param params - Release action parameters:
|
|
3768
|
+
* - `releaseId` - The id of the release to publish.
|
|
3769
|
+
* @param options - Additional action options.
|
|
3770
|
+
* @returns A promise that resolves to the `transactionId`.
|
|
3554
3771
|
*/
|
|
3555
|
-
|
|
3772
|
+
publish(
|
|
3773
|
+
{
|
|
3774
|
+
releaseId,
|
|
3775
|
+
}: {
|
|
3776
|
+
releaseId: string
|
|
3777
|
+
},
|
|
3778
|
+
options?: BaseActionOptions,
|
|
3779
|
+
): Promise<SingleActionResult>
|
|
3556
3780
|
/**
|
|
3557
|
-
*
|
|
3781
|
+
* @public
|
|
3558
3782
|
*
|
|
3559
|
-
*
|
|
3560
|
-
*
|
|
3561
|
-
*
|
|
3783
|
+
* An archive action removes an active release. The documents that comprise the release
|
|
3784
|
+
* are deleted and therefore no longer queryable.
|
|
3785
|
+
*
|
|
3786
|
+
* While the documents remain in retention the last version can still be accessed using document history endpoint.
|
|
3787
|
+
*
|
|
3788
|
+
* @category Releases
|
|
3789
|
+
*
|
|
3790
|
+
* @param params - Release action parameters:
|
|
3791
|
+
* - `releaseId` - The id of the release to archive.
|
|
3792
|
+
* @param options - Additional action options.
|
|
3793
|
+
* @returns A promise that resolves to the `transactionId`.
|
|
3562
3794
|
*/
|
|
3563
|
-
|
|
3795
|
+
archive(
|
|
3796
|
+
{
|
|
3797
|
+
releaseId,
|
|
3798
|
+
}: {
|
|
3799
|
+
releaseId: string
|
|
3800
|
+
},
|
|
3801
|
+
options?: BaseActionOptions,
|
|
3802
|
+
): Promise<SingleActionResult>
|
|
3564
3803
|
/**
|
|
3565
|
-
*
|
|
3804
|
+
* @public
|
|
3566
3805
|
*
|
|
3567
|
-
*
|
|
3806
|
+
* An unarchive action restores an archived release and all documents
|
|
3807
|
+
* with the content they had just prior to archiving.
|
|
3808
|
+
*
|
|
3809
|
+
* @category Releases
|
|
3810
|
+
*
|
|
3811
|
+
* @param params - Release action parameters:
|
|
3812
|
+
* - `releaseId` - The id of the release to unarchive.
|
|
3813
|
+
* @param options - Additional action options.
|
|
3814
|
+
* @returns A promise that resolves to the `transactionId`.
|
|
3568
3815
|
*/
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3816
|
+
unarchive(
|
|
3817
|
+
{
|
|
3818
|
+
releaseId,
|
|
3819
|
+
}: {
|
|
3820
|
+
releaseId: string
|
|
3821
|
+
},
|
|
3822
|
+
options?: BaseActionOptions,
|
|
3823
|
+
): Promise<SingleActionResult>
|
|
3824
|
+
/**
|
|
3825
|
+
* @public
|
|
3826
|
+
*
|
|
3827
|
+
* A schedule action queues a release for publishing at the given future time.
|
|
3828
|
+
* The release is locked such that no documents in the release can be modified and
|
|
3829
|
+
* no documents that it references can be deleted as this would make the publish fail.
|
|
3830
|
+
* At the given time, the same logic as for the publish action is triggered.
|
|
3831
|
+
*
|
|
3832
|
+
* @category Releases
|
|
3833
|
+
*
|
|
3834
|
+
* @param params - Release action parameters:
|
|
3835
|
+
* - `releaseId` - The id of the release to schedule.
|
|
3836
|
+
* - `publishAt` - The serialised date and time to publish the release. If the `publishAt` is in the past, the release will be published immediately.
|
|
3837
|
+
* @param options - Additional action options.
|
|
3838
|
+
* @returns A promise that resolves to the `transactionId`.
|
|
3839
|
+
*/
|
|
3840
|
+
schedule(
|
|
3841
|
+
{
|
|
3842
|
+
releaseId,
|
|
3843
|
+
publishAt,
|
|
3844
|
+
}: {
|
|
3845
|
+
releaseId: string
|
|
3846
|
+
publishAt: string
|
|
3847
|
+
},
|
|
3848
|
+
options?: BaseActionOptions,
|
|
3849
|
+
): Promise<SingleActionResult>
|
|
3572
3850
|
/**
|
|
3573
|
-
*
|
|
3574
|
-
* Returns a promise that resolves to the transaction result
|
|
3851
|
+
* @public
|
|
3575
3852
|
*
|
|
3576
|
-
*
|
|
3577
|
-
*
|
|
3853
|
+
* An unschedule action stops a release from being published.
|
|
3854
|
+
* The documents in the release are considered unlocked and can be edited again.
|
|
3855
|
+
* This may fail if another release is scheduled to be published after this one and
|
|
3856
|
+
* has a reference to a document created by this one.
|
|
3857
|
+
*
|
|
3858
|
+
* @category Releases
|
|
3859
|
+
*
|
|
3860
|
+
* @param params - Release action parameters:
|
|
3861
|
+
* - `releaseId` - The id of the release to unschedule.
|
|
3862
|
+
* @param options - Additional action options.
|
|
3863
|
+
* @returns A promise that resolves to the `transactionId`.
|
|
3578
3864
|
*/
|
|
3579
|
-
|
|
3580
|
-
|
|
3865
|
+
unschedule(
|
|
3866
|
+
{
|
|
3867
|
+
releaseId,
|
|
3868
|
+
}: {
|
|
3869
|
+
releaseId: string
|
|
3870
|
+
},
|
|
3581
3871
|
options?: BaseActionOptions,
|
|
3582
|
-
): Promise<SingleActionResult
|
|
3872
|
+
): Promise<SingleActionResult>
|
|
3583
3873
|
/**
|
|
3584
|
-
*
|
|
3585
|
-
* NOTE: Only use this for Sanity API endpoints, not for your own APIs!
|
|
3874
|
+
* @public
|
|
3586
3875
|
*
|
|
3587
|
-
*
|
|
3588
|
-
*
|
|
3876
|
+
* A delete action removes a published or archived release.
|
|
3877
|
+
* The backing system document will be removed from the dataset.
|
|
3878
|
+
*
|
|
3879
|
+
* @category Releases
|
|
3880
|
+
*
|
|
3881
|
+
* @param params - Release action parameters:
|
|
3882
|
+
* - `releaseId` - The id of the release to delete.
|
|
3883
|
+
* @param options - Additional action options.
|
|
3884
|
+
* @returns A promise that resolves to the `transactionId`.
|
|
3589
3885
|
*/
|
|
3590
|
-
|
|
3886
|
+
delete(
|
|
3887
|
+
{
|
|
3888
|
+
releaseId,
|
|
3889
|
+
}: {
|
|
3890
|
+
releaseId: string
|
|
3891
|
+
},
|
|
3892
|
+
options?: BaseActionOptions,
|
|
3893
|
+
): Promise<SingleActionResult>
|
|
3591
3894
|
/**
|
|
3592
|
-
*
|
|
3593
|
-
* NOTE: Considered internal, thus marked as deprecated. Use `request` instead.
|
|
3895
|
+
* @public
|
|
3594
3896
|
*
|
|
3595
|
-
*
|
|
3596
|
-
*
|
|
3597
|
-
* @
|
|
3598
|
-
*
|
|
3599
|
-
* @
|
|
3897
|
+
* Fetch the documents in a release by release id.
|
|
3898
|
+
*
|
|
3899
|
+
* @category Releases
|
|
3900
|
+
*
|
|
3901
|
+
* @param params - Release action parameters:
|
|
3902
|
+
* - `releaseId` - The id of the release to fetch documents for.
|
|
3903
|
+
* @param options - Additional mutation options {@link BaseMutationOptions}.
|
|
3904
|
+
* @returns A promise that resolves to the documents in the release.
|
|
3600
3905
|
*/
|
|
3601
|
-
|
|
3906
|
+
fetchDocuments(
|
|
3907
|
+
{
|
|
3908
|
+
releaseId,
|
|
3909
|
+
}: {
|
|
3910
|
+
releaseId: string
|
|
3911
|
+
},
|
|
3912
|
+
options?: BaseMutationOptions,
|
|
3913
|
+
): Promise<RawQueryResponse<SanityDocument[]>>
|
|
3914
|
+
}
|
|
3915
|
+
|
|
3916
|
+
/** @beta */
|
|
3917
|
+
export declare type ReleaseState =
|
|
3918
|
+
| 'active'
|
|
3919
|
+
| 'archiving'
|
|
3920
|
+
| 'unarchiving'
|
|
3921
|
+
| 'archived'
|
|
3922
|
+
| 'published'
|
|
3923
|
+
| 'publishing'
|
|
3924
|
+
| 'scheduled'
|
|
3925
|
+
| 'scheduling'
|
|
3926
|
+
|
|
3927
|
+
/** @internal */
|
|
3928
|
+
export declare type ReleaseType = 'asap' | 'scheduled' | 'undecided'
|
|
3929
|
+
|
|
3930
|
+
/**
|
|
3931
|
+
* Replaces an existing draft document.
|
|
3932
|
+
* At least one of the draft or published versions of the document must exist.
|
|
3933
|
+
*
|
|
3934
|
+
* @public
|
|
3935
|
+
* @deprecated Use {@link ReplaceVersionAction} instead
|
|
3936
|
+
*/
|
|
3937
|
+
export declare type ReplaceDraftAction = {
|
|
3938
|
+
actionType: 'sanity.action.document.replaceDraft'
|
|
3602
3939
|
/**
|
|
3603
|
-
*
|
|
3604
|
-
*
|
|
3605
|
-
* @param uri - URI/path to build URL for
|
|
3606
|
-
* @param canUseCdn - Whether or not to allow using the API CDN for this route
|
|
3940
|
+
* Published document ID to create draft from, if draft does not exist
|
|
3607
3941
|
*/
|
|
3608
|
-
|
|
3942
|
+
publishedId: string
|
|
3609
3943
|
/**
|
|
3610
|
-
*
|
|
3611
|
-
*
|
|
3612
|
-
* @param operation - Data operation (eg `query`, `mutate`, `listen` or similar)
|
|
3613
|
-
* @param path - Path to append after the operation
|
|
3944
|
+
* Document to create if it does not already exist. Requires `_id` and `_type` properties.
|
|
3614
3945
|
*/
|
|
3615
|
-
|
|
3946
|
+
attributes: IdentifiedSanityDocumentStub
|
|
3947
|
+
}
|
|
3948
|
+
|
|
3949
|
+
/**
|
|
3950
|
+
* Replace an existing version of a document.
|
|
3951
|
+
*
|
|
3952
|
+
* @public
|
|
3953
|
+
*/
|
|
3954
|
+
export declare interface ReplaceVersionAction {
|
|
3955
|
+
actionType: 'sanity.action.document.version.replace'
|
|
3956
|
+
document: IdentifiedSanityDocumentStub
|
|
3957
|
+
}
|
|
3958
|
+
|
|
3959
|
+
/** @public */
|
|
3960
|
+
export declare const requester: Requester
|
|
3961
|
+
|
|
3962
|
+
/** @internal */
|
|
3963
|
+
export declare interface RequestObservableOptions extends Omit<RequestOptions, 'url'> {
|
|
3964
|
+
url?: string
|
|
3965
|
+
uri?: string
|
|
3966
|
+
canUseCdn?: boolean
|
|
3967
|
+
useCdn?: boolean
|
|
3968
|
+
tag?: string
|
|
3969
|
+
returnQuery?: boolean
|
|
3970
|
+
resultSourceMap?: boolean | 'withKeyArraySelector'
|
|
3971
|
+
perspective?: ClientPerspective
|
|
3972
|
+
lastLiveEventId?: string
|
|
3973
|
+
cacheMode?: 'noStale'
|
|
3974
|
+
}
|
|
3975
|
+
|
|
3976
|
+
/** @public */
|
|
3977
|
+
export declare interface RequestOptions {
|
|
3978
|
+
timeout?: number
|
|
3979
|
+
token?: string
|
|
3980
|
+
tag?: string
|
|
3981
|
+
headers?: Record<string, string>
|
|
3982
|
+
method?: string
|
|
3983
|
+
query?: Any
|
|
3984
|
+
body?: Any
|
|
3985
|
+
signal?: AbortSignal
|
|
3616
3986
|
}
|
|
3617
3987
|
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3988
|
+
export {ResolveStudioUrl}
|
|
3989
|
+
|
|
3990
|
+
/** @public */
|
|
3991
|
+
export declare interface ResponseEvent<T = unknown> {
|
|
3992
|
+
type: 'response'
|
|
3993
|
+
body: T
|
|
3994
|
+
url: string
|
|
3995
|
+
method: string
|
|
3996
|
+
statusCode: number
|
|
3997
|
+
statusMessage?: string
|
|
3998
|
+
headers: Record<string, string>
|
|
3999
|
+
}
|
|
4000
|
+
|
|
4001
|
+
/** @public */
|
|
4002
|
+
export declare interface ResponseQueryOptions extends RequestOptions {
|
|
4003
|
+
perspective?: ClientPerspective
|
|
4004
|
+
resultSourceMap?: boolean | 'withKeyArraySelector'
|
|
4005
|
+
returnQuery?: boolean
|
|
4006
|
+
useCdn?: boolean
|
|
4007
|
+
stega?: boolean | StegaConfig
|
|
4008
|
+
cache?: 'next' extends keyof RequestInit ? RequestInit['cache'] : never
|
|
4009
|
+
next?: ('next' extends keyof RequestInit ? RequestInit : never)['next']
|
|
4010
|
+
lastLiveEventId?: string | string[] | null
|
|
3632
4011
|
/**
|
|
3633
|
-
*
|
|
4012
|
+
* When set to `noStale`, APICDN will not return a cached response if the content is stale.
|
|
4013
|
+
* Tradeoff between latency and freshness of content.
|
|
3634
4014
|
*
|
|
3635
|
-
*
|
|
3636
|
-
* @param path - Path to append after the operation
|
|
4015
|
+
* Only to be used with live content queries and when useCdn is true.
|
|
3637
4016
|
*/
|
|
3638
|
-
|
|
4017
|
+
cacheMode?: 'noStale'
|
|
3639
4018
|
}
|
|
3640
4019
|
|
|
3641
|
-
/**
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
4020
|
+
/** @internal */
|
|
4021
|
+
export declare interface SanityAssetDocument extends SanityDocument {
|
|
4022
|
+
url: string
|
|
4023
|
+
path: string
|
|
4024
|
+
size: number
|
|
4025
|
+
assetId: string
|
|
4026
|
+
mimeType: string
|
|
4027
|
+
sha1hash: string
|
|
4028
|
+
extension: string
|
|
4029
|
+
uploadId?: string
|
|
4030
|
+
originalFilename?: string
|
|
4031
|
+
}
|
|
4032
|
+
|
|
4033
|
+
/** @public */
|
|
4034
|
+
export declare class SanityClient {
|
|
4035
|
+
#private
|
|
4036
|
+
assets: AssetsClient
|
|
4037
|
+
datasets: DatasetsClient
|
|
4038
|
+
live: LiveClient
|
|
4039
|
+
projects: ProjectsClient
|
|
4040
|
+
users: UsersClient
|
|
4041
|
+
agent: {
|
|
4042
|
+
action: AgentActionsClient
|
|
4043
|
+
}
|
|
4044
|
+
releases: ReleasesClient
|
|
3653
4045
|
/**
|
|
3654
4046
|
* Observable version of the Sanity client, with the same configuration as the promise-based one
|
|
3655
4047
|
*/
|
|
3656
|
-
observable:
|
|
4048
|
+
observable: ObservableSanityClient
|
|
4049
|
+
/**
|
|
4050
|
+
* Instance properties
|
|
4051
|
+
*/
|
|
4052
|
+
listen: typeof _listen
|
|
4053
|
+
constructor(httpRequest: HttpRequest, config?: ClientConfig)
|
|
3657
4054
|
/**
|
|
3658
4055
|
* Clone the client - returns a new instance
|
|
3659
4056
|
*/
|
|
3660
|
-
clone():
|
|
4057
|
+
clone(): SanityClient
|
|
3661
4058
|
/**
|
|
3662
4059
|
* Returns the current client configuration
|
|
3663
4060
|
*/
|
|
@@ -3665,13 +4062,13 @@ export declare interface SanityClientType extends SanityClientBase {
|
|
|
3665
4062
|
/**
|
|
3666
4063
|
* Reconfigure the client. Note that this _mutates_ the current client.
|
|
3667
4064
|
*/
|
|
3668
|
-
config(newConfig?: Partial<ClientConfig>):
|
|
4065
|
+
config(newConfig?: Partial<ClientConfig>): this
|
|
3669
4066
|
/**
|
|
3670
4067
|
* Clone the client with a new (partial) configuration.
|
|
3671
4068
|
*
|
|
3672
4069
|
* @param newConfig - New client configuration properties, shallowly merged with existing configuration
|
|
3673
4070
|
*/
|
|
3674
|
-
withConfig(newConfig?: Partial<ClientConfig>):
|
|
4071
|
+
withConfig(newConfig?: Partial<ClientConfig>): SanityClient
|
|
3675
4072
|
/**
|
|
3676
4073
|
* Perform a GROQ-query against the configured dataset.
|
|
3677
4074
|
*
|
|
@@ -3681,10 +4078,7 @@ export declare interface SanityClientType extends SanityClientBase {
|
|
|
3681
4078
|
R = Any,
|
|
3682
4079
|
Q extends QueryWithoutParams = QueryWithoutParams,
|
|
3683
4080
|
const G extends string = string,
|
|
3684
|
-
>(
|
|
3685
|
-
query: G,
|
|
3686
|
-
params?: Q | QueryWithoutParams,
|
|
3687
|
-
): Promise<ClientReturn<G, R>>
|
|
4081
|
+
>(query: G, params?: Q | QueryWithoutParams): Promise<ClientReturn<G, R>>
|
|
3688
4082
|
/**
|
|
3689
4083
|
* Perform a GROQ-query against the configured dataset.
|
|
3690
4084
|
*
|
|
@@ -3744,6 +4138,7 @@ export declare interface SanityClientType extends SanityClientBase {
|
|
|
3744
4138
|
options?: {
|
|
3745
4139
|
signal?: AbortSignal
|
|
3746
4140
|
tag?: string
|
|
4141
|
+
releaseId?: string
|
|
3747
4142
|
},
|
|
3748
4143
|
): Promise<SanityDocument<R> | undefined>
|
|
3749
4144
|
/**
|
|
@@ -3927,6 +4322,90 @@ export declare interface SanityClientType extends SanityClientBase {
|
|
|
3927
4322
|
document: IdentifiedSanityDocumentStub<R>,
|
|
3928
4323
|
options?: BaseMutationOptions,
|
|
3929
4324
|
): Promise<SanityDocument<R>>
|
|
4325
|
+
/**
|
|
4326
|
+
* @public
|
|
4327
|
+
*
|
|
4328
|
+
* Creates a new version of a published document.
|
|
4329
|
+
*
|
|
4330
|
+
* @remarks
|
|
4331
|
+
* * Requires a document with a `_type` property.
|
|
4332
|
+
* * Creating a version with no `releaseId` will create a new draft version of the published document.
|
|
4333
|
+
* * If the `document._id` is defined, it should be a draft or release version ID that matches the version ID generated from `publishedId` and `releaseId`.
|
|
4334
|
+
* * If the `document._id` is not defined, it will be generated from `publishedId` and `releaseId`.
|
|
4335
|
+
* * To create a version of an unpublished document, use the `client.create` method.
|
|
4336
|
+
*
|
|
4337
|
+
* @category Versions
|
|
4338
|
+
*
|
|
4339
|
+
* @param params - Version action parameters:
|
|
4340
|
+
* - `document` - The document to create as a new version (must include `_type`).
|
|
4341
|
+
* - `publishedId` - The ID of the published document being versioned.
|
|
4342
|
+
* - `releaseId` - The ID of the release to create the version for.
|
|
4343
|
+
* @param options - Additional action options.
|
|
4344
|
+
* @returns A promise that resolves to the `transactionId`.
|
|
4345
|
+
*
|
|
4346
|
+
* @example Creating a new version of a published document with a generated version ID
|
|
4347
|
+
* ```ts
|
|
4348
|
+
* const transactionId = await client.createVersion({
|
|
4349
|
+
* // The document does not need to include an `_id` property since it will be generated from `publishedId` and `releaseId`
|
|
4350
|
+
* document: {_type: 'myDocument', title: 'My Document'},
|
|
4351
|
+
* publishedId: 'myDocument',
|
|
4352
|
+
* releaseId: 'myRelease',
|
|
4353
|
+
* })
|
|
4354
|
+
*
|
|
4355
|
+
* // The following document will be created:
|
|
4356
|
+
* // {
|
|
4357
|
+
* // _id: 'versions.myRelease.myDocument',
|
|
4358
|
+
* // _type: 'myDocument',
|
|
4359
|
+
* // title: 'My Document',
|
|
4360
|
+
* // }
|
|
4361
|
+
* ```
|
|
4362
|
+
*
|
|
4363
|
+
* @example Creating a new version of a published document with a specified version ID
|
|
4364
|
+
* ```ts
|
|
4365
|
+
* const transactionId = await client.createVersion({
|
|
4366
|
+
* document: {_type: 'myDocument', _id: 'versions.myRelease.myDocument', title: 'My Document'},
|
|
4367
|
+
* // `publishedId` and `releaseId` are not required since `document._id` has been specified
|
|
4368
|
+
* })
|
|
4369
|
+
*
|
|
4370
|
+
* // The following document will be created:
|
|
4371
|
+
* // {
|
|
4372
|
+
* // _id: 'versions.myRelease.myDocument',
|
|
4373
|
+
* // _type: 'myDocument',
|
|
4374
|
+
* // title: 'My Document',
|
|
4375
|
+
* // }
|
|
4376
|
+
* ```
|
|
4377
|
+
*
|
|
4378
|
+
* @example Creating a new draft version of a published document
|
|
4379
|
+
* ```ts
|
|
4380
|
+
* const transactionId = await client.createVersion({
|
|
4381
|
+
* document: {_type: 'myDocument', title: 'My Document'},
|
|
4382
|
+
* publishedId: 'myDocument',
|
|
4383
|
+
* })
|
|
4384
|
+
*
|
|
4385
|
+
* // The following document will be created:
|
|
4386
|
+
* // {
|
|
4387
|
+
* // _id: 'drafts.myDocument',
|
|
4388
|
+
* // _type: 'myDocument',
|
|
4389
|
+
* // title: 'My Document',
|
|
4390
|
+
* // }
|
|
4391
|
+
* ```
|
|
4392
|
+
*/
|
|
4393
|
+
createVersion<R extends Record<string, Any>>(
|
|
4394
|
+
args: {
|
|
4395
|
+
document: SanityDocumentStub<R>
|
|
4396
|
+
publishedId: string
|
|
4397
|
+
releaseId?: string
|
|
4398
|
+
},
|
|
4399
|
+
options?: BaseActionOptions,
|
|
4400
|
+
): Promise<SingleActionResult | MultipleActionResult>
|
|
4401
|
+
createVersion<R extends Record<string, Any>>(
|
|
4402
|
+
args: {
|
|
4403
|
+
document: IdentifiedSanityDocumentStub<R>
|
|
4404
|
+
publishedId?: string
|
|
4405
|
+
releaseId?: string
|
|
4406
|
+
},
|
|
4407
|
+
options?: BaseActionOptions,
|
|
4408
|
+
): Promise<SingleActionResult | MultipleActionResult>
|
|
3930
4409
|
/**
|
|
3931
4410
|
* Deletes a document with the given document ID.
|
|
3932
4411
|
* Returns a promise that resolves to the deleted document.
|
|
@@ -4031,6 +4510,157 @@ export declare interface SanityClientType extends SanityClientBase {
|
|
|
4031
4510
|
selection: MutationSelection,
|
|
4032
4511
|
options?: BaseMutationOptions,
|
|
4033
4512
|
): Promise<SanityDocument<R>>
|
|
4513
|
+
/**
|
|
4514
|
+
* @public
|
|
4515
|
+
*
|
|
4516
|
+
* Deletes the draft or release version of a document.
|
|
4517
|
+
*
|
|
4518
|
+
* @remarks
|
|
4519
|
+
* * Discarding a version with no `releaseId` will discard the draft version of the published document.
|
|
4520
|
+
* * If the draft or release version does not exist, any error will throw.
|
|
4521
|
+
*
|
|
4522
|
+
* @param params - Version action parameters:
|
|
4523
|
+
* - `releaseId` - The ID of the release to discard the document from.
|
|
4524
|
+
* - `publishedId` - The published ID of the document to discard.
|
|
4525
|
+
* @param purge - if `true` the document history is also discarded.
|
|
4526
|
+
* @param options - Additional action options.
|
|
4527
|
+
* @returns a promise that resolves to the `transactionId`.
|
|
4528
|
+
*
|
|
4529
|
+
* @example Discarding a release version of a document
|
|
4530
|
+
* ```ts
|
|
4531
|
+
* client.discardVersion({publishedId: 'myDocument', releaseId: 'myRelease'})
|
|
4532
|
+
* // The document with the ID `versions.myRelease.myDocument` will be discarded.
|
|
4533
|
+
* ```
|
|
4534
|
+
*
|
|
4535
|
+
* @example Discarding a draft version of a document
|
|
4536
|
+
* ```ts
|
|
4537
|
+
* client.discardVersion({publishedId: 'myDocument'})
|
|
4538
|
+
* // The document with the ID `drafts.myDocument` will be discarded.
|
|
4539
|
+
* ```
|
|
4540
|
+
*/
|
|
4541
|
+
discardVersion(
|
|
4542
|
+
{
|
|
4543
|
+
releaseId,
|
|
4544
|
+
publishedId,
|
|
4545
|
+
}: {
|
|
4546
|
+
releaseId?: string
|
|
4547
|
+
publishedId: string
|
|
4548
|
+
},
|
|
4549
|
+
purge?: boolean,
|
|
4550
|
+
options?: BaseActionOptions,
|
|
4551
|
+
): Promise<SingleActionResult | MultipleActionResult>
|
|
4552
|
+
/**
|
|
4553
|
+
* @public
|
|
4554
|
+
*
|
|
4555
|
+
* Replaces an existing version document.
|
|
4556
|
+
*
|
|
4557
|
+
* @remarks
|
|
4558
|
+
* * Requires a document with a `_type` property.
|
|
4559
|
+
* * If the `document._id` is defined, it should be a draft or release version ID that matches the version ID generated from `publishedId` and `releaseId`.
|
|
4560
|
+
* * If the `document._id` is not defined, it will be generated from `publishedId` and `releaseId`.
|
|
4561
|
+
* * Replacing a version with no `releaseId` will replace the draft version of the published document.
|
|
4562
|
+
* * At least one of the **version** or **published** documents must exist.
|
|
4563
|
+
*
|
|
4564
|
+
* @param params - Version action parameters:
|
|
4565
|
+
* - `document` - The new document to replace the version with.
|
|
4566
|
+
* - `releaseId` - The ID of the release where the document version is replaced.
|
|
4567
|
+
* - `publishedId` - The ID of the published document to replace.
|
|
4568
|
+
* @param options - Additional action options.
|
|
4569
|
+
* @returns a promise that resolves to the `transactionId`.
|
|
4570
|
+
*
|
|
4571
|
+
* @example Replacing a release version of a published document with a generated version ID
|
|
4572
|
+
* ```ts
|
|
4573
|
+
* await client.replaceVersion({
|
|
4574
|
+
* document: {_type: 'myDocument', title: 'My Document'},
|
|
4575
|
+
* publishedId: 'myDocument',
|
|
4576
|
+
* releaseId: 'myRelease',
|
|
4577
|
+
* })
|
|
4578
|
+
*
|
|
4579
|
+
* // The following document will be patched:
|
|
4580
|
+
* // {
|
|
4581
|
+
* // _id: 'versions.myRelease.myDocument',
|
|
4582
|
+
* // _type: 'myDocument',
|
|
4583
|
+
* // title: 'My Document',
|
|
4584
|
+
* // }
|
|
4585
|
+
* ```
|
|
4586
|
+
*
|
|
4587
|
+
* @example Replacing a release version of a published document with a specified version ID
|
|
4588
|
+
* ```ts
|
|
4589
|
+
* await client.replaceVersion({
|
|
4590
|
+
* document: {_type: 'myDocument', _id: 'versions.myRelease.myDocument', title: 'My Document'},
|
|
4591
|
+
* // `publishedId` and `releaseId` are not required since `document._id` has been specified
|
|
4592
|
+
* })
|
|
4593
|
+
*
|
|
4594
|
+
* // The following document will be patched:
|
|
4595
|
+
* // {
|
|
4596
|
+
* // _id: 'versions.myRelease.myDocument',
|
|
4597
|
+
* // _type: 'myDocument',
|
|
4598
|
+
* // title: 'My Document',
|
|
4599
|
+
* // }
|
|
4600
|
+
* ```
|
|
4601
|
+
*
|
|
4602
|
+
* @example Replacing a draft version of a published document
|
|
4603
|
+
* ```ts
|
|
4604
|
+
* await client.replaceVersion({
|
|
4605
|
+
* document: {_type: 'myDocument', title: 'My Document'},
|
|
4606
|
+
* publishedId: 'myDocument',
|
|
4607
|
+
* })
|
|
4608
|
+
*
|
|
4609
|
+
* // The following document will be patched:
|
|
4610
|
+
* // {
|
|
4611
|
+
* // _id: 'drafts.myDocument',
|
|
4612
|
+
* // _type: 'myDocument',
|
|
4613
|
+
* // title: 'My Document',
|
|
4614
|
+
* // }
|
|
4615
|
+
* ```
|
|
4616
|
+
*/
|
|
4617
|
+
replaceVersion<R extends Record<string, Any>>(
|
|
4618
|
+
args: {
|
|
4619
|
+
document: SanityDocumentStub<R>
|
|
4620
|
+
publishedId: string
|
|
4621
|
+
releaseId?: string
|
|
4622
|
+
},
|
|
4623
|
+
options?: BaseActionOptions,
|
|
4624
|
+
): Promise<SingleActionResult | MultipleActionResult>
|
|
4625
|
+
replaceVersion<R extends Record<string, Any>>(
|
|
4626
|
+
args: {
|
|
4627
|
+
document: IdentifiedSanityDocumentStub<R>
|
|
4628
|
+
publishedId?: string
|
|
4629
|
+
releaseId?: string
|
|
4630
|
+
},
|
|
4631
|
+
options?: BaseActionOptions,
|
|
4632
|
+
): Promise<SingleActionResult | MultipleActionResult>
|
|
4633
|
+
/**
|
|
4634
|
+
* @public
|
|
4635
|
+
*
|
|
4636
|
+
* Used to indicate when a document within a release should be unpublished when
|
|
4637
|
+
* the release is run.
|
|
4638
|
+
*
|
|
4639
|
+
* @remarks
|
|
4640
|
+
* * If the published document does not exist, an error will be thrown.
|
|
4641
|
+
*
|
|
4642
|
+
* @param params - Version action parameters:
|
|
4643
|
+
* - `releaseId` - The ID of the release to unpublish the document from.
|
|
4644
|
+
* - `publishedId` - The published ID of the document to unpublish.
|
|
4645
|
+
* @param options - Additional action options.
|
|
4646
|
+
* @returns a promise that resolves to the `transactionId`.
|
|
4647
|
+
*
|
|
4648
|
+
* @example Unpublishing a release version of a published document
|
|
4649
|
+
* ```ts
|
|
4650
|
+
* await client.unpublishVersion({publishedId: 'myDocument', releaseId: 'myRelease'})
|
|
4651
|
+
* // The document with the ID `versions.myRelease.myDocument` will be unpublished. when `myRelease` is run.
|
|
4652
|
+
* ```
|
|
4653
|
+
*/
|
|
4654
|
+
unpublishVersion(
|
|
4655
|
+
{
|
|
4656
|
+
releaseId,
|
|
4657
|
+
publishedId,
|
|
4658
|
+
}: {
|
|
4659
|
+
releaseId: string
|
|
4660
|
+
publishedId: string
|
|
4661
|
+
},
|
|
4662
|
+
options?: BaseActionOptions,
|
|
4663
|
+
): Promise<SingleActionResult | MultipleActionResult>
|
|
4034
4664
|
/**
|
|
4035
4665
|
* Perform mutation operations against the configured dataset
|
|
4036
4666
|
* Returns a promise that resolves to the first mutated document.
|
|
@@ -4071,7 +4701,7 @@ export declare interface SanityClientType extends SanityClientBase {
|
|
|
4071
4701
|
* @param operations - Mutation operations to execute
|
|
4072
4702
|
* @param options - Mutation options
|
|
4073
4703
|
*/
|
|
4074
|
-
mutate<R extends Record<string, Any>>(
|
|
4704
|
+
mutate<R extends Record<string, Any> = Record<string, Any>>(
|
|
4075
4705
|
operations: Mutation<R>[] | Patch | Transaction,
|
|
4076
4706
|
options: AllDocumentIdsMutationOptions,
|
|
4077
4707
|
): Promise<MultipleMutationResult>
|
|
@@ -4110,14 +4740,6 @@ export declare interface SanityClientType extends SanityClientBase {
|
|
|
4110
4740
|
* @returns Patch instance - call `.commit()` to perform the operations defined
|
|
4111
4741
|
*/
|
|
4112
4742
|
patch(selection: MutationSelection, operations?: PatchOperations): Patch
|
|
4113
|
-
/**
|
|
4114
|
-
* Create a new buildable patch of operations to perform
|
|
4115
|
-
*
|
|
4116
|
-
* @param selection - Document ID, an array of document IDs, or an object with `query` and optional `params`, defining which document(s) to patch
|
|
4117
|
-
* @param operations - Optional object of patch operations to initialize the patch instance with
|
|
4118
|
-
* @returns Patch instance - call `.commit()` to perform the operations defined
|
|
4119
|
-
*/
|
|
4120
|
-
patch(selection: PatchSelection, operations?: PatchOperations): Patch
|
|
4121
4743
|
/**
|
|
4122
4744
|
* Create a new transaction of mutations
|
|
4123
4745
|
*
|
|
@@ -4156,6 +4778,20 @@ export declare interface SanityClientType extends SanityClientBase {
|
|
|
4156
4778
|
* @internal
|
|
4157
4779
|
*/
|
|
4158
4780
|
dataRequest(endpoint: string, body: unknown, options?: BaseMutationOptions): Promise<Any>
|
|
4781
|
+
/**
|
|
4782
|
+
* Get a Sanity API URL for the URI provided
|
|
4783
|
+
*
|
|
4784
|
+
* @param uri - URI/path to build URL for
|
|
4785
|
+
* @param canUseCdn - Whether or not to allow using the API CDN for this route
|
|
4786
|
+
*/
|
|
4787
|
+
getUrl(uri: string, canUseCdn?: boolean): string
|
|
4788
|
+
/**
|
|
4789
|
+
* Get a Sanity API URL for the data operation and path provided
|
|
4790
|
+
*
|
|
4791
|
+
* @param operation - Data operation (eg `query`, `mutate`, `listen` or similar)
|
|
4792
|
+
* @param path - Path to append after the operation
|
|
4793
|
+
*/
|
|
4794
|
+
getDataUrl(operation: string, path?: string): string
|
|
4159
4795
|
}
|
|
4160
4796
|
|
|
4161
4797
|
/** @internal */
|
|
@@ -4281,6 +4917,17 @@ export declare interface SanityUser {
|
|
|
4281
4917
|
isCurrentUser: boolean
|
|
4282
4918
|
}
|
|
4283
4919
|
|
|
4920
|
+
/**
|
|
4921
|
+
* Queues release for publishing at the given future time.
|
|
4922
|
+
*
|
|
4923
|
+
* @public
|
|
4924
|
+
*/
|
|
4925
|
+
export declare interface ScheduleReleaseAction {
|
|
4926
|
+
actionType: 'sanity.action.release.schedule'
|
|
4927
|
+
releaseId: string
|
|
4928
|
+
publishAt: string
|
|
4929
|
+
}
|
|
4930
|
+
|
|
4284
4931
|
/** @public */
|
|
4285
4932
|
export declare class ServerError extends Error {
|
|
4286
4933
|
response: ErrorProps['response']
|
|
@@ -4456,6 +5103,319 @@ export declare type TransactionMutationOptions =
|
|
|
4456
5103
|
| TransactionAllDocumentsMutationOptions
|
|
4457
5104
|
| TransactionAllDocumentIdsMutationOptions
|
|
4458
5105
|
|
|
5106
|
+
/** @beta */
|
|
5107
|
+
export declare type TransformDocument<T extends Record<string, Any> = Record<string, Any>> =
|
|
5108
|
+
| TransformDocumentSync<T>
|
|
5109
|
+
| TransformDocumentAsync
|
|
5110
|
+
|
|
5111
|
+
/** @beta */
|
|
5112
|
+
declare type TransformDocumentAsync = TransformRequestBase & AgentActionAsync
|
|
5113
|
+
|
|
5114
|
+
/** @beta */
|
|
5115
|
+
declare type TransformDocumentSync<T extends Record<string, Any> = Record<string, Any>> =
|
|
5116
|
+
TransformRequestBase & AgentActionSync
|
|
5117
|
+
|
|
5118
|
+
/** @beta */
|
|
5119
|
+
declare interface TransformRequestBase extends AgentActionRequestBase {
|
|
5120
|
+
/** schemaId as reported by sanity deploy / sanity schema store */
|
|
5121
|
+
schemaId: string
|
|
5122
|
+
/**
|
|
5123
|
+
* The source document the transformation will use as input.
|
|
5124
|
+
*/
|
|
5125
|
+
documentId: string
|
|
5126
|
+
/**
|
|
5127
|
+
* The source document's content is first copied to the target,
|
|
5128
|
+
* then it is transformed according to the instruction.
|
|
5129
|
+
*
|
|
5130
|
+
* When omitted, the source document (documentId) is also the target document.
|
|
5131
|
+
*/
|
|
5132
|
+
targetDocument?: TransformTargetDocument
|
|
5133
|
+
/**
|
|
5134
|
+
* Instruct the LLM how to transform the input to th output.
|
|
5135
|
+
*
|
|
5136
|
+
* String template using $variable from instructionParams.
|
|
5137
|
+
*
|
|
5138
|
+
* Capped to 2000 characters, after variables has been injected.
|
|
5139
|
+
* */
|
|
5140
|
+
instruction: string
|
|
5141
|
+
/**
|
|
5142
|
+
*
|
|
5143
|
+
* param values for the string template, keys are the variable name, ie if the template has "$variable", one key must be "variable"
|
|
5144
|
+
*
|
|
5145
|
+
* ### Examples
|
|
5146
|
+
*
|
|
5147
|
+
* #### Constant
|
|
5148
|
+
*
|
|
5149
|
+
* ##### Shorthand
|
|
5150
|
+
* ```ts
|
|
5151
|
+
* client.agent.action.generate({
|
|
5152
|
+
* schemaId,
|
|
5153
|
+
* documentId,
|
|
5154
|
+
* instruction: 'Give the following topic:\n $topic \n ---\nGenerate the full article.',
|
|
5155
|
+
* instructionParams: {
|
|
5156
|
+
* topic: 'Grapefruit'
|
|
5157
|
+
* },
|
|
5158
|
+
* })
|
|
5159
|
+
* ```
|
|
5160
|
+
* ##### Object-form
|
|
5161
|
+
*
|
|
5162
|
+
* ```ts
|
|
5163
|
+
* client.agent.action.transform({
|
|
5164
|
+
* schemaId,
|
|
5165
|
+
* documentId,
|
|
5166
|
+
* instruction: 'Give the following topic:\n $topic \n ---\nGenerate the full article.',
|
|
5167
|
+
* instructionParams: {
|
|
5168
|
+
* topic: {
|
|
5169
|
+
* type: 'constant',
|
|
5170
|
+
* value: 'Grapefruit'
|
|
5171
|
+
* },
|
|
5172
|
+
* },
|
|
5173
|
+
* })
|
|
5174
|
+
* ```
|
|
5175
|
+
* #### Field
|
|
5176
|
+
* ```ts
|
|
5177
|
+
* client.agent.action.transform({
|
|
5178
|
+
* schemaId,
|
|
5179
|
+
* documentId,
|
|
5180
|
+
* instruction: 'Give the following field value:\n $pte \n ---\nGenerate keywords.',
|
|
5181
|
+
* instructionParams: {
|
|
5182
|
+
* pte: {
|
|
5183
|
+
* type: 'field',
|
|
5184
|
+
* path: ['pteField'],
|
|
5185
|
+
* },
|
|
5186
|
+
* },
|
|
5187
|
+
* target: {path: 'keywords' }
|
|
5188
|
+
* })
|
|
5189
|
+
* ```
|
|
5190
|
+
* #### Document
|
|
5191
|
+
* ```ts
|
|
5192
|
+
* client.agent.action.transform({
|
|
5193
|
+
* schemaId,
|
|
5194
|
+
* documentId,
|
|
5195
|
+
* instruction: 'Give the following document value:\n $document \n ---\nGenerate keywords.',
|
|
5196
|
+
* instructionParams: {
|
|
5197
|
+
* document: {
|
|
5198
|
+
* type: 'document',
|
|
5199
|
+
* },
|
|
5200
|
+
* },
|
|
5201
|
+
* target: {path: 'keywords' }
|
|
5202
|
+
* })
|
|
5203
|
+
* ```
|
|
5204
|
+
*
|
|
5205
|
+
* #### GROQ
|
|
5206
|
+
* ```ts
|
|
5207
|
+
* client.agent.action.transform({
|
|
5208
|
+
* schemaId,
|
|
5209
|
+
* documentId,
|
|
5210
|
+
* instruction: 'Give the following list of titles:\n $list \n ---\nGenerate a similar title.',
|
|
5211
|
+
* instructionParams: {
|
|
5212
|
+
* list: {
|
|
5213
|
+
* type: 'groq',
|
|
5214
|
+
* query: '* [_type==$type].title',
|
|
5215
|
+
* params: {type: 'article'}
|
|
5216
|
+
* },
|
|
5217
|
+
* },
|
|
5218
|
+
* target: {path: 'title'}
|
|
5219
|
+
* })
|
|
5220
|
+
* ```
|
|
5221
|
+
* */
|
|
5222
|
+
instructionParams?: AgentActionParams
|
|
5223
|
+
/**
|
|
5224
|
+
* Target defines which parts of the document will be affected by the instruction.
|
|
5225
|
+
* It can be an array, so multiple parts of the document can be separately configured in detail.
|
|
5226
|
+
*
|
|
5227
|
+
* Omitting target implies that the document itself is the root.
|
|
5228
|
+
*
|
|
5229
|
+
* Notes:
|
|
5230
|
+
* - instruction can only affect fields up to `maxPathDepth`
|
|
5231
|
+
* - when multiple targets are provided, they will be coalesced into a single target sharing a common target root.
|
|
5232
|
+
* It is therefor an error to provide conflicting include/exclude across targets (ie, include title in one, and exclude it in another)
|
|
5233
|
+
*
|
|
5234
|
+
* Default max depth for transform: 12
|
|
5235
|
+
* @see AgentActionRequestBase#conditionalPaths
|
|
5236
|
+
*/
|
|
5237
|
+
target?: TransformTarget | TransformTarget[]
|
|
5238
|
+
}
|
|
5239
|
+
|
|
5240
|
+
/** @beta */
|
|
5241
|
+
export declare interface TransformTarget extends AgentActionTarget {
|
|
5242
|
+
/**
|
|
5243
|
+
* Specifies a tailored instruction of this target.
|
|
5244
|
+
*
|
|
5245
|
+
* string template using $variable from instructionParams.
|
|
5246
|
+
* */
|
|
5247
|
+
instruction?: string
|
|
5248
|
+
/**
|
|
5249
|
+
* By default, all children up to `target.maxPathDepth` are included.
|
|
5250
|
+
*
|
|
5251
|
+
* When `include` is specified, only segments explicitly listed will be included.
|
|
5252
|
+
*
|
|
5253
|
+
* Fields or array items not on the include list, are implicitly excluded.
|
|
5254
|
+
*/
|
|
5255
|
+
include?: (AgentActionPathSegment | TransformTargetInclude)[]
|
|
5256
|
+
}
|
|
5257
|
+
|
|
5258
|
+
/** @beta */
|
|
5259
|
+
export declare type TransformTargetDocument =
|
|
5260
|
+
| {
|
|
5261
|
+
operation: 'edit'
|
|
5262
|
+
_id: string
|
|
5263
|
+
}
|
|
5264
|
+
| {
|
|
5265
|
+
operation: 'create'
|
|
5266
|
+
_id?: string
|
|
5267
|
+
}
|
|
5268
|
+
| {
|
|
5269
|
+
operation: 'createIfNotExists'
|
|
5270
|
+
_id: string
|
|
5271
|
+
}
|
|
5272
|
+
| {
|
|
5273
|
+
operation: 'createOrReplace'
|
|
5274
|
+
_id: string
|
|
5275
|
+
}
|
|
5276
|
+
|
|
5277
|
+
/** @beta */
|
|
5278
|
+
export declare interface TransformTargetInclude extends AgentActionTargetInclude {
|
|
5279
|
+
/**
|
|
5280
|
+
* Specifies a tailored instruction of this target.
|
|
5281
|
+
*
|
|
5282
|
+
* string template using $variable from instructionParams */
|
|
5283
|
+
instruction?: string
|
|
5284
|
+
/**
|
|
5285
|
+
* By default, all children up to `target.maxPathDepth` are included.
|
|
5286
|
+
*
|
|
5287
|
+
* When `include` is specified, only segments explicitly listed will be included.
|
|
5288
|
+
*
|
|
5289
|
+
* Fields or array items not on the include list, are implicitly excluded.
|
|
5290
|
+
*/
|
|
5291
|
+
include?: (AgentActionPathSegment | TransformTargetInclude)[]
|
|
5292
|
+
}
|
|
5293
|
+
|
|
5294
|
+
/** @beta */
|
|
5295
|
+
export declare type TranslateDocument<T extends Record<string, Any> = Record<string, Any>> =
|
|
5296
|
+
| TranslateDocumentSync<T>
|
|
5297
|
+
| TranslateDocumentAsync
|
|
5298
|
+
|
|
5299
|
+
/** @beta */
|
|
5300
|
+
declare type TranslateDocumentAsync = TranslateRequestBase & AgentActionAsync
|
|
5301
|
+
|
|
5302
|
+
/** @beta */
|
|
5303
|
+
declare type TranslateDocumentSync<T extends Record<string, Any> = Record<string, Any>> =
|
|
5304
|
+
TranslateRequestBase & AgentActionSync
|
|
5305
|
+
|
|
5306
|
+
/** @beta */
|
|
5307
|
+
declare interface TranslateLanguage {
|
|
5308
|
+
/**
|
|
5309
|
+
* Language code
|
|
5310
|
+
*/
|
|
5311
|
+
id: string
|
|
5312
|
+
/**
|
|
5313
|
+
* While optional, it is recommended to provide a language title
|
|
5314
|
+
*/
|
|
5315
|
+
title?: string
|
|
5316
|
+
}
|
|
5317
|
+
|
|
5318
|
+
/** @beta */
|
|
5319
|
+
declare interface TranslateRequestBase extends AgentActionRequestBase {
|
|
5320
|
+
/** schemaId as reported by sanity deploy / sanity schema store */
|
|
5321
|
+
schemaId: string
|
|
5322
|
+
/**
|
|
5323
|
+
* The source document the transformation will use as input.
|
|
5324
|
+
*/
|
|
5325
|
+
documentId: string
|
|
5326
|
+
/**
|
|
5327
|
+
* The target document will first get content copied over from the source,
|
|
5328
|
+
* then it is translated according to the instruction.
|
|
5329
|
+
*
|
|
5330
|
+
* When omitted, the source document (documentId) is also the target document.
|
|
5331
|
+
*/
|
|
5332
|
+
targetDocument?: TransformTargetDocument
|
|
5333
|
+
/**
|
|
5334
|
+
* While optional, it is recommended
|
|
5335
|
+
*/
|
|
5336
|
+
fromLanguage?: TranslateLanguage
|
|
5337
|
+
toLanguage: TranslateLanguage
|
|
5338
|
+
/**
|
|
5339
|
+
* `styleGuide` can be used to tailor how the translation should be preformed.
|
|
5340
|
+
*
|
|
5341
|
+
* String template using $variable from styleGuideParams.
|
|
5342
|
+
*
|
|
5343
|
+
* Capped to 2000 characters, after variables has been injected.
|
|
5344
|
+
*
|
|
5345
|
+
* @see #protectedPhrases
|
|
5346
|
+
*/
|
|
5347
|
+
styleGuide?: string
|
|
5348
|
+
/** param values for the string template, keys are the variable name, ie if the template has "$variable", one key must be "variable" */
|
|
5349
|
+
styleGuideParams?: AgentActionParams
|
|
5350
|
+
/**
|
|
5351
|
+
* When the input string contains any phrase from `protectedPhrases`, the LLM will be instructed not
|
|
5352
|
+
* to translate them.
|
|
5353
|
+
*
|
|
5354
|
+
* It is recommended to use `protectedPhrases` instead of `styleGuide` for deny-list words and phrases,
|
|
5355
|
+
* since it keeps token cost low, resulting in faster responses, and limits how much information the LLM
|
|
5356
|
+
* has to process, since only phrases that are actually in the input string will be included in the final prompt.
|
|
5357
|
+
*/
|
|
5358
|
+
protectedPhrases?: string[]
|
|
5359
|
+
/**
|
|
5360
|
+
* When specified, the `toLanguage.id` will be stored in the specified path in the target document.
|
|
5361
|
+
*
|
|
5362
|
+
* The file _can_ be hidden: true (unlike other fields in the target, which will be ignored)
|
|
5363
|
+
*/
|
|
5364
|
+
languageFieldPath?: AgentActionPathSegment | AgentActionPath
|
|
5365
|
+
/**
|
|
5366
|
+
* Target defines which parts of the document will be affected by the instruction.
|
|
5367
|
+
* It can be an array, so multiple parts of the document can be separately configured in detail.
|
|
5368
|
+
*
|
|
5369
|
+
* Omitting target implies that the document itself is the root.
|
|
5370
|
+
*
|
|
5371
|
+
* Notes:
|
|
5372
|
+
* - instruction can only affect fields up to `maxPathDepth`
|
|
5373
|
+
* - when multiple targets are provided, they will be coalesced into a single target sharing a common target root.
|
|
5374
|
+
* It is therefor an error to provide conflicting include/exclude across targets (ie, include title in one, and exclude it in another)
|
|
5375
|
+
*
|
|
5376
|
+
* @see AgentActionRequestBase#conditionalPaths
|
|
5377
|
+
*/
|
|
5378
|
+
target?: TranslateTarget | TranslateTarget[]
|
|
5379
|
+
}
|
|
5380
|
+
|
|
5381
|
+
/** @beta */
|
|
5382
|
+
export declare interface TranslateTarget extends AgentActionTarget {
|
|
5383
|
+
/** string template using $variable from instructionParams */
|
|
5384
|
+
styleGuide?: string
|
|
5385
|
+
/**
|
|
5386
|
+
* By default, all children up to `target.maxPathDepth` are included.
|
|
5387
|
+
*
|
|
5388
|
+
* When `include` is specified, only segments explicitly listed will be included.
|
|
5389
|
+
*
|
|
5390
|
+
* Fields or array items not on the include list, are implicitly excluded.
|
|
5391
|
+
*/
|
|
5392
|
+
include?: (AgentActionPathSegment | TranslateTargetInclude)[]
|
|
5393
|
+
}
|
|
5394
|
+
|
|
5395
|
+
/** @beta */
|
|
5396
|
+
export declare interface TranslateTargetInclude extends AgentActionTargetInclude {
|
|
5397
|
+
/** string template using $variable from instructionParams */
|
|
5398
|
+
styleGuide?: string
|
|
5399
|
+
/**
|
|
5400
|
+
* By default, all children up to `target.maxPathDepth` are included.
|
|
5401
|
+
*
|
|
5402
|
+
* When `include` is specified, only segments explicitly listed will be included.
|
|
5403
|
+
*
|
|
5404
|
+
* Fields or array items not on the include list, are implicitly excluded.
|
|
5405
|
+
*/
|
|
5406
|
+
include?: (AgentActionPathSegment | TranslateTargetInclude)[]
|
|
5407
|
+
}
|
|
5408
|
+
|
|
5409
|
+
/**
|
|
5410
|
+
* Unarchived an `archived` release, and restores all the release documents.
|
|
5411
|
+
*
|
|
5412
|
+
* @public
|
|
5413
|
+
*/
|
|
5414
|
+
export declare interface UnarchiveReleaseAction {
|
|
5415
|
+
actionType: 'sanity.action.release.unarchive'
|
|
5416
|
+
releaseId: string
|
|
5417
|
+
}
|
|
5418
|
+
|
|
4459
5419
|
/** @public */
|
|
4460
5420
|
export declare interface UnfilteredResponseQueryOptions extends ResponseQueryOptions {
|
|
4461
5421
|
filterResponse: false
|
|
@@ -4497,6 +5457,28 @@ export declare type UnpublishAction = {
|
|
|
4497
5457
|
publishedId: string
|
|
4498
5458
|
}
|
|
4499
5459
|
|
|
5460
|
+
/**
|
|
5461
|
+
* Identify that a version of a document should be unpublished when
|
|
5462
|
+
* the release that version is contained within is published.
|
|
5463
|
+
*
|
|
5464
|
+
* @public
|
|
5465
|
+
*/
|
|
5466
|
+
export declare interface UnpublishVersionAction {
|
|
5467
|
+
actionType: 'sanity.action.document.version.unpublish'
|
|
5468
|
+
versionId: string
|
|
5469
|
+
publishedId: string
|
|
5470
|
+
}
|
|
5471
|
+
|
|
5472
|
+
/**
|
|
5473
|
+
* Unschedules a `scheduled` release, stopping it from being published.
|
|
5474
|
+
*
|
|
5475
|
+
* @public
|
|
5476
|
+
*/
|
|
5477
|
+
export declare interface UnscheduleReleaseAction {
|
|
5478
|
+
actionType: 'sanity.action.release.unschedule'
|
|
5479
|
+
releaseId: string
|
|
5480
|
+
}
|
|
5481
|
+
|
|
4500
5482
|
export {unstable__adapter}
|
|
4501
5483
|
|
|
4502
5484
|
export {unstable__environment}
|
|
@@ -4566,7 +5548,7 @@ export declare interface UploadClientConfig {
|
|
|
4566
5548
|
}
|
|
4567
5549
|
|
|
4568
5550
|
/** @public */
|
|
4569
|
-
export declare class UsersClient
|
|
5551
|
+
export declare class UsersClient {
|
|
4570
5552
|
#private
|
|
4571
5553
|
constructor(client: SanityClient, httpRequest: HttpRequest)
|
|
4572
5554
|
/**
|
|
@@ -4577,16 +5559,6 @@ export declare class UsersClient implements UsersClientType {
|
|
|
4577
5559
|
getById<T extends 'me' | string>(id: T): Promise<T extends 'me' ? CurrentSanityUser : SanityUser>
|
|
4578
5560
|
}
|
|
4579
5561
|
|
|
4580
|
-
/** @internal */
|
|
4581
|
-
declare interface UsersClientType {
|
|
4582
|
-
/**
|
|
4583
|
-
* Fetch a user by user ID
|
|
4584
|
-
*
|
|
4585
|
-
* @param id - User ID of the user to fetch. If `me` is provided, a minimal response including the users role is returned.
|
|
4586
|
-
*/
|
|
4587
|
-
getById<T extends 'me' | string>(id: T): Promise<T extends 'me' ? CurrentSanityUser : SanityUser>
|
|
4588
|
-
}
|
|
4589
|
-
|
|
4590
5562
|
/**
|
|
4591
5563
|
* @internal - it may have breaking changes in any release
|
|
4592
5564
|
*/
|
|
@@ -4594,6 +5566,13 @@ export declare function validateApiPerspective(
|
|
|
4594
5566
|
perspective: unknown,
|
|
4595
5567
|
): asserts perspective is ClientPerspective
|
|
4596
5568
|
|
|
5569
|
+
/** @public */
|
|
5570
|
+
export declare type VersionAction =
|
|
5571
|
+
| CreateVersionAction
|
|
5572
|
+
| DiscardVersionAction
|
|
5573
|
+
| ReplaceVersionAction
|
|
5574
|
+
| UnpublishVersionAction
|
|
5575
|
+
|
|
4597
5576
|
/**
|
|
4598
5577
|
* The listener has been established, and will start receiving events.
|
|
4599
5578
|
* Note that this is also emitted upon _reconnection_.
|