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