@sanity/schema 4.19.1-next.8 → 4.20.0-next.40

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.
@@ -1,407 +0,0 @@
1
- import {Rule} from '@sanity/types'
2
- import {SanityDocument} from '@sanity/types'
3
- import {Schema} from '@sanity/types'
4
- import {SchemaType} from '@sanity/types'
5
- import {SchemaType as SchemaType_2} from 'groq-js'
6
- import {SchemaTypeDefinition} from '@sanity/types'
7
- import {SchemaValidationProblem} from '@sanity/types'
8
- import {SchemaValidationProblemGroup} from '@sanity/types'
9
- import {SetSynchronization} from '@sanity/descriptors'
10
- import {SynchronizationRequest} from '@sanity/descriptors'
11
- import {SynchronizationResult} from '@sanity/descriptors'
12
-
13
- export declare const ALL_FIELDS_GROUP_NAME = 'all-fields'
14
-
15
- export declare const builtinTypes: (
16
- | {
17
- title: string
18
- name: string
19
- type: string
20
- fields: {
21
- name: string
22
- type: string
23
- title: string
24
- }[]
25
- }
26
- | {
27
- name: string
28
- title: string
29
- type: string
30
- fieldsets: {
31
- name: string
32
- title: string
33
- description: string
34
- }[]
35
- fields: (
36
- | {
37
- name: string
38
- type: string
39
- title: string
40
- readOnly: boolean
41
- fieldset?: undefined
42
- hidden?: undefined
43
- }
44
- | {
45
- name: string
46
- type: string
47
- title: string
48
- readOnly?: undefined
49
- fieldset?: undefined
50
- hidden?: undefined
51
- }
52
- | {
53
- name: string
54
- type: string
55
- title: string
56
- readOnly: boolean
57
- fieldset: string
58
- hidden?: undefined
59
- }
60
- | {
61
- name: string
62
- type: string
63
- readOnly: boolean
64
- hidden: boolean
65
- fieldset: string
66
- title?: undefined
67
- }
68
- )[]
69
- preview: {
70
- select: {
71
- id: string
72
- title: string
73
- mimeType: string
74
- size: string
75
- }
76
- prepare(doc: Partial<SanityDocument>): {
77
- title: {}
78
- media: {
79
- asset: {
80
- _ref: unknown
81
- }
82
- }
83
- subtitle: string
84
- }
85
- }
86
- orderings: {
87
- title: string
88
- name: string
89
- by: {
90
- field: string
91
- direction: string
92
- }[]
93
- }[]
94
- }
95
- | {
96
- name: string
97
- title: string
98
- type: string
99
- fieldsets: {
100
- name: string
101
- title: string
102
- description: string
103
- }[]
104
- fields: (
105
- | {
106
- name: string
107
- type: string
108
- title: string
109
- readOnly: boolean
110
- fieldset?: undefined
111
- hidden?: undefined
112
- }
113
- | {
114
- name: string
115
- type: string
116
- title: string
117
- readOnly?: undefined
118
- fieldset?: undefined
119
- hidden?: undefined
120
- }
121
- | {
122
- name: string
123
- type: string
124
- title: string
125
- readOnly: boolean
126
- fieldset: string
127
- hidden?: undefined
128
- }
129
- | {
130
- name: string
131
- type: string
132
- readOnly: boolean
133
- hidden: boolean
134
- fieldset: string
135
- title?: undefined
136
- }
137
- )[]
138
- preview: {
139
- select: {
140
- title: string
141
- path: string
142
- mimeType: string
143
- size: string
144
- }
145
- prepare(doc: Record<string, any>): {
146
- title: any
147
- subtitle: string
148
- }
149
- }
150
- orderings: {
151
- title: string
152
- name: string
153
- by: {
154
- field: string
155
- direction: string
156
- }[]
157
- }[]
158
- }
159
- | {
160
- name: string
161
- title: string
162
- type: string
163
- fields: {
164
- name: string
165
- type: string
166
- validation: (Rule: Rule) => Rule
167
- }[]
168
- }
169
- | {
170
- name: string
171
- title: string
172
- type: string
173
- fieldsets: {
174
- name: string
175
- title: string
176
- options: {
177
- collapsable: boolean
178
- }
179
- }[]
180
- fields: (
181
- | {
182
- name: string
183
- type: string
184
- title?: undefined
185
- fieldset?: undefined
186
- readOnly?: undefined
187
- }
188
- | {
189
- name: string
190
- title: string
191
- type: string
192
- fieldset: string
193
- readOnly?: undefined
194
- }
195
- | {
196
- name: string
197
- title: string
198
- type: string
199
- readOnly: boolean
200
- fieldset?: undefined
201
- }
202
- )[]
203
- }
204
- )[]
205
-
206
- export declare function createSchemaFromManifestTypes(schemaDef: {
207
- name: string
208
- types: unknown[]
209
- }): Schema_2
210
-
211
- export declare const DEFAULT_MAX_FIELD_DEPTH = 5
212
-
213
- export declare class DescriptorConverter {
214
- opts: Options
215
- cache: WeakMap<Schema, SetSynchronization<RegistryType>>
216
- constructor(opts: Options)
217
- /**
218
- * Returns a synchronization object for a schema.
219
- *
220
- * This is automatically cached in a weak map.
221
- */
222
- get(schema: Schema): SetSynchronization<RegistryType>
223
- }
224
-
225
- export declare function extractSchema(
226
- schemaDef: Schema,
227
- extractOptions?: ExtractSchemaOptions,
228
- ): SchemaType_2
229
-
230
- declare interface ExtractSchemaOptions {
231
- enforceRequiredFields?: boolean
232
- }
233
-
234
- /**
235
- * @internal
236
- */
237
- export declare type FIXME = any
238
-
239
- /**
240
- * @internal
241
- */
242
- export declare function groupProblems(types: SchemaTypeDefinition[]): SchemaValidationProblemGroup[]
243
-
244
- export declare const isActionEnabled: (schemaType: SchemaType, action: string) => boolean
245
-
246
- /**
247
- * Options used when converting the schema.
248
- *
249
- * We know we need this in order to handle validations.
250
- **/
251
- declare type Options = Record<never, never>
252
-
253
- declare interface Options_2 {
254
- transformTypeVisitors?: (visitors: typeof typeVisitors) => Partial<typeof typeVisitors>
255
- transformCommonVisitors?: (visitors: any[]) => any[]
256
- }
257
-
258
- /**
259
- * @internal
260
- */
261
- export declare type ProblemPath = ProblemPathSegment[]
262
-
263
- /**
264
- * @internal
265
- */
266
- export declare interface ProblemPathPropertySegment {
267
- kind: 'property'
268
- name: string
269
- }
270
-
271
- /**
272
- * @internal
273
- */
274
- export declare type ProblemPathSegment = ProblemPathTypeSegment | ProblemPathPropertySegment
275
-
276
- /**
277
- * @internal
278
- */
279
- export declare interface ProblemPathTypeSegment {
280
- kind: 'type'
281
- type: string
282
- name: string
283
- }
284
-
285
- /**
286
- * Returns the next request that should be generated for synchronizing the
287
- * schema, based on the previous response from the /synchronize endpoint.
288
- *
289
- * @param response - The previous response, or `null` if it's the first request.
290
- * @returns The next request, or `null` if it's been fully synchronized.
291
- */
292
- export declare function processSchemaSynchronization(
293
- sync: SetSynchronization<RegistryType>,
294
- response: SchemaSynchronizationResult | null,
295
- ): SchemaSynchronizationRequest | null
296
-
297
- declare type RegistryType = 'sanity.schema.registry'
298
-
299
- /**
300
- * @internal
301
- */
302
- export declare function resolveSearchConfig(type: any, maxDepth?: number): any
303
-
304
- export declare function resolveSearchConfigForBaseFieldPaths(type: any, maxDepth?: number): any
305
-
306
- /**
307
- * @beta
308
- */
309
- declare class Schema_2 {
310
- #private
311
- _original: {
312
- name: string
313
- types: any[]
314
- parent?: Schema_2
315
- }
316
- _registry: {
317
- [typeName: string]: any
318
- }
319
- static compile(schemaDef: any): Schema_2
320
- constructor(schemaDef: any)
321
- get name(): string
322
- /**
323
- * Returns the parent schema.
324
- */
325
- get parent(): Schema_2 | undefined
326
- get(name: string): any
327
- has(name: string): boolean
328
- getTypeNames(): string[]
329
- getLocalTypeNames(): string[]
330
- }
331
-
332
- export declare type SchemaSynchronizationRequest = SynchronizationRequest
333
-
334
- export declare type SchemaSynchronizationResult = SynchronizationResult
335
-
336
- /**
337
- * @internal
338
- */
339
- declare interface SchemaValidationResult {
340
- severity: 'warning' | 'error'
341
- message: string
342
- helpId?: string
343
- }
344
- export {SchemaValidationResult as Problem}
345
- export {SchemaValidationResult as ValidationResult}
346
-
347
- declare const typeVisitors: {
348
- array: (typeDef: any, visitorContext: any) => any
349
- object: (typeDef: any, visitorContext: any) => any
350
- slug: (typeDef: any, visitorContext: any) => any
351
- file: (typeDef: any, visitorContext: any) => any
352
- image: (typeDef: any, visitorContext: any) => any
353
- block: typeof validateBlockType
354
- document: (typeDefinition: any, visitorContext: any) => any
355
- reference: (typeDef: any, visitorContext: any) => any
356
- crossDatasetReference: (typeDef: any, visitorContext: any) => any
357
- globalDocumentReference: (typeDef: any, visitorContext: any) => any
358
- }
359
-
360
- /**
361
- * @internal
362
- */
363
- export declare interface TypeWithProblems {
364
- path: ProblemPath
365
- problems: SchemaValidationResult[]
366
- }
367
-
368
- declare function validateBlockType(
369
- typeDef: any,
370
- visitorContext: any,
371
- ): {
372
- marks: any
373
- styles: any
374
- name: any
375
- of: any
376
- _problems: SchemaValidationResult[]
377
- }
378
-
379
- /**
380
- * Ensure that the provided value is a valid Media Library asset aspect that can be safely deployed.
381
- *
382
- * @internal
383
- */
384
- export declare function validateMediaLibraryAssetAspect(
385
- maybeAspect: unknown,
386
- ): [isValidMediaLibraryAspect: boolean, validationErrors: SchemaValidationProblem[][]]
387
-
388
- /**
389
- * @internal
390
- */
391
- export declare function validateSchema(
392
- schemaTypes: FIXME,
393
- {transformTypeVisitors, transformCommonVisitors}?: Options_2,
394
- ): {
395
- get(typeName: string): any
396
- has(typeName: string): boolean
397
- getTypeNames(): string[]
398
- getTypes(): any[]
399
- toJSON(): any[]
400
- }
401
-
402
- export declare class ValidationError extends Error {
403
- problems: SchemaValidationProblemGroup[]
404
- constructor(problems: SchemaValidationProblemGroup[])
405
- }
406
-
407
- export {}