@sanity/media-library-types 1.2.0 → 1.3.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/lib/index.d.cts CHANGED
@@ -1,11 +1,11 @@
1
- import {Asset as Asset_3} from '@sanity/media-library-types'
2
- import {AssetInstanceDocument as AssetInstanceDocument_2} from '@sanity/media-library-types'
3
- import {ClientPerspective} from '@sanity/client'
4
- import {ComponentType} from 'react'
5
- import {ElementType} from 'react'
6
- import {ReactNode} from 'react'
7
- import {SanityClient} from '@sanity/client'
8
- import {StackablePerspective} from '@sanity/client'
1
+ import { Asset as Asset_3 } from "@sanity/media-library-types";
2
+ import { AssetInstanceDocument as AssetInstanceDocument_2 } from "@sanity/media-library-types";
3
+ import { ClientPerspective } from "@sanity/client";
4
+ import { ComponentType } from "react";
5
+ import { ElementType } from "react";
6
+ import { ReactNode } from "react";
7
+ import { SanityClient } from "@sanity/client";
8
+ import { StackablePerspective } from "@sanity/client";
9
9
 
10
10
  /**
11
11
  * Types of array actions that can be performed
@@ -15,198 +15,272 @@ declare type ArrayActionName =
15
15
  /**
16
16
  * Add any item to the array at any position
17
17
  */
18
- | 'add'
18
+ | "add"
19
19
  /**
20
20
  * Add item after an existing item
21
21
  */
22
- | 'addBefore'
22
+ | "addBefore"
23
23
  /**
24
24
  * Add item after an existing item
25
25
  */
26
- | 'addAfter'
26
+ | "addAfter"
27
27
  /**
28
28
  * Remove any item
29
29
  */
30
- | 'remove'
30
+ | "remove"
31
31
  /**
32
32
  * Duplicate item
33
33
  */
34
- | 'duplicate'
34
+ | "duplicate"
35
35
  /**
36
36
  * Copy item
37
37
  */
38
- | 'copy'
38
+ | "copy";
39
39
 
40
40
  /** @public */
41
41
  declare interface ArrayDefinition extends BaseSchemaDefinition {
42
- type: 'array'
43
- of: ArrayOfType[]
44
- initialValue?: InitialValueProperty<any, unknown[]>
45
- validation?: ValidationBuilder<ArrayRule<unknown[]>, unknown[]>
46
- options?: ArrayOptions
42
+ type: "array";
43
+ of: ArrayOfType[];
44
+ initialValue?: InitialValueProperty<any, unknown[]>;
45
+ validation?: ValidationBuilder<ArrayRule<unknown[]>, unknown[]>;
46
+ options?: ArrayOptions;
47
47
  }
48
48
 
49
49
  /** @public */
50
- declare type ArrayOfEntry<T> = Omit<T, 'name' | 'hidden'> & {
51
- name?: string
52
- }
50
+ declare type ArrayOfEntry<T> = Omit<T, "name" | "hidden"> & {
51
+ name?: string;
52
+ };
53
53
 
54
54
  /** @public */
55
55
  declare type ArrayOfType<
56
56
  TType extends IntrinsicTypeName = IntrinsicTypeName,
57
57
  TAlias extends IntrinsicTypeName | undefined = undefined,
58
- > = IntrinsicArrayOfDefinition[TType] | ArrayOfEntry<TypeAliasDefinition<string, TAlias>>
58
+ > =
59
+ | IntrinsicArrayOfDefinition[TType]
60
+ | ArrayOfEntry<TypeAliasDefinition<string, TAlias>>;
59
61
 
60
62
  /** @public */
61
- declare interface ArrayOptions<V = unknown> extends SearchConfiguration, BaseSchemaTypeOptions {
62
- list?: TitledListValue<V>[] | V[]
63
- layout?: 'list' | 'tags' | 'grid'
63
+ declare interface ArrayOptions<V = unknown>
64
+ extends SearchConfiguration, BaseSchemaTypeOptions {
65
+ list?: TitledListValue<V>[] | V[];
66
+ layout?: "list" | "tags" | "grid";
64
67
  /** @deprecated This option does not have any effect anymore */
65
- direction?: 'horizontal' | 'vertical'
66
- sortable?: boolean
68
+ direction?: "horizontal" | "vertical";
69
+ sortable?: boolean;
67
70
  modal?: {
68
- type?: 'dialog' | 'popover'
69
- width?: number | 'auto'
70
- }
71
+ type?: "dialog" | "popover";
72
+ width?: number | "auto";
73
+ };
71
74
  /** @alpha This API may change */
72
- insertMenu?: InsertMenuOptions
75
+ insertMenu?: InsertMenuOptions;
73
76
  /**
74
77
  * A boolean flag to enable or disable tree editing for the array.
75
78
  * If there are any nested arrays, they will inherit this value.
76
79
  * @deprecated tree editing beta feature has been disabled
77
80
  */
78
- treeEditing?: boolean
81
+ treeEditing?: boolean;
79
82
  /**
80
83
  * A list of array actions to disable
81
84
  * Possible options are defined by {@link ArrayActionName}
82
85
  * @beta
83
86
  */
84
- disableActions?: ArrayActionName[]
87
+ disableActions?: ArrayActionName[];
85
88
  }
86
89
 
87
90
  /** @public */
88
91
  declare interface ArrayRule<Value> extends RuleDef<ArrayRule<Value>, Value> {
89
- min: (length: number | FieldReference) => ArrayRule<Value>
90
- max: (length: number | FieldReference) => ArrayRule<Value>
91
- length: (length: number | FieldReference) => ArrayRule<Value>
92
- unique: () => ArrayRule<Value>
92
+ min: (length: number | FieldReference) => ArrayRule<Value>;
93
+ max: (length: number | FieldReference) => ArrayRule<Value>;
94
+ length: (length: number | FieldReference) => ArrayRule<Value>;
95
+ unique: () => ArrayRule<Value>;
93
96
  }
94
97
 
95
98
  /** @public */
96
99
  declare interface ArraySchemaType<V = unknown> extends BaseSchemaType {
97
- jsonType: 'array'
98
- of: (Exclude<SchemaType, ArraySchemaType> | ReferenceSchemaType)[]
100
+ jsonType: "array";
101
+ of: (Exclude<SchemaType, ArraySchemaType> | ReferenceSchemaType)[];
99
102
  options?: ArrayOptions<V> & {
100
- layout?: V extends string ? 'tag' : 'grid'
101
- }
103
+ layout?: V extends string ? "tag" : "grid";
104
+ };
102
105
  }
103
106
 
104
107
  export declare interface Asset<
105
108
  AssetInstance extends AssetInstanceDocument = AssetInstanceDocument,
106
109
  > {
107
- _id: string
108
- _type: SanityAsset['_type']
109
- title: string
110
- assetType: AssetInstance['_type']
111
- cdnAccessPolicy: SanityAsset['cdnAccessPolicy']
110
+ _id: string;
111
+ _originalId?: string;
112
+ _type: SanityAsset["_type"];
113
+ title: string;
114
+ assetType: AssetInstance["_type"];
115
+ cdnAccessPolicy: SanityAsset["cdnAccessPolicy"];
112
116
  currentVersion: {
113
- _ref: string
114
- }
115
- aspects?: unknown
116
- versions: AssetVersion<AssetInstance>[]
117
- collections: SanityAssetCollection[]
118
- _createdAt: string
119
- _updatedAt: string
120
- _rev: string
121
- url?: string
117
+ _ref: string;
118
+ };
119
+ aspects?: unknown;
120
+ versions: AssetVersion<AssetInstance>[];
121
+ collections: SanityAssetCollection[];
122
+ _createdAt: string;
123
+ _updatedAt: string;
124
+ _rev: string;
125
+ url?: string;
122
126
  }
123
127
 
124
128
  /** @public */
125
129
  declare interface Asset_2 extends SanityDocument {
126
- url: string
127
- path: string
128
- assetId: string
129
- extension: string
130
- mimeType: string
131
- sha1hash: string
132
- size: number
133
- originalFilename?: string
134
- label?: string
135
- title?: string
136
- description?: string
137
- creditLine?: string
138
- source?: AssetSourceSpec
130
+ url: string;
131
+ path: string;
132
+ assetId: string;
133
+ extension: string;
134
+ mimeType: string;
135
+ sha1hash: string;
136
+ size: number;
137
+ originalFilename?: string;
138
+ label?: string;
139
+ title?: string;
140
+ description?: string;
141
+ creditLine?: string;
142
+ source?: AssetSourceSpec;
139
143
  }
140
144
 
141
145
  export declare interface AssetAspectDocument extends BaseDocument {
142
- _type: 'sanity.asset.aspect'
146
+ _type: "sanity.asset.aspect";
143
147
  /**
144
148
  * The asset type this aspect definition applies to
145
149
  * Undefined means that it applies to all asset types
146
150
  */
147
- assetType?: Asset['assetType']
148
- definition: FieldDefinition
149
- public?: boolean
151
+ assetType?: Asset["assetType"];
152
+ definition: FieldDefinition;
153
+ public?: boolean;
150
154
  }
151
155
 
152
156
  /** @public */
153
157
  declare type AssetFromSource = {
154
- kind: 'assetDocumentId' | 'file' | 'base64' | 'url'
155
- value: string | File_2
156
- assetDocumentProps?: ImageAsset
158
+ kind: "assetDocumentId" | "file" | "base64" | "url";
159
+ value: string | File_2;
160
+ assetDocumentProps?: ImageAsset;
157
161
  mediaLibraryProps?: {
158
- mediaLibraryId: string
159
- assetId: string
160
- assetInstanceId: string
161
- }
162
- }
162
+ mediaLibraryId: string;
163
+ assetId: string;
164
+ assetInstanceId: string;
165
+ };
166
+ };
163
167
 
164
- export declare type AssetInstanceDocument = SanityImageAsset | SanityVideoAsset | SanityFileAsset
168
+ export declare type AssetInstanceDocument =
169
+ | SanityImageAsset
170
+ | SanityVideoAsset
171
+ | SanityFileAsset;
165
172
 
166
173
  export declare interface AssetSelectionItem {
167
- asset: Asset
168
- assetInstanceId?: string | null
174
+ asset: Asset;
175
+ assetInstanceId?: string | null;
169
176
  }
170
177
 
171
178
  declare interface AssetSelectionItemWithLegacySupport extends AssetSelectionItem {
172
- assetId: string
173
- assetType: string
174
- assetInstanceId: string
179
+ assetId: string;
180
+ assetType: string;
181
+ assetInstanceId: string;
175
182
  }
176
183
 
177
184
  /** @public */
178
185
  declare interface AssetSource {
179
- name: string
186
+ name: string;
180
187
  /** @deprecated provide `i18nKey` instead */
181
- title?: string
182
- i18nKey?: string
183
- component: ComponentType<AssetSourceComponentProps>
184
- icon?: ComponentType<EmptyProps>
188
+ title?: string;
189
+ i18nKey?: string;
190
+ component: ComponentType<AssetSourceComponentProps>;
191
+ icon?: ComponentType;
185
192
  /** @beta */
186
- Uploader?: AssetSourceUploaderClass
193
+ Uploader?: AssetSourceUploaderClass;
194
+ /**
195
+ * Specifies how uploads should be initiated for this source.
196
+ *
197
+ * - `'picker'` (default): The studio opens a native file picker first,
198
+ * then passes the selected files to the source via the `uploader` prop.
199
+ * Progress is tracked via the uploader and shown in the studio UI.
200
+ *
201
+ * - `'component'`: The studio renders the source component directly with
202
+ * `action: 'upload'`. The source provides its own UI for selecting and
203
+ * uploading files, and tracks progress internally. When complete, the
204
+ * source calls `onSelect` with the uploaded assets.
205
+ *
206
+ * @beta
207
+ */
208
+ uploadMode?: "picker" | "component";
209
+ /**
210
+ * Resolve how to open an asset in its original source.
211
+ *
212
+ * This function is called for each AssetSource when determining if
213
+ * "Open in Source" should be available. The plugin should check
214
+ * `asset.source.name` to determine if it can handle this asset.
215
+ *
216
+ * Return values:
217
+ * - `{ type: 'url', url: string }` - Open the URL (in new window by default)
218
+ * - `{ type: 'component' }` - Render the asset source component with action='openInSource'
219
+ * - `false` or `undefined` - This plugin cannot handle this asset
220
+ *
221
+ * @beta
222
+ */
223
+ openInSource?: (asset: Asset_2) => AssetSourceOpenInSourceResult;
187
224
  }
188
225
 
226
+ /** @public */
227
+ declare type AssetSourceComponentAction = "select" | "upload" | "openInSource";
228
+
189
229
  /** @public */
190
230
  declare interface AssetSourceComponentProps {
191
- action?: 'select' | 'upload'
192
- assetSource: AssetSource
193
- assetType?: 'file' | 'image' | 'sanity.video'
194
- accept: string
195
- selectionType: 'single'
196
- dialogHeaderTitle?: React.ReactNode
197
- selectedAssets: Asset_2[]
198
- onClose: () => void
199
- onSelect: (assetFromSource: AssetFromSource[]) => void
200
- schemaType?: ImageSchemaType | FileSchemaType
201
- /** @beta */
202
- uploader?: AssetSourceUploader
231
+ action?: AssetSourceComponentAction;
232
+ assetSource: AssetSource;
233
+ assetType?: "file" | "image" | "sanity.video";
234
+ accept: string;
235
+ selectionType: "single";
236
+ dialogHeaderTitle?: React.ReactNode;
237
+ selectedAssets: Asset_2[];
238
+ onClose: () => void;
239
+ onSelect: (assetFromSource: AssetFromSource[]) => void;
240
+ onChangeAction?: (action: AssetSourceComponentAction) => void;
241
+ schemaType?: ImageSchemaType | FileSchemaType;
242
+ /**
243
+ * The uploader instance for tracking upload progress.
244
+ *
245
+ * When `action` is `'upload'`:
246
+ * - If `uploader` is provided: Picker mode. Files are available via
247
+ * `uploader.getFiles()`. The source should upload these files and report
248
+ * progress via the uploader.
249
+ * - If `uploader` is undefined: Component mode. The source should show its
250
+ * own file selection UI, handle uploads internally, and call `onSelect`
251
+ * when complete.
252
+ *
253
+ * @beta
254
+ */
255
+ uploader?: AssetSourceUploader;
256
+ /**
257
+ * The asset to open in source. Only provided when action is 'openInSource'.
258
+ * @beta
259
+ */
260
+ assetToOpen?: Asset_2;
203
261
  }
204
262
 
263
+ /**
264
+ * The result of calling `AssetSource.openInSource`.
265
+ * @beta
266
+ */
267
+ declare type AssetSourceOpenInSourceResult =
268
+ | {
269
+ type: "url";
270
+ url: string;
271
+ target?: "_blank" | "_self";
272
+ }
273
+ | {
274
+ type: "component";
275
+ }
276
+ | false
277
+ | undefined;
278
+
205
279
  /** @public */
206
280
  declare interface AssetSourceSpec {
207
- id: string
208
- name: string
209
- url?: string
281
+ id: string;
282
+ name: string;
283
+ url?: string;
210
284
  }
211
285
 
212
286
  /** @beta */
@@ -218,45 +292,47 @@ declare interface AssetSourceUploader {
218
292
  * The schema type of the field the asset is being uploaded to.
219
293
  * May be of interest to the uploader to read file and image options.
220
294
  */
221
- schemaType?: SchemaType
295
+ schemaType?: SchemaType;
222
296
  /**
223
297
  * The uploader may send patches directly to the field
224
298
  * Typed 'unknown' as we don't have patch definitions in sanity/types yet.
225
299
  */
226
- onChange?: (patch: unknown) => void
300
+ onChange?: (patch: unknown) => void;
227
301
  },
228
- ): AssetSourceUploadFile[]
302
+ ): AssetSourceUploadFile[];
229
303
  /**
230
304
  * Abort the upload of a file
231
305
  */
232
- abort(file?: AssetSourceUploadFile): void
306
+ abort(file?: AssetSourceUploadFile): void;
233
307
  /**
234
308
  * Get the files that are currently being uploaded
235
309
  */
236
- getFiles(): AssetSourceUploadFile[]
310
+ getFiles(): AssetSourceUploadFile[];
237
311
  /**
238
312
  * Subscribe to upload events from the uploader
239
313
  */
240
- subscribe(subscriber: (event: AssetSourceUploadEvent) => void): () => void
314
+ subscribe(subscriber: (event: AssetSourceUploadEvent) => void): () => void;
241
315
  /**
242
316
  * Update the status of a file. Will be emitted to subscribers.
243
317
  */
244
318
  updateFile(
245
319
  fileId: string,
246
320
  data: {
247
- progress?: number
248
- status?: string
249
- error?: Error
321
+ progress?: number;
322
+ status?: string;
323
+ error?: Error;
250
324
  },
251
- ): void
325
+ ): void;
252
326
  /**
253
327
  * Reset the uploader (clear files). Should be called by the uploader when all files are done.
254
328
  */
255
- reset(): void
329
+ reset(): void;
256
330
  }
257
331
 
258
332
  /** @beta */
259
- declare type AssetSourceUploaderClass = new (...args: any[]) => AssetSourceUploader
333
+ declare type AssetSourceUploaderClass = new (
334
+ ...args: any[]
335
+ ) => AssetSourceUploader;
260
336
 
261
337
  /** @beta */
262
338
  declare type AssetSourceUploadEvent =
@@ -264,128 +340,134 @@ declare type AssetSourceUploadEvent =
264
340
  | AssetSourceUploadEventStatus
265
341
  | AssetSourceUploadEventAllComplete
266
342
  | AssetSourceUploadEventError
267
- | AssetSourceUploadEventAbort
343
+ | AssetSourceUploadEventAbort;
268
344
 
269
345
  /**
270
346
  * Emitted when all files are done, either successfully, aborted or with errors
271
347
  * @beta */
272
348
  declare type AssetSourceUploadEventAbort = {
273
- type: 'abort'
349
+ type: "abort";
274
350
  /**
275
351
  * Files aborted
276
352
  */
277
- files: AssetSourceUploadFile[]
278
- }
353
+ files: AssetSourceUploadFile[];
354
+ };
279
355
 
280
356
  /**
281
357
  * Emitted when all files are done, either successfully, aborted or with errors
282
358
  * @beta */
283
359
  declare type AssetSourceUploadEventAllComplete = {
284
- type: 'all-complete'
285
- files: AssetSourceUploadFile[]
286
- }
360
+ type: "all-complete";
361
+ files: AssetSourceUploadFile[];
362
+ };
287
363
 
288
364
  /**
289
365
  * Emitted when all files are done, either successfully, aborted or with errors
290
366
  * @beta */
291
367
  declare type AssetSourceUploadEventError = {
292
- type: 'error'
368
+ type: "error";
293
369
  /**
294
370
  * Files errored
295
371
  */
296
- files: AssetSourceUploadFile[]
297
- }
372
+ files: AssetSourceUploadFile[];
373
+ };
298
374
 
299
375
  /**
300
376
  * Emitted when a file upload is progressing
301
377
  * @beta */
302
378
  declare type AssetSourceUploadEventProgress = {
303
- type: 'progress'
304
- file: AssetSourceUploadFile
305
- progress: number
306
- }
379
+ type: "progress";
380
+ file: AssetSourceUploadFile;
381
+ progress: number;
382
+ };
307
383
 
308
384
  /**
309
385
  * Emitted when a file upload is changing status
310
386
  * @beta */
311
387
  declare type AssetSourceUploadEventStatus = {
312
- type: 'status'
313
- file: AssetSourceUploadFile
314
- status: AssetSourceUploadFile['status']
315
- }
388
+ type: "status";
389
+ file: AssetSourceUploadFile;
390
+ status: AssetSourceUploadFile["status"];
391
+ };
316
392
 
317
393
  /** @beta */
318
394
  declare interface AssetSourceUploadFile {
319
- id: string
320
- file: globalThis.File
321
- progress: number
322
- status: 'pending' | 'uploading' | 'complete' | 'error' | 'aborted' | 'alreadyExists'
323
- error?: Error
324
- result?: unknown
395
+ id: string;
396
+ file: globalThis.File;
397
+ progress: number;
398
+ status:
399
+ | "pending"
400
+ | "uploading"
401
+ | "complete"
402
+ | "error"
403
+ | "aborted"
404
+ | "alreadyExists";
405
+ error?: Error;
406
+ result?: unknown;
325
407
  }
326
408
 
327
409
  export declare interface AssetVersion<
328
410
  AssetInstance extends AssetInstanceDocument = AssetInstanceDocument,
329
411
  > {
330
- _key: string
331
- _type: SanityAssetVersion['_type']
332
- title?: string
333
- instance: AssetInstance
412
+ _key: string;
413
+ _type: SanityAssetVersion["_type"];
414
+ title?: string;
415
+ instance: AssetInstance;
334
416
  }
335
417
 
336
418
  export declare type BaseDocument = {
337
- _id: string
338
- _type: string
339
- _rev: string
340
- _createdAt: string
341
- _updatedAt: string
342
- [key: string]: any
343
- }
419
+ _id: string;
420
+ _type: string;
421
+ _rev: string;
422
+ _createdAt: string;
423
+ _updatedAt: string;
424
+ [key: string]: any;
425
+ };
344
426
 
345
427
  /** @public */
346
428
  declare interface BaseSchemaDefinition {
347
- name: string
348
- title?: string
349
- description?: string | React.JSX.Element
350
- hidden?: ConditionalProperty
351
- readOnly?: ConditionalProperty
352
- icon?: ComponentType | ReactNode
353
- validation?: unknown
354
- initialValue?: unknown
355
- deprecated?: DeprecatedProperty
429
+ name: string;
430
+ title?: string;
431
+ description?: string | React.JSX.Element;
432
+ hidden?: ConditionalProperty;
433
+ readOnly?: ConditionalProperty;
434
+ icon?: ComponentType | ReactNode;
435
+ validation?: unknown;
436
+ initialValue?: unknown;
437
+ deprecated?: DeprecatedProperty;
356
438
  }
357
439
 
358
440
  /** @public */
359
441
  declare interface BaseSchemaType extends Partial<DeprecationConfiguration> {
360
- name: string
361
- title?: string
362
- description?: string
363
- type?: SchemaType
364
- liveEdit?: boolean
365
- readOnly?: ConditionalProperty
366
- hidden?: ConditionalProperty
367
- icon?: ComponentType
368
- initialValue?: InitialValueProperty<any, any>
369
- validation?: SchemaValidationValue
370
- preview?: PreviewConfig
442
+ name: string;
443
+ title?: string;
444
+ description?: string;
445
+ type?: SchemaType;
446
+ liveEdit?: boolean;
447
+ readOnly?: ConditionalProperty;
448
+ hidden?: ConditionalProperty;
449
+ icon?: ComponentType;
450
+ initialValue?: InitialValueProperty<any, any>;
451
+ validation?: SchemaValidationValue;
452
+ preview?: PreviewConfig;
371
453
  /** @beta */
372
454
  components?: {
373
- block?: ComponentType<any>
374
- inlineBlock?: ComponentType<any>
375
- annotation?: ComponentType<any>
376
- diff?: ComponentType<any>
377
- field?: ComponentType<any>
378
- input?: ComponentType<any>
379
- item?: ComponentType<any>
380
- preview?: ComponentType<any>
455
+ block?: ComponentType<any>;
456
+ inlineBlock?: ComponentType<any>;
457
+ annotation?: ComponentType<any>;
458
+ diff?: ComponentType<any>;
459
+ field?: ComponentType<any>;
460
+ input?: ComponentType<any>;
461
+ item?: ComponentType<any>;
462
+ preview?: ComponentType<any>;
381
463
  portableText?: {
382
- plugins?: ComponentType<any>
383
- }
384
- }
464
+ plugins?: ComponentType<any>;
465
+ };
466
+ };
385
467
  /**
386
468
  * @deprecated This will be removed.
387
469
  */
388
- placeholder?: string
470
+ placeholder?: string;
389
471
  }
390
472
 
391
473
  /**
@@ -396,8 +478,8 @@ declare interface BaseSchemaType extends Partial<DeprecationConfiguration> {
396
478
  * @public
397
479
  * */
398
480
  declare interface BaseSchemaTypeOptions {
399
- sanityCreate?: SanityCreateOptions
400
- canvasApp?: CanvasAppOptions
481
+ sanityCreate?: SanityCreateOptions;
482
+ canvasApp?: CanvasAppOptions;
401
483
  }
402
484
 
403
485
  /**
@@ -428,10 +510,10 @@ declare interface BaseSchemaTypeOptions {
428
510
  * ```
429
511
  */
430
512
  declare interface BlockDecoratorDefinition {
431
- title: string
432
- i18nTitleKey?: string
433
- value: string
434
- icon?: ReactNode | ComponentType
513
+ title: string;
514
+ i18nTitleKey?: string;
515
+ value: string;
516
+ icon?: ReactNode | ComponentType;
435
517
  }
436
518
 
437
519
  /**
@@ -488,14 +570,14 @@ declare interface BlockDecoratorDefinition {
488
570
  * ```
489
571
  */
490
572
  declare interface BlockDefinition extends BaseSchemaDefinition {
491
- type: 'block'
492
- styles?: BlockStyleDefinition[]
493
- lists?: BlockListDefinition[]
494
- marks?: BlockMarksDefinition
495
- of?: ArrayOfType<'object' | 'reference'>[]
496
- initialValue?: InitialValueProperty<any, any[]>
497
- options?: BlockOptions
498
- validation?: ValidationBuilder<BlockRule, any[]>
573
+ type: "block";
574
+ styles?: BlockStyleDefinition[];
575
+ lists?: BlockListDefinition[];
576
+ marks?: BlockMarksDefinition;
577
+ of?: ArrayOfType<"object" | "reference">[];
578
+ initialValue?: InitialValueProperty<any, any[]>;
579
+ options?: BlockOptions;
580
+ validation?: ValidationBuilder<BlockRule, any[]>;
499
581
  }
500
582
 
501
583
  /**
@@ -521,10 +603,10 @@ declare interface BlockDefinition extends BaseSchemaDefinition {
521
603
  * ```
522
604
  */
523
605
  declare interface BlockListDefinition {
524
- title: string
525
- i18nTitleKey?: string
526
- value: string
527
- icon?: ReactNode | ComponentType
606
+ title: string;
607
+ i18nTitleKey?: string;
608
+ value: string;
609
+ icon?: ReactNode | ComponentType;
528
610
  }
529
611
 
530
612
  /**
@@ -532,8 +614,8 @@ declare interface BlockListDefinition {
532
614
  *
533
615
  * @public */
534
616
  declare interface BlockMarksDefinition {
535
- decorators?: BlockDecoratorDefinition[]
536
- annotations?: ArrayOfType<'object' | 'reference'>[]
617
+ decorators?: BlockDecoratorDefinition[];
618
+ annotations?: ArrayOfType<"object" | "reference">[];
537
619
  }
538
620
 
539
621
  /**
@@ -543,8 +625,8 @@ declare interface BlockOptions extends BaseSchemaTypeOptions {
543
625
  /**
544
626
  * Turn on or off the builtin browser spellchecking. Default is on.
545
627
  */
546
- spellCheck?: boolean
547
- unstable_whitespaceOnPasteMode?: 'preserve' | 'normalize' | 'remove'
628
+ spellCheck?: boolean;
629
+ unstable_whitespaceOnPasteMode?: "preserve" | "normalize" | "remove";
548
630
  /**
549
631
  * When enabled, the editor will restrict all line breaks and soft breaks,
550
632
  * forcing content to remain on a single line. This will also update
@@ -554,7 +636,7 @@ declare interface BlockOptions extends BaseSchemaTypeOptions {
554
636
  *
555
637
  * @defaultValue false
556
638
  */
557
- oneLine?: boolean
639
+ oneLine?: boolean;
558
640
  }
559
641
 
560
642
  /** @public */
@@ -615,23 +697,23 @@ declare interface BlockRule extends RuleDef<BlockRule, any[]> {}
615
697
  * ```
616
698
  */
617
699
  declare interface BlockStyleDefinition {
618
- title: string
619
- value: string
620
- i18nTitleKey?: string
621
- icon?: ReactNode | ComponentType
700
+ title: string;
701
+ value: string;
702
+ i18nTitleKey?: string;
703
+ icon?: ReactNode | ComponentType;
622
704
  }
623
705
 
624
706
  /** @public */
625
707
  declare interface BooleanDefinition extends BaseSchemaDefinition {
626
- type: 'boolean'
627
- options?: BooleanOptions
628
- initialValue?: InitialValueProperty<any, boolean>
629
- validation?: ValidationBuilder<BooleanRule, boolean>
708
+ type: "boolean";
709
+ options?: BooleanOptions;
710
+ initialValue?: InitialValueProperty<any, boolean>;
711
+ validation?: ValidationBuilder<BooleanRule, boolean>;
630
712
  }
631
713
 
632
714
  /** @public */
633
715
  declare interface BooleanOptions extends BaseSchemaTypeOptions {
634
- layout?: 'switch' | 'checkbox'
716
+ layout?: "switch" | "checkbox";
635
717
  }
636
718
 
637
719
  /** @public */
@@ -639,9 +721,9 @@ declare interface BooleanRule extends RuleDef<BooleanRule, boolean> {}
639
721
 
640
722
  /** @public */
641
723
  declare interface BooleanSchemaType extends BaseSchemaType {
642
- jsonType: 'boolean'
643
- options?: BooleanOptions
644
- initialValue?: InitialValueProperty<any, boolean>
724
+ jsonType: "boolean";
725
+ options?: BooleanOptions;
726
+ initialValue?: InitialValueProperty<any, boolean>;
645
727
  }
646
728
 
647
729
  /**
@@ -651,82 +733,91 @@ declare interface BooleanSchemaType extends BaseSchemaType {
651
733
  */
652
734
  declare interface CanvasAppOptions {
653
735
  /** Set to true to exclude a type or field from appearing in Canvas */
654
- exclude?: boolean
736
+ exclude?: boolean;
655
737
  /**
656
738
  * A short description of what the type or field is used for.
657
739
  * Purpose can be used to improve how and when content mapping uses the field.
658
740
  * */
659
- purpose?: string
741
+ purpose?: string;
660
742
  }
661
743
 
662
744
  /** @public */
663
745
  declare interface CollapseOptions {
664
- collapsed?: boolean
665
- collapsible?: boolean
746
+ collapsed?: boolean;
747
+ collapsible?: boolean;
666
748
  /**
667
749
  * @deprecated Use `collapsible` instead
668
750
  */
669
- collapsable?: boolean
751
+ collapsable?: boolean;
670
752
  }
671
753
 
672
754
  /** @public */
673
- declare type ConditionalProperty = boolean | ConditionalPropertyCallback | undefined
755
+ declare type ConditionalProperty =
756
+ | boolean
757
+ | ConditionalPropertyCallback
758
+ | undefined;
674
759
 
675
760
  /** @public */
676
- declare type ConditionalPropertyCallback = (context: ConditionalPropertyCallbackContext) => boolean
761
+ declare type ConditionalPropertyCallback = (
762
+ context: ConditionalPropertyCallbackContext,
763
+ ) => boolean;
677
764
 
678
765
  /** @public */
679
766
  declare interface ConditionalPropertyCallbackContext {
680
- document: SanityDocument | undefined
681
- parent: any
682
- value: any
683
- currentUser: Omit<CurrentUser, 'role'> | null
767
+ document: SanityDocument | undefined;
768
+ parent: any;
769
+ value: any;
770
+ currentUser: Omit<CurrentUser, "role"> | null;
771
+ path: Path;
684
772
  }
685
773
 
686
774
  /** @public */
687
775
  declare interface CrossDatasetReferenceDefinition extends BaseSchemaDefinition {
688
- type: 'crossDatasetReference'
689
- weak?: boolean
776
+ type: "crossDatasetReference";
777
+ weak?: boolean;
690
778
  to: {
691
- type: string
692
- title?: string
693
- icon?: ComponentType
694
- preview?: PreviewConfig
779
+ type: string;
780
+ title?: string;
781
+ icon?: ComponentType;
782
+ preview?: PreviewConfig;
695
783
  /**
696
784
  * @deprecated Unused. Configuring search is no longer supported.
697
785
  */
698
786
  __experimental_search?: {
699
- path: string | string[]
700
- weight?: number
701
- mapWith?: string
702
- }[]
703
- }[]
704
- dataset: string
705
- studioUrl?: (document: {id: string; type?: string}) => string | null
706
- tokenId?: string
707
- options?: ReferenceOptions
787
+ path: string | string[];
788
+ weight?: number;
789
+ mapWith?: string;
790
+ }[];
791
+ }[];
792
+ dataset: string;
793
+ studioUrl?: (document: { id: string; type?: string }) => string | null;
794
+ tokenId?: string;
795
+ options?: ReferenceOptions;
708
796
  /**
709
797
  * @deprecated Cross-project references are no longer supported, only cross-dataset
710
798
  */
711
- projectId?: string
799
+ projectId?: string;
712
800
  }
713
801
 
714
802
  /** @public */
715
803
  declare interface CurrentUser {
716
- id: string
717
- name: string
718
- email: string
719
- profileImage?: string
720
- provider?: string
804
+ id: string;
805
+ name: string;
806
+ email: string;
807
+ profileImage?: string;
808
+ provider?: string;
721
809
  /** @deprecated use `roles` instead */
722
- role: string
723
- roles: Role[]
810
+ role: string;
811
+ roles: Role[];
724
812
  }
725
813
 
726
814
  /** @public */
727
815
  declare interface CustomValidator<T = unknown> {
728
- (value: T, context: ValidationContext): CustomValidatorResult | Promise<CustomValidatorResult>
729
- bypassConcurrencyLimit?: boolean
816
+ (
817
+ value: T,
818
+ context: ValidationContext,
819
+ ): CustomValidatorResult | Promise<CustomValidatorResult>;
820
+ bypassConcurrencyLimit?: boolean;
730
821
  }
731
822
 
732
823
  /** @public */
@@ -735,20 +826,20 @@ declare type CustomValidatorResult =
735
826
  | string
736
827
  | ValidationError
737
828
  | ValidationError[]
738
- | LocalizedValidationMessages
829
+ | LocalizedValidationMessages;
739
830
 
740
831
  /** @public */
741
832
  declare interface DateDefinition extends BaseSchemaDefinition {
742
- type: 'date'
743
- options?: DateOptions
744
- placeholder?: string
745
- validation?: ValidationBuilder<DateRule, string>
746
- initialValue?: InitialValueProperty<any, string>
833
+ type: "date";
834
+ options?: DateOptions;
835
+ placeholder?: string;
836
+ validation?: ValidationBuilder<DateRule, string>;
837
+ initialValue?: InitialValueProperty<any, string>;
747
838
  }
748
839
 
749
840
  /** @public */
750
841
  declare interface DateOptions extends BaseSchemaTypeOptions {
751
- dateFormat?: string
842
+ dateFormat?: string;
752
843
  }
753
844
 
754
845
  /** @public */
@@ -756,29 +847,29 @@ declare interface DateRule extends RuleDef<DateRule, string> {
756
847
  /**
757
848
  * @param minDate - Minimum date (inclusive). minDate should be in ISO 8601 format.
758
849
  */
759
- min: (minDate: string | FieldReference) => DateRule
850
+ min: (minDate: string | FieldReference) => DateRule;
760
851
  /**
761
852
  * @param maxDate - Maximum date (inclusive). maxDate should be in ISO 8601 format.
762
853
  */
763
- max: (maxDate: string | FieldReference) => DateRule
854
+ max: (maxDate: string | FieldReference) => DateRule;
764
855
  }
765
856
 
766
857
  /** @public */
767
858
  declare interface DatetimeDefinition extends BaseSchemaDefinition {
768
- type: 'datetime'
769
- options?: DatetimeOptions
770
- placeholder?: string
771
- validation?: ValidationBuilder<DatetimeRule, string>
772
- initialValue?: InitialValueProperty<any, string>
859
+ type: "datetime";
860
+ options?: DatetimeOptions;
861
+ placeholder?: string;
862
+ validation?: ValidationBuilder<DatetimeRule, string>;
863
+ initialValue?: InitialValueProperty<any, string>;
773
864
  }
774
865
 
775
866
  /** @public */
776
867
  declare interface DatetimeOptions extends BaseSchemaTypeOptions {
777
- dateFormat?: string
778
- timeFormat?: string
779
- timeStep?: number
780
- displayTimeZone?: string
781
- allowTimeZoneSwitch?: boolean
868
+ dateFormat?: string;
869
+ timeFormat?: string;
870
+ timeStep?: number;
871
+ displayTimeZone?: string;
872
+ allowTimeZoneSwitch?: boolean;
782
873
  }
783
874
 
784
875
  /** @public */
@@ -786,47 +877,47 @@ declare interface DatetimeRule extends RuleDef<DatetimeRule, string> {
786
877
  /**
787
878
  * @param minDate - Minimum date (inclusive). minDate should be in ISO 8601 format.
788
879
  */
789
- min: (minDate: string | FieldReference) => DatetimeRule
880
+ min: (minDate: string | FieldReference) => DatetimeRule;
790
881
  /**
791
882
  * @param maxDate - Maximum date (inclusive). maxDate should be in ISO 8601 format.
792
883
  */
793
- max: (maxDate: string | FieldReference) => DatetimeRule
884
+ max: (maxDate: string | FieldReference) => DatetimeRule;
794
885
  }
795
886
 
796
887
  /** @public */
797
888
  declare interface DeprecatedProperty {
798
- reason: string
889
+ reason: string;
799
890
  }
800
891
 
801
892
  /**
802
893
  * @public
803
894
  */
804
895
  declare interface DeprecationConfiguration {
805
- deprecated: DeprecatedProperty
896
+ deprecated: DeprecatedProperty;
806
897
  }
807
898
 
808
899
  /** @public */
809
- declare interface DocumentDefinition extends Omit<ObjectDefinition, 'type'> {
810
- type: 'document'
811
- liveEdit?: boolean
900
+ declare interface DocumentDefinition extends Omit<ObjectDefinition, "type"> {
901
+ type: "document";
902
+ liveEdit?: boolean;
812
903
  /** @beta */
813
- orderings?: SortOrdering[]
814
- options?: DocumentOptions
815
- validation?: ValidationBuilder<DocumentRule, SanityDocument>
816
- initialValue?: InitialValueProperty<any, Record<string, unknown>>
904
+ orderings?: SortOrdering[];
905
+ options?: DocumentOptions;
906
+ validation?: ValidationBuilder<DocumentRule, SanityDocument>;
907
+ initialValue?: InitialValueProperty<any, Record<string, unknown>>;
817
908
  /** @deprecated Unused. Use the new field-level search config. */
818
909
  __experimental_search?: {
819
- path: string
820
- weight: number
821
- mapWith?: string
822
- }[]
910
+ path: string;
911
+ weight: number;
912
+ mapWith?: string;
913
+ }[];
823
914
  /** @alpha */
824
- __experimental_omnisearch_visibility?: boolean
915
+ __experimental_omnisearch_visibility?: boolean;
825
916
  /**
826
917
  * Determines whether the large preview title is displayed in the document pane form
827
918
  * @alpha
828
919
  * */
829
- __experimental_formPreviewTitle?: boolean
920
+ __experimental_formPreviewTitle?: boolean;
830
921
  }
831
922
 
832
923
  /**
@@ -841,11 +932,11 @@ declare interface DocumentRule extends RuleDef<DocumentRule, SanityDocument> {}
841
932
 
842
933
  /** @public */
843
934
  declare interface EmailDefinition extends BaseSchemaDefinition {
844
- type: 'email'
845
- options?: EmailOptions
846
- placeholder?: string
847
- validation?: ValidationBuilder<EmailRule, string>
848
- initialValue?: InitialValueProperty<any, string>
935
+ type: "email";
936
+ options?: EmailOptions;
937
+ placeholder?: string;
938
+ validation?: ValidationBuilder<EmailRule, string>;
939
+ initialValue?: InitialValueProperty<any, string>;
849
940
  }
850
941
 
851
942
  /** @public */
@@ -854,14 +945,11 @@ declare interface EmailOptions extends BaseSchemaTypeOptions {}
854
945
  /** @public */
855
946
  declare interface EmailRule extends RuleDef<EmailRule, string> {}
856
947
 
857
- /** @public */
858
- declare interface EmptyProps {}
859
-
860
948
  /** @public */
861
949
  declare interface EnumListProps<V = unknown> {
862
- list?: Array<TitledListValue<V> | V>
863
- layout?: 'radio' | 'dropdown'
864
- direction?: 'horizontal' | 'vertical'
950
+ list?: Array<TitledListValue<V> | V>;
951
+ layout?: "radio" | "dropdown";
952
+ direction?: "horizontal" | "vertical";
865
953
  }
866
954
 
867
955
  /**
@@ -879,35 +967,36 @@ declare interface EnumListProps<V = unknown> {
879
967
  declare type FieldDefinition<
880
968
  TType extends IntrinsicTypeName = IntrinsicTypeName,
881
969
  TAlias extends IntrinsicTypeName | undefined = undefined,
882
- > = (InlineFieldDefinition[TType] | TypeAliasDefinition<string, TAlias>) & FieldDefinitionBase
970
+ > = (InlineFieldDefinition[TType] | TypeAliasDefinition<string, TAlias>) &
971
+ FieldDefinitionBase;
883
972
 
884
973
  /** @public */
885
974
  declare interface FieldDefinitionBase {
886
- fieldset?: string
887
- group?: string | string[]
975
+ fieldset?: string;
976
+ group?: string | string[];
888
977
  }
889
978
 
890
979
  /** @public */
891
980
  declare interface FieldGroup {
892
- name: string
893
- icon?: ComponentType
894
- title?: string
895
- description?: string
896
- i18n?: I18nTextRecord<'title'>
897
- hidden?: ConditionalProperty
898
- default?: boolean
899
- fields?: ObjectField[]
981
+ name: string;
982
+ icon?: ComponentType;
983
+ title?: string;
984
+ description?: string;
985
+ i18n?: I18nTextRecord<"title">;
986
+ hidden?: ConditionalProperty;
987
+ default?: boolean;
988
+ fields?: ObjectField[];
900
989
  }
901
990
 
902
991
  /** @public */
903
992
  declare type FieldGroupDefinition = {
904
- name: string
905
- title?: string
906
- hidden?: ConditionalProperty
907
- icon?: ComponentType
908
- default?: boolean
909
- i18n?: I18nTextRecord<'title'>
910
- }
993
+ name: string;
994
+ title?: string;
995
+ hidden?: ConditionalProperty;
996
+ icon?: ComponentType;
997
+ default?: boolean;
998
+ i18n?: I18nTextRecord<"title">;
999
+ };
911
1000
 
912
1001
  /**
913
1002
  * Holds a reference to a different field
@@ -916,53 +1005,58 @@ declare type FieldGroupDefinition = {
916
1005
  * @public
917
1006
  */
918
1007
  declare interface FieldReference {
919
- type: symbol
920
- path: string | string[]
1008
+ type: symbol;
1009
+ path: string | string[];
921
1010
  }
922
1011
 
923
1012
  /** @public */
924
1013
  declare type FieldRules = {
925
- [fieldKey: string]: SchemaValidationValue
926
- }
1014
+ [fieldKey: string]: SchemaValidationValue;
1015
+ };
927
1016
 
928
1017
  /** @public */
929
- declare type Fieldset = SingleFieldSet | MultiFieldSet
1018
+ declare type Fieldset = SingleFieldSet | MultiFieldSet;
930
1019
 
931
1020
  /** @public */
932
- declare type FieldsetDefinition = {
933
- name: string
934
- title?: string
935
- description?: string
936
- group?: string
937
- hidden?: ConditionalProperty
938
- readOnly?: ConditionalProperty
939
- options?: ObjectOptions
1021
+ declare interface FieldsetDefinition {
1022
+ name: string;
1023
+ title?: string;
1024
+ description?: string;
1025
+ group?: string;
1026
+ hidden?: ConditionalProperty;
1027
+ readOnly?: ConditionalProperty;
1028
+ options?: ObjectOptions;
940
1029
  }
941
1030
 
942
1031
  /** @public */
943
1032
  declare interface File_2 {
944
- [key: string]: unknown
945
- asset?: Reference
1033
+ [key: string]: unknown;
1034
+ asset?: Reference;
946
1035
  }
947
1036
 
948
1037
  /** @public */
949
1038
  declare interface FileDefinition extends Omit<
950
1039
  ObjectDefinition,
951
- 'type' | 'fields' | 'options' | 'groups' | 'validation'
1040
+ "type" | "fields" | "options" | "groups" | "validation"
952
1041
  > {
953
- type: 'file'
954
- fields?: ObjectDefinition['fields']
955
- options?: FileOptions
956
- validation?: ValidationBuilder<FileRule, FileValue>
957
- initialValue?: InitialValueProperty<any, FileValue>
1042
+ type: "file";
1043
+ fields?: ObjectDefinition["fields"];
1044
+ options?: FileOptions;
1045
+ validation?: ValidationBuilder<FileRule, FileValue>;
1046
+ initialValue?: InitialValueProperty<any, FileValue>;
958
1047
  }
959
1048
 
960
1049
  /** @public */
961
1050
  declare interface FileOptions extends ObjectOptions {
962
- storeOriginalFilename?: boolean
963
- accept?: string
964
- sources?: AssetSource[]
965
- mediaLibrary?: MediaLibraryOptions
1051
+ storeOriginalFilename?: boolean;
1052
+ accept?: string;
1053
+ sources?: AssetSource[];
1054
+ mediaLibrary?: MediaLibraryOptions;
1055
+ /**
1056
+ * When set to `true`, hides the upload UI, only allowing selection of existing assets from the media library.
1057
+ * Useful for centralized asset management workflows where ad-hoc uploads should be prevented.
1058
+ */
1059
+ disableNew?: boolean;
966
1060
  }
967
1061
 
968
1062
  /** @public */
@@ -980,46 +1074,51 @@ declare interface FileRule extends RuleDef<FileRule, FileValue> {
980
1074
  * })
981
1075
  * ```
982
1076
  */
983
- assetRequired(): FileRule
1077
+ assetRequired(): FileRule;
984
1078
  }
985
1079
 
986
1080
  /** @public */
987
- declare interface FileSchemaType extends Omit<ObjectSchemaType, 'options'> {
988
- options?: FileOptions
1081
+ declare interface FileSchemaType extends Omit<ObjectSchemaType, "options"> {
1082
+ options?: FileOptions;
989
1083
  }
990
1084
 
991
- export declare type FileStatus = 'pending' | 'uploading' | 'complete' | 'error' | 'alreadyExists'
1085
+ export declare type FileStatus =
1086
+ | "pending"
1087
+ | "uploading"
1088
+ | "complete"
1089
+ | "error"
1090
+ | "alreadyExists";
992
1091
 
993
1092
  /**
994
1093
  * Wrapper object for the file upload with progress and status
995
1094
  */
996
1095
  export declare interface FileUpload {
997
- id: string
998
- file: File
999
- status: FileStatus
1000
- progress: number
1001
- error?: Error
1096
+ id: string;
1097
+ file: File;
1098
+ status: FileStatus;
1099
+ progress: number;
1100
+ error?: Error;
1002
1101
  }
1003
1102
 
1004
1103
  /** @public */
1005
1104
  declare interface FileValue {
1006
- asset?: Reference
1007
- [index: string]: unknown
1105
+ asset?: Reference;
1106
+ [index: string]: unknown;
1008
1107
  }
1009
1108
 
1010
1109
  declare type Geopoint = {
1011
- _type: 'geopoint'
1012
- lat?: number
1013
- lng?: number
1014
- alt?: number
1015
- }
1110
+ _type: "geopoint";
1111
+ lat?: number;
1112
+ lng?: number;
1113
+ alt?: number;
1114
+ };
1016
1115
 
1017
1116
  /** @public */
1018
1117
  declare interface GeopointDefinition extends BaseSchemaDefinition {
1019
- type: 'geopoint'
1020
- options?: GeopointOptions
1021
- validation?: ValidationBuilder<GeopointRule, GeopointValue>
1022
- initialValue?: InitialValueProperty<any, Omit<GeopointValue, '_type'>>
1118
+ type: "geopoint";
1119
+ options?: GeopointOptions;
1120
+ validation?: ValidationBuilder<GeopointRule, GeopointValue>;
1121
+ initialValue?: InitialValueProperty<any, Omit<GeopointValue, "_type">>;
1023
1122
  }
1024
1123
 
1025
1124
  /** @public */
@@ -1039,131 +1138,141 @@ declare interface GeopointValue {
1039
1138
  /**
1040
1139
  * Type of the object. Must be `geopoint`.
1041
1140
  */
1042
- _type: 'geopoint'
1141
+ _type: "geopoint";
1043
1142
  /**
1044
1143
  * Latitude in degrees
1045
1144
  */
1046
- lat: number
1145
+ lat: number;
1047
1146
  /**
1048
1147
  * Longitude in degrees
1049
1148
  */
1050
- lng: number
1149
+ lng: number;
1051
1150
  /**
1052
1151
  * Altitude in meters
1053
1152
  */
1054
- alt?: number
1153
+ alt?: number;
1055
1154
  }
1056
1155
 
1057
1156
  /** @public */
1058
1157
  declare interface GlobalDocumentReferenceDefinition extends BaseSchemaDefinition {
1059
- type: 'globalDocumentReference'
1060
- weak?: boolean
1158
+ type: "globalDocumentReference";
1159
+ weak?: boolean;
1061
1160
  to: {
1062
- type: string
1063
- title?: string
1064
- icon?: ComponentType
1065
- preview?: PreviewConfig
1066
- }[]
1067
- resourceType: string
1068
- resourceId: string
1069
- options?: ReferenceOptions
1070
- studioUrl?: string | ((document: {id: string; type?: string}) => string | null)
1161
+ type: string;
1162
+ title?: string;
1163
+ icon?: ComponentType;
1164
+ preview?: PreviewConfig;
1165
+ }[];
1166
+ resourceType: string;
1167
+ resourceId: string;
1168
+ options?: ReferenceOptions;
1169
+ studioUrl?:
1170
+ | string
1171
+ | ((document: { id: string; type?: string }) => string | null);
1071
1172
  }
1072
1173
 
1073
1174
  /** @public */
1074
1175
  declare interface HotspotOptions {
1075
- previews?: HotspotPreview[]
1176
+ previews?: HotspotPreview[];
1076
1177
  }
1077
1178
 
1078
1179
  /** @public */
1079
1180
  declare interface HotspotPreview {
1080
- title: string
1081
- aspectRatio: number
1181
+ title: string;
1182
+ aspectRatio: number;
1082
1183
  }
1083
1184
 
1084
1185
  /** @public */
1085
1186
  declare type I18nTextRecord<K extends string> = {
1086
1187
  [P in K]?: {
1087
- key: string
1088
- ns: string
1089
- }
1090
- }
1188
+ key: string;
1189
+ ns: string;
1190
+ };
1191
+ };
1091
1192
 
1092
1193
  /** @public */
1093
1194
  declare interface ImageAsset extends Asset_2 {
1094
- _type: 'sanity.imageAsset'
1095
- metadata: ImageMetadata
1195
+ _type: "sanity.imageAsset";
1196
+ metadata: ImageMetadata;
1096
1197
  }
1097
1198
 
1098
1199
  /** @public */
1099
1200
  declare interface ImageCrop {
1100
- _type?: 'sanity.imageCrop'
1101
- left: number
1102
- bottom: number
1103
- right: number
1104
- top: number
1201
+ _type?: "sanity.imageCrop";
1202
+ left: number;
1203
+ bottom: number;
1204
+ right: number;
1205
+ top: number;
1105
1206
  }
1106
1207
 
1107
1208
  /** @public */
1108
1209
  declare interface ImageDefinition extends Omit<
1109
1210
  ObjectDefinition,
1110
- 'type' | 'fields' | 'options' | 'groups' | 'validation'
1211
+ "type" | "fields" | "options" | "groups" | "validation"
1111
1212
  > {
1112
- type: 'image'
1113
- fields?: FieldDefinition[]
1114
- options?: ImageOptions
1115
- validation?: ValidationBuilder<ImageRule, ImageValue>
1116
- initialValue?: InitialValueProperty<any, ImageValue>
1213
+ type: "image";
1214
+ fields?: FieldDefinition[];
1215
+ options?: ImageOptions;
1216
+ validation?: ValidationBuilder<ImageRule, ImageValue>;
1217
+ initialValue?: InitialValueProperty<any, ImageValue>;
1117
1218
  }
1118
1219
 
1119
1220
  /** @public */
1120
1221
  declare interface ImageDimensions {
1121
- _type: 'sanity.imageDimensions'
1122
- height: number
1123
- width: number
1124
- aspectRatio: number
1222
+ _type: "sanity.imageDimensions";
1223
+ height: number;
1224
+ width: number;
1225
+ aspectRatio: number;
1125
1226
  }
1126
1227
 
1127
1228
  /** @public */
1128
1229
  declare interface ImageHotspot {
1129
- _type?: 'sanity.imageHotspot'
1130
- width: number
1131
- height: number
1132
- x: number
1133
- y: number
1230
+ _type?: "sanity.imageHotspot";
1231
+ width: number;
1232
+ height: number;
1233
+ x: number;
1234
+ y: number;
1134
1235
  }
1135
1236
 
1136
1237
  /** @public */
1137
1238
  declare interface ImageMetadata {
1138
- [key: string]: unknown
1139
- _type: 'sanity.imageMetadata'
1140
- dimensions: ImageDimensions
1141
- palette?: ImagePalette
1142
- lqip?: string
1143
- blurHash?: string
1144
- hasAlpha: boolean
1145
- isOpaque: boolean
1239
+ [key: string]: unknown;
1240
+ _type: "sanity.imageMetadata";
1241
+ dimensions: ImageDimensions;
1242
+ palette?: ImagePalette;
1243
+ lqip?: string;
1244
+ blurHash?: string;
1245
+ thumbHash?: string;
1246
+ hasAlpha: boolean;
1247
+ isOpaque: boolean;
1146
1248
  }
1147
1249
 
1148
1250
  /** @public */
1149
- declare type ImageMetadataType = 'blurhash' | 'lqip' | 'palette' | 'exif' | 'image' | 'location'
1251
+ declare type ImageMetadataType =
1252
+ | "blurhash"
1253
+ | "thumbhash"
1254
+ | "lqip"
1255
+ | "palette"
1256
+ | "exif"
1257
+ | "image"
1258
+ | "location";
1150
1259
 
1151
1260
  /** @public */
1152
1261
  declare interface ImageOptions extends FileOptions {
1153
- metadata?: ImageMetadataType[]
1154
- hotspot?: boolean | HotspotOptions
1262
+ metadata?: ImageMetadataType[];
1263
+ hotspot?: boolean | HotspotOptions;
1155
1264
  }
1156
1265
 
1157
1266
  /** @public */
1158
1267
  declare interface ImagePalette {
1159
- _type: 'sanity.imagePalette'
1160
- darkMuted?: ImageSwatch
1161
- darkVibrant?: ImageSwatch
1162
- dominant?: ImageSwatch
1163
- lightMuted?: ImageSwatch
1164
- lightVibrant?: ImageSwatch
1165
- muted?: ImageSwatch
1166
- vibrant?: ImageSwatch
1268
+ _type: "sanity.imagePalette";
1269
+ darkMuted?: ImageSwatch;
1270
+ darkVibrant?: ImageSwatch;
1271
+ dominant?: ImageSwatch;
1272
+ lightMuted?: ImageSwatch;
1273
+ lightVibrant?: ImageSwatch;
1274
+ muted?: ImageSwatch;
1275
+ vibrant?: ImageSwatch;
1167
1276
  }
1168
1277
 
1169
1278
  /** @public */
@@ -1181,64 +1290,64 @@ declare interface ImageRule extends RuleDef<ImageRule, ImageValue> {
1181
1290
  * })
1182
1291
  * ```
1183
1292
  */
1184
- assetRequired(): ImageRule
1293
+ assetRequired(): ImageRule;
1185
1294
  }
1186
1295
 
1187
1296
  /** @public */
1188
- declare interface ImageSchemaType extends Omit<ObjectSchemaType, 'options'> {
1189
- options?: ImageOptions
1297
+ declare interface ImageSchemaType extends Omit<ObjectSchemaType, "options"> {
1298
+ options?: ImageOptions;
1190
1299
  }
1191
1300
 
1192
1301
  /** @public */
1193
1302
  declare interface ImageSwatch {
1194
- _type: 'sanity.imagePaletteSwatch'
1195
- background: string
1196
- foreground: string
1197
- population: number
1198
- title?: string
1303
+ _type: "sanity.imagePaletteSwatch";
1304
+ background: string;
1305
+ foreground: string;
1306
+ population: number;
1307
+ title?: string;
1199
1308
  }
1200
1309
 
1201
1310
  /** @public */
1202
1311
  declare interface ImageValue extends FileValue {
1203
- crop?: ImageCrop
1204
- hotspot?: ImageHotspot
1205
- [index: string]: unknown
1312
+ crop?: ImageCrop;
1313
+ hotspot?: ImageHotspot;
1314
+ [index: string]: unknown;
1206
1315
  }
1207
1316
 
1208
1317
  /** @public */
1209
- declare type IndexTuple = [number | '', number | '']
1318
+ declare type IndexTuple = [number | "", number | ""];
1210
1319
 
1211
1320
  /** @public */
1212
1321
  declare type InitialValueProperty<Params, Value> =
1213
1322
  | Value
1214
1323
  | InitialValueResolver<Params, Value>
1215
- | undefined
1324
+ | undefined;
1216
1325
 
1217
1326
  /** @public */
1218
1327
  declare type InitialValueResolver<Params, Value> = (
1219
1328
  params: Params | undefined,
1220
1329
  context: InitialValueResolverContext,
1221
- ) => Promise<Value> | Value
1330
+ ) => Promise<Value> | Value;
1222
1331
 
1223
1332
  /** @public */
1224
1333
  declare interface InitialValueResolverContext {
1225
- projectId: string
1226
- dataset: string
1227
- schema: Schema
1228
- currentUser: CurrentUser | null
1229
- getClient: (options: {apiVersion: string}) => SanityClient
1334
+ projectId: string;
1335
+ dataset: string;
1336
+ schema: Schema;
1337
+ currentUser: CurrentUser | null;
1338
+ getClient: (options: { apiVersion: string }) => SanityClient;
1230
1339
  }
1231
1340
 
1232
1341
  /** @public */
1233
1342
  declare type InlineFieldDefinition = {
1234
1343
  [K in keyof IntrinsicDefinitions]: Omit<
1235
1344
  IntrinsicDefinitions[K],
1236
- 'initialValue' | 'validation'
1345
+ "initialValue" | "validation"
1237
1346
  > & {
1238
- validation?: SchemaValidationValue
1239
- initialValue?: InitialValueProperty<any, any>
1240
- }
1241
- }
1347
+ validation?: SchemaValidationValue;
1348
+ initialValue?: InitialValueProperty<any, any>;
1349
+ };
1350
+ };
1242
1351
 
1243
1352
  /** @alpha This API may change */
1244
1353
  declare interface InsertMenuOptions {
@@ -1247,42 +1356,42 @@ declare interface InsertMenuOptions {
1247
1356
  * `filter: 'auto'` automatically turns on filtering if there are more than 5
1248
1357
  * schema types added to the menu.
1249
1358
  */
1250
- filter?: 'auto' | boolean | undefined
1359
+ filter?: "auto" | boolean | undefined;
1251
1360
  groups?:
1252
1361
  | Array<{
1253
- name: string
1254
- title?: string
1255
- of?: Array<string>
1362
+ name: string;
1363
+ title?: string;
1364
+ of?: Array<string>;
1256
1365
  }>
1257
- | undefined
1366
+ | undefined;
1258
1367
  /** defaultValue `true` */
1259
- showIcons?: boolean | undefined
1368
+ showIcons?: boolean | undefined;
1260
1369
  /** @defaultValue `[{name: 'list'}]` */
1261
1370
  views?:
1262
1371
  | Array<
1263
1372
  | {
1264
- name: 'list'
1373
+ name: "list";
1265
1374
  }
1266
1375
  | {
1267
- name: 'grid'
1268
- previewImageUrl?: (schemaTypeName: string) => string | undefined
1376
+ name: "grid";
1377
+ previewImageUrl?: (schemaTypeName: string) => string | undefined;
1269
1378
  }
1270
1379
  >
1271
- | undefined
1380
+ | undefined;
1272
1381
  }
1273
1382
 
1274
- declare const internalGroqTypeReferenceTo: unique symbol
1383
+ declare const internalGroqTypeReferenceTo: unique symbol;
1275
1384
 
1276
1385
  /** @public */
1277
1386
  declare type IntrinsicArrayOfDefinition = {
1278
1387
  [K in keyof IntrinsicDefinitions]: Omit<
1279
1388
  ArrayOfEntry<IntrinsicDefinitions[K]>,
1280
- 'validation' | 'initialValue'
1389
+ "validation" | "initialValue"
1281
1390
  > & {
1282
- validation?: SchemaValidationValue
1283
- initialValue?: InitialValueProperty<any, any>
1284
- }
1285
- }
1391
+ validation?: SchemaValidationValue;
1392
+ initialValue?: InitialValueProperty<any, any>;
1393
+ };
1394
+ };
1286
1395
 
1287
1396
  /**
1288
1397
  * `IntrinsicDefinitions` is a lookup map for "predefined" schema definitions.
@@ -1300,25 +1409,25 @@ declare type IntrinsicArrayOfDefinition = {
1300
1409
  * @public
1301
1410
  */
1302
1411
  declare interface IntrinsicDefinitions {
1303
- array: ArrayDefinition
1304
- block: BlockDefinition
1305
- boolean: BooleanDefinition
1306
- date: DateDefinition
1307
- datetime: DatetimeDefinition
1308
- document: DocumentDefinition
1309
- file: FileDefinition
1310
- geopoint: GeopointDefinition
1311
- image: ImageDefinition
1312
- number: NumberDefinition
1313
- object: ObjectDefinition
1314
- reference: ReferenceDefinition
1315
- crossDatasetReference: CrossDatasetReferenceDefinition
1316
- globalDocumentReference: GlobalDocumentReferenceDefinition
1317
- slug: SlugDefinition
1318
- string: StringDefinition
1319
- text: TextDefinition
1320
- url: UrlDefinition
1321
- email: EmailDefinition
1412
+ array: ArrayDefinition;
1413
+ block: BlockDefinition;
1414
+ boolean: BooleanDefinition;
1415
+ date: DateDefinition;
1416
+ datetime: DatetimeDefinition;
1417
+ document: DocumentDefinition;
1418
+ file: FileDefinition;
1419
+ geopoint: GeopointDefinition;
1420
+ image: ImageDefinition;
1421
+ number: NumberDefinition;
1422
+ object: ObjectDefinition;
1423
+ reference: ReferenceDefinition;
1424
+ crossDatasetReference: CrossDatasetReferenceDefinition;
1425
+ globalDocumentReference: GlobalDocumentReferenceDefinition;
1426
+ slug: SlugDefinition;
1427
+ string: StringDefinition;
1428
+ text: TextDefinition;
1429
+ url: UrlDefinition;
1430
+ email: EmailDefinition;
1322
1431
  }
1323
1432
 
1324
1433
  /**
@@ -1328,12 +1437,13 @@ declare interface IntrinsicDefinitions {
1328
1437
  *
1329
1438
  * @public
1330
1439
  */
1331
- declare type IntrinsicTypeName = IntrinsicDefinitions[keyof IntrinsicDefinitions]['type']
1440
+ declare type IntrinsicTypeName =
1441
+ IntrinsicDefinitions[keyof IntrinsicDefinitions]["type"];
1332
1442
 
1333
1443
  /** @public */
1334
1444
  declare type KeyedSegment = {
1335
- _key: string
1336
- }
1445
+ _key: string;
1446
+ };
1337
1447
 
1338
1448
  /**
1339
1449
  * Holds localized validation messages for a given field.
@@ -1348,25 +1458,27 @@ declare type KeyedSegment = {
1348
1458
  * @public
1349
1459
  */
1350
1460
  declare interface LocalizedValidationMessages {
1351
- [locale: string]: string
1461
+ [locale: string]: string;
1352
1462
  }
1353
1463
 
1354
1464
  /** @public */
1355
- declare type MediaAssetTypes = AssetInstanceDocument_2['_type']
1465
+ declare type MediaAssetTypes = AssetInstanceDocument_2["_type"];
1356
1466
 
1357
1467
  /** @public */
1358
1468
  declare interface MediaLibraryFilter {
1359
- name: string
1360
- query: string
1469
+ name: string;
1470
+ query: string;
1361
1471
  }
1362
1472
 
1363
1473
  /** @public */
1364
1474
  declare interface MediaLibraryOptions {
1365
- filters?: MediaLibraryFilter[]
1475
+ filters?: MediaLibraryFilter[];
1366
1476
  }
1367
1477
 
1368
1478
  /** @public */
1369
- declare interface MediaValidationValue<T extends MediaAssetTypes = MediaAssetTypes> {
1479
+ declare interface MediaValidationValue<
1480
+ T extends MediaAssetTypes = MediaAssetTypes,
1481
+ > {
1370
1482
  /**
1371
1483
  * Media information
1372
1484
  */
@@ -1378,15 +1490,15 @@ declare interface MediaValidationValue<T extends MediaAssetTypes = MediaAssetTyp
1378
1490
  currentVersion: Extract<
1379
1491
  AssetInstanceDocument_2,
1380
1492
  {
1381
- _type: T
1493
+ _type: T;
1382
1494
  }
1383
- >
1384
- }
1385
- }
1495
+ >;
1496
+ };
1497
+ };
1386
1498
  /**
1387
1499
  * The field value which the media is used in.
1388
1500
  */
1389
- value: unknown
1501
+ value: unknown;
1390
1502
  }
1391
1503
 
1392
1504
  /** @public */
@@ -1394,159 +1506,163 @@ declare interface MediaValidator<T extends MediaAssetTypes = MediaAssetTypes> {
1394
1506
  (
1395
1507
  value: MediaValidationValue<T>,
1396
1508
  context: ValidationContext,
1397
- ): CustomValidatorResult | Promise<CustomValidatorResult>
1509
+ ): CustomValidatorResult | Promise<CustomValidatorResult>;
1398
1510
  }
1399
1511
 
1400
1512
  /** @public */
1401
1513
  declare interface MultiFieldSet {
1402
- name: string
1403
- title?: string
1404
- description?: string
1405
- single?: false
1406
- group?: string | string[]
1514
+ name: string;
1515
+ title?: string;
1516
+ description?: string;
1517
+ single?: false;
1518
+ group?: string | string[];
1407
1519
  options?: CollapseOptions & {
1408
- columns?: number
1409
- }
1410
- fields: ObjectField[]
1411
- hidden?: ConditionalProperty
1412
- readOnly?: ConditionalProperty
1520
+ columns?: number;
1521
+ };
1522
+ fields: ObjectField[];
1523
+ hidden?: ConditionalProperty;
1524
+ readOnly?: ConditionalProperty;
1413
1525
  }
1414
1526
 
1415
1527
  /** @public */
1416
1528
  declare interface NumberDefinition extends BaseSchemaDefinition {
1417
- type: 'number'
1418
- options?: NumberOptions
1419
- placeholder?: string
1420
- validation?: ValidationBuilder<NumberRule, number>
1421
- initialValue?: InitialValueProperty<any, number>
1529
+ type: "number";
1530
+ options?: NumberOptions;
1531
+ placeholder?: string;
1532
+ validation?: ValidationBuilder<NumberRule, number>;
1533
+ initialValue?: InitialValueProperty<any, number>;
1422
1534
  }
1423
1535
 
1424
1536
  /** @public */
1425
- declare interface NumberOptions extends EnumListProps<number>, BaseSchemaTypeOptions {}
1537
+ declare interface NumberOptions
1538
+ extends EnumListProps<number>, BaseSchemaTypeOptions {}
1426
1539
 
1427
1540
  /** @public */
1428
1541
  declare interface NumberRule extends RuleDef<NumberRule, number> {
1429
- min: (minNumber: number | FieldReference) => NumberRule
1430
- max: (maxNumber: number | FieldReference) => NumberRule
1431
- lessThan: (limit: number | FieldReference) => NumberRule
1432
- greaterThan: (limit: number | FieldReference) => NumberRule
1433
- integer: () => NumberRule
1434
- precision: (limit: number | FieldReference) => NumberRule
1435
- positive: () => NumberRule
1436
- negative: () => NumberRule
1542
+ min: (minNumber: number | FieldReference) => NumberRule;
1543
+ max: (maxNumber: number | FieldReference) => NumberRule;
1544
+ lessThan: (limit: number | FieldReference) => NumberRule;
1545
+ greaterThan: (limit: number | FieldReference) => NumberRule;
1546
+ integer: () => NumberRule;
1547
+ precision: (limit: number | FieldReference) => NumberRule;
1548
+ positive: () => NumberRule;
1549
+ negative: () => NumberRule;
1437
1550
  }
1438
1551
 
1439
1552
  /** @public */
1440
1553
  declare interface NumberSchemaType extends BaseSchemaType {
1441
- jsonType: 'number'
1442
- options?: NumberOptions
1443
- initialValue?: InitialValueProperty<any, number>
1554
+ jsonType: "number";
1555
+ options?: NumberOptions;
1556
+ initialValue?: InitialValueProperty<any, number>;
1444
1557
  }
1445
1558
 
1446
1559
  /** @public */
1447
1560
  declare interface ObjectDefinition extends BaseSchemaDefinition {
1448
- type: 'object'
1561
+ type: "object";
1449
1562
  /**
1450
1563
  * Object must have at least one field. This is validated at Studio startup.
1451
1564
  */
1452
- fields: FieldDefinition[]
1453
- groups?: FieldGroupDefinition[]
1454
- fieldsets?: FieldsetDefinition[]
1455
- preview?: PreviewConfig
1456
- options?: ObjectOptions
1457
- validation?: ValidationBuilder<ObjectRule, Record<string, unknown>>
1458
- initialValue?: InitialValueProperty<any, Record<string, unknown>>
1565
+ fields: FieldDefinition[];
1566
+ groups?: FieldGroupDefinition[];
1567
+ fieldsets?: FieldsetDefinition[];
1568
+ preview?: PreviewConfig;
1569
+ options?: ObjectOptions;
1570
+ validation?: ValidationBuilder<ObjectRule, Record<string, unknown>>;
1571
+ initialValue?: InitialValueProperty<any, Record<string, unknown>>;
1459
1572
  }
1460
1573
 
1461
1574
  /** @public */
1462
1575
  declare interface ObjectField<T extends SchemaType = SchemaType> {
1463
- name: string
1464
- fieldset?: string
1465
- group?: string | string[]
1466
- type: ObjectFieldType<T>
1576
+ name: string;
1577
+ fieldset?: string;
1578
+ group?: string | string[];
1579
+ type: ObjectFieldType<T>;
1467
1580
  }
1468
1581
 
1469
1582
  /** @public */
1470
1583
  declare type ObjectFieldType<T extends SchemaType = SchemaType> = T & {
1471
- hidden?: ConditionalProperty
1472
- readOnly?: ConditionalProperty
1473
- }
1584
+ hidden?: ConditionalProperty;
1585
+ readOnly?: ConditionalProperty;
1586
+ };
1474
1587
 
1475
1588
  /** @public */
1476
1589
  declare interface ObjectOptions extends BaseSchemaTypeOptions {
1477
- collapsible?: boolean
1478
- collapsed?: boolean
1479
- columns?: number
1590
+ collapsible?: boolean;
1591
+ collapsed?: boolean;
1592
+ columns?: number;
1480
1593
  modal?: {
1481
- type?: 'dialog' | 'popover'
1482
- width?: number | number[] | 'auto'
1483
- }
1594
+ type?: "dialog" | "popover";
1595
+ width?: number | number[] | "auto";
1596
+ };
1484
1597
  }
1485
1598
 
1486
1599
  /** @public */
1487
- declare interface ObjectRule extends RuleDef<ObjectRule, Record<string, unknown>> {}
1600
+ declare interface ObjectRule extends RuleDef<
1601
+ ObjectRule,
1602
+ Record<string, unknown>
1603
+ > {}
1488
1604
 
1489
1605
  /** @public */
1490
1606
  declare interface ObjectSchemaType extends BaseSchemaType {
1491
- jsonType: 'object'
1492
- fields: ObjectField[]
1493
- groups?: FieldGroup[]
1494
- fieldsets?: Fieldset[]
1495
- initialValue?: InitialValueProperty<any, Record<string, unknown>>
1496
- weak?: boolean
1607
+ jsonType: "object";
1608
+ fields: ObjectField[];
1609
+ groups?: FieldGroup[];
1610
+ fieldsets?: Fieldset[];
1611
+ initialValue?: InitialValueProperty<any, Record<string, unknown>>;
1612
+ weak?: boolean;
1497
1613
  /** @deprecated Unused. Use the new field-level search config. */
1498
1614
  __experimental_search?: {
1499
- path: (string | number)[]
1500
- weight: number
1501
- mapWith?: string
1502
- }[]
1615
+ path: (string | number)[];
1616
+ weight: number;
1617
+ mapWith?: string;
1618
+ }[];
1503
1619
  /** @alpha */
1504
- __experimental_omnisearch_visibility?: boolean
1620
+ __experimental_omnisearch_visibility?: boolean;
1505
1621
  /** @alpha */
1506
- __experimental_actions?: string[]
1622
+ __experimental_actions?: string[];
1507
1623
  /** @alpha */
1508
- __experimental_formPreviewTitle?: boolean
1624
+ __experimental_formPreviewTitle?: boolean;
1509
1625
  /**
1510
1626
  * @beta
1511
1627
  */
1512
- orderings?: SortOrdering[]
1513
- options?: any
1628
+ orderings?: SortOrdering[];
1629
+ options?: any;
1514
1630
  }
1515
1631
 
1516
1632
  /** @public */
1517
- declare type Path = PathSegment[]
1633
+ declare type Path = PathSegment[];
1518
1634
 
1519
1635
  /** @public */
1520
- declare type PathSegment = string | number | KeyedSegment | IndexTuple
1636
+ declare type PathSegment = string | number | KeyedSegment | IndexTuple;
1521
1637
 
1522
1638
  /**
1523
1639
  * Media Library capabilities that the consumer can declare it supports
1524
1640
  */
1525
1641
  export declare type PluginCapabilities = {
1526
- privateAssets?: boolean
1527
- }
1642
+ privateAssets?: boolean;
1643
+ };
1528
1644
 
1529
1645
  /**
1530
1646
  * Filter that the plugin consumer can use to limit the assets shown
1531
1647
  */
1532
1648
  export declare type PluginFilter = {
1533
- type: 'groq'
1534
- name: string
1535
- query: string
1536
- }
1649
+ type: "groq";
1650
+ name: string;
1651
+ query: string;
1652
+ };
1537
1653
 
1538
1654
  /**
1539
1655
  * Payload used to configure the plugin behavior
1540
1656
  */
1541
1657
  export declare type PluginPayload = {
1542
- auth: 'token' | 'cookie'
1543
- capabilities?: PluginCapabilities
1544
- disableNavigation?: boolean
1545
- pluginFilters?: PluginFilter[]
1546
- scheme: 'light' | 'dark'
1547
- selectAssetTypes: PluginSelectAssetType[]
1548
- selectionType: 'single' | 'multiple'
1549
- }
1658
+ auth: "token" | "cookie";
1659
+ capabilities?: PluginCapabilities;
1660
+ disableNavigation?: boolean;
1661
+ pluginFilters?: PluginFilter[];
1662
+ scheme: "light" | "dark";
1663
+ selectAssetTypes: PluginSelectAssetType[];
1664
+ selectionType: "single" | "multiple";
1665
+ };
1550
1666
 
1551
1667
  export declare type PluginPostMessage =
1552
1668
  | PluginPostMessageAbortUploadRequest
@@ -1558,93 +1674,93 @@ export declare type PluginPostMessage =
1558
1674
  | PluginPostMessageTokenResponse
1559
1675
  | PluginPostMessageUploadFilesProgress
1560
1676
  | PluginPostMessageUploadFilesRequest
1561
- | PluginPostMessageUploadFilesResponse
1677
+ | PluginPostMessageUploadFilesResponse;
1562
1678
 
1563
1679
  export declare type PluginPostMessageAbortUploadRequest = {
1564
- type: 'abortUploadRequest'
1680
+ type: "abortUploadRequest";
1565
1681
  files?: {
1566
- id: string
1567
- }[]
1568
- }
1682
+ id: string;
1683
+ }[];
1684
+ };
1569
1685
 
1570
1686
  export declare type PluginPostMessageAssetSelection = {
1571
- type: 'assetSelection'
1572
- selection: AssetSelectionItemWithLegacySupport[]
1573
- }
1687
+ type: "assetSelection";
1688
+ selection: AssetSelectionItemWithLegacySupport[];
1689
+ };
1574
1690
 
1575
1691
  /**
1576
1692
  * Message sent from the plugin that a document has been updated
1577
1693
  */
1578
1694
  export declare type PluginPostMessageDocumentUpdate = {
1579
- type: 'documentUpdate'
1695
+ type: "documentUpdate";
1580
1696
  document: {
1581
- _id: string
1582
- _type: string
1583
- _rev: string
1584
- }
1585
- }
1697
+ _id: string;
1698
+ _type: string;
1699
+ _rev: string;
1700
+ };
1701
+ };
1586
1702
 
1587
1703
  /**
1588
1704
  * Message sent from a plugin page to notify the host that the page is loaded and ready to be interacted with
1589
1705
  */
1590
1706
  export declare type PluginPostMessagePageLoaded = {
1591
- type: 'pageLoaded'
1592
- page: string
1593
- }
1707
+ type: "pageLoaded";
1708
+ page: string;
1709
+ };
1594
1710
 
1595
1711
  /**
1596
1712
  * Message sent from a plugin page that a page is unloaded by the user (for closing the dialog and similar)
1597
1713
  */
1598
1714
  export declare type PluginPostMessagePageUnloaded = {
1599
- type: 'pageUnloaded'
1600
- page: string
1601
- }
1715
+ type: "pageUnloaded";
1716
+ page: string;
1717
+ };
1602
1718
 
1603
1719
  export declare type PluginPostMessageTokenRequest = {
1604
- type: 'tokenRequest'
1605
- }
1720
+ type: "tokenRequest";
1721
+ };
1606
1722
 
1607
1723
  export declare type PluginPostMessageTokenResponse = {
1608
- type: 'tokenResponse'
1609
- token: string | null
1610
- }
1724
+ type: "tokenResponse";
1725
+ token: string | null;
1726
+ };
1611
1727
 
1612
1728
  /**
1613
1729
  * Message sent from the plugin when files are uploading
1614
1730
  */
1615
1731
  export declare type PluginPostMessageUploadFilesProgress = {
1616
- type: 'uploadProgress'
1617
- files: FileUpload[]
1618
- }
1732
+ type: "uploadProgress";
1733
+ files: FileUpload[];
1734
+ };
1619
1735
 
1620
1736
  /**
1621
1737
  * Message sent from the plugin that the user wants to upload files
1622
1738
  */
1623
1739
  export declare type PluginPostMessageUploadFilesRequest = {
1624
- type: 'uploadRequest'
1740
+ type: "uploadRequest";
1625
1741
  files: {
1626
- id: string
1627
- file: File
1628
- }[]
1629
- }
1742
+ id: string;
1743
+ file: File;
1744
+ }[];
1745
+ };
1630
1746
 
1631
1747
  /**
1632
1748
  * Message sent from the app that the pending uploads are uploaded
1633
1749
  */
1634
1750
  export declare type PluginPostMessageUploadFilesResponse = {
1635
- type: 'uploadResponse'
1636
- assets: AssetSelectionItemWithLegacySupport[]
1637
- }
1751
+ type: "uploadResponse";
1752
+ assets: AssetSelectionItemWithLegacySupport[];
1753
+ };
1638
1754
 
1639
1755
  /**
1640
1756
  * Asset types that can be selected by the plugin
1641
1757
  */
1642
- export declare type PluginSelectAssetType = 'file' | 'image' | 'video'
1758
+ export declare type PluginSelectAssetType = "file" | "image" | "video";
1643
1759
 
1644
1760
  /** @public */
1645
1761
  declare interface PrepareViewOptions {
1646
1762
  /** @beta */
1647
- ordering?: SortOrdering
1763
+ ordering?: SortOrdering;
1648
1764
  }
1649
1765
 
1650
1766
  /** @public */
@@ -1652,91 +1768,121 @@ declare interface PreviewConfig<
1652
1768
  Select extends Record<string, string> = Record<string, string>,
1653
1769
  PrepareValue extends Record<keyof Select, any> = Record<keyof Select, any>,
1654
1770
  > {
1655
- select?: Select
1656
- prepare?: (value: PrepareValue, viewOptions?: PrepareViewOptions) => PreviewValue
1771
+ select?: Select;
1772
+ prepare?: (
1773
+ value: PrepareValue,
1774
+ viewOptions?: PrepareViewOptions,
1775
+ ) => PreviewValue;
1657
1776
  }
1658
1777
 
1659
1778
  /** @public */
1660
1779
  declare interface PreviewValue {
1661
- _id?: string
1662
- _createdAt?: string
1663
- _updatedAt?: string
1664
- title?: string
1665
- subtitle?: string
1666
- description?: string
1667
- media?: ReactNode | ElementType
1668
- imageUrl?: string
1780
+ _id?: string;
1781
+ _createdAt?: string;
1782
+ _updatedAt?: string;
1783
+ title?: string;
1784
+ subtitle?: string;
1785
+ description?: string;
1786
+ media?: ReactNode | ElementType;
1787
+ imageUrl?: string;
1669
1788
  }
1670
1789
 
1671
1790
  /** @public */
1672
1791
  declare interface Reference {
1673
- _type: string
1674
- _ref: string
1675
- _key?: string
1676
- _weak?: boolean
1792
+ _type: string;
1793
+ _ref: string;
1794
+ _key?: string;
1795
+ _weak?: boolean;
1677
1796
  _strengthenOnPublish?: {
1678
- type: string
1679
- weak?: boolean
1797
+ type: string;
1798
+ weak?: boolean;
1680
1799
  template?: {
1681
- id: string
1682
- params: Record<string, string | number | boolean>
1683
- }
1684
- }
1800
+ id: string;
1801
+ params: Record<string, string | number | boolean>;
1802
+ };
1803
+ };
1685
1804
  }
1686
1805
 
1687
1806
  /** @public */
1688
1807
  declare interface ReferenceBaseOptions extends BaseSchemaTypeOptions {
1689
- disableNew?: boolean
1808
+ /**
1809
+ * When `true`, hides the "Create new" button in the reference input,
1810
+ * preventing users from creating new documents from this field.
1811
+ *
1812
+ * For more granular control (e.g., allowing creation of only specific types,
1813
+ * or conditionally hiding the button based on document state), use the
1814
+ * `creationTypeFilter` option instead.
1815
+ */
1816
+ disableNew?: boolean;
1817
+ /**
1818
+ * Callback function to dynamically filter which document types can be created
1819
+ * from this reference field based on the current document state.
1820
+ *
1821
+ * This allows you to conditionally restrict the types available in the
1822
+ * "Create new" dropdown based on other field values in the document.
1823
+ *
1824
+ * **Important**: This only affects document creation, not which existing documents
1825
+ * appear in search results. To filter search results, use the `filter` option instead.
1826
+ *
1827
+ * @param context - Contains the current document, parent value, and field path
1828
+ * @param toTypes - Array of all types configured in the reference field's `to` property
1829
+ * @returns Array of type options that should be available for creation. Return the
1830
+ * original `toTypes` array to allow all types, a filtered subset to restrict
1831
+ * available types, or an empty array `[]` to hide the "Create new" button entirely.
1832
+ */
1833
+ creationTypeFilter?: ReferenceTypeFilter;
1690
1834
  }
1691
1835
 
1692
1836
  /** @public */
1693
1837
  declare interface ReferenceDefinition extends BaseSchemaDefinition {
1694
- type: 'reference'
1695
- to: ReferenceTo
1696
- weak?: boolean
1697
- options?: ReferenceOptions
1698
- validation?: ValidationBuilder<ReferenceRule, ReferenceValue>
1699
- initialValue?: InitialValueProperty<any, Omit<ReferenceValue, '_type'>>
1838
+ type: "reference";
1839
+ to: ReferenceTo;
1840
+ weak?: boolean;
1841
+ options?: ReferenceOptions;
1842
+ validation?: ValidationBuilder<ReferenceRule, ReferenceValue>;
1843
+ initialValue?: InitialValueProperty<any, Omit<ReferenceValue, "_type">>;
1700
1844
  }
1701
1845
 
1702
1846
  /** @public */
1703
- declare type ReferenceFilterOptions = ReferenceFilterResolverOptions | ReferenceFilterQueryOptions
1847
+ declare type ReferenceFilterOptions =
1848
+ | ReferenceFilterResolverOptions
1849
+ | ReferenceFilterQueryOptions;
1704
1850
 
1705
1851
  /** @public */
1706
1852
  declare interface ReferenceFilterQueryOptions {
1707
- filter: string
1708
- filterParams?: Record<string, unknown>
1853
+ filter: string;
1854
+ filterParams?: Record<string, unknown>;
1709
1855
  }
1710
1856
 
1711
1857
  /** @public */
1712
1858
  declare type ReferenceFilterResolver = (
1713
1859
  context: ReferenceFilterResolverContext,
1714
- ) => ReferenceFilterSearchOptions | Promise<ReferenceFilterSearchOptions>
1860
+ ) => ReferenceFilterSearchOptions | Promise<ReferenceFilterSearchOptions>;
1715
1861
 
1716
1862
  /** @public */
1717
1863
  declare interface ReferenceFilterResolverContext {
1718
- document: SanityDocument
1719
- parent?: Record<string, unknown> | Record<string, unknown>[]
1720
- parentPath: Path
1721
- perspective: StackablePerspective[]
1722
- getClient: (options: {apiVersion: string}) => SanityClient
1864
+ document: SanityDocument;
1865
+ parent?: Record<string, unknown> | Record<string, unknown>[];
1866
+ parentPath: Path;
1867
+ perspective: StackablePerspective[];
1868
+ getClient: (options: { apiVersion: string }) => SanityClient;
1723
1869
  }
1724
1870
 
1725
1871
  /** @public */
1726
1872
  declare interface ReferenceFilterResolverOptions {
1727
- filter?: ReferenceFilterResolver
1728
- filterParams?: never
1873
+ filter?: ReferenceFilterResolver;
1874
+ filterParams?: never;
1729
1875
  }
1730
1876
 
1731
1877
  /** @public */
1732
1878
  declare type ReferenceFilterSearchOptions = {
1733
- filter?: string
1734
- params?: Record<string, unknown>
1735
- tag?: string
1736
- maxFieldDepth?: number
1737
- strategy?: SearchStrategy
1738
- perspective?: Exclude<ClientPerspective, 'raw' | 'previewDrafts'>
1739
- }
1879
+ filter?: string;
1880
+ params?: Record<string, unknown>;
1881
+ tag?: string;
1882
+ maxFieldDepth?: number;
1883
+ strategy?: SearchStrategy;
1884
+ perspective?: Exclude<ClientPerspective, "raw" | "previewDrafts">;
1885
+ };
1740
1886
 
1741
1887
  /**
1742
1888
  * Types are closed for extension. To add properties via declaration merging to this type,
@@ -1748,33 +1894,77 @@ declare type ReferenceFilterSearchOptions = {
1748
1894
  *
1749
1895
  * @public
1750
1896
  */
1751
- declare type ReferenceOptions = ReferenceBaseOptions & ReferenceFilterOptions
1897
+ declare type ReferenceOptions = ReferenceBaseOptions & ReferenceFilterOptions;
1752
1898
 
1753
1899
  /** @public */
1754
- declare interface ReferenceRule extends RuleDef<ReferenceRule, ReferenceValue> {}
1900
+ declare interface ReferenceRule extends RuleDef<
1901
+ ReferenceRule,
1902
+ ReferenceValue
1903
+ > {}
1755
1904
 
1756
1905
  /** @public */
1757
- declare interface ReferenceSchemaType extends Omit<ObjectSchemaType, 'options'> {
1758
- jsonType: 'object'
1759
- to: ObjectSchemaType[]
1760
- weak?: boolean
1761
- options?: ReferenceOptions
1906
+ declare interface ReferenceSchemaType extends Omit<
1907
+ ObjectSchemaType,
1908
+ "options"
1909
+ > {
1910
+ jsonType: "object";
1911
+ to: ObjectSchemaType[];
1912
+ weak?: boolean;
1913
+ options?: ReferenceOptions;
1762
1914
  }
1763
1915
 
1764
1916
  /** @public */
1765
1917
  declare type ReferenceTo =
1766
1918
  | SchemaTypeDefinition
1767
1919
  | TypeReference
1768
- | Array<SchemaTypeDefinition | TypeReference>
1920
+ | Array<SchemaTypeDefinition | TypeReference>;
1921
+
1922
+ /**
1923
+ * Function type for filtering which document types can be created from a reference field.
1924
+ *
1925
+ * The `creationTypeFilter` specifically controls the types
1926
+ * available when clicking "Create new" in the reference input.
1927
+ *
1928
+ * This is distinct from the `filter` option, which controls which existing documents appear in search results.
1929
+ *
1930
+ * @param context - Information about the current document and field location
1931
+ * @param toTypes - Array of type options from the reference field's `to` configuration
1932
+ * @returns Filtered array of type options that should be available for creation
1933
+ *
1934
+ * @public
1935
+ */
1936
+ declare type ReferenceTypeFilter = (
1937
+ context: ReferenceTypeFilterContext,
1938
+ toTypes: ReferenceTypeOption[],
1939
+ ) => ReferenceTypeOption[];
1940
+
1941
+ /**
1942
+ * Context object passed to the creationTypeFilter callback.
1943
+ *
1944
+ * @public
1945
+ */
1946
+ declare interface ReferenceTypeFilterContext {
1947
+ /** The current document being edited */
1948
+ document: SanityDocument;
1949
+ /** The parent value containing this reference field */
1950
+ parent?: Record<string, unknown> | Record<string, unknown>[];
1951
+ /** The path to the parent value in the document */
1952
+ parentPath: Path;
1953
+ }
1954
+
1955
+ /** @public */
1956
+ declare interface ReferenceTypeOption {
1957
+ type: string;
1958
+ }
1769
1959
 
1770
1960
  /** @public */
1771
- declare type ReferenceValue = Reference
1961
+ declare type ReferenceValue = Reference;
1772
1962
 
1773
1963
  /** @public */
1774
1964
  declare interface Role {
1775
- name: string
1776
- title: string
1777
- description?: string
1965
+ name: string;
1966
+ title: string;
1967
+ description?: string;
1778
1968
  }
1779
1969
 
1780
1970
  /** @public */
@@ -1783,37 +1973,37 @@ declare interface Rule {
1783
1973
  * @internal
1784
1974
  * @deprecated internal use only
1785
1975
  */
1786
- _type: RuleTypeConstraint | undefined
1976
+ _type: RuleTypeConstraint | undefined;
1787
1977
  /**
1788
1978
  * @internal
1789
1979
  * @deprecated internal use only
1790
1980
  */
1791
- _level: 'error' | 'warning' | 'info' | undefined
1981
+ _level: "error" | "warning" | "info" | undefined;
1792
1982
  /**
1793
1983
  * @internal
1794
1984
  * @deprecated internal use only
1795
1985
  */
1796
- _required: 'required' | 'optional' | undefined
1986
+ _required: "required" | "optional" | undefined;
1797
1987
  /**
1798
1988
  * @internal
1799
1989
  * @deprecated internal use only
1800
1990
  */
1801
- _typeDef: SchemaType | undefined
1991
+ _typeDef: SchemaType | undefined;
1802
1992
  /**
1803
1993
  * @internal
1804
1994
  * @deprecated internal use only
1805
1995
  */
1806
- _message: string | LocalizedValidationMessages | undefined
1996
+ _message: string | LocalizedValidationMessages | undefined;
1807
1997
  /**
1808
1998
  * @internal
1809
1999
  * @deprecated internal use only
1810
2000
  */
1811
- _rules: RuleSpec[]
2001
+ _rules: RuleSpec[];
1812
2002
  /**
1813
2003
  * @internal
1814
2004
  * @deprecated internal use only
1815
2005
  */
1816
- _fieldRules: FieldRules | undefined
2006
+ _fieldRules: FieldRules | undefined;
1817
2007
  /**
1818
2008
  * Takes in a path and returns an object with a symbol.
1819
2009
  *
@@ -1836,62 +2026,65 @@ declare interface Rule {
1836
2026
  * ]
1837
2027
  * ```
1838
2028
  */
1839
- valueOfField: (path: string | string[]) => FieldReference
1840
- error(message?: string | LocalizedValidationMessages): Rule
1841
- warning(message?: string | LocalizedValidationMessages): Rule
1842
- info(message?: string | LocalizedValidationMessages): Rule
1843
- reset(): this
1844
- isRequired(): boolean
1845
- clone(): Rule
1846
- cloneWithRules(rules: RuleSpec[]): Rule
1847
- merge(rule: Rule): Rule
1848
- type(targetType: RuleTypeConstraint | Lowercase<RuleTypeConstraint>): Rule
1849
- all(children: Rule[]): Rule
1850
- either(children: Rule[]): Rule
1851
- optional(): Rule
1852
- required(): Rule
2029
+ valueOfField: (path: string | string[]) => FieldReference;
2030
+ error(message?: string | LocalizedValidationMessages): Rule;
2031
+ warning(message?: string | LocalizedValidationMessages): Rule;
2032
+ info(message?: string | LocalizedValidationMessages): Rule;
2033
+ reset(): this;
2034
+ isRequired(): boolean;
2035
+ clone(): Rule;
2036
+ cloneWithRules(rules: RuleSpec[]): Rule;
2037
+ merge(rule: Rule): Rule;
2038
+ type(targetType: RuleTypeConstraint | Lowercase<RuleTypeConstraint>): Rule;
2039
+ all(children: Rule[]): Rule;
2040
+ either(children: Rule[]): Rule;
2041
+ optional(): Rule;
2042
+ required(): Rule;
2043
+ skip(): Rule;
1853
2044
  custom<T = unknown>(
1854
2045
  fn: CustomValidator<T>,
1855
2046
  options?: {
1856
- bypassConcurrencyLimit?: boolean
2047
+ bypassConcurrencyLimit?: boolean;
1857
2048
  },
1858
- ): Rule
1859
- media<T extends MediaAssetTypes = MediaAssetTypes>(fn: MediaValidator<T>): Rule
1860
- min(len: number | string | FieldReference): Rule
1861
- max(len: number | string | FieldReference): Rule
1862
- length(len: number | FieldReference): Rule
1863
- valid(value: unknown | unknown[]): Rule
1864
- integer(): Rule
1865
- precision(limit: number | FieldReference): Rule
1866
- positive(): Rule
1867
- negative(): Rule
1868
- greaterThan(num: number | FieldReference): Rule
1869
- lessThan(num: number | FieldReference): Rule
1870
- uppercase(): Rule
1871
- lowercase(): Rule
2049
+ ): Rule;
2050
+ media<T extends MediaAssetTypes = MediaAssetTypes>(
2051
+ fn: MediaValidator<T>,
2052
+ ): Rule;
2053
+ min(len: number | string | FieldReference): Rule;
2054
+ max(len: number | string | FieldReference): Rule;
2055
+ length(len: number | FieldReference): Rule;
2056
+ valid(value: unknown | unknown[]): Rule;
2057
+ integer(): Rule;
2058
+ precision(limit: number | FieldReference): Rule;
2059
+ positive(): Rule;
2060
+ negative(): Rule;
2061
+ greaterThan(num: number | FieldReference): Rule;
2062
+ lessThan(num: number | FieldReference): Rule;
2063
+ uppercase(): Rule;
2064
+ lowercase(): Rule;
1872
2065
  regex(
1873
2066
  pattern: RegExp,
1874
2067
  name: string,
1875
2068
  options: {
1876
- name?: string
1877
- invert?: boolean
2069
+ name?: string;
2070
+ invert?: boolean;
1878
2071
  },
1879
- ): Rule
2072
+ ): Rule;
1880
2073
  regex(
1881
2074
  pattern: RegExp,
1882
2075
  options: {
1883
- name?: string
1884
- invert?: boolean
2076
+ name?: string;
2077
+ invert?: boolean;
1885
2078
  },
1886
- ): Rule
1887
- regex(pattern: RegExp, name: string): Rule
1888
- regex(pattern: RegExp): Rule
1889
- email(): Rule
1890
- uri(options?: UriValidationOptions): Rule
1891
- unique(): Rule
1892
- reference(): Rule
1893
- fields(rules: FieldRules): Rule
1894
- assetRequired(): Rule
2079
+ ): Rule;
2080
+ regex(pattern: RegExp, name: string): Rule;
2081
+ regex(pattern: RegExp): Rule;
2082
+ email(): Rule;
2083
+ uri(options?: UriValidationOptions): Rule;
2084
+ unique(): Rule;
2085
+ reference(): Rule;
2086
+ fields(rules: FieldRules): Rule;
2087
+ assetRequired(): Rule;
1895
2088
  validate(
1896
2089
  value: unknown,
1897
2090
  options: ValidationContext & {
@@ -1901,194 +2094,208 @@ declare interface Rule {
1901
2094
  */
1902
2095
  __internal?: {
1903
2096
  customValidationConcurrencyLimiter?: {
1904
- ready: () => Promise<void>
1905
- release: () => void
1906
- }
1907
- }
2097
+ ready: () => Promise<void>;
2098
+ release: () => void;
2099
+ };
2100
+ };
1908
2101
  },
1909
- ): Promise<ValidationMarker[]>
2102
+ ): Promise<ValidationMarker[]>;
1910
2103
  }
1911
2104
 
1912
2105
  /** @public */
1913
- declare type RuleBuilder<T extends RuleDef<T, FieldValue>, FieldValue = unknown> = T | T[]
2106
+ declare type RuleBuilder<
2107
+ T extends RuleDef<T, FieldValue>,
2108
+ FieldValue = unknown,
2109
+ > = T | T[];
1914
2110
 
1915
2111
  /** @public */
1916
2112
  declare interface RuleDef<T, FieldValue = unknown> {
1917
- required: () => T
2113
+ required: () => T;
2114
+ skip: () => T;
1918
2115
  custom: <LenientFieldValue extends FieldValue>(
1919
2116
  fn: CustomValidator<LenientFieldValue | undefined>,
1920
- ) => T
1921
- info: (message?: string | LocalizedValidationMessages) => T
1922
- error: (message?: string | LocalizedValidationMessages) => T
1923
- warning: (message?: string | LocalizedValidationMessages) => T
1924
- valueOfField: (path: string | string[]) => FieldReference
2117
+ ) => T;
2118
+ info: (message?: string | LocalizedValidationMessages) => T;
2119
+ error: (message?: string | LocalizedValidationMessages) => T;
2120
+ warning: (message?: string | LocalizedValidationMessages) => T;
2121
+ valueOfField: (path: string | string[]) => FieldReference;
1925
2122
  }
1926
2123
 
1927
2124
  /** @public */
1928
2125
  declare type RuleSpec =
1929
2126
  | {
1930
- flag: 'integer'
2127
+ flag: "integer";
1931
2128
  }
1932
2129
  | {
1933
- flag: 'email'
2130
+ flag: "email";
1934
2131
  }
1935
2132
  | {
1936
- flag: 'unique'
2133
+ flag: "unique";
1937
2134
  }
1938
2135
  | {
1939
- flag: 'reference'
2136
+ flag: "reference";
1940
2137
  }
1941
2138
  | {
1942
- flag: 'type'
1943
- constraint: RuleTypeConstraint
2139
+ flag: "type";
2140
+ constraint: RuleTypeConstraint;
1944
2141
  }
1945
2142
  | {
1946
- flag: 'all'
1947
- constraint: Rule[]
2143
+ flag: "all";
2144
+ constraint: Rule[];
1948
2145
  }
1949
2146
  | {
1950
- flag: 'either'
1951
- constraint: Rule[]
2147
+ flag: "either";
2148
+ constraint: Rule[];
1952
2149
  }
1953
2150
  | {
1954
- flag: 'presence'
1955
- constraint: 'optional' | 'required'
2151
+ flag: "presence";
2152
+ constraint: "optional" | "required";
1956
2153
  }
1957
2154
  | {
1958
- flag: 'custom'
1959
- constraint: CustomValidator
2155
+ flag: "custom";
2156
+ constraint: CustomValidator;
1960
2157
  }
1961
2158
  | {
1962
- flag: 'min'
1963
- constraint: number | string | FieldReference
2159
+ flag: "min";
2160
+ constraint: number | string | FieldReference;
1964
2161
  }
1965
2162
  | {
1966
- flag: 'max'
1967
- constraint: number | string | FieldReference
2163
+ flag: "max";
2164
+ constraint: number | string | FieldReference;
1968
2165
  }
1969
2166
  | {
1970
- flag: 'length'
1971
- constraint: number | FieldReference
2167
+ flag: "length";
2168
+ constraint: number | FieldReference;
1972
2169
  }
1973
2170
  | {
1974
- flag: 'valid'
1975
- constraint: unknown[]
2171
+ flag: "valid";
2172
+ constraint: unknown[];
1976
2173
  }
1977
2174
  | {
1978
- flag: 'precision'
1979
- constraint: number | FieldReference
2175
+ flag: "precision";
2176
+ constraint: number | FieldReference;
1980
2177
  }
1981
2178
  | {
1982
- flag: 'lessThan'
1983
- constraint: number | FieldReference
2179
+ flag: "lessThan";
2180
+ constraint: number | FieldReference;
1984
2181
  }
1985
2182
  | {
1986
- flag: 'greaterThan'
1987
- constraint: number | FieldReference
2183
+ flag: "greaterThan";
2184
+ constraint: number | FieldReference;
1988
2185
  }
1989
2186
  | {
1990
- flag: 'stringCasing'
1991
- constraint: 'uppercase' | 'lowercase'
2187
+ flag: "stringCasing";
2188
+ constraint: "uppercase" | "lowercase";
1992
2189
  }
1993
2190
  | {
1994
- flag: 'assetRequired'
2191
+ flag: "assetRequired";
1995
2192
  constraint: {
1996
- assetType: 'asset' | 'image' | 'file'
1997
- }
2193
+ assetType: "asset" | "image" | "file";
2194
+ };
1998
2195
  }
1999
2196
  | {
2000
- flag: 'media'
2001
- constraint: MediaValidator<any>
2197
+ flag: "media";
2198
+ constraint: MediaValidator<any>;
2002
2199
  }
2003
2200
  | {
2004
- flag: 'regex'
2201
+ flag: "regex";
2005
2202
  constraint: {
2006
- pattern: RegExp
2007
- name?: string
2008
- invert: boolean
2009
- }
2203
+ pattern: RegExp;
2204
+ name?: string;
2205
+ invert: boolean;
2206
+ };
2010
2207
  }
2011
2208
  | {
2012
- flag: 'uri'
2209
+ flag: "uri";
2013
2210
  constraint: {
2014
2211
  options: {
2015
- scheme: RegExp[]
2016
- allowRelative: boolean
2017
- relativeOnly: boolean
2018
- allowCredentials: boolean
2019
- }
2020
- }
2021
- }
2022
-
2023
- /** @public */
2024
- declare type RuleTypeConstraint = 'Array' | 'Boolean' | 'Date' | 'Number' | 'Object' | 'String'
2212
+ scheme: RegExp[];
2213
+ allowRelative: boolean;
2214
+ relativeOnly: boolean;
2215
+ allowCredentials: boolean;
2216
+ };
2217
+ };
2218
+ };
2219
+
2220
+ /** @public */
2221
+ declare type RuleTypeConstraint =
2222
+ | "Array"
2223
+ | "Boolean"
2224
+ | "Date"
2225
+ | "Number"
2226
+ | "Object"
2227
+ | "String";
2025
2228
 
2026
2229
  declare type SanityAsset = {
2027
- _id: string
2028
- _type: 'sanity.asset'
2029
- _createdAt: string
2030
- _updatedAt: string
2031
- _rev: string
2032
- title?: string
2033
- aspects?: Record<string, unknown>
2034
- currentVersion: {
2035
- _ref: string
2036
- _type: 'reference'
2037
- _weak?: boolean
2038
- [internalGroqTypeReferenceTo]?: 'sanity.asset.version'
2039
- }
2230
+ _id: string;
2231
+ _type: "sanity.asset";
2232
+ _createdAt: string;
2233
+ _updatedAt: string;
2234
+ _rev: string;
2235
+ title?: string;
2236
+ aspects?: Record<string, unknown>;
2237
+ currentVersion: SanityAssetVersionReference;
2040
2238
  versions: Array<
2041
2239
  {
2042
- _key: string
2240
+ _key: string;
2043
2241
  } & SanityAssetVersion
2044
- >
2045
- assetType: 'sanity.imageAsset' | 'sanity.videoAsset' | 'sanity.fileAsset'
2046
- cdnAccessPolicy: 'public' | 'private'
2047
- url?: string
2048
- }
2242
+ >;
2243
+ assetType: "sanity.imageAsset" | "sanity.videoAsset" | "sanity.fileAsset";
2244
+ cdnAccessPolicy: "public" | "private";
2245
+ parent?: SanityDirectoryReference | SanityTreeReference;
2246
+ rootDirectory?: SanityDirectoryReference;
2247
+ url?: string;
2248
+ _system?: SanitySystem;
2249
+ };
2049
2250
 
2050
2251
  declare type SanityAssetCollection = {
2051
- _id: string
2052
- _type: 'sanity.asset.collection'
2053
- _createdAt: string
2054
- _updatedAt: string
2055
- _rev: string
2056
- title: string
2057
- description?: string
2058
- assets?: Array<{
2059
- _ref: string
2060
- _type: 'reference'
2061
- _weak?: boolean
2062
- _key: string
2063
- [internalGroqTypeReferenceTo]?: 'sanity.asset'
2064
- }>
2065
- }
2066
-
2067
- declare type SanityAssetInstanceState = string
2252
+ _id: string;
2253
+ _type: "sanity.asset.collection";
2254
+ _createdAt: string;
2255
+ _updatedAt: string;
2256
+ _rev: string;
2257
+ title: string;
2258
+ description?: string;
2259
+ parent?: SanityDirectoryReference | SanityTreeReference;
2260
+ rootDirectory?: SanityDirectoryReference;
2261
+ assets?: Array<
2262
+ {
2263
+ _key: string;
2264
+ } & SanityAssetReference
2265
+ >;
2266
+ };
2267
+
2268
+ declare type SanityAssetInstanceState = string;
2269
+
2270
+ declare type SanityAssetReference = {
2271
+ _ref: string;
2272
+ _type: "reference";
2273
+ _weak?: boolean;
2274
+ [internalGroqTypeReferenceTo]?: "sanity.asset";
2275
+ };
2276
+
2277
+ declare type SanityAssetSubtitleReference = {
2278
+ _ref: string;
2279
+ _type: "reference";
2280
+ _weak?: boolean;
2281
+ [internalGroqTypeReferenceTo]?: "sanity.asset.subtitle";
2282
+ };
2068
2283
 
2069
2284
  declare type SanityAssetVersion = {
2070
- _type: 'sanity.asset.version'
2071
- title?: string
2285
+ _type: "sanity.asset.version";
2286
+ title?: string;
2072
2287
  instance:
2073
- | {
2074
- _ref: string
2075
- _type: 'reference'
2076
- _weak?: boolean
2077
- [internalGroqTypeReferenceTo]?: 'sanity.imageAsset'
2078
- }
2079
- | {
2080
- _ref: string
2081
- _type: 'reference'
2082
- _weak?: boolean
2083
- [internalGroqTypeReferenceTo]?: 'sanity.fileAsset'
2084
- }
2085
- | {
2086
- _ref: string
2087
- _type: 'reference'
2088
- _weak?: boolean
2089
- [internalGroqTypeReferenceTo]?: 'sanity.videoAsset'
2090
- }
2091
- }
2288
+ | SanityImageAssetReference
2289
+ | SanityFileAssetReference
2290
+ | SanityVideoAssetReference;
2291
+ };
2292
+
2293
+ declare type SanityAssetVersionReference = {
2294
+ _ref: string;
2295
+ _type: "reference";
2296
+ _weak?: boolean;
2297
+ [internalGroqTypeReferenceTo]?: "sanity.asset.version";
2298
+ };
2092
2299
 
2093
2300
  /**
2094
2301
  * Options for configuring how Sanity Create interfaces with the type or field.
@@ -2097,260 +2304,306 @@ declare type SanityAssetVersion = {
2097
2304
  */
2098
2305
  declare interface SanityCreateOptions {
2099
2306
  /** Set to true to exclude a type or field from appearing in Sanity Create */
2100
- exclude?: boolean
2307
+ exclude?: boolean;
2101
2308
  /**
2102
2309
  * A short description of what the type or field is used for.
2103
2310
  * Purpose can be used to improve how and when content mapping uses the field.
2104
2311
  * */
2105
- purpose?: string
2312
+ purpose?: string;
2106
2313
  }
2107
2314
 
2315
+ declare type SanityDirectoryReference = {
2316
+ _ref: string;
2317
+ _type: "reference";
2318
+ _weak?: boolean;
2319
+ [internalGroqTypeReferenceTo]?: "sanity.directory";
2320
+ };
2321
+
2108
2322
  /** @public */
2109
2323
  declare interface SanityDocument {
2110
- _id: string
2111
- _type: string
2112
- _createdAt: string
2113
- _updatedAt: string
2114
- _rev: string
2115
- [key: string]: unknown
2324
+ _id: string;
2325
+ _type: string;
2326
+ _createdAt: string;
2327
+ _updatedAt: string;
2328
+ _rev: string;
2329
+ [key: string]: unknown;
2116
2330
  }
2117
2331
 
2118
2332
  declare type SanityFileAsset = {
2119
- _id: string
2120
- _type: 'sanity.fileAsset'
2121
- _createdAt: string
2122
- _updatedAt: string
2123
- _rev: string
2124
- title?: string
2333
+ _id: string;
2334
+ _type: "sanity.fileAsset";
2335
+ _createdAt: string;
2336
+ _updatedAt: string;
2337
+ _rev: string;
2338
+ title?: string;
2125
2339
  description?: Array<{
2126
2340
  children?: Array<{
2127
- marks?: Array<string>
2128
- text?: string
2129
- _type: 'span'
2130
- _key: string
2131
- }>
2132
- style?: 'normal' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'blockquote'
2133
- listItem?: 'bullet' | 'number'
2341
+ marks?: Array<string>;
2342
+ text?: string;
2343
+ _type: "span";
2344
+ _key: string;
2345
+ }>;
2346
+ style?: "normal" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "blockquote";
2347
+ listItem?: "bullet" | "number";
2134
2348
  markDefs?: Array<{
2135
- href?: string
2136
- _type: 'link'
2137
- _key: string
2138
- }>
2139
- level?: number
2140
- _type: 'block'
2141
- _key: string
2142
- }>
2143
- state: SanityAssetInstanceState
2144
- sha1hash?: string
2145
- mimeType?: string
2146
- originalFilename?: string
2147
- size?: number
2148
- uploadId?: string
2149
- path: string
2150
- extension?: string
2151
- url: string
2152
- previewUrl?: string
2153
- }
2349
+ href?: string;
2350
+ _type: "link";
2351
+ _key: string;
2352
+ }>;
2353
+ level?: number;
2354
+ _type: "block";
2355
+ _key: string;
2356
+ }>;
2357
+ state: SanityAssetInstanceState;
2358
+ sha1hash?: string;
2359
+ mimeType?: string;
2360
+ originalFilename?: string;
2361
+ size?: number;
2362
+ uploadId?: string;
2363
+ path: string;
2364
+ extension?: string;
2365
+ url: string;
2366
+ previewUrl?: string;
2367
+ rootDirectory?: SanityDirectoryReference;
2368
+ _system?: SanitySystem;
2369
+ };
2370
+
2371
+ declare type SanityFileAssetReference = {
2372
+ _ref: string;
2373
+ _type: "reference";
2374
+ _weak?: boolean;
2375
+ [internalGroqTypeReferenceTo]?: "sanity.fileAsset";
2376
+ };
2154
2377
 
2155
2378
  declare type SanityImageAsset = {
2156
- _id: string
2157
- _type: 'sanity.imageAsset'
2158
- _createdAt: string
2159
- _updatedAt: string
2160
- _rev: string
2161
- altText?: string
2162
- state: SanityAssetInstanceState
2163
- sha1hash?: string
2164
- mimeType?: string
2165
- originalFilename?: string
2166
- size?: number
2167
- uploadId?: string
2168
- path?: string
2169
- extension?: string
2170
- url: string
2171
- metadata: SanityImageMetadata
2172
- }
2379
+ _id: string;
2380
+ _type: "sanity.imageAsset";
2381
+ _createdAt: string;
2382
+ _updatedAt: string;
2383
+ _rev: string;
2384
+ altText?: string;
2385
+ state: SanityAssetInstanceState;
2386
+ sha1hash?: string;
2387
+ mimeType?: string;
2388
+ originalFilename?: string;
2389
+ size?: number;
2390
+ uploadId?: string;
2391
+ path?: string;
2392
+ extension?: string;
2393
+ url: string;
2394
+ metadata: SanityImageMetadata;
2395
+ rootDirectory?: SanityDirectoryReference;
2396
+ _system?: SanitySystem;
2397
+ };
2398
+
2399
+ declare type SanityImageAssetReference = {
2400
+ _ref: string;
2401
+ _type: "reference";
2402
+ _weak?: boolean;
2403
+ [internalGroqTypeReferenceTo]?: "sanity.imageAsset";
2404
+ };
2173
2405
 
2174
2406
  declare type SanityImageDimensions = {
2175
- _type: 'sanity.imageDimensions'
2176
- height: number
2177
- width: number
2178
- aspectRatio: number
2179
- }
2407
+ _type: "sanity.imageDimensions";
2408
+ height: number;
2409
+ width: number;
2410
+ aspectRatio: number;
2411
+ };
2180
2412
 
2181
2413
  declare type SanityImageExifMetadata = {
2182
- _type: 'sanity.imageExifMetadata'
2183
- ApertureValue?: number
2184
- BrightnessValue?: number
2185
- DateTimeDigitized?: string
2186
- DateTimeOriginal?: string
2187
- ExposureBiasValue?: number
2188
- ExposureMode?: number
2189
- ExposureProgram?: number
2190
- ExposureTime?: number
2191
- FNumber?: number
2192
- Flash?: number
2193
- FocalLength?: number
2194
- FocalLengthIn35mmFormat?: number
2195
- ISO?: number
2196
- LensModel?: string
2197
- WhiteBalance?: number
2198
- GPSLatitude?: number
2199
- GPSLongitude?: number
2200
- GPSAltitude?: number
2201
- Copyright?: string
2202
- Artist?: string
2203
- }
2414
+ _type: "sanity.imageExifMetadata";
2415
+ ApertureValue?: number;
2416
+ BrightnessValue?: number;
2417
+ DateTimeDigitized?: string;
2418
+ DateTimeOriginal?: string;
2419
+ ExposureBiasValue?: number;
2420
+ ExposureMode?: number;
2421
+ ExposureProgram?: number;
2422
+ ExposureTime?: number;
2423
+ FNumber?: number;
2424
+ Flash?: number;
2425
+ FocalLength?: number;
2426
+ FocalLengthIn35mmFormat?: number;
2427
+ ISO?: number;
2428
+ LensModel?: string;
2429
+ WhiteBalance?: number;
2430
+ GPSLatitude?: number;
2431
+ GPSLongitude?: number;
2432
+ GPSAltitude?: number;
2433
+ Copyright?: string;
2434
+ Artist?: string;
2435
+ };
2204
2436
 
2205
2437
  declare type SanityImageExifTags = {
2206
- _type: 'sanity.imageExifTags'
2207
- Make?: string
2208
- Model?: string
2209
- Orientation?: number
2210
- XResolution?: number
2211
- YResolution?: number
2212
- ResolutionUnit?: number
2213
- Software?: string
2214
- ModifyDate?: string
2215
- ExifOffset?: number
2216
- GPSInfo?: number
2217
- }
2438
+ _type: "sanity.imageExifTags";
2439
+ Make?: string;
2440
+ Model?: string;
2441
+ Orientation?: number;
2442
+ XResolution?: number;
2443
+ YResolution?: number;
2444
+ ResolutionUnit?: number;
2445
+ Software?: string;
2446
+ ModifyDate?: string;
2447
+ ExifOffset?: number;
2448
+ GPSInfo?: number;
2449
+ };
2218
2450
 
2219
2451
  declare type SanityImageMetadata = {
2220
- _type: 'sanity.imageMetadata'
2221
- location?: Geopoint
2222
- dimensions: SanityImageDimensions
2223
- exif?: SanityImageExifMetadata
2224
- image?: SanityImageExifTags
2225
- palette: SanityImagePalette
2226
- lqip: string
2227
- blurHash: string
2228
- hasAlpha: boolean
2229
- isOpaque: boolean
2230
- }
2452
+ _type: "sanity.imageMetadata";
2453
+ location?: Geopoint;
2454
+ dimensions: SanityImageDimensions;
2455
+ exif?: SanityImageExifMetadata;
2456
+ image?: SanityImageExifTags;
2457
+ palette: SanityImagePalette;
2458
+ lqip: string;
2459
+ blurHash: string;
2460
+ hasAlpha: boolean;
2461
+ isOpaque: boolean;
2462
+ };
2231
2463
 
2232
2464
  declare type SanityImagePalette = {
2233
- _type: 'sanity.imagePalette'
2234
- darkMuted?: SanityImagePaletteSwatch
2235
- lightVibrant?: SanityImagePaletteSwatch
2236
- darkVibrant?: SanityImagePaletteSwatch
2237
- vibrant?: SanityImagePaletteSwatch
2238
- dominant?: SanityImagePaletteSwatch
2239
- lightMuted?: SanityImagePaletteSwatch
2240
- muted?: SanityImagePaletteSwatch
2241
- }
2465
+ _type: "sanity.imagePalette";
2466
+ darkMuted?: SanityImagePaletteSwatch;
2467
+ lightVibrant?: SanityImagePaletteSwatch;
2468
+ darkVibrant?: SanityImagePaletteSwatch;
2469
+ vibrant?: SanityImagePaletteSwatch;
2470
+ dominant?: SanityImagePaletteSwatch;
2471
+ lightMuted?: SanityImagePaletteSwatch;
2472
+ muted?: SanityImagePaletteSwatch;
2473
+ };
2242
2474
 
2243
2475
  declare type SanityImagePaletteSwatch = {
2244
- _type: 'sanity.imagePaletteSwatch'
2245
- background?: string
2246
- foreground?: string
2247
- population?: number
2248
- title?: string
2249
- }
2476
+ _type: "sanity.imagePaletteSwatch";
2477
+ background?: string;
2478
+ foreground?: string;
2479
+ population?: number;
2480
+ title?: string;
2481
+ };
2250
2482
 
2251
2483
  declare type SanitySystem = {
2252
- _type: 'sanity.system'
2253
- createdBy?: string
2254
- }
2484
+ _type: "sanity.system";
2485
+ createdBy?: string;
2486
+ };
2487
+
2488
+ declare type SanityTreeReference = {
2489
+ _ref: string;
2490
+ _type: "reference";
2491
+ _weak?: boolean;
2492
+ [internalGroqTypeReferenceTo]?: "sanity.tree";
2493
+ };
2255
2494
 
2256
2495
  export declare type SanityVideoAsset = {
2257
- _id: string
2258
- _type: 'sanity.videoAsset'
2259
- _createdAt: string
2260
- _updatedAt: string
2261
- _rev: string
2262
- title?: string
2496
+ _id: string;
2497
+ _type: "sanity.videoAsset";
2498
+ _createdAt: string;
2499
+ _updatedAt: string;
2500
+ _rev: string;
2501
+ title?: string;
2263
2502
  description?: Array<{
2264
2503
  children?: Array<{
2265
- marks?: Array<string>
2266
- text?: string
2267
- _type: 'span'
2268
- _key: string
2269
- }>
2270
- style?: 'normal' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'blockquote'
2271
- listItem?: 'bullet' | 'number'
2504
+ marks?: Array<string>;
2505
+ text?: string;
2506
+ _type: "span";
2507
+ _key: string;
2508
+ }>;
2509
+ style?: "normal" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "blockquote";
2510
+ listItem?: "bullet" | "number";
2272
2511
  markDefs?: Array<{
2273
- href?: string
2274
- _type: 'link'
2275
- _key: string
2276
- }>
2277
- level?: number
2278
- _type: 'block'
2279
- _key: string
2280
- }>
2281
- state: SanityAssetInstanceState
2282
- sha1hash?: string
2283
- mimeType?: string
2284
- originalFilename?: string
2285
- size?: number
2286
- uploadId?: string
2287
- path?: string
2288
- url?: string
2289
- extension?: string
2512
+ href?: string;
2513
+ _type: "link";
2514
+ _key: string;
2515
+ }>;
2516
+ level?: number;
2517
+ _type: "block";
2518
+ _key: string;
2519
+ }>;
2520
+ state: SanityAssetInstanceState;
2521
+ sha1hash?: string;
2522
+ mimeType?: string;
2523
+ originalFilename?: string;
2524
+ size?: number;
2525
+ uploadId?: string;
2526
+ path?: string;
2527
+ url?: string;
2528
+ extension?: string;
2290
2529
  source?: {
2291
- id?: string
2292
- name?: string
2293
- url?: string
2294
- }
2295
- metadata: SanityVideoMetadata
2296
- }
2530
+ id?: string;
2531
+ name?: string;
2532
+ url?: string;
2533
+ };
2534
+ metadata: SanityVideoMetadata;
2535
+ rootDirectory?: SanityDirectoryReference;
2536
+ _system?: SanitySystem;
2537
+ };
2538
+
2539
+ declare type SanityVideoAssetReference = {
2540
+ _ref: string;
2541
+ _type: "reference";
2542
+ _weak?: boolean;
2543
+ [internalGroqTypeReferenceTo]?: "sanity.videoAsset";
2544
+ };
2297
2545
 
2298
2546
  declare type SanityVideoMetadata = {
2299
- _type: 'sanity.videoMetadata'
2300
- aspectRatio?: string
2301
- duration?: number
2302
- framerate?: number
2547
+ _type: "sanity.videoMetadata";
2548
+ aspectRatio?: string;
2549
+ duration?: number;
2550
+ framerate?: number;
2303
2551
  playbacks?: Array<
2304
2552
  {
2305
- _key: string
2553
+ _key: string;
2306
2554
  } & SanityVideoMetadataPlayback
2307
- >
2555
+ >;
2308
2556
  renditions?: Array<
2309
2557
  {
2310
- _key: string
2558
+ _key: string;
2311
2559
  } & SanityVideoMetadataRendition
2312
- >
2313
- }
2560
+ >;
2561
+ subtitles?: Array<
2562
+ {
2563
+ _key: string;
2564
+ } & SanityAssetSubtitleReference
2565
+ >;
2566
+ };
2314
2567
 
2315
2568
  declare type SanityVideoMetadataPlayback = {
2316
- _type: 'sanity.videoMetadata.playback'
2317
- _id: string
2318
- name?: string
2319
- policy: string
2320
- }
2569
+ _type: "sanity.videoMetadata.playback";
2570
+ _id: string;
2571
+ name?: string;
2572
+ policy: string;
2573
+ };
2321
2574
 
2322
2575
  export declare type SanityVideoMetadataRendition = {
2323
- _type: 'sanity.videoMetadata.rendition'
2324
- name: string
2325
- resolution: string
2326
- }
2576
+ _type: "sanity.videoMetadata.rendition";
2577
+ name: string;
2578
+ resolution: string;
2579
+ };
2327
2580
 
2328
2581
  /** @public */
2329
2582
  declare interface Schema {
2330
2583
  /** @internal */
2331
2584
  _original?: {
2332
- name: string
2333
- types: SchemaTypeDefinition[]
2334
- }
2585
+ name: string;
2586
+ types: SchemaTypeDefinition[];
2587
+ };
2335
2588
  /** @internal */
2336
2589
  _registry: {
2337
- [typeName: string]: any
2338
- }
2590
+ [typeName: string]: any;
2591
+ };
2339
2592
  /** @internal */
2340
- _validation?: SchemaValidationProblemGroup[]
2341
- name: string
2342
- get: (name: string) => SchemaType | undefined
2343
- has: (name: string) => boolean
2344
- getTypeNames: () => string[]
2593
+ _validation?: SchemaValidationProblemGroup[];
2594
+ name: string;
2595
+ get: (name: string) => SchemaType | undefined;
2596
+ has: (name: string) => boolean;
2597
+ getTypeNames: () => string[];
2345
2598
  /**
2346
2599
  * Returns the types which were explicitly defined in this schema,
2347
2600
  * as opposed to the types which were inherited from the parent.
2348
2601
  */
2349
- getLocalTypeNames: () => string[]
2602
+ getLocalTypeNames: () => string[];
2350
2603
  /**
2351
2604
  * Returns the parent schema.
2352
2605
  */
2353
- parent?: Schema
2606
+ parent?: Schema;
2354
2607
  }
2355
2608
 
2356
2609
  /**
@@ -2366,7 +2619,7 @@ declare type SchemaType =
2366
2619
  | NumberSchemaType
2367
2620
  | ObjectSchemaType
2368
2621
  | StringSchemaType
2369
- | ReferenceSchemaType
2622
+ | ReferenceSchemaType;
2370
2623
 
2371
2624
  /**
2372
2625
  * Represents a Sanity schema type definition with an optional type parameter.
@@ -2378,38 +2631,42 @@ declare type SchemaType =
2378
2631
  *
2379
2632
  * @public
2380
2633
  */
2381
- declare type SchemaTypeDefinition<TType extends IntrinsicTypeName = IntrinsicTypeName> =
2634
+ declare type SchemaTypeDefinition<
2635
+ TType extends IntrinsicTypeName = IntrinsicTypeName,
2636
+ > =
2382
2637
  | IntrinsicDefinitions[IntrinsicTypeName]
2383
- | TypeAliasDefinition<string, TType>
2638
+ | TypeAliasDefinition<string, TType>;
2384
2639
 
2385
2640
  /** @public */
2386
2641
  declare interface SchemaValidationError {
2387
- helpId?: string
2388
- message: string
2389
- severity: 'error'
2642
+ helpId?: string;
2643
+ message: string;
2644
+ severity: "error";
2390
2645
  }
2391
2646
 
2392
2647
  /** @internal */
2393
- declare type SchemaValidationProblem = SchemaValidationError | SchemaValidationWarning
2648
+ declare type SchemaValidationProblem =
2649
+ | SchemaValidationError
2650
+ | SchemaValidationWarning;
2394
2651
 
2395
2652
  /** @internal */
2396
2653
  declare interface SchemaValidationProblemGroup {
2397
- path: SchemaValidationProblemPath
2398
- problems: SchemaValidationProblem[]
2654
+ path: SchemaValidationProblemPath;
2655
+ problems: SchemaValidationProblem[];
2399
2656
  }
2400
2657
 
2401
2658
  /** @internal */
2402
2659
  declare type SchemaValidationProblemPath = Array<
2403
2660
  | {
2404
- kind: 'type'
2405
- type: string
2406
- name?: string
2661
+ kind: "type";
2662
+ type: string;
2663
+ name?: string;
2407
2664
  }
2408
2665
  | {
2409
- kind: 'property'
2410
- name: string
2666
+ kind: "property";
2667
+ name: string;
2411
2668
  }
2412
- >
2669
+ >;
2413
2670
 
2414
2671
  /**
2415
2672
  * Represents the possible values of a schema type's `validation` field.
@@ -2441,13 +2698,13 @@ declare type SchemaValidationValue =
2441
2698
  | undefined
2442
2699
  | Rule
2443
2700
  | SchemaValidationValue[]
2444
- | ((rule: Rule) => SchemaValidationValue)
2701
+ | ((rule: Rule, context?: ValidationContext) => SchemaValidationValue);
2445
2702
 
2446
2703
  /** @internal */
2447
2704
  declare interface SchemaValidationWarning {
2448
- helpId?: string
2449
- message: string
2450
- severity: 'warning'
2705
+ helpId?: string;
2706
+ message: string;
2707
+ severity: "warning";
2451
2708
  }
2452
2709
 
2453
2710
  /** @public */
@@ -2467,35 +2724,35 @@ declare interface SearchConfiguration {
2467
2724
  * Note: Search weight configuration is currently supported only for fields
2468
2725
  * of type string or portable text arrays.
2469
2726
  */
2470
- weight?: number
2471
- }
2727
+ weight?: number;
2728
+ };
2472
2729
  }
2473
2730
 
2474
2731
  /**
2475
2732
  * @public
2476
2733
  */
2477
- declare const searchStrategies: readonly ['groqLegacy', 'groq2024']
2734
+ declare const searchStrategies: readonly ["groqLegacy", "groq2024"];
2478
2735
 
2479
2736
  /**
2480
2737
  * @public
2481
2738
  */
2482
- declare type SearchStrategy = (typeof searchStrategies)[number]
2739
+ declare type SearchStrategy = (typeof searchStrategies)[number];
2483
2740
 
2484
2741
  /** @public */
2485
2742
  declare interface SingleFieldSet {
2486
- single: true
2487
- field: ObjectField
2488
- hidden?: ConditionalProperty
2489
- readOnly?: ConditionalProperty
2490
- group?: string | string[]
2743
+ single: true;
2744
+ field: ObjectField;
2745
+ hidden?: ConditionalProperty;
2746
+ readOnly?: ConditionalProperty;
2747
+ group?: string | string[];
2491
2748
  }
2492
2749
 
2493
2750
  /** @public */
2494
2751
  declare interface SlugDefinition extends BaseSchemaDefinition {
2495
- type: 'slug'
2496
- options?: SlugOptions
2497
- validation?: ValidationBuilder<SlugRule, SlugValue>
2498
- initialValue?: InitialValueProperty<any, Omit<SlugValue, '_type'>>
2752
+ type: "slug";
2753
+ options?: SlugOptions;
2754
+ validation?: ValidationBuilder<SlugRule, SlugValue>;
2755
+ initialValue?: InitialValueProperty<any, Omit<SlugValue, "_type">>;
2499
2756
  }
2500
2757
 
2501
2758
  /** @public */
@@ -2503,86 +2760,102 @@ declare type SlugifierFn = (
2503
2760
  source: string,
2504
2761
  schemaType: SlugSchemaType,
2505
2762
  context: SlugSourceContext,
2506
- ) => string | Promise<string>
2763
+ ) => string | Promise<string>;
2507
2764
 
2508
2765
  /** @public */
2509
2766
  declare type SlugIsUniqueValidator = (
2510
2767
  slug: string,
2511
2768
  context: SlugValidationContext,
2512
- ) => boolean | Promise<boolean>
2769
+ ) => boolean | Promise<boolean>;
2513
2770
 
2514
2771
  /** @public */
2515
- declare interface SlugOptions extends SearchConfiguration, BaseSchemaTypeOptions {
2516
- source?: string | Path | SlugSourceFn
2517
- maxLength?: number
2518
- slugify?: SlugifierFn
2519
- isUnique?: SlugIsUniqueValidator
2520
- disableArrayWarning?: boolean
2772
+ declare interface SlugOptions
2773
+ extends SearchConfiguration, BaseSchemaTypeOptions {
2774
+ source?: string | Path | SlugSourceFn;
2775
+ maxLength?: number;
2776
+ slugify?: SlugifierFn;
2777
+ isUnique?: SlugIsUniqueValidator;
2778
+ disableArrayWarning?: boolean;
2521
2779
  }
2522
2780
 
2523
2781
  /** @public */
2524
- declare type SlugParent = Record<string, unknown> | Record<string, unknown>[]
2782
+ declare type SlugParent = Record<string, unknown> | Record<string, unknown>[];
2525
2783
 
2526
2784
  /** @public */
2527
2785
  declare interface SlugRule extends RuleDef<SlugRule, SlugValue> {}
2528
2786
 
2529
2787
  /** @public */
2530
2788
  declare interface SlugSchemaType extends ObjectSchemaType {
2531
- jsonType: 'object'
2532
- options?: SlugOptions
2789
+ jsonType: "object";
2790
+ options?: SlugOptions;
2533
2791
  }
2534
2792
 
2535
2793
  /** @public */
2536
2794
  declare interface SlugSourceContext {
2537
- parentPath: Path
2538
- parent: SlugParent
2539
- projectId: string
2540
- dataset: string
2541
- schema: Schema
2542
- currentUser: CurrentUser | null
2543
- getClient: (options: {apiVersion: string}) => SanityClient
2795
+ parentPath: Path;
2796
+ parent: SlugParent;
2797
+ projectId: string;
2798
+ dataset: string;
2799
+ schema: Schema;
2800
+ currentUser: CurrentUser | null;
2801
+ getClient: (options: { apiVersion: string }) => SanityClient;
2544
2802
  }
2545
2803
 
2546
2804
  /** @public */
2547
2805
  declare type SlugSourceFn = (
2548
2806
  document: SanityDocument,
2549
2807
  context: SlugSourceContext,
2550
- ) => string | Promise<string>
2808
+ ) => string | Promise<string>;
2551
2809
 
2552
2810
  /** @public */
2553
2811
  declare interface SlugValidationContext extends ValidationContext {
2554
- parent: SlugParent
2555
- type: SlugSchemaType
2556
- defaultIsUnique: SlugIsUniqueValidator
2812
+ parent: SlugParent;
2813
+ type: SlugSchemaType;
2814
+ defaultIsUnique: SlugIsUniqueValidator;
2557
2815
  }
2558
2816
 
2559
2817
  /** @public */
2560
2818
  declare interface SlugValue {
2561
- _type: 'slug'
2562
- current?: string
2819
+ _type: "slug";
2820
+ current?: string;
2563
2821
  }
2564
2822
 
2565
2823
  /** @beta */
2566
2824
  declare type SortOrdering = {
2567
- title: string
2568
- i18n?: I18nTextRecord<'title'>
2569
- name: string
2570
- by: SortOrderingItem[]
2571
- }
2825
+ title: string;
2826
+ i18n?: I18nTextRecord<"title">;
2827
+ name: string;
2828
+ by: SortOrderingItem[];
2829
+ };
2572
2830
 
2573
2831
  /** @beta */
2574
2832
  declare interface SortOrderingItem {
2575
- field: string
2576
- direction: 'asc' | 'desc'
2833
+ field: string;
2834
+ direction: "asc" | "desc";
2835
+ /**
2836
+ * Controls whether null/undefined values appear first or last in the sort order.
2837
+ *
2838
+ * Defaults match PostgreSQL behavior:
2839
+ * - `'desc'` direction → nulls first
2840
+ * - `'asc'` direction → nulls last
2841
+ *
2842
+ * Only specify this to override the default (e.g. `nulls: 'last'` with `direction: 'desc'`).
2843
+ *
2844
+ * ### ❗This is an experimental feature.
2845
+ * Overriding the default may have performance implications for document types
2846
+ * with hundreds of documents.
2847
+ * @alpha
2848
+ */
2849
+ nulls?: "first" | "last";
2577
2850
  }
2578
2851
 
2579
2852
  /** @public */
2580
2853
  declare interface StringDefinition extends BaseSchemaDefinition {
2581
- type: 'string'
2582
- options?: StringOptions
2583
- placeholder?: string
2584
- validation?: ValidationBuilder<StringRule, string>
2585
- initialValue?: InitialValueProperty<any, string>
2854
+ type: "string";
2855
+ options?: StringOptions;
2856
+ placeholder?: string;
2857
+ validation?: ValidationBuilder<StringRule, string>;
2858
+ initialValue?: InitialValueProperty<any, string>;
2586
2859
  }
2587
2860
 
2588
2861
  /** @public */
@@ -2591,29 +2864,29 @@ declare interface StringOptions
2591
2864
 
2592
2865
  /** @public */
2593
2866
  declare interface StringRule extends RuleDef<StringRule, string> {
2594
- min: (minNumber: number | FieldReference) => StringRule
2595
- max: (maxNumber: number | FieldReference) => StringRule
2596
- length: (exactLength: number | FieldReference) => StringRule
2597
- uppercase: () => StringRule
2598
- lowercase: () => StringRule
2867
+ min: (minNumber: number | FieldReference) => StringRule;
2868
+ max: (maxNumber: number | FieldReference) => StringRule;
2869
+ length: (exactLength: number | FieldReference) => StringRule;
2870
+ uppercase: () => StringRule;
2871
+ lowercase: () => StringRule;
2599
2872
  regex(
2600
2873
  pattern: RegExp,
2601
2874
  name: string,
2602
2875
  options: {
2603
- name?: string
2604
- invert?: boolean
2876
+ name?: string;
2877
+ invert?: boolean;
2605
2878
  },
2606
- ): StringRule
2879
+ ): StringRule;
2607
2880
  regex(
2608
2881
  pattern: RegExp,
2609
2882
  options: {
2610
- name?: string
2611
- invert?: boolean
2883
+ name?: string;
2884
+ invert?: boolean;
2612
2885
  },
2613
- ): StringRule
2614
- regex(pattern: RegExp, name: string): StringRule
2615
- regex(pattern: RegExp): StringRule
2616
- email(): StringRule
2886
+ ): StringRule;
2887
+ regex(pattern: RegExp, name: string): StringRule;
2888
+ regex(pattern: RegExp): StringRule;
2889
+ email(): StringRule;
2617
2890
  }
2618
2891
 
2619
2892
  /**
@@ -2623,19 +2896,19 @@ declare interface StringRule extends RuleDef<StringRule, string> {
2623
2896
  * @public
2624
2897
  */
2625
2898
  declare interface StringSchemaType extends BaseSchemaType {
2626
- jsonType: 'string'
2627
- options?: StringOptions & TextOptions & DateOptions & DatetimeOptions
2628
- initialValue?: InitialValueProperty<any, string>
2899
+ jsonType: "string";
2900
+ options?: StringOptions & TextOptions & DateOptions & DatetimeOptions;
2901
+ initialValue?: InitialValueProperty<any, string>;
2629
2902
  }
2630
2903
 
2631
2904
  /** @public */
2632
2905
  declare interface TextDefinition extends BaseSchemaDefinition {
2633
- type: 'text'
2634
- rows?: number
2635
- options?: TextOptions
2636
- placeholder?: string
2637
- validation?: ValidationBuilder<TextRule, string>
2638
- initialValue?: InitialValueProperty<any, string>
2906
+ type: "text";
2907
+ rows?: number;
2908
+ options?: TextOptions;
2909
+ placeholder?: string;
2910
+ validation?: ValidationBuilder<TextRule, string>;
2911
+ initialValue?: InitialValueProperty<any, string>;
2639
2912
  }
2640
2913
 
2641
2914
  /** @public */
@@ -2646,9 +2919,9 @@ declare interface TextRule extends StringRule {}
2646
2919
 
2647
2920
  /** @public */
2648
2921
  declare interface TitledListValue<V = unknown> {
2649
- _key?: string
2650
- title: string
2651
- value?: V
2922
+ _key?: string;
2923
+ title: string;
2924
+ value?: V;
2652
2925
  }
2653
2926
 
2654
2927
  /**
@@ -2663,21 +2936,23 @@ declare interface TypeAliasDefinition<
2663
2936
  TType extends string,
2664
2937
  TAlias extends IntrinsicTypeName | undefined,
2665
2938
  > extends BaseSchemaDefinition {
2666
- type: TType
2667
- options?: TAlias extends IntrinsicTypeName ? IntrinsicDefinitions[TAlias]['options'] : unknown
2668
- validation?: SchemaValidationValue
2669
- initialValue?: InitialValueProperty<any, any>
2670
- preview?: PreviewConfig
2939
+ type: TType;
2940
+ options?: TAlias extends IntrinsicTypeName
2941
+ ? IntrinsicDefinitions[TAlias]["options"]
2942
+ : unknown;
2943
+ validation?: SchemaValidationValue;
2944
+ initialValue?: InitialValueProperty<any, any>;
2945
+ preview?: PreviewConfig;
2671
2946
  components?: {
2672
- annotation?: ComponentType<any>
2673
- block?: ComponentType<any>
2674
- inlineBlock?: ComponentType<any>
2675
- diff?: ComponentType<any>
2676
- field?: ComponentType<any>
2677
- input?: ComponentType<any>
2678
- item?: ComponentType<any>
2679
- preview?: ComponentType<any>
2680
- }
2947
+ annotation?: ComponentType<any>;
2948
+ block?: ComponentType<any>;
2949
+ inlineBlock?: ComponentType<any>;
2950
+ diff?: ComponentType<any>;
2951
+ field?: ComponentType<any>;
2952
+ input?: ComponentType<any>;
2953
+ item?: ComponentType<any>;
2954
+ preview?: ComponentType<any>;
2955
+ };
2681
2956
  }
2682
2957
 
2683
2958
  /**
@@ -2686,46 +2961,44 @@ declare interface TypeAliasDefinition<
2686
2961
  * @public
2687
2962
  */
2688
2963
  declare interface TypeReference {
2689
- type: string
2690
- name?: string
2691
- icon?: ComponentType | ReactNode
2964
+ type: string;
2965
+ name?: string;
2966
+ icon?: ComponentType | ReactNode;
2692
2967
  options?: {
2693
- [key: string]: unknown
2694
- }
2968
+ [key: string]: unknown;
2969
+ };
2695
2970
  }
2696
2971
 
2697
2972
  export declare type UploadSession = {
2698
- _id: string
2699
- _type: 'sanity.asset.upload-session'
2700
- _createdAt: string
2701
- _updatedAt: string
2702
- _rev: string
2703
- title: string
2704
- assets?: Array<{
2705
- _ref: string
2706
- _type: 'reference'
2707
- _weak?: boolean
2708
- _key: string
2709
- [internalGroqTypeReferenceTo]?: 'sanity.asset'
2710
- }>
2711
- _system?: SanitySystem
2712
- }
2973
+ _id: string;
2974
+ _type: "sanity.asset.upload-session";
2975
+ _createdAt: string;
2976
+ _updatedAt: string;
2977
+ _rev: string;
2978
+ title: string;
2979
+ assets?: Array<
2980
+ {
2981
+ _key: string;
2982
+ } & SanityAssetReference
2983
+ >;
2984
+ _system?: SanitySystem;
2985
+ };
2713
2986
 
2714
2987
  /** @public */
2715
2988
  declare interface UriValidationOptions {
2716
- scheme?: (string | RegExp) | Array<string | RegExp>
2717
- allowRelative?: boolean
2718
- relativeOnly?: boolean
2719
- allowCredentials?: boolean
2989
+ scheme?: (string | RegExp) | Array<string | RegExp>;
2990
+ allowRelative?: boolean;
2991
+ relativeOnly?: boolean;
2992
+ allowCredentials?: boolean;
2720
2993
  }
2721
2994
 
2722
2995
  /** @public */
2723
2996
  declare interface UrlDefinition extends BaseSchemaDefinition {
2724
- type: 'url'
2725
- options?: UrlOptions
2726
- placeholder?: string
2727
- validation?: ValidationBuilder<UrlRule, string>
2728
- initialValue?: InitialValueProperty<any, string>
2997
+ type: "url";
2998
+ options?: UrlOptions;
2999
+ placeholder?: string;
3000
+ validation?: ValidationBuilder<UrlRule, string>;
3001
+ initialValue?: InitialValueProperty<any, string>;
2729
3002
  }
2730
3003
 
2731
3004
  /** @public */
@@ -2733,13 +3006,14 @@ declare interface UrlOptions extends BaseSchemaTypeOptions {}
2733
3006
 
2734
3007
  /** @public */
2735
3008
  declare interface UrlRule extends RuleDef<UrlRule, string> {
2736
- uri(options: UriValidationOptions): UrlRule
3009
+ uri(options: UriValidationOptions): UrlRule;
2737
3010
  }
2738
3011
 
2739
3012
  /** @public */
2740
- declare type ValidationBuilder<T extends RuleDef<T, FieldValue>, FieldValue = unknown> = (
2741
- rule: T,
2742
- ) => RuleBuilder<T, FieldValue>
3013
+ declare type ValidationBuilder<
3014
+ T extends RuleDef<T, FieldValue>,
3015
+ FieldValue = unknown,
3016
+ > = (rule: T, context?: ValidationContext) => RuleBuilder<T, FieldValue>;
2743
3017
 
2744
3018
  /**
2745
3019
  * A context object passed around during validation. This includes the
@@ -2756,14 +3030,18 @@ declare type ValidationBuilder<T extends RuleDef<T, FieldValue>, FieldValue = un
2756
3030
  * @public
2757
3031
  */
2758
3032
  declare interface ValidationContext {
2759
- getClient: (options: {apiVersion: string}) => SanityClient
2760
- schema: Schema
2761
- parent?: unknown
2762
- type?: SchemaType
2763
- document?: SanityDocument
2764
- path?: Path
2765
- getDocumentExists?: (options: {id: string}) => Promise<boolean>
2766
- environment: 'cli' | 'studio'
3033
+ getClient: (options: { apiVersion: string }) => SanityClient;
3034
+ schema: Schema;
3035
+ parent?: unknown;
3036
+ type?: SchemaType;
3037
+ document?: SanityDocument;
3038
+ path?: Path;
3039
+ getDocumentExists?: (options: { id: string }) => Promise<boolean>;
3040
+ environment: "cli" | "studio";
3041
+ /**
3042
+ * Whether this field is hidden for any reason (either itself or any of its ancestors).
3043
+ */
3044
+ hidden?: boolean;
2767
3045
  }
2768
3046
 
2769
3047
  /**
@@ -2779,7 +3057,7 @@ declare interface ValidationError {
2779
3057
  * The message describing why the value is not valid. This message will be
2780
3058
  * included in the validation markers after validation has finished running.
2781
3059
  */
2782
- message: string
3060
+ message: string;
2783
3061
  /**
2784
3062
  * If writing a custom validator, you can return validation messages to
2785
3063
  * specific path inside of the current value (object or array) by populating
@@ -2788,14 +3066,14 @@ declare interface ValidationError {
2788
3066
  * NOTE: This path is relative to the current value and _not_ relative to
2789
3067
  * the document.
2790
3068
  */
2791
- path?: Path
3069
+ path?: Path;
2792
3070
  /**
2793
3071
  * Extra metadata for the validation error. Currently used by the Media Library asset source to ignore
2794
3072
  * certain validation markers when validating asset source media library assets.
2795
3073
  *
2796
3074
  * @internal
2797
3075
  */
2798
- __internal_metadata?: unknown
3076
+ __internal_metadata?: unknown;
2799
3077
  /**
2800
3078
  * Same as `path` but allows more than one value. If provided, the same
2801
3079
  * message will create two markers from each path with the same message
@@ -2803,32 +3081,32 @@ declare interface ValidationError {
2803
3081
  *
2804
3082
  * @deprecated prefer `path`
2805
3083
  */
2806
- paths?: Path[]
3084
+ paths?: Path[];
2807
3085
  /**
2808
3086
  * @deprecated Unused. Was used to store the results from `.either()` /`.all()`
2809
3087
  */
2810
- children?: ValidationMarker[]
3088
+ children?: ValidationMarker[];
2811
3089
  /**
2812
3090
  * @deprecated Unused. Was used to signal if this error came from an `.either()`/`.all()`.
2813
3091
  */
2814
- operation?: 'AND' | 'OR'
3092
+ operation?: "AND" | "OR";
2815
3093
  /**
2816
3094
  * @deprecated Unused. Was relevant when validation error was used as a class.
2817
3095
  */
2818
- cloneWithMessage?(message: string): ValidationError
3096
+ cloneWithMessage?(message: string): ValidationError;
2819
3097
  }
2820
3098
 
2821
3099
  /** @public */
2822
3100
  declare interface ValidationMarker {
2823
- level: 'error' | 'warning' | 'info'
3101
+ level: "error" | "warning" | "info";
2824
3102
  /**
2825
3103
  * The validation message for this marker. E.g. "Must be greater than 0"
2826
3104
  */
2827
- message: string
3105
+ message: string;
2828
3106
  /**
2829
3107
  * @deprecated use `message` instead
2830
3108
  */
2831
- item?: ValidationError
3109
+ item?: ValidationError;
2832
3110
  /**
2833
3111
  * The sanity path _relative to the root of the current document_ to this
2834
3112
  * marker.
@@ -2836,14 +3114,14 @@ declare interface ValidationMarker {
2836
3114
  * NOTE: Sanity paths may contain keyed segments (i.e. `{_key: string}`) that
2837
3115
  * are not compatible with deep getters like lodash/get
2838
3116
  */
2839
- path: Path
3117
+ path: Path;
2840
3118
  /**
2841
3119
  * Extra metadata for the validation marker. Currently used by the Media Library asset source to ignore
2842
3120
  * certain validation markers when validating asset source media library assets.
2843
3121
  *
2844
3122
  * @internal
2845
3123
  */
2846
- __internal_metadata?: unknown
3124
+ __internal_metadata?: unknown;
2847
3125
  }
2848
3126
 
2849
- export {}
3127
+ export {};