@sanity/media-library-types 1.1.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,158 +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
- pluginFilters?: PluginFilter[]
1545
- scheme: 'light' | 'dark'
1546
- selectAssetTypes: PluginSelectAssetType[]
1547
- selectionType: 'single' | 'multiple'
1548
- }
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
+ };
1549
1666
 
1550
1667
  export declare type PluginPostMessage =
1551
1668
  | PluginPostMessageAbortUploadRequest
@@ -1557,93 +1674,93 @@ export declare type PluginPostMessage =
1557
1674
  | PluginPostMessageTokenResponse
1558
1675
  | PluginPostMessageUploadFilesProgress
1559
1676
  | PluginPostMessageUploadFilesRequest
1560
- | PluginPostMessageUploadFilesResponse
1677
+ | PluginPostMessageUploadFilesResponse;
1561
1678
 
1562
1679
  export declare type PluginPostMessageAbortUploadRequest = {
1563
- type: 'abortUploadRequest'
1680
+ type: "abortUploadRequest";
1564
1681
  files?: {
1565
- id: string
1566
- }[]
1567
- }
1682
+ id: string;
1683
+ }[];
1684
+ };
1568
1685
 
1569
1686
  export declare type PluginPostMessageAssetSelection = {
1570
- type: 'assetSelection'
1571
- selection: AssetSelectionItemWithLegacySupport[]
1572
- }
1687
+ type: "assetSelection";
1688
+ selection: AssetSelectionItemWithLegacySupport[];
1689
+ };
1573
1690
 
1574
1691
  /**
1575
1692
  * Message sent from the plugin that a document has been updated
1576
1693
  */
1577
1694
  export declare type PluginPostMessageDocumentUpdate = {
1578
- type: 'documentUpdate'
1695
+ type: "documentUpdate";
1579
1696
  document: {
1580
- _id: string
1581
- _type: string
1582
- _rev: string
1583
- }
1584
- }
1697
+ _id: string;
1698
+ _type: string;
1699
+ _rev: string;
1700
+ };
1701
+ };
1585
1702
 
1586
1703
  /**
1587
1704
  * Message sent from a plugin page to notify the host that the page is loaded and ready to be interacted with
1588
1705
  */
1589
1706
  export declare type PluginPostMessagePageLoaded = {
1590
- type: 'pageLoaded'
1591
- page: string
1592
- }
1707
+ type: "pageLoaded";
1708
+ page: string;
1709
+ };
1593
1710
 
1594
1711
  /**
1595
1712
  * Message sent from a plugin page that a page is unloaded by the user (for closing the dialog and similar)
1596
1713
  */
1597
1714
  export declare type PluginPostMessagePageUnloaded = {
1598
- type: 'pageUnloaded'
1599
- page: string
1600
- }
1715
+ type: "pageUnloaded";
1716
+ page: string;
1717
+ };
1601
1718
 
1602
1719
  export declare type PluginPostMessageTokenRequest = {
1603
- type: 'tokenRequest'
1604
- }
1720
+ type: "tokenRequest";
1721
+ };
1605
1722
 
1606
1723
  export declare type PluginPostMessageTokenResponse = {
1607
- type: 'tokenResponse'
1608
- token: string | null
1609
- }
1724
+ type: "tokenResponse";
1725
+ token: string | null;
1726
+ };
1610
1727
 
1611
1728
  /**
1612
1729
  * Message sent from the plugin when files are uploading
1613
1730
  */
1614
1731
  export declare type PluginPostMessageUploadFilesProgress = {
1615
- type: 'uploadProgress'
1616
- files: FileUpload[]
1617
- }
1732
+ type: "uploadProgress";
1733
+ files: FileUpload[];
1734
+ };
1618
1735
 
1619
1736
  /**
1620
1737
  * Message sent from the plugin that the user wants to upload files
1621
1738
  */
1622
1739
  export declare type PluginPostMessageUploadFilesRequest = {
1623
- type: 'uploadRequest'
1740
+ type: "uploadRequest";
1624
1741
  files: {
1625
- id: string
1626
- file: File
1627
- }[]
1628
- }
1742
+ id: string;
1743
+ file: File;
1744
+ }[];
1745
+ };
1629
1746
 
1630
1747
  /**
1631
1748
  * Message sent from the app that the pending uploads are uploaded
1632
1749
  */
1633
1750
  export declare type PluginPostMessageUploadFilesResponse = {
1634
- type: 'uploadResponse'
1635
- assets: AssetSelectionItemWithLegacySupport[]
1636
- }
1751
+ type: "uploadResponse";
1752
+ assets: AssetSelectionItemWithLegacySupport[];
1753
+ };
1637
1754
 
1638
1755
  /**
1639
1756
  * Asset types that can be selected by the plugin
1640
1757
  */
1641
- export declare type PluginSelectAssetType = 'file' | 'image' | 'video'
1758
+ export declare type PluginSelectAssetType = "file" | "image" | "video";
1642
1759
 
1643
1760
  /** @public */
1644
1761
  declare interface PrepareViewOptions {
1645
1762
  /** @beta */
1646
- ordering?: SortOrdering
1763
+ ordering?: SortOrdering;
1647
1764
  }
1648
1765
 
1649
1766
  /** @public */
@@ -1651,91 +1768,121 @@ declare interface PreviewConfig<
1651
1768
  Select extends Record<string, string> = Record<string, string>,
1652
1769
  PrepareValue extends Record<keyof Select, any> = Record<keyof Select, any>,
1653
1770
  > {
1654
- select?: Select
1655
- prepare?: (value: PrepareValue, viewOptions?: PrepareViewOptions) => PreviewValue
1771
+ select?: Select;
1772
+ prepare?: (
1773
+ value: PrepareValue,
1774
+ viewOptions?: PrepareViewOptions,
1775
+ ) => PreviewValue;
1656
1776
  }
1657
1777
 
1658
1778
  /** @public */
1659
1779
  declare interface PreviewValue {
1660
- _id?: string
1661
- _createdAt?: string
1662
- _updatedAt?: string
1663
- title?: string
1664
- subtitle?: string
1665
- description?: string
1666
- media?: ReactNode | ElementType
1667
- 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;
1668
1788
  }
1669
1789
 
1670
1790
  /** @public */
1671
1791
  declare interface Reference {
1672
- _type: string
1673
- _ref: string
1674
- _key?: string
1675
- _weak?: boolean
1792
+ _type: string;
1793
+ _ref: string;
1794
+ _key?: string;
1795
+ _weak?: boolean;
1676
1796
  _strengthenOnPublish?: {
1677
- type: string
1678
- weak?: boolean
1797
+ type: string;
1798
+ weak?: boolean;
1679
1799
  template?: {
1680
- id: string
1681
- params: Record<string, string | number | boolean>
1682
- }
1683
- }
1800
+ id: string;
1801
+ params: Record<string, string | number | boolean>;
1802
+ };
1803
+ };
1684
1804
  }
1685
1805
 
1686
1806
  /** @public */
1687
1807
  declare interface ReferenceBaseOptions extends BaseSchemaTypeOptions {
1688
- 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;
1689
1834
  }
1690
1835
 
1691
1836
  /** @public */
1692
1837
  declare interface ReferenceDefinition extends BaseSchemaDefinition {
1693
- type: 'reference'
1694
- to: ReferenceTo
1695
- weak?: boolean
1696
- options?: ReferenceOptions
1697
- validation?: ValidationBuilder<ReferenceRule, ReferenceValue>
1698
- 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">>;
1699
1844
  }
1700
1845
 
1701
1846
  /** @public */
1702
- declare type ReferenceFilterOptions = ReferenceFilterResolverOptions | ReferenceFilterQueryOptions
1847
+ declare type ReferenceFilterOptions =
1848
+ | ReferenceFilterResolverOptions
1849
+ | ReferenceFilterQueryOptions;
1703
1850
 
1704
1851
  /** @public */
1705
1852
  declare interface ReferenceFilterQueryOptions {
1706
- filter: string
1707
- filterParams?: Record<string, unknown>
1853
+ filter: string;
1854
+ filterParams?: Record<string, unknown>;
1708
1855
  }
1709
1856
 
1710
1857
  /** @public */
1711
1858
  declare type ReferenceFilterResolver = (
1712
1859
  context: ReferenceFilterResolverContext,
1713
- ) => ReferenceFilterSearchOptions | Promise<ReferenceFilterSearchOptions>
1860
+ ) => ReferenceFilterSearchOptions | Promise<ReferenceFilterSearchOptions>;
1714
1861
 
1715
1862
  /** @public */
1716
1863
  declare interface ReferenceFilterResolverContext {
1717
- document: SanityDocument
1718
- parent?: Record<string, unknown> | Record<string, unknown>[]
1719
- parentPath: Path
1720
- perspective: StackablePerspective[]
1721
- 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;
1722
1869
  }
1723
1870
 
1724
1871
  /** @public */
1725
1872
  declare interface ReferenceFilterResolverOptions {
1726
- filter?: ReferenceFilterResolver
1727
- filterParams?: never
1873
+ filter?: ReferenceFilterResolver;
1874
+ filterParams?: never;
1728
1875
  }
1729
1876
 
1730
1877
  /** @public */
1731
1878
  declare type ReferenceFilterSearchOptions = {
1732
- filter?: string
1733
- params?: Record<string, unknown>
1734
- tag?: string
1735
- maxFieldDepth?: number
1736
- strategy?: SearchStrategy
1737
- perspective?: Exclude<ClientPerspective, 'raw' | 'previewDrafts'>
1738
- }
1879
+ filter?: string;
1880
+ params?: Record<string, unknown>;
1881
+ tag?: string;
1882
+ maxFieldDepth?: number;
1883
+ strategy?: SearchStrategy;
1884
+ perspective?: Exclude<ClientPerspective, "raw" | "previewDrafts">;
1885
+ };
1739
1886
 
1740
1887
  /**
1741
1888
  * Types are closed for extension. To add properties via declaration merging to this type,
@@ -1747,33 +1894,77 @@ declare type ReferenceFilterSearchOptions = {
1747
1894
  *
1748
1895
  * @public
1749
1896
  */
1750
- declare type ReferenceOptions = ReferenceBaseOptions & ReferenceFilterOptions
1897
+ declare type ReferenceOptions = ReferenceBaseOptions & ReferenceFilterOptions;
1751
1898
 
1752
1899
  /** @public */
1753
- declare interface ReferenceRule extends RuleDef<ReferenceRule, ReferenceValue> {}
1900
+ declare interface ReferenceRule extends RuleDef<
1901
+ ReferenceRule,
1902
+ ReferenceValue
1903
+ > {}
1754
1904
 
1755
1905
  /** @public */
1756
- declare interface ReferenceSchemaType extends Omit<ObjectSchemaType, 'options'> {
1757
- jsonType: 'object'
1758
- to: ObjectSchemaType[]
1759
- weak?: boolean
1760
- 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;
1761
1914
  }
1762
1915
 
1763
1916
  /** @public */
1764
1917
  declare type ReferenceTo =
1765
1918
  | SchemaTypeDefinition
1766
1919
  | TypeReference
1767
- | 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
+ }
1768
1959
 
1769
1960
  /** @public */
1770
- declare type ReferenceValue = Reference
1961
+ declare type ReferenceValue = Reference;
1771
1962
 
1772
1963
  /** @public */
1773
1964
  declare interface Role {
1774
- name: string
1775
- title: string
1776
- description?: string
1965
+ name: string;
1966
+ title: string;
1967
+ description?: string;
1777
1968
  }
1778
1969
 
1779
1970
  /** @public */
@@ -1782,37 +1973,37 @@ declare interface Rule {
1782
1973
  * @internal
1783
1974
  * @deprecated internal use only
1784
1975
  */
1785
- _type: RuleTypeConstraint | undefined
1976
+ _type: RuleTypeConstraint | undefined;
1786
1977
  /**
1787
1978
  * @internal
1788
1979
  * @deprecated internal use only
1789
1980
  */
1790
- _level: 'error' | 'warning' | 'info' | undefined
1981
+ _level: "error" | "warning" | "info" | undefined;
1791
1982
  /**
1792
1983
  * @internal
1793
1984
  * @deprecated internal use only
1794
1985
  */
1795
- _required: 'required' | 'optional' | undefined
1986
+ _required: "required" | "optional" | undefined;
1796
1987
  /**
1797
1988
  * @internal
1798
1989
  * @deprecated internal use only
1799
1990
  */
1800
- _typeDef: SchemaType | undefined
1991
+ _typeDef: SchemaType | undefined;
1801
1992
  /**
1802
1993
  * @internal
1803
1994
  * @deprecated internal use only
1804
1995
  */
1805
- _message: string | LocalizedValidationMessages | undefined
1996
+ _message: string | LocalizedValidationMessages | undefined;
1806
1997
  /**
1807
1998
  * @internal
1808
1999
  * @deprecated internal use only
1809
2000
  */
1810
- _rules: RuleSpec[]
2001
+ _rules: RuleSpec[];
1811
2002
  /**
1812
2003
  * @internal
1813
2004
  * @deprecated internal use only
1814
2005
  */
1815
- _fieldRules: FieldRules | undefined
2006
+ _fieldRules: FieldRules | undefined;
1816
2007
  /**
1817
2008
  * Takes in a path and returns an object with a symbol.
1818
2009
  *
@@ -1835,62 +2026,65 @@ declare interface Rule {
1835
2026
  * ]
1836
2027
  * ```
1837
2028
  */
1838
- valueOfField: (path: string | string[]) => FieldReference
1839
- error(message?: string | LocalizedValidationMessages): Rule
1840
- warning(message?: string | LocalizedValidationMessages): Rule
1841
- info(message?: string | LocalizedValidationMessages): Rule
1842
- reset(): this
1843
- isRequired(): boolean
1844
- clone(): Rule
1845
- cloneWithRules(rules: RuleSpec[]): Rule
1846
- merge(rule: Rule): Rule
1847
- type(targetType: RuleTypeConstraint | Lowercase<RuleTypeConstraint>): Rule
1848
- all(children: Rule[]): Rule
1849
- either(children: Rule[]): Rule
1850
- optional(): Rule
1851
- 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;
1852
2044
  custom<T = unknown>(
1853
2045
  fn: CustomValidator<T>,
1854
2046
  options?: {
1855
- bypassConcurrencyLimit?: boolean
2047
+ bypassConcurrencyLimit?: boolean;
1856
2048
  },
1857
- ): Rule
1858
- media<T extends MediaAssetTypes = MediaAssetTypes>(fn: MediaValidator<T>): Rule
1859
- min(len: number | string | FieldReference): Rule
1860
- max(len: number | string | FieldReference): Rule
1861
- length(len: number | FieldReference): Rule
1862
- valid(value: unknown | unknown[]): Rule
1863
- integer(): Rule
1864
- precision(limit: number | FieldReference): Rule
1865
- positive(): Rule
1866
- negative(): Rule
1867
- greaterThan(num: number | FieldReference): Rule
1868
- lessThan(num: number | FieldReference): Rule
1869
- uppercase(): Rule
1870
- 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;
1871
2065
  regex(
1872
2066
  pattern: RegExp,
1873
2067
  name: string,
1874
2068
  options: {
1875
- name?: string
1876
- invert?: boolean
2069
+ name?: string;
2070
+ invert?: boolean;
1877
2071
  },
1878
- ): Rule
2072
+ ): Rule;
1879
2073
  regex(
1880
2074
  pattern: RegExp,
1881
2075
  options: {
1882
- name?: string
1883
- invert?: boolean
2076
+ name?: string;
2077
+ invert?: boolean;
1884
2078
  },
1885
- ): Rule
1886
- regex(pattern: RegExp, name: string): Rule
1887
- regex(pattern: RegExp): Rule
1888
- email(): Rule
1889
- uri(options?: UriValidationOptions): Rule
1890
- unique(): Rule
1891
- reference(): Rule
1892
- fields(rules: FieldRules): Rule
1893
- 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;
1894
2088
  validate(
1895
2089
  value: unknown,
1896
2090
  options: ValidationContext & {
@@ -1900,194 +2094,208 @@ declare interface Rule {
1900
2094
  */
1901
2095
  __internal?: {
1902
2096
  customValidationConcurrencyLimiter?: {
1903
- ready: () => Promise<void>
1904
- release: () => void
1905
- }
1906
- }
2097
+ ready: () => Promise<void>;
2098
+ release: () => void;
2099
+ };
2100
+ };
1907
2101
  },
1908
- ): Promise<ValidationMarker[]>
2102
+ ): Promise<ValidationMarker[]>;
1909
2103
  }
1910
2104
 
1911
2105
  /** @public */
1912
- 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[];
1913
2110
 
1914
2111
  /** @public */
1915
2112
  declare interface RuleDef<T, FieldValue = unknown> {
1916
- required: () => T
2113
+ required: () => T;
2114
+ skip: () => T;
1917
2115
  custom: <LenientFieldValue extends FieldValue>(
1918
2116
  fn: CustomValidator<LenientFieldValue | undefined>,
1919
- ) => T
1920
- info: (message?: string | LocalizedValidationMessages) => T
1921
- error: (message?: string | LocalizedValidationMessages) => T
1922
- warning: (message?: string | LocalizedValidationMessages) => T
1923
- 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;
1924
2122
  }
1925
2123
 
1926
2124
  /** @public */
1927
2125
  declare type RuleSpec =
1928
2126
  | {
1929
- flag: 'integer'
2127
+ flag: "integer";
1930
2128
  }
1931
2129
  | {
1932
- flag: 'email'
2130
+ flag: "email";
1933
2131
  }
1934
2132
  | {
1935
- flag: 'unique'
2133
+ flag: "unique";
1936
2134
  }
1937
2135
  | {
1938
- flag: 'reference'
2136
+ flag: "reference";
1939
2137
  }
1940
2138
  | {
1941
- flag: 'type'
1942
- constraint: RuleTypeConstraint
2139
+ flag: "type";
2140
+ constraint: RuleTypeConstraint;
1943
2141
  }
1944
2142
  | {
1945
- flag: 'all'
1946
- constraint: Rule[]
2143
+ flag: "all";
2144
+ constraint: Rule[];
1947
2145
  }
1948
2146
  | {
1949
- flag: 'either'
1950
- constraint: Rule[]
2147
+ flag: "either";
2148
+ constraint: Rule[];
1951
2149
  }
1952
2150
  | {
1953
- flag: 'presence'
1954
- constraint: 'optional' | 'required'
2151
+ flag: "presence";
2152
+ constraint: "optional" | "required";
1955
2153
  }
1956
2154
  | {
1957
- flag: 'custom'
1958
- constraint: CustomValidator
2155
+ flag: "custom";
2156
+ constraint: CustomValidator;
1959
2157
  }
1960
2158
  | {
1961
- flag: 'min'
1962
- constraint: number | string | FieldReference
2159
+ flag: "min";
2160
+ constraint: number | string | FieldReference;
1963
2161
  }
1964
2162
  | {
1965
- flag: 'max'
1966
- constraint: number | string | FieldReference
2163
+ flag: "max";
2164
+ constraint: number | string | FieldReference;
1967
2165
  }
1968
2166
  | {
1969
- flag: 'length'
1970
- constraint: number | FieldReference
2167
+ flag: "length";
2168
+ constraint: number | FieldReference;
1971
2169
  }
1972
2170
  | {
1973
- flag: 'valid'
1974
- constraint: unknown[]
2171
+ flag: "valid";
2172
+ constraint: unknown[];
1975
2173
  }
1976
2174
  | {
1977
- flag: 'precision'
1978
- constraint: number | FieldReference
2175
+ flag: "precision";
2176
+ constraint: number | FieldReference;
1979
2177
  }
1980
2178
  | {
1981
- flag: 'lessThan'
1982
- constraint: number | FieldReference
2179
+ flag: "lessThan";
2180
+ constraint: number | FieldReference;
1983
2181
  }
1984
2182
  | {
1985
- flag: 'greaterThan'
1986
- constraint: number | FieldReference
2183
+ flag: "greaterThan";
2184
+ constraint: number | FieldReference;
1987
2185
  }
1988
2186
  | {
1989
- flag: 'stringCasing'
1990
- constraint: 'uppercase' | 'lowercase'
2187
+ flag: "stringCasing";
2188
+ constraint: "uppercase" | "lowercase";
1991
2189
  }
1992
2190
  | {
1993
- flag: 'assetRequired'
2191
+ flag: "assetRequired";
1994
2192
  constraint: {
1995
- assetType: 'asset' | 'image' | 'file'
1996
- }
2193
+ assetType: "asset" | "image" | "file";
2194
+ };
1997
2195
  }
1998
2196
  | {
1999
- flag: 'media'
2000
- constraint: MediaValidator<any>
2197
+ flag: "media";
2198
+ constraint: MediaValidator<any>;
2001
2199
  }
2002
2200
  | {
2003
- flag: 'regex'
2201
+ flag: "regex";
2004
2202
  constraint: {
2005
- pattern: RegExp
2006
- name?: string
2007
- invert: boolean
2008
- }
2203
+ pattern: RegExp;
2204
+ name?: string;
2205
+ invert: boolean;
2206
+ };
2009
2207
  }
2010
2208
  | {
2011
- flag: 'uri'
2209
+ flag: "uri";
2012
2210
  constraint: {
2013
2211
  options: {
2014
- scheme: RegExp[]
2015
- allowRelative: boolean
2016
- relativeOnly: boolean
2017
- allowCredentials: boolean
2018
- }
2019
- }
2020
- }
2021
-
2022
- /** @public */
2023
- 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";
2024
2228
 
2025
2229
  declare type SanityAsset = {
2026
- _id: string
2027
- _type: 'sanity.asset'
2028
- _createdAt: string
2029
- _updatedAt: string
2030
- _rev: string
2031
- title?: string
2032
- aspects?: Record<string, unknown>
2033
- currentVersion: {
2034
- _ref: string
2035
- _type: 'reference'
2036
- _weak?: boolean
2037
- [internalGroqTypeReferenceTo]?: 'sanity.asset.version'
2038
- }
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;
2039
2238
  versions: Array<
2040
2239
  {
2041
- _key: string
2240
+ _key: string;
2042
2241
  } & SanityAssetVersion
2043
- >
2044
- assetType: 'sanity.imageAsset' | 'sanity.videoAsset' | 'sanity.fileAsset'
2045
- cdnAccessPolicy: 'public' | 'private'
2046
- url?: string
2047
- }
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
+ };
2048
2250
 
2049
2251
  declare type SanityAssetCollection = {
2050
- _id: string
2051
- _type: 'sanity.asset.collection'
2052
- _createdAt: string
2053
- _updatedAt: string
2054
- _rev: string
2055
- title: string
2056
- description?: string
2057
- assets?: Array<{
2058
- _ref: string
2059
- _type: 'reference'
2060
- _weak?: boolean
2061
- _key: string
2062
- [internalGroqTypeReferenceTo]?: 'sanity.asset'
2063
- }>
2064
- }
2065
-
2066
- 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
+ };
2067
2283
 
2068
2284
  declare type SanityAssetVersion = {
2069
- _type: 'sanity.asset.version'
2070
- title?: string
2285
+ _type: "sanity.asset.version";
2286
+ title?: string;
2071
2287
  instance:
2072
- | {
2073
- _ref: string
2074
- _type: 'reference'
2075
- _weak?: boolean
2076
- [internalGroqTypeReferenceTo]?: 'sanity.imageAsset'
2077
- }
2078
- | {
2079
- _ref: string
2080
- _type: 'reference'
2081
- _weak?: boolean
2082
- [internalGroqTypeReferenceTo]?: 'sanity.fileAsset'
2083
- }
2084
- | {
2085
- _ref: string
2086
- _type: 'reference'
2087
- _weak?: boolean
2088
- [internalGroqTypeReferenceTo]?: 'sanity.videoAsset'
2089
- }
2090
- }
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
+ };
2091
2299
 
2092
2300
  /**
2093
2301
  * Options for configuring how Sanity Create interfaces with the type or field.
@@ -2096,260 +2304,306 @@ declare type SanityAssetVersion = {
2096
2304
  */
2097
2305
  declare interface SanityCreateOptions {
2098
2306
  /** Set to true to exclude a type or field from appearing in Sanity Create */
2099
- exclude?: boolean
2307
+ exclude?: boolean;
2100
2308
  /**
2101
2309
  * A short description of what the type or field is used for.
2102
2310
  * Purpose can be used to improve how and when content mapping uses the field.
2103
2311
  * */
2104
- purpose?: string
2312
+ purpose?: string;
2105
2313
  }
2106
2314
 
2315
+ declare type SanityDirectoryReference = {
2316
+ _ref: string;
2317
+ _type: "reference";
2318
+ _weak?: boolean;
2319
+ [internalGroqTypeReferenceTo]?: "sanity.directory";
2320
+ };
2321
+
2107
2322
  /** @public */
2108
2323
  declare interface SanityDocument {
2109
- _id: string
2110
- _type: string
2111
- _createdAt: string
2112
- _updatedAt: string
2113
- _rev: string
2114
- [key: string]: unknown
2324
+ _id: string;
2325
+ _type: string;
2326
+ _createdAt: string;
2327
+ _updatedAt: string;
2328
+ _rev: string;
2329
+ [key: string]: unknown;
2115
2330
  }
2116
2331
 
2117
2332
  declare type SanityFileAsset = {
2118
- _id: string
2119
- _type: 'sanity.fileAsset'
2120
- _createdAt: string
2121
- _updatedAt: string
2122
- _rev: string
2123
- title?: string
2333
+ _id: string;
2334
+ _type: "sanity.fileAsset";
2335
+ _createdAt: string;
2336
+ _updatedAt: string;
2337
+ _rev: string;
2338
+ title?: string;
2124
2339
  description?: Array<{
2125
2340
  children?: Array<{
2126
- marks?: Array<string>
2127
- text?: string
2128
- _type: 'span'
2129
- _key: string
2130
- }>
2131
- style?: 'normal' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'blockquote'
2132
- 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";
2133
2348
  markDefs?: Array<{
2134
- href?: string
2135
- _type: 'link'
2136
- _key: string
2137
- }>
2138
- level?: number
2139
- _type: 'block'
2140
- _key: string
2141
- }>
2142
- state: SanityAssetInstanceState
2143
- sha1hash?: string
2144
- mimeType?: string
2145
- originalFilename?: string
2146
- size?: number
2147
- uploadId?: string
2148
- path: string
2149
- extension?: string
2150
- url: string
2151
- previewUrl?: string
2152
- }
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
+ };
2153
2377
 
2154
2378
  declare type SanityImageAsset = {
2155
- _id: string
2156
- _type: 'sanity.imageAsset'
2157
- _createdAt: string
2158
- _updatedAt: string
2159
- _rev: string
2160
- altText?: string
2161
- state: SanityAssetInstanceState
2162
- sha1hash?: string
2163
- mimeType?: string
2164
- originalFilename?: string
2165
- size?: number
2166
- uploadId?: string
2167
- path?: string
2168
- extension?: string
2169
- url: string
2170
- metadata: SanityImageMetadata
2171
- }
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
+ };
2172
2405
 
2173
2406
  declare type SanityImageDimensions = {
2174
- _type: 'sanity.imageDimensions'
2175
- height: number
2176
- width: number
2177
- aspectRatio: number
2178
- }
2407
+ _type: "sanity.imageDimensions";
2408
+ height: number;
2409
+ width: number;
2410
+ aspectRatio: number;
2411
+ };
2179
2412
 
2180
2413
  declare type SanityImageExifMetadata = {
2181
- _type: 'sanity.imageExifMetadata'
2182
- ApertureValue?: number
2183
- BrightnessValue?: number
2184
- DateTimeDigitized?: string
2185
- DateTimeOriginal?: string
2186
- ExposureBiasValue?: number
2187
- ExposureMode?: number
2188
- ExposureProgram?: number
2189
- ExposureTime?: number
2190
- FNumber?: number
2191
- Flash?: number
2192
- FocalLength?: number
2193
- FocalLengthIn35mmFormat?: number
2194
- ISO?: number
2195
- LensModel?: string
2196
- WhiteBalance?: number
2197
- GPSLatitude?: number
2198
- GPSLongitude?: number
2199
- GPSAltitude?: number
2200
- Copyright?: string
2201
- Artist?: string
2202
- }
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
+ };
2203
2436
 
2204
2437
  declare type SanityImageExifTags = {
2205
- _type: 'sanity.imageExifTags'
2206
- Make?: string
2207
- Model?: string
2208
- Orientation?: number
2209
- XResolution?: number
2210
- YResolution?: number
2211
- ResolutionUnit?: number
2212
- Software?: string
2213
- ModifyDate?: string
2214
- ExifOffset?: number
2215
- GPSInfo?: number
2216
- }
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
+ };
2217
2450
 
2218
2451
  declare type SanityImageMetadata = {
2219
- _type: 'sanity.imageMetadata'
2220
- location?: Geopoint
2221
- dimensions: SanityImageDimensions
2222
- exif?: SanityImageExifMetadata
2223
- image?: SanityImageExifTags
2224
- palette: SanityImagePalette
2225
- lqip: string
2226
- blurHash: string
2227
- hasAlpha: boolean
2228
- isOpaque: boolean
2229
- }
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
+ };
2230
2463
 
2231
2464
  declare type SanityImagePalette = {
2232
- _type: 'sanity.imagePalette'
2233
- darkMuted?: SanityImagePaletteSwatch
2234
- lightVibrant?: SanityImagePaletteSwatch
2235
- darkVibrant?: SanityImagePaletteSwatch
2236
- vibrant?: SanityImagePaletteSwatch
2237
- dominant?: SanityImagePaletteSwatch
2238
- lightMuted?: SanityImagePaletteSwatch
2239
- muted?: SanityImagePaletteSwatch
2240
- }
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
+ };
2241
2474
 
2242
2475
  declare type SanityImagePaletteSwatch = {
2243
- _type: 'sanity.imagePaletteSwatch'
2244
- background?: string
2245
- foreground?: string
2246
- population?: number
2247
- title?: string
2248
- }
2476
+ _type: "sanity.imagePaletteSwatch";
2477
+ background?: string;
2478
+ foreground?: string;
2479
+ population?: number;
2480
+ title?: string;
2481
+ };
2249
2482
 
2250
2483
  declare type SanitySystem = {
2251
- _type: 'sanity.system'
2252
- createdBy?: string
2253
- }
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
+ };
2254
2494
 
2255
2495
  export declare type SanityVideoAsset = {
2256
- _id: string
2257
- _type: 'sanity.videoAsset'
2258
- _createdAt: string
2259
- _updatedAt: string
2260
- _rev: string
2261
- title?: string
2496
+ _id: string;
2497
+ _type: "sanity.videoAsset";
2498
+ _createdAt: string;
2499
+ _updatedAt: string;
2500
+ _rev: string;
2501
+ title?: string;
2262
2502
  description?: Array<{
2263
2503
  children?: Array<{
2264
- marks?: Array<string>
2265
- text?: string
2266
- _type: 'span'
2267
- _key: string
2268
- }>
2269
- style?: 'normal' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'blockquote'
2270
- 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";
2271
2511
  markDefs?: Array<{
2272
- href?: string
2273
- _type: 'link'
2274
- _key: string
2275
- }>
2276
- level?: number
2277
- _type: 'block'
2278
- _key: string
2279
- }>
2280
- state: SanityAssetInstanceState
2281
- sha1hash?: string
2282
- mimeType?: string
2283
- originalFilename?: string
2284
- size?: number
2285
- uploadId?: string
2286
- path?: string
2287
- url?: string
2288
- 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;
2289
2529
  source?: {
2290
- id?: string
2291
- name?: string
2292
- url?: string
2293
- }
2294
- metadata: SanityVideoMetadata
2295
- }
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
+ };
2296
2545
 
2297
2546
  declare type SanityVideoMetadata = {
2298
- _type: 'sanity.videoMetadata'
2299
- aspectRatio?: string
2300
- duration?: number
2301
- framerate?: number
2547
+ _type: "sanity.videoMetadata";
2548
+ aspectRatio?: string;
2549
+ duration?: number;
2550
+ framerate?: number;
2302
2551
  playbacks?: Array<
2303
2552
  {
2304
- _key: string
2553
+ _key: string;
2305
2554
  } & SanityVideoMetadataPlayback
2306
- >
2555
+ >;
2307
2556
  renditions?: Array<
2308
2557
  {
2309
- _key: string
2558
+ _key: string;
2310
2559
  } & SanityVideoMetadataRendition
2311
- >
2312
- }
2560
+ >;
2561
+ subtitles?: Array<
2562
+ {
2563
+ _key: string;
2564
+ } & SanityAssetSubtitleReference
2565
+ >;
2566
+ };
2313
2567
 
2314
2568
  declare type SanityVideoMetadataPlayback = {
2315
- _type: 'sanity.videoMetadata.playback'
2316
- _id: string
2317
- name?: string
2318
- policy: string
2319
- }
2569
+ _type: "sanity.videoMetadata.playback";
2570
+ _id: string;
2571
+ name?: string;
2572
+ policy: string;
2573
+ };
2320
2574
 
2321
2575
  export declare type SanityVideoMetadataRendition = {
2322
- _type: 'sanity.videoMetadata.rendition'
2323
- name: string
2324
- resolution: string
2325
- }
2576
+ _type: "sanity.videoMetadata.rendition";
2577
+ name: string;
2578
+ resolution: string;
2579
+ };
2326
2580
 
2327
2581
  /** @public */
2328
2582
  declare interface Schema {
2329
2583
  /** @internal */
2330
2584
  _original?: {
2331
- name: string
2332
- types: SchemaTypeDefinition[]
2333
- }
2585
+ name: string;
2586
+ types: SchemaTypeDefinition[];
2587
+ };
2334
2588
  /** @internal */
2335
2589
  _registry: {
2336
- [typeName: string]: any
2337
- }
2590
+ [typeName: string]: any;
2591
+ };
2338
2592
  /** @internal */
2339
- _validation?: SchemaValidationProblemGroup[]
2340
- name: string
2341
- get: (name: string) => SchemaType | undefined
2342
- has: (name: string) => boolean
2343
- getTypeNames: () => string[]
2593
+ _validation?: SchemaValidationProblemGroup[];
2594
+ name: string;
2595
+ get: (name: string) => SchemaType | undefined;
2596
+ has: (name: string) => boolean;
2597
+ getTypeNames: () => string[];
2344
2598
  /**
2345
2599
  * Returns the types which were explicitly defined in this schema,
2346
2600
  * as opposed to the types which were inherited from the parent.
2347
2601
  */
2348
- getLocalTypeNames: () => string[]
2602
+ getLocalTypeNames: () => string[];
2349
2603
  /**
2350
2604
  * Returns the parent schema.
2351
2605
  */
2352
- parent?: Schema
2606
+ parent?: Schema;
2353
2607
  }
2354
2608
 
2355
2609
  /**
@@ -2365,7 +2619,7 @@ declare type SchemaType =
2365
2619
  | NumberSchemaType
2366
2620
  | ObjectSchemaType
2367
2621
  | StringSchemaType
2368
- | ReferenceSchemaType
2622
+ | ReferenceSchemaType;
2369
2623
 
2370
2624
  /**
2371
2625
  * Represents a Sanity schema type definition with an optional type parameter.
@@ -2377,38 +2631,42 @@ declare type SchemaType =
2377
2631
  *
2378
2632
  * @public
2379
2633
  */
2380
- declare type SchemaTypeDefinition<TType extends IntrinsicTypeName = IntrinsicTypeName> =
2634
+ declare type SchemaTypeDefinition<
2635
+ TType extends IntrinsicTypeName = IntrinsicTypeName,
2636
+ > =
2381
2637
  | IntrinsicDefinitions[IntrinsicTypeName]
2382
- | TypeAliasDefinition<string, TType>
2638
+ | TypeAliasDefinition<string, TType>;
2383
2639
 
2384
2640
  /** @public */
2385
2641
  declare interface SchemaValidationError {
2386
- helpId?: string
2387
- message: string
2388
- severity: 'error'
2642
+ helpId?: string;
2643
+ message: string;
2644
+ severity: "error";
2389
2645
  }
2390
2646
 
2391
2647
  /** @internal */
2392
- declare type SchemaValidationProblem = SchemaValidationError | SchemaValidationWarning
2648
+ declare type SchemaValidationProblem =
2649
+ | SchemaValidationError
2650
+ | SchemaValidationWarning;
2393
2651
 
2394
2652
  /** @internal */
2395
2653
  declare interface SchemaValidationProblemGroup {
2396
- path: SchemaValidationProblemPath
2397
- problems: SchemaValidationProblem[]
2654
+ path: SchemaValidationProblemPath;
2655
+ problems: SchemaValidationProblem[];
2398
2656
  }
2399
2657
 
2400
2658
  /** @internal */
2401
2659
  declare type SchemaValidationProblemPath = Array<
2402
2660
  | {
2403
- kind: 'type'
2404
- type: string
2405
- name?: string
2661
+ kind: "type";
2662
+ type: string;
2663
+ name?: string;
2406
2664
  }
2407
2665
  | {
2408
- kind: 'property'
2409
- name: string
2666
+ kind: "property";
2667
+ name: string;
2410
2668
  }
2411
- >
2669
+ >;
2412
2670
 
2413
2671
  /**
2414
2672
  * Represents the possible values of a schema type's `validation` field.
@@ -2440,13 +2698,13 @@ declare type SchemaValidationValue =
2440
2698
  | undefined
2441
2699
  | Rule
2442
2700
  | SchemaValidationValue[]
2443
- | ((rule: Rule) => SchemaValidationValue)
2701
+ | ((rule: Rule, context?: ValidationContext) => SchemaValidationValue);
2444
2702
 
2445
2703
  /** @internal */
2446
2704
  declare interface SchemaValidationWarning {
2447
- helpId?: string
2448
- message: string
2449
- severity: 'warning'
2705
+ helpId?: string;
2706
+ message: string;
2707
+ severity: "warning";
2450
2708
  }
2451
2709
 
2452
2710
  /** @public */
@@ -2466,35 +2724,35 @@ declare interface SearchConfiguration {
2466
2724
  * Note: Search weight configuration is currently supported only for fields
2467
2725
  * of type string or portable text arrays.
2468
2726
  */
2469
- weight?: number
2470
- }
2727
+ weight?: number;
2728
+ };
2471
2729
  }
2472
2730
 
2473
2731
  /**
2474
2732
  * @public
2475
2733
  */
2476
- declare const searchStrategies: readonly ['groqLegacy', 'groq2024']
2734
+ declare const searchStrategies: readonly ["groqLegacy", "groq2024"];
2477
2735
 
2478
2736
  /**
2479
2737
  * @public
2480
2738
  */
2481
- declare type SearchStrategy = (typeof searchStrategies)[number]
2739
+ declare type SearchStrategy = (typeof searchStrategies)[number];
2482
2740
 
2483
2741
  /** @public */
2484
2742
  declare interface SingleFieldSet {
2485
- single: true
2486
- field: ObjectField
2487
- hidden?: ConditionalProperty
2488
- readOnly?: ConditionalProperty
2489
- group?: string | string[]
2743
+ single: true;
2744
+ field: ObjectField;
2745
+ hidden?: ConditionalProperty;
2746
+ readOnly?: ConditionalProperty;
2747
+ group?: string | string[];
2490
2748
  }
2491
2749
 
2492
2750
  /** @public */
2493
2751
  declare interface SlugDefinition extends BaseSchemaDefinition {
2494
- type: 'slug'
2495
- options?: SlugOptions
2496
- validation?: ValidationBuilder<SlugRule, SlugValue>
2497
- initialValue?: InitialValueProperty<any, Omit<SlugValue, '_type'>>
2752
+ type: "slug";
2753
+ options?: SlugOptions;
2754
+ validation?: ValidationBuilder<SlugRule, SlugValue>;
2755
+ initialValue?: InitialValueProperty<any, Omit<SlugValue, "_type">>;
2498
2756
  }
2499
2757
 
2500
2758
  /** @public */
@@ -2502,86 +2760,102 @@ declare type SlugifierFn = (
2502
2760
  source: string,
2503
2761
  schemaType: SlugSchemaType,
2504
2762
  context: SlugSourceContext,
2505
- ) => string | Promise<string>
2763
+ ) => string | Promise<string>;
2506
2764
 
2507
2765
  /** @public */
2508
2766
  declare type SlugIsUniqueValidator = (
2509
2767
  slug: string,
2510
2768
  context: SlugValidationContext,
2511
- ) => boolean | Promise<boolean>
2769
+ ) => boolean | Promise<boolean>;
2512
2770
 
2513
2771
  /** @public */
2514
- declare interface SlugOptions extends SearchConfiguration, BaseSchemaTypeOptions {
2515
- source?: string | Path | SlugSourceFn
2516
- maxLength?: number
2517
- slugify?: SlugifierFn
2518
- isUnique?: SlugIsUniqueValidator
2519
- 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;
2520
2779
  }
2521
2780
 
2522
2781
  /** @public */
2523
- declare type SlugParent = Record<string, unknown> | Record<string, unknown>[]
2782
+ declare type SlugParent = Record<string, unknown> | Record<string, unknown>[];
2524
2783
 
2525
2784
  /** @public */
2526
2785
  declare interface SlugRule extends RuleDef<SlugRule, SlugValue> {}
2527
2786
 
2528
2787
  /** @public */
2529
2788
  declare interface SlugSchemaType extends ObjectSchemaType {
2530
- jsonType: 'object'
2531
- options?: SlugOptions
2789
+ jsonType: "object";
2790
+ options?: SlugOptions;
2532
2791
  }
2533
2792
 
2534
2793
  /** @public */
2535
2794
  declare interface SlugSourceContext {
2536
- parentPath: Path
2537
- parent: SlugParent
2538
- projectId: string
2539
- dataset: string
2540
- schema: Schema
2541
- currentUser: CurrentUser | null
2542
- 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;
2543
2802
  }
2544
2803
 
2545
2804
  /** @public */
2546
2805
  declare type SlugSourceFn = (
2547
2806
  document: SanityDocument,
2548
2807
  context: SlugSourceContext,
2549
- ) => string | Promise<string>
2808
+ ) => string | Promise<string>;
2550
2809
 
2551
2810
  /** @public */
2552
2811
  declare interface SlugValidationContext extends ValidationContext {
2553
- parent: SlugParent
2554
- type: SlugSchemaType
2555
- defaultIsUnique: SlugIsUniqueValidator
2812
+ parent: SlugParent;
2813
+ type: SlugSchemaType;
2814
+ defaultIsUnique: SlugIsUniqueValidator;
2556
2815
  }
2557
2816
 
2558
2817
  /** @public */
2559
2818
  declare interface SlugValue {
2560
- _type: 'slug'
2561
- current?: string
2819
+ _type: "slug";
2820
+ current?: string;
2562
2821
  }
2563
2822
 
2564
2823
  /** @beta */
2565
2824
  declare type SortOrdering = {
2566
- title: string
2567
- i18n?: I18nTextRecord<'title'>
2568
- name: string
2569
- by: SortOrderingItem[]
2570
- }
2825
+ title: string;
2826
+ i18n?: I18nTextRecord<"title">;
2827
+ name: string;
2828
+ by: SortOrderingItem[];
2829
+ };
2571
2830
 
2572
2831
  /** @beta */
2573
2832
  declare interface SortOrderingItem {
2574
- field: string
2575
- 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";
2576
2850
  }
2577
2851
 
2578
2852
  /** @public */
2579
2853
  declare interface StringDefinition extends BaseSchemaDefinition {
2580
- type: 'string'
2581
- options?: StringOptions
2582
- placeholder?: string
2583
- validation?: ValidationBuilder<StringRule, string>
2584
- initialValue?: InitialValueProperty<any, string>
2854
+ type: "string";
2855
+ options?: StringOptions;
2856
+ placeholder?: string;
2857
+ validation?: ValidationBuilder<StringRule, string>;
2858
+ initialValue?: InitialValueProperty<any, string>;
2585
2859
  }
2586
2860
 
2587
2861
  /** @public */
@@ -2590,29 +2864,29 @@ declare interface StringOptions
2590
2864
 
2591
2865
  /** @public */
2592
2866
  declare interface StringRule extends RuleDef<StringRule, string> {
2593
- min: (minNumber: number | FieldReference) => StringRule
2594
- max: (maxNumber: number | FieldReference) => StringRule
2595
- length: (exactLength: number | FieldReference) => StringRule
2596
- uppercase: () => StringRule
2597
- 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;
2598
2872
  regex(
2599
2873
  pattern: RegExp,
2600
2874
  name: string,
2601
2875
  options: {
2602
- name?: string
2603
- invert?: boolean
2876
+ name?: string;
2877
+ invert?: boolean;
2604
2878
  },
2605
- ): StringRule
2879
+ ): StringRule;
2606
2880
  regex(
2607
2881
  pattern: RegExp,
2608
2882
  options: {
2609
- name?: string
2610
- invert?: boolean
2883
+ name?: string;
2884
+ invert?: boolean;
2611
2885
  },
2612
- ): StringRule
2613
- regex(pattern: RegExp, name: string): StringRule
2614
- regex(pattern: RegExp): StringRule
2615
- email(): StringRule
2886
+ ): StringRule;
2887
+ regex(pattern: RegExp, name: string): StringRule;
2888
+ regex(pattern: RegExp): StringRule;
2889
+ email(): StringRule;
2616
2890
  }
2617
2891
 
2618
2892
  /**
@@ -2622,19 +2896,19 @@ declare interface StringRule extends RuleDef<StringRule, string> {
2622
2896
  * @public
2623
2897
  */
2624
2898
  declare interface StringSchemaType extends BaseSchemaType {
2625
- jsonType: 'string'
2626
- options?: StringOptions & TextOptions & DateOptions & DatetimeOptions
2627
- initialValue?: InitialValueProperty<any, string>
2899
+ jsonType: "string";
2900
+ options?: StringOptions & TextOptions & DateOptions & DatetimeOptions;
2901
+ initialValue?: InitialValueProperty<any, string>;
2628
2902
  }
2629
2903
 
2630
2904
  /** @public */
2631
2905
  declare interface TextDefinition extends BaseSchemaDefinition {
2632
- type: 'text'
2633
- rows?: number
2634
- options?: TextOptions
2635
- placeholder?: string
2636
- validation?: ValidationBuilder<TextRule, string>
2637
- 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>;
2638
2912
  }
2639
2913
 
2640
2914
  /** @public */
@@ -2645,9 +2919,9 @@ declare interface TextRule extends StringRule {}
2645
2919
 
2646
2920
  /** @public */
2647
2921
  declare interface TitledListValue<V = unknown> {
2648
- _key?: string
2649
- title: string
2650
- value?: V
2922
+ _key?: string;
2923
+ title: string;
2924
+ value?: V;
2651
2925
  }
2652
2926
 
2653
2927
  /**
@@ -2662,21 +2936,23 @@ declare interface TypeAliasDefinition<
2662
2936
  TType extends string,
2663
2937
  TAlias extends IntrinsicTypeName | undefined,
2664
2938
  > extends BaseSchemaDefinition {
2665
- type: TType
2666
- options?: TAlias extends IntrinsicTypeName ? IntrinsicDefinitions[TAlias]['options'] : unknown
2667
- validation?: SchemaValidationValue
2668
- initialValue?: InitialValueProperty<any, any>
2669
- 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;
2670
2946
  components?: {
2671
- annotation?: ComponentType<any>
2672
- block?: ComponentType<any>
2673
- inlineBlock?: ComponentType<any>
2674
- diff?: ComponentType<any>
2675
- field?: ComponentType<any>
2676
- input?: ComponentType<any>
2677
- item?: ComponentType<any>
2678
- preview?: ComponentType<any>
2679
- }
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
+ };
2680
2956
  }
2681
2957
 
2682
2958
  /**
@@ -2685,46 +2961,44 @@ declare interface TypeAliasDefinition<
2685
2961
  * @public
2686
2962
  */
2687
2963
  declare interface TypeReference {
2688
- type: string
2689
- name?: string
2690
- icon?: ComponentType | ReactNode
2964
+ type: string;
2965
+ name?: string;
2966
+ icon?: ComponentType | ReactNode;
2691
2967
  options?: {
2692
- [key: string]: unknown
2693
- }
2968
+ [key: string]: unknown;
2969
+ };
2694
2970
  }
2695
2971
 
2696
2972
  export declare type UploadSession = {
2697
- _id: string
2698
- _type: 'sanity.asset.upload-session'
2699
- _createdAt: string
2700
- _updatedAt: string
2701
- _rev: string
2702
- title: string
2703
- assets?: Array<{
2704
- _ref: string
2705
- _type: 'reference'
2706
- _weak?: boolean
2707
- _key: string
2708
- [internalGroqTypeReferenceTo]?: 'sanity.asset'
2709
- }>
2710
- _system?: SanitySystem
2711
- }
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
+ };
2712
2986
 
2713
2987
  /** @public */
2714
2988
  declare interface UriValidationOptions {
2715
- scheme?: (string | RegExp) | Array<string | RegExp>
2716
- allowRelative?: boolean
2717
- relativeOnly?: boolean
2718
- allowCredentials?: boolean
2989
+ scheme?: (string | RegExp) | Array<string | RegExp>;
2990
+ allowRelative?: boolean;
2991
+ relativeOnly?: boolean;
2992
+ allowCredentials?: boolean;
2719
2993
  }
2720
2994
 
2721
2995
  /** @public */
2722
2996
  declare interface UrlDefinition extends BaseSchemaDefinition {
2723
- type: 'url'
2724
- options?: UrlOptions
2725
- placeholder?: string
2726
- validation?: ValidationBuilder<UrlRule, string>
2727
- initialValue?: InitialValueProperty<any, string>
2997
+ type: "url";
2998
+ options?: UrlOptions;
2999
+ placeholder?: string;
3000
+ validation?: ValidationBuilder<UrlRule, string>;
3001
+ initialValue?: InitialValueProperty<any, string>;
2728
3002
  }
2729
3003
 
2730
3004
  /** @public */
@@ -2732,13 +3006,14 @@ declare interface UrlOptions extends BaseSchemaTypeOptions {}
2732
3006
 
2733
3007
  /** @public */
2734
3008
  declare interface UrlRule extends RuleDef<UrlRule, string> {
2735
- uri(options: UriValidationOptions): UrlRule
3009
+ uri(options: UriValidationOptions): UrlRule;
2736
3010
  }
2737
3011
 
2738
3012
  /** @public */
2739
- declare type ValidationBuilder<T extends RuleDef<T, FieldValue>, FieldValue = unknown> = (
2740
- rule: T,
2741
- ) => RuleBuilder<T, FieldValue>
3013
+ declare type ValidationBuilder<
3014
+ T extends RuleDef<T, FieldValue>,
3015
+ FieldValue = unknown,
3016
+ > = (rule: T, context?: ValidationContext) => RuleBuilder<T, FieldValue>;
2742
3017
 
2743
3018
  /**
2744
3019
  * A context object passed around during validation. This includes the
@@ -2755,14 +3030,18 @@ declare type ValidationBuilder<T extends RuleDef<T, FieldValue>, FieldValue = un
2755
3030
  * @public
2756
3031
  */
2757
3032
  declare interface ValidationContext {
2758
- getClient: (options: {apiVersion: string}) => SanityClient
2759
- schema: Schema
2760
- parent?: unknown
2761
- type?: SchemaType
2762
- document?: SanityDocument
2763
- path?: Path
2764
- getDocumentExists?: (options: {id: string}) => Promise<boolean>
2765
- 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;
2766
3045
  }
2767
3046
 
2768
3047
  /**
@@ -2778,7 +3057,7 @@ declare interface ValidationError {
2778
3057
  * The message describing why the value is not valid. This message will be
2779
3058
  * included in the validation markers after validation has finished running.
2780
3059
  */
2781
- message: string
3060
+ message: string;
2782
3061
  /**
2783
3062
  * If writing a custom validator, you can return validation messages to
2784
3063
  * specific path inside of the current value (object or array) by populating
@@ -2787,14 +3066,14 @@ declare interface ValidationError {
2787
3066
  * NOTE: This path is relative to the current value and _not_ relative to
2788
3067
  * the document.
2789
3068
  */
2790
- path?: Path
3069
+ path?: Path;
2791
3070
  /**
2792
3071
  * Extra metadata for the validation error. Currently used by the Media Library asset source to ignore
2793
3072
  * certain validation markers when validating asset source media library assets.
2794
3073
  *
2795
3074
  * @internal
2796
3075
  */
2797
- __internal_metadata?: unknown
3076
+ __internal_metadata?: unknown;
2798
3077
  /**
2799
3078
  * Same as `path` but allows more than one value. If provided, the same
2800
3079
  * message will create two markers from each path with the same message
@@ -2802,32 +3081,32 @@ declare interface ValidationError {
2802
3081
  *
2803
3082
  * @deprecated prefer `path`
2804
3083
  */
2805
- paths?: Path[]
3084
+ paths?: Path[];
2806
3085
  /**
2807
3086
  * @deprecated Unused. Was used to store the results from `.either()` /`.all()`
2808
3087
  */
2809
- children?: ValidationMarker[]
3088
+ children?: ValidationMarker[];
2810
3089
  /**
2811
3090
  * @deprecated Unused. Was used to signal if this error came from an `.either()`/`.all()`.
2812
3091
  */
2813
- operation?: 'AND' | 'OR'
3092
+ operation?: "AND" | "OR";
2814
3093
  /**
2815
3094
  * @deprecated Unused. Was relevant when validation error was used as a class.
2816
3095
  */
2817
- cloneWithMessage?(message: string): ValidationError
3096
+ cloneWithMessage?(message: string): ValidationError;
2818
3097
  }
2819
3098
 
2820
3099
  /** @public */
2821
3100
  declare interface ValidationMarker {
2822
- level: 'error' | 'warning' | 'info'
3101
+ level: "error" | "warning" | "info";
2823
3102
  /**
2824
3103
  * The validation message for this marker. E.g. "Must be greater than 0"
2825
3104
  */
2826
- message: string
3105
+ message: string;
2827
3106
  /**
2828
3107
  * @deprecated use `message` instead
2829
3108
  */
2830
- item?: ValidationError
3109
+ item?: ValidationError;
2831
3110
  /**
2832
3111
  * The sanity path _relative to the root of the current document_ to this
2833
3112
  * marker.
@@ -2835,14 +3114,14 @@ declare interface ValidationMarker {
2835
3114
  * NOTE: Sanity paths may contain keyed segments (i.e. `{_key: string}`) that
2836
3115
  * are not compatible with deep getters like lodash/get
2837
3116
  */
2838
- path: Path
3117
+ path: Path;
2839
3118
  /**
2840
3119
  * Extra metadata for the validation marker. Currently used by the Media Library asset source to ignore
2841
3120
  * certain validation markers when validating asset source media library assets.
2842
3121
  *
2843
3122
  * @internal
2844
3123
  */
2845
- __internal_metadata?: unknown
3124
+ __internal_metadata?: unknown;
2846
3125
  }
2847
3126
 
2848
- export {}
3127
+ export {};