@sanity/schema 5.0.0-next.0-9b570ece82-202507150640 → 5.0.0-next.6
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/LICENSE +1 -1
- package/lib/{index.mjs → _chunks-es/Rule.js} +368 -62
- package/lib/_chunks-es/Rule.js.map +1 -0
- package/lib/_internal.d.ts +266 -20
- package/lib/_internal.js +1489 -737
- package/lib/_internal.js.map +1 -1
- package/lib/index.d.ts +10 -0
- package/lib/index.js +7 -1411
- package/lib/index.js.map +1 -1
- package/package.json +18 -19
- package/lib/_chunks-cjs/resolve.js +0 -111
- package/lib/_chunks-cjs/resolve.js.map +0 -1
- package/lib/_chunks-es/resolve.mjs +0 -109
- package/lib/_chunks-es/resolve.mjs.map +0 -1
- package/lib/_internal.d.mts +0 -185
- package/lib/_internal.mjs +0 -2131
- package/lib/_internal.mjs.map +0 -1
- package/lib/index.d.mts +0 -47
- package/lib/index.mjs.map +0 -1
package/lib/_internal.d.mts
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import {Schema} from '@sanity/types'
|
|
2
|
-
import {SchemaType} from '@sanity/types'
|
|
3
|
-
import {SchemaType as SchemaType_2} from 'groq-js'
|
|
4
|
-
import {SchemaTypeDefinition} from '@sanity/types'
|
|
5
|
-
import {SchemaValidationProblem} from '@sanity/types'
|
|
6
|
-
import {SchemaValidationProblemGroup} from '@sanity/types'
|
|
7
|
-
import {SetSynchronization} from '@sanity/descriptors'
|
|
8
|
-
import {SynchronizationRequest} from '@sanity/descriptors'
|
|
9
|
-
import {SynchronizationResult} from '@sanity/descriptors'
|
|
10
|
-
|
|
11
|
-
export declare const builtinTypes: {
|
|
12
|
-
name: string
|
|
13
|
-
title: string
|
|
14
|
-
type: string
|
|
15
|
-
fields: {
|
|
16
|
-
name: string
|
|
17
|
-
type: string
|
|
18
|
-
}[]
|
|
19
|
-
}[]
|
|
20
|
-
|
|
21
|
-
export declare const DEFAULT_MAX_FIELD_DEPTH = 5
|
|
22
|
-
|
|
23
|
-
export declare class DescriptorConverter {
|
|
24
|
-
opts: Options
|
|
25
|
-
cache: WeakMap<Schema, SetSynchronization<RegistryType>>
|
|
26
|
-
constructor(opts: Options)
|
|
27
|
-
/**
|
|
28
|
-
* Returns a synchronization object for a schema.
|
|
29
|
-
*
|
|
30
|
-
* This is automatically cached in a weak map.
|
|
31
|
-
*/
|
|
32
|
-
get(schema: Schema): SetSynchronization<RegistryType>
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export declare function extractSchema(
|
|
36
|
-
schemaDef: Schema,
|
|
37
|
-
extractOptions?: ExtractSchemaOptions,
|
|
38
|
-
): SchemaType_2
|
|
39
|
-
|
|
40
|
-
declare interface ExtractSchemaOptions {
|
|
41
|
-
enforceRequiredFields?: boolean
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* @internal
|
|
46
|
-
*/
|
|
47
|
-
export declare type FIXME = any
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* @internal
|
|
51
|
-
*/
|
|
52
|
-
export declare function groupProblems(types: SchemaTypeDefinition[]): SchemaValidationProblemGroup[]
|
|
53
|
-
|
|
54
|
-
export declare const isActionEnabled: (schemaType: SchemaType, action: string) => boolean
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Options used when converting the schema.
|
|
58
|
-
*
|
|
59
|
-
* We know we need this in order to handle validations.
|
|
60
|
-
**/
|
|
61
|
-
declare type Options = Record<never, never>
|
|
62
|
-
|
|
63
|
-
declare interface Options_2 {
|
|
64
|
-
transformTypeVisitors?: (visitors: typeof typeVisitors) => Partial<typeof typeVisitors>
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* @internal
|
|
69
|
-
*/
|
|
70
|
-
export declare type ProblemPath = ProblemPathSegment[]
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* @internal
|
|
74
|
-
*/
|
|
75
|
-
export declare interface ProblemPathPropertySegment {
|
|
76
|
-
kind: 'property'
|
|
77
|
-
name: string
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* @internal
|
|
82
|
-
*/
|
|
83
|
-
export declare type ProblemPathSegment = ProblemPathTypeSegment | ProblemPathPropertySegment
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* @internal
|
|
87
|
-
*/
|
|
88
|
-
export declare interface ProblemPathTypeSegment {
|
|
89
|
-
kind: 'type'
|
|
90
|
-
type: string
|
|
91
|
-
name: string
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Returns the next request that should be generated for synchronizing the
|
|
96
|
-
* schema, based on the previous response from the /synchronize endpoint.
|
|
97
|
-
*
|
|
98
|
-
* @param response - The previous response, or `null` if it's the first request.
|
|
99
|
-
* @returns The next request, or `null` if it's been fully synchronized.
|
|
100
|
-
*/
|
|
101
|
-
export declare function processSchemaSynchronization(
|
|
102
|
-
sync: SetSynchronization<RegistryType>,
|
|
103
|
-
response: SchemaSynchronizationResult | null,
|
|
104
|
-
): SchemaSynchronizationRequest | null
|
|
105
|
-
|
|
106
|
-
declare type RegistryType = 'sanity.schema.registry'
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* @internal
|
|
110
|
-
*/
|
|
111
|
-
export declare function resolveSearchConfig(type: any, maxDepth?: number): any
|
|
112
|
-
|
|
113
|
-
export declare function resolveSearchConfigForBaseFieldPaths(type: any, maxDepth?: number): any
|
|
114
|
-
|
|
115
|
-
export declare type SchemaSynchronizationRequest = SynchronizationRequest
|
|
116
|
-
|
|
117
|
-
export declare type SchemaSynchronizationResult = SynchronizationResult
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* @internal
|
|
121
|
-
*/
|
|
122
|
-
declare interface SchemaValidationResult {
|
|
123
|
-
severity: 'warning' | 'error'
|
|
124
|
-
message: string
|
|
125
|
-
helpId?: string
|
|
126
|
-
}
|
|
127
|
-
export {SchemaValidationResult as Problem}
|
|
128
|
-
export {SchemaValidationResult as ValidationResult}
|
|
129
|
-
|
|
130
|
-
declare const typeVisitors: {
|
|
131
|
-
array: (typeDef: any, visitorContext: any) => any
|
|
132
|
-
object: (typeDef: any, visitorContext: any) => any
|
|
133
|
-
slug: (typeDef: any, visitorContext: any) => any
|
|
134
|
-
file: (typeDef: any, visitorContext: any) => any
|
|
135
|
-
image: (typeDef: any, visitorContext: any) => any
|
|
136
|
-
block: typeof validateBlockType
|
|
137
|
-
document: (typeDefinition: any, visitorContext: any) => any
|
|
138
|
-
reference: (typeDef: any, visitorContext: any) => any
|
|
139
|
-
crossDatasetReference: (typeDef: any, visitorContext: any) => any
|
|
140
|
-
globalDocumentReference: (typeDef: any, visitorContext: any) => any
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* @internal
|
|
145
|
-
*/
|
|
146
|
-
export declare interface TypeWithProblems {
|
|
147
|
-
path: ProblemPath
|
|
148
|
-
problems: SchemaValidationResult[]
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
declare function validateBlockType(
|
|
152
|
-
typeDef: any,
|
|
153
|
-
visitorContext: any,
|
|
154
|
-
): {
|
|
155
|
-
marks: any
|
|
156
|
-
styles: any
|
|
157
|
-
name: any
|
|
158
|
-
of: any
|
|
159
|
-
_problems: SchemaValidationResult[]
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Ensure that the provided value is a valid Media Library asset aspect that can be safely deployed.
|
|
164
|
-
*
|
|
165
|
-
* @internal
|
|
166
|
-
*/
|
|
167
|
-
export declare function validateMediaLibraryAssetAspect(
|
|
168
|
-
maybeAspect: unknown,
|
|
169
|
-
): [isValidMediaLibraryAspect: boolean, validationErrors: SchemaValidationProblem[][]]
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* @internal
|
|
173
|
-
*/
|
|
174
|
-
export declare function validateSchema(
|
|
175
|
-
schemaTypes: FIXME,
|
|
176
|
-
{transformTypeVisitors}?: Options_2,
|
|
177
|
-
): {
|
|
178
|
-
get(typeName: string): any
|
|
179
|
-
has(typeName: string): boolean
|
|
180
|
-
getTypeNames(): string[]
|
|
181
|
-
getTypes(): any[]
|
|
182
|
-
toJSON(): any[]
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
export {}
|