@sanity/schema 5.8.0 → 5.8.1-next.1
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/_internal.d.ts +247 -232
- package/lib/index.d.ts +43 -43
- package/package.json +18 -18
package/lib/_internal.d.ts
CHANGED
|
@@ -1,219 +1,219 @@
|
|
|
1
|
-
import {Rule} from
|
|
2
|
-
import {SanityDocument} from
|
|
3
|
-
import {Schema} from
|
|
4
|
-
import {SchemaType} from
|
|
5
|
-
import {SchemaType as SchemaType_2} from
|
|
6
|
-
import {SchemaTypeDefinition} from
|
|
7
|
-
import {SchemaValidationProblem} from
|
|
8
|
-
import {SchemaValidationProblemGroup} from
|
|
9
|
-
import {SetSynchronization} from
|
|
10
|
-
import {SynchronizationRequest} from
|
|
11
|
-
import {SynchronizationResult} from
|
|
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
12
|
|
|
13
|
-
export declare const ALL_FIELDS_GROUP_NAME =
|
|
13
|
+
export declare const ALL_FIELDS_GROUP_NAME = "all-fields";
|
|
14
14
|
|
|
15
15
|
export declare const builtinTypes: (
|
|
16
16
|
| {
|
|
17
|
-
title: string
|
|
18
|
-
name: string
|
|
19
|
-
type: string
|
|
17
|
+
title: string;
|
|
18
|
+
name: string;
|
|
19
|
+
type: string;
|
|
20
20
|
fields: {
|
|
21
|
-
name: string
|
|
22
|
-
type: string
|
|
23
|
-
title: string
|
|
24
|
-
}[]
|
|
21
|
+
name: string;
|
|
22
|
+
type: string;
|
|
23
|
+
title: string;
|
|
24
|
+
}[];
|
|
25
25
|
}
|
|
26
26
|
| {
|
|
27
|
-
name: string
|
|
28
|
-
title: string
|
|
29
|
-
type: string
|
|
27
|
+
name: string;
|
|
28
|
+
title: string;
|
|
29
|
+
type: string;
|
|
30
30
|
fieldsets: {
|
|
31
|
-
name: string
|
|
32
|
-
title: string
|
|
33
|
-
description: string
|
|
34
|
-
}[]
|
|
31
|
+
name: string;
|
|
32
|
+
title: string;
|
|
33
|
+
description: string;
|
|
34
|
+
}[];
|
|
35
35
|
fields: (
|
|
36
36
|
| {
|
|
37
|
-
name: string
|
|
38
|
-
type: string
|
|
39
|
-
title: string
|
|
40
|
-
readOnly: boolean
|
|
41
|
-
fieldset?: undefined
|
|
42
|
-
hidden?: undefined
|
|
37
|
+
name: string;
|
|
38
|
+
type: string;
|
|
39
|
+
title: string;
|
|
40
|
+
readOnly: boolean;
|
|
41
|
+
fieldset?: undefined;
|
|
42
|
+
hidden?: undefined;
|
|
43
43
|
}
|
|
44
44
|
| {
|
|
45
|
-
name: string
|
|
46
|
-
type: string
|
|
47
|
-
title: string
|
|
48
|
-
readOnly?: undefined
|
|
49
|
-
fieldset?: undefined
|
|
50
|
-
hidden?: undefined
|
|
45
|
+
name: string;
|
|
46
|
+
type: string;
|
|
47
|
+
title: string;
|
|
48
|
+
readOnly?: undefined;
|
|
49
|
+
fieldset?: undefined;
|
|
50
|
+
hidden?: undefined;
|
|
51
51
|
}
|
|
52
52
|
| {
|
|
53
|
-
name: string
|
|
54
|
-
type: string
|
|
55
|
-
title: string
|
|
56
|
-
readOnly: boolean
|
|
57
|
-
fieldset: string
|
|
58
|
-
hidden?: undefined
|
|
53
|
+
name: string;
|
|
54
|
+
type: string;
|
|
55
|
+
title: string;
|
|
56
|
+
readOnly: boolean;
|
|
57
|
+
fieldset: string;
|
|
58
|
+
hidden?: undefined;
|
|
59
59
|
}
|
|
60
60
|
| {
|
|
61
|
-
name: string
|
|
62
|
-
type: string
|
|
63
|
-
readOnly: boolean
|
|
64
|
-
hidden: boolean
|
|
65
|
-
fieldset: string
|
|
66
|
-
title?: undefined
|
|
61
|
+
name: string;
|
|
62
|
+
type: string;
|
|
63
|
+
readOnly: boolean;
|
|
64
|
+
hidden: boolean;
|
|
65
|
+
fieldset: string;
|
|
66
|
+
title?: undefined;
|
|
67
67
|
}
|
|
68
|
-
)[]
|
|
68
|
+
)[];
|
|
69
69
|
preview: {
|
|
70
70
|
select: {
|
|
71
|
-
id: string
|
|
72
|
-
title: string
|
|
73
|
-
mimeType: string
|
|
74
|
-
size: string
|
|
75
|
-
media: string
|
|
76
|
-
}
|
|
71
|
+
id: string;
|
|
72
|
+
title: string;
|
|
73
|
+
mimeType: string;
|
|
74
|
+
size: string;
|
|
75
|
+
media: string;
|
|
76
|
+
};
|
|
77
77
|
prepare(doc: Partial<SanityDocument>): {
|
|
78
|
-
title: {}
|
|
78
|
+
title: {};
|
|
79
79
|
media: {
|
|
80
|
-
media?: {} | undefined
|
|
80
|
+
media?: {} | undefined;
|
|
81
81
|
asset: {
|
|
82
|
-
_ref: unknown
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
subtitle: string
|
|
86
|
-
}
|
|
87
|
-
}
|
|
82
|
+
_ref: unknown;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
subtitle: string;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
88
|
orderings: {
|
|
89
|
-
title: string
|
|
90
|
-
name: string
|
|
89
|
+
title: string;
|
|
90
|
+
name: string;
|
|
91
91
|
by: {
|
|
92
|
-
field: string
|
|
93
|
-
direction: string
|
|
94
|
-
}[]
|
|
95
|
-
}[]
|
|
92
|
+
field: string;
|
|
93
|
+
direction: string;
|
|
94
|
+
}[];
|
|
95
|
+
}[];
|
|
96
96
|
}
|
|
97
97
|
| {
|
|
98
|
-
name: string
|
|
99
|
-
title: string
|
|
100
|
-
type: string
|
|
98
|
+
name: string;
|
|
99
|
+
title: string;
|
|
100
|
+
type: string;
|
|
101
101
|
fieldsets: {
|
|
102
|
-
name: string
|
|
103
|
-
title: string
|
|
104
|
-
description: string
|
|
105
|
-
}[]
|
|
102
|
+
name: string;
|
|
103
|
+
title: string;
|
|
104
|
+
description: string;
|
|
105
|
+
}[];
|
|
106
106
|
fields: (
|
|
107
107
|
| {
|
|
108
|
-
name: string
|
|
109
|
-
type: string
|
|
110
|
-
title: string
|
|
111
|
-
readOnly: boolean
|
|
112
|
-
fieldset?: undefined
|
|
113
|
-
hidden?: undefined
|
|
108
|
+
name: string;
|
|
109
|
+
type: string;
|
|
110
|
+
title: string;
|
|
111
|
+
readOnly: boolean;
|
|
112
|
+
fieldset?: undefined;
|
|
113
|
+
hidden?: undefined;
|
|
114
114
|
}
|
|
115
115
|
| {
|
|
116
|
-
name: string
|
|
117
|
-
type: string
|
|
118
|
-
title: string
|
|
119
|
-
readOnly?: undefined
|
|
120
|
-
fieldset?: undefined
|
|
121
|
-
hidden?: undefined
|
|
116
|
+
name: string;
|
|
117
|
+
type: string;
|
|
118
|
+
title: string;
|
|
119
|
+
readOnly?: undefined;
|
|
120
|
+
fieldset?: undefined;
|
|
121
|
+
hidden?: undefined;
|
|
122
122
|
}
|
|
123
123
|
| {
|
|
124
|
-
name: string
|
|
125
|
-
type: string
|
|
126
|
-
title: string
|
|
127
|
-
readOnly: boolean
|
|
128
|
-
fieldset: string
|
|
129
|
-
hidden?: undefined
|
|
124
|
+
name: string;
|
|
125
|
+
type: string;
|
|
126
|
+
title: string;
|
|
127
|
+
readOnly: boolean;
|
|
128
|
+
fieldset: string;
|
|
129
|
+
hidden?: undefined;
|
|
130
130
|
}
|
|
131
131
|
| {
|
|
132
|
-
name: string
|
|
133
|
-
type: string
|
|
134
|
-
readOnly: boolean
|
|
135
|
-
hidden: boolean
|
|
136
|
-
fieldset: string
|
|
137
|
-
title?: undefined
|
|
132
|
+
name: string;
|
|
133
|
+
type: string;
|
|
134
|
+
readOnly: boolean;
|
|
135
|
+
hidden: boolean;
|
|
136
|
+
fieldset: string;
|
|
137
|
+
title?: undefined;
|
|
138
138
|
}
|
|
139
|
-
)[]
|
|
139
|
+
)[];
|
|
140
140
|
preview: {
|
|
141
141
|
select: {
|
|
142
|
-
title: string
|
|
143
|
-
path: string
|
|
144
|
-
mimeType: string
|
|
145
|
-
size: string
|
|
146
|
-
}
|
|
142
|
+
title: string;
|
|
143
|
+
path: string;
|
|
144
|
+
mimeType: string;
|
|
145
|
+
size: string;
|
|
146
|
+
};
|
|
147
147
|
prepare(doc: Record<string, any>): {
|
|
148
|
-
title: any
|
|
149
|
-
subtitle: string
|
|
150
|
-
}
|
|
151
|
-
}
|
|
148
|
+
title: any;
|
|
149
|
+
subtitle: string;
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
152
|
orderings: {
|
|
153
|
-
title: string
|
|
154
|
-
name: string
|
|
153
|
+
title: string;
|
|
154
|
+
name: string;
|
|
155
155
|
by: {
|
|
156
|
-
field: string
|
|
157
|
-
direction: string
|
|
158
|
-
}[]
|
|
159
|
-
}[]
|
|
156
|
+
field: string;
|
|
157
|
+
direction: string;
|
|
158
|
+
}[];
|
|
159
|
+
}[];
|
|
160
160
|
}
|
|
161
161
|
| {
|
|
162
|
-
name: string
|
|
163
|
-
title: string
|
|
164
|
-
type: string
|
|
162
|
+
name: string;
|
|
163
|
+
title: string;
|
|
164
|
+
type: string;
|
|
165
165
|
fields: {
|
|
166
|
-
name: string
|
|
167
|
-
type: string
|
|
168
|
-
validation: (Rule: Rule) => Rule
|
|
169
|
-
}[]
|
|
166
|
+
name: string;
|
|
167
|
+
type: string;
|
|
168
|
+
validation: (Rule: Rule) => Rule;
|
|
169
|
+
}[];
|
|
170
170
|
}
|
|
171
171
|
| {
|
|
172
|
-
name: string
|
|
173
|
-
title: string
|
|
174
|
-
type: string
|
|
172
|
+
name: string;
|
|
173
|
+
title: string;
|
|
174
|
+
type: string;
|
|
175
175
|
fieldsets: {
|
|
176
|
-
name: string
|
|
177
|
-
title: string
|
|
176
|
+
name: string;
|
|
177
|
+
title: string;
|
|
178
178
|
options: {
|
|
179
|
-
collapsable: boolean
|
|
180
|
-
}
|
|
181
|
-
}[]
|
|
179
|
+
collapsable: boolean;
|
|
180
|
+
};
|
|
181
|
+
}[];
|
|
182
182
|
fields: (
|
|
183
183
|
| {
|
|
184
|
-
name: string
|
|
185
|
-
type: string
|
|
186
|
-
title?: undefined
|
|
187
|
-
fieldset?: undefined
|
|
188
|
-
readOnly?: undefined
|
|
184
|
+
name: string;
|
|
185
|
+
type: string;
|
|
186
|
+
title?: undefined;
|
|
187
|
+
fieldset?: undefined;
|
|
188
|
+
readOnly?: undefined;
|
|
189
189
|
}
|
|
190
190
|
| {
|
|
191
|
-
name: string
|
|
192
|
-
title: string
|
|
193
|
-
type: string
|
|
194
|
-
fieldset: string
|
|
195
|
-
readOnly?: undefined
|
|
191
|
+
name: string;
|
|
192
|
+
title: string;
|
|
193
|
+
type: string;
|
|
194
|
+
fieldset: string;
|
|
195
|
+
readOnly?: undefined;
|
|
196
196
|
}
|
|
197
197
|
| {
|
|
198
|
-
name: string
|
|
199
|
-
title: string
|
|
200
|
-
type: string
|
|
201
|
-
readOnly: boolean
|
|
202
|
-
fieldset?: undefined
|
|
198
|
+
name: string;
|
|
199
|
+
title: string;
|
|
200
|
+
type: string;
|
|
201
|
+
readOnly: boolean;
|
|
202
|
+
fieldset?: undefined;
|
|
203
203
|
}
|
|
204
|
-
)[]
|
|
204
|
+
)[];
|
|
205
205
|
}
|
|
206
|
-
)[]
|
|
206
|
+
)[];
|
|
207
207
|
|
|
208
208
|
export declare function createSchemaFromManifestTypes(schemaDef: {
|
|
209
|
-
name: string
|
|
210
|
-
types: unknown[]
|
|
211
|
-
}): Schema_2
|
|
209
|
+
name: string;
|
|
210
|
+
types: unknown[];
|
|
211
|
+
}): Schema_2;
|
|
212
212
|
|
|
213
|
-
export declare const DEFAULT_MAX_FIELD_DEPTH = 5
|
|
213
|
+
export declare const DEFAULT_MAX_FIELD_DEPTH = 5;
|
|
214
214
|
|
|
215
215
|
export declare class DescriptorConverter {
|
|
216
|
-
cache: WeakMap<Schema, SetSynchronization<RegistryType
|
|
216
|
+
cache: WeakMap<Schema, SetSynchronization<RegistryType>>;
|
|
217
217
|
/**
|
|
218
218
|
* Returns a synchronization object for a schema.
|
|
219
219
|
*
|
|
@@ -226,11 +226,11 @@ export declare class DescriptorConverter {
|
|
|
226
226
|
* If present, this will use an idle scheduler which records duration into this array.
|
|
227
227
|
* This option will be ignored if the `scheduler` option is passed in.
|
|
228
228
|
**/
|
|
229
|
-
pauseDurations?: number[]
|
|
229
|
+
pauseDurations?: number[];
|
|
230
230
|
/** An explicit scheduler to do the work. */
|
|
231
|
-
scheduler?: Scheduler
|
|
231
|
+
scheduler?: Scheduler;
|
|
232
232
|
},
|
|
233
|
-
): Promise<SetSynchronization<RegistryType
|
|
233
|
+
): Promise<SetSynchronization<RegistryType>>;
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
/**
|
|
@@ -249,54 +249,63 @@ export declare class DescriptorConverter {
|
|
|
249
249
|
export declare function extractSchema(
|
|
250
250
|
schemaDef: Schema,
|
|
251
251
|
extractOptions?: ExtractSchemaOptions,
|
|
252
|
-
): SchemaType_2
|
|
252
|
+
): SchemaType_2;
|
|
253
253
|
|
|
254
254
|
declare interface ExtractSchemaOptions {
|
|
255
|
-
enforceRequiredFields?: boolean
|
|
255
|
+
enforceRequiredFields?: boolean;
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
/**
|
|
259
259
|
* @internal
|
|
260
260
|
*/
|
|
261
|
-
export declare type FIXME = any
|
|
261
|
+
export declare type FIXME = any;
|
|
262
262
|
|
|
263
263
|
/**
|
|
264
264
|
* @internal
|
|
265
265
|
*/
|
|
266
|
-
export declare function groupProblems(
|
|
266
|
+
export declare function groupProblems(
|
|
267
|
+
types: SchemaTypeDefinition[],
|
|
268
|
+
): SchemaValidationProblemGroup[];
|
|
267
269
|
|
|
268
|
-
export declare const isActionEnabled: (
|
|
270
|
+
export declare const isActionEnabled: (
|
|
271
|
+
schemaType: SchemaType,
|
|
272
|
+
action: string,
|
|
273
|
+
) => boolean;
|
|
269
274
|
|
|
270
275
|
declare interface Options {
|
|
271
|
-
transformTypeVisitors?: (
|
|
272
|
-
|
|
276
|
+
transformTypeVisitors?: (
|
|
277
|
+
visitors: typeof typeVisitors,
|
|
278
|
+
) => Partial<typeof typeVisitors>;
|
|
279
|
+
transformCommonVisitors?: (visitors: any[]) => any[];
|
|
273
280
|
}
|
|
274
281
|
|
|
275
282
|
/**
|
|
276
283
|
* @internal
|
|
277
284
|
*/
|
|
278
|
-
export declare type ProblemPath = ProblemPathSegment[]
|
|
285
|
+
export declare type ProblemPath = ProblemPathSegment[];
|
|
279
286
|
|
|
280
287
|
/**
|
|
281
288
|
* @internal
|
|
282
289
|
*/
|
|
283
290
|
export declare interface ProblemPathPropertySegment {
|
|
284
|
-
kind:
|
|
285
|
-
name: string
|
|
291
|
+
kind: "property";
|
|
292
|
+
name: string;
|
|
286
293
|
}
|
|
287
294
|
|
|
288
295
|
/**
|
|
289
296
|
* @internal
|
|
290
297
|
*/
|
|
291
|
-
export declare type ProblemPathSegment =
|
|
298
|
+
export declare type ProblemPathSegment =
|
|
299
|
+
| ProblemPathTypeSegment
|
|
300
|
+
| ProblemPathPropertySegment;
|
|
292
301
|
|
|
293
302
|
/**
|
|
294
303
|
* @internal
|
|
295
304
|
*/
|
|
296
305
|
export declare interface ProblemPathTypeSegment {
|
|
297
|
-
kind:
|
|
298
|
-
type: string
|
|
299
|
-
name: string
|
|
306
|
+
kind: "type";
|
|
307
|
+
type: string;
|
|
308
|
+
name: string;
|
|
300
309
|
}
|
|
301
310
|
|
|
302
311
|
/**
|
|
@@ -309,96 +318,99 @@ export declare interface ProblemPathTypeSegment {
|
|
|
309
318
|
export declare function processSchemaSynchronization(
|
|
310
319
|
sync: SetSynchronization<RegistryType>,
|
|
311
320
|
response: SchemaSynchronizationResult | null,
|
|
312
|
-
): SchemaSynchronizationRequest | null
|
|
321
|
+
): SchemaSynchronizationRequest | null;
|
|
313
322
|
|
|
314
|
-
declare type RegistryType =
|
|
323
|
+
declare type RegistryType = "sanity.schema.registry";
|
|
315
324
|
|
|
316
325
|
/**
|
|
317
326
|
* @internal
|
|
318
327
|
*/
|
|
319
|
-
export declare function resolveSearchConfig(type: any, maxDepth?: number): any
|
|
328
|
+
export declare function resolveSearchConfig(type: any, maxDepth?: number): any;
|
|
320
329
|
|
|
321
|
-
export declare function resolveSearchConfigForBaseFieldPaths(
|
|
330
|
+
export declare function resolveSearchConfigForBaseFieldPaths(
|
|
331
|
+
type: any,
|
|
332
|
+
maxDepth?: number,
|
|
333
|
+
): any;
|
|
322
334
|
|
|
323
335
|
/** The scheduler is capable of executing work in different ways. */
|
|
324
336
|
declare type Scheduler = {
|
|
325
|
-
map<T, U>(arr: T[], fn: (val: T) => U): Promise<U[]
|
|
326
|
-
forEach<T>(arr: T[], fn: (val: T) => void): Promise<void
|
|
327
|
-
forEachIter<T>(iter: Iterable<T>, fn: (val: T) => void): Promise<void
|
|
328
|
-
}
|
|
337
|
+
map<T, U>(arr: T[], fn: (val: T) => U): Promise<U[]>;
|
|
338
|
+
forEach<T>(arr: T[], fn: (val: T) => void): Promise<void>;
|
|
339
|
+
forEachIter<T>(iter: Iterable<T>, fn: (val: T) => void): Promise<void>;
|
|
340
|
+
};
|
|
329
341
|
|
|
330
342
|
/**
|
|
331
343
|
* @beta
|
|
332
344
|
*/
|
|
333
345
|
declare class Schema_2 {
|
|
334
|
-
#private
|
|
346
|
+
#private;
|
|
335
347
|
_original: {
|
|
336
|
-
name: string
|
|
337
|
-
types: any[]
|
|
338
|
-
parent?: Schema_2
|
|
339
|
-
}
|
|
348
|
+
name: string;
|
|
349
|
+
types: any[];
|
|
350
|
+
parent?: Schema_2;
|
|
351
|
+
};
|
|
340
352
|
_registry: {
|
|
341
|
-
[typeName: string]: any
|
|
342
|
-
}
|
|
343
|
-
static compile(schemaDef: any): Schema_2
|
|
344
|
-
constructor(schemaDef: any)
|
|
345
|
-
get name(): string
|
|
353
|
+
[typeName: string]: any;
|
|
354
|
+
};
|
|
355
|
+
static compile(schemaDef: any): Schema_2;
|
|
356
|
+
constructor(schemaDef: any);
|
|
357
|
+
get name(): string;
|
|
346
358
|
/**
|
|
347
359
|
* Returns the parent schema.
|
|
348
360
|
*/
|
|
349
|
-
get parent(): Schema_2 | undefined
|
|
350
|
-
get(name: string): any
|
|
351
|
-
has(name: string): boolean
|
|
352
|
-
getTypeNames(): string[]
|
|
353
|
-
getLocalTypeNames(): string[]
|
|
361
|
+
get parent(): Schema_2 | undefined;
|
|
362
|
+
get(name: string): any;
|
|
363
|
+
has(name: string): boolean;
|
|
364
|
+
getTypeNames(): string[];
|
|
365
|
+
getLocalTypeNames(): string[];
|
|
354
366
|
}
|
|
355
367
|
|
|
356
|
-
export declare type SchemaSynchronizationRequest = SynchronizationRequest
|
|
368
|
+
export declare type SchemaSynchronizationRequest = SynchronizationRequest;
|
|
357
369
|
|
|
358
|
-
export declare type SchemaSynchronizationResult = SynchronizationResult
|
|
370
|
+
export declare type SchemaSynchronizationResult = SynchronizationResult;
|
|
359
371
|
|
|
360
372
|
/**
|
|
361
373
|
* @internal
|
|
362
374
|
*/
|
|
363
375
|
declare interface SchemaValidationResult {
|
|
364
|
-
severity:
|
|
365
|
-
message: string
|
|
366
|
-
helpId?: string
|
|
376
|
+
severity: "warning" | "error";
|
|
377
|
+
message: string;
|
|
378
|
+
helpId?: string;
|
|
367
379
|
}
|
|
368
|
-
export {SchemaValidationResult as Problem}
|
|
369
|
-
export {SchemaValidationResult as ValidationResult}
|
|
380
|
+
export { SchemaValidationResult as Problem };
|
|
381
|
+
export { SchemaValidationResult as ValidationResult };
|
|
370
382
|
|
|
371
383
|
declare const typeVisitors: {
|
|
372
|
-
array: (typeDef: any, visitorContext: any) => any
|
|
373
|
-
object: (typeDef: any, visitorContext: any) => any
|
|
374
|
-
slug: (typeDef: any, visitorContext: any) => any
|
|
375
|
-
file: (typeDef: any, visitorContext: any) => any
|
|
376
|
-
image: (typeDef: any, visitorContext: any) => any
|
|
377
|
-
block: typeof validateBlockType
|
|
378
|
-
document: (typeDefinition: any, visitorContext: any) => any
|
|
379
|
-
reference: (typeDef: any, visitorContext: any) => any
|
|
380
|
-
crossDatasetReference: (typeDef: any, visitorContext: any) => any
|
|
381
|
-
globalDocumentReference: (typeDef: any, visitorContext: any) => any
|
|
382
|
-
}
|
|
384
|
+
array: (typeDef: any, visitorContext: any) => any;
|
|
385
|
+
object: (typeDef: any, visitorContext: any) => any;
|
|
386
|
+
slug: (typeDef: any, visitorContext: any) => any;
|
|
387
|
+
file: (typeDef: any, visitorContext: any) => any;
|
|
388
|
+
image: (typeDef: any, visitorContext: any) => any;
|
|
389
|
+
block: typeof validateBlockType;
|
|
390
|
+
document: (typeDefinition: any, visitorContext: any) => any;
|
|
391
|
+
reference: (typeDef: any, visitorContext: any) => any;
|
|
392
|
+
crossDatasetReference: (typeDef: any, visitorContext: any) => any;
|
|
393
|
+
globalDocumentReference: (typeDef: any, visitorContext: any) => any;
|
|
394
|
+
};
|
|
383
395
|
|
|
384
396
|
/**
|
|
385
397
|
* @internal
|
|
386
398
|
*/
|
|
387
399
|
export declare interface TypeWithProblems {
|
|
388
|
-
path: ProblemPath
|
|
389
|
-
problems: SchemaValidationResult[]
|
|
400
|
+
path: ProblemPath;
|
|
401
|
+
problems: SchemaValidationResult[];
|
|
390
402
|
}
|
|
391
403
|
|
|
392
404
|
declare function validateBlockType(
|
|
393
405
|
typeDef: any,
|
|
394
406
|
visitorContext: any,
|
|
395
407
|
): {
|
|
396
|
-
marks: any
|
|
397
|
-
styles: any
|
|
398
|
-
name: any
|
|
399
|
-
of: any
|
|
400
|
-
_problems: SchemaValidationResult[]
|
|
401
|
-
}
|
|
408
|
+
marks: any;
|
|
409
|
+
styles: any;
|
|
410
|
+
name: any;
|
|
411
|
+
of: any;
|
|
412
|
+
_problems: SchemaValidationResult[];
|
|
413
|
+
};
|
|
402
414
|
|
|
403
415
|
/**
|
|
404
416
|
* Ensure that the provided value is a valid Media Library asset aspect that can be safely deployed.
|
|
@@ -407,25 +419,28 @@ declare function validateBlockType(
|
|
|
407
419
|
*/
|
|
408
420
|
export declare function validateMediaLibraryAssetAspect(
|
|
409
421
|
maybeAspect: unknown,
|
|
410
|
-
): [
|
|
422
|
+
): [
|
|
423
|
+
isValidMediaLibraryAspect: boolean,
|
|
424
|
+
validationErrors: SchemaValidationProblem[][],
|
|
425
|
+
];
|
|
411
426
|
|
|
412
427
|
/**
|
|
413
428
|
* @internal
|
|
414
429
|
*/
|
|
415
430
|
export declare function validateSchema(
|
|
416
431
|
schemaTypes: FIXME,
|
|
417
|
-
{transformTypeVisitors, transformCommonVisitors}?: Options,
|
|
432
|
+
{ transformTypeVisitors, transformCommonVisitors }?: Options,
|
|
418
433
|
): {
|
|
419
|
-
get(typeName: string): any
|
|
420
|
-
has(typeName: string): boolean
|
|
421
|
-
getTypeNames(): string[]
|
|
422
|
-
getTypes(): any[]
|
|
423
|
-
toJSON(): any[]
|
|
424
|
-
}
|
|
434
|
+
get(typeName: string): any;
|
|
435
|
+
has(typeName: string): boolean;
|
|
436
|
+
getTypeNames(): string[];
|
|
437
|
+
getTypes(): any[];
|
|
438
|
+
toJSON(): any[];
|
|
439
|
+
};
|
|
425
440
|
|
|
426
441
|
export declare class ValidationError extends Error {
|
|
427
|
-
problems: SchemaValidationProblemGroup[]
|
|
428
|
-
constructor(problems: SchemaValidationProblemGroup[])
|
|
442
|
+
problems: SchemaValidationProblemGroup[];
|
|
443
|
+
constructor(problems: SchemaValidationProblemGroup[]);
|
|
429
444
|
}
|
|
430
445
|
|
|
431
|
-
export {}
|
|
446
|
+
export {};
|
package/lib/index.d.ts
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import {RuleClass} from
|
|
1
|
+
import { RuleClass } from "@sanity/types";
|
|
2
2
|
|
|
3
3
|
export declare const DEFAULT_ANNOTATIONS: {
|
|
4
|
-
type: string
|
|
5
|
-
name: string
|
|
6
|
-
title: string
|
|
7
|
-
i18nTitleKey: string
|
|
4
|
+
type: string;
|
|
5
|
+
name: string;
|
|
6
|
+
title: string;
|
|
7
|
+
i18nTitleKey: string;
|
|
8
8
|
options: {
|
|
9
9
|
modal: {
|
|
10
|
-
type: string
|
|
11
|
-
}
|
|
12
|
-
}
|
|
10
|
+
type: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
13
|
fields: {
|
|
14
|
-
name: string
|
|
15
|
-
type: string
|
|
16
|
-
title: string
|
|
17
|
-
description: string
|
|
18
|
-
validation: (Rule: any) => any
|
|
19
|
-
}[]
|
|
20
|
-
}[]
|
|
14
|
+
name: string;
|
|
15
|
+
type: string;
|
|
16
|
+
title: string;
|
|
17
|
+
description: string;
|
|
18
|
+
validation: (Rule: any) => any;
|
|
19
|
+
}[];
|
|
20
|
+
}[];
|
|
21
21
|
|
|
22
22
|
export declare const DEFAULT_DECORATORS: {
|
|
23
|
-
title: string
|
|
24
|
-
value: string
|
|
25
|
-
i18nTitleKey: string
|
|
26
|
-
}[]
|
|
23
|
+
title: string;
|
|
24
|
+
value: string;
|
|
25
|
+
i18nTitleKey: string;
|
|
26
|
+
}[];
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* @deprecated Use `import {Schema} from "@sanity/schema"` instead
|
|
30
30
|
*/
|
|
31
31
|
declare class DeprecatedDefaultSchema extends Schema_2 {
|
|
32
|
-
static compile(schemaDef: any): Schema_2
|
|
33
|
-
constructor(schemaDef: any)
|
|
32
|
+
static compile(schemaDef: any): Schema_2;
|
|
33
|
+
constructor(schemaDef: any);
|
|
34
34
|
}
|
|
35
|
-
export default DeprecatedDefaultSchema
|
|
35
|
+
export default DeprecatedDefaultSchema;
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* Core Rule implementation without validation logic.
|
|
@@ -40,43 +40,43 @@ export default DeprecatedDefaultSchema
|
|
|
40
40
|
*
|
|
41
41
|
* @internal
|
|
42
42
|
*/
|
|
43
|
-
export declare const Rule: RuleClass
|
|
43
|
+
export declare const Rule: RuleClass;
|
|
44
44
|
|
|
45
|
-
export declare const Schema: typeof Schema_2
|
|
45
|
+
export declare const Schema: typeof Schema_2;
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
48
|
* @beta
|
|
49
49
|
*/
|
|
50
50
|
declare class Schema_2 {
|
|
51
|
-
#private
|
|
51
|
+
#private;
|
|
52
52
|
_original: {
|
|
53
|
-
name: string
|
|
54
|
-
types: any[]
|
|
55
|
-
parent?: Schema_2
|
|
56
|
-
}
|
|
53
|
+
name: string;
|
|
54
|
+
types: any[];
|
|
55
|
+
parent?: Schema_2;
|
|
56
|
+
};
|
|
57
57
|
_registry: {
|
|
58
|
-
[typeName: string]: any
|
|
59
|
-
}
|
|
60
|
-
static compile(schemaDef: any): Schema_2
|
|
61
|
-
constructor(schemaDef: any)
|
|
62
|
-
get name(): string
|
|
58
|
+
[typeName: string]: any;
|
|
59
|
+
};
|
|
60
|
+
static compile(schemaDef: any): Schema_2;
|
|
61
|
+
constructor(schemaDef: any);
|
|
62
|
+
get name(): string;
|
|
63
63
|
/**
|
|
64
64
|
* Returns the parent schema.
|
|
65
65
|
*/
|
|
66
|
-
get parent(): Schema_2 | undefined
|
|
67
|
-
get(name: string): any
|
|
68
|
-
has(name: string): boolean
|
|
69
|
-
getTypeNames(): string[]
|
|
70
|
-
getLocalTypeNames(): string[]
|
|
66
|
+
get parent(): Schema_2 | undefined;
|
|
67
|
+
get(name: string): any;
|
|
68
|
+
has(name: string): boolean;
|
|
69
|
+
getTypeNames(): string[];
|
|
70
|
+
getLocalTypeNames(): string[];
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
74
|
* @internal
|
|
75
75
|
*/
|
|
76
76
|
export declare interface SchemaValidationResult {
|
|
77
|
-
severity:
|
|
78
|
-
message: string
|
|
79
|
-
helpId?: string
|
|
77
|
+
severity: "warning" | "error";
|
|
78
|
+
message: string;
|
|
79
|
+
helpId?: string;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
export {}
|
|
82
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,33 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/schema",
|
|
3
|
-
"version": "5.8.
|
|
3
|
+
"version": "5.8.1-next.1+a2c187ff7a",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"sanity",
|
|
7
6
|
"cms",
|
|
7
|
+
"content",
|
|
8
8
|
"headless",
|
|
9
9
|
"realtime",
|
|
10
|
-
"
|
|
10
|
+
"sanity",
|
|
11
11
|
"schema"
|
|
12
12
|
],
|
|
13
13
|
"homepage": "https://www.sanity.io/",
|
|
14
14
|
"bugs": {
|
|
15
15
|
"url": "https://github.com/sanity-io/sanity/issues"
|
|
16
16
|
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"author": "Sanity.io <hello@sanity.io>",
|
|
17
19
|
"repository": {
|
|
18
20
|
"type": "git",
|
|
19
21
|
"url": "git+https://github.com/sanity-io/sanity.git",
|
|
20
22
|
"directory": "packages/@sanity/schema"
|
|
21
23
|
},
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
"files": [
|
|
25
|
+
"lib"
|
|
26
|
+
],
|
|
25
27
|
"type": "module",
|
|
26
|
-
"
|
|
27
|
-
".": "./lib/index.js",
|
|
28
|
-
"./_internal": "./lib/_internal.js",
|
|
29
|
-
"./package.json": "./package.json"
|
|
30
|
-
},
|
|
28
|
+
"sideEffects": false,
|
|
31
29
|
"main": "./lib/index.js",
|
|
32
30
|
"types": "./lib/index.d.ts",
|
|
33
31
|
"typesVersions": {
|
|
@@ -37,9 +35,11 @@
|
|
|
37
35
|
]
|
|
38
36
|
}
|
|
39
37
|
},
|
|
40
|
-
"
|
|
41
|
-
"lib"
|
|
42
|
-
|
|
38
|
+
"exports": {
|
|
39
|
+
".": "./lib/index.js",
|
|
40
|
+
"./_internal": "./lib/_internal.js",
|
|
41
|
+
"./package.json": "./package.json"
|
|
42
|
+
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@sanity/descriptors": "^1.3.0",
|
|
45
45
|
"@sanity/generate-help-url": "^4.0.0",
|
|
@@ -61,10 +61,10 @@
|
|
|
61
61
|
"eslint": "^9.39.2",
|
|
62
62
|
"rimraf": "^5.0.10",
|
|
63
63
|
"vitest": "^4.0.18",
|
|
64
|
-
"@repo/package.config": "5.8.
|
|
65
|
-
"@repo/
|
|
66
|
-
"@repo/
|
|
67
|
-
"@repo/tsconfig": "5.8.
|
|
64
|
+
"@repo/package.config": "5.8.1-next.1+a2c187ff7a",
|
|
65
|
+
"@repo/eslint-config": "5.8.1-next.1+a2c187ff7a",
|
|
66
|
+
"@repo/test-config": "5.8.1-next.1+a2c187ff7a",
|
|
67
|
+
"@repo/tsconfig": "5.8.1-next.1+a2c187ff7a"
|
|
68
68
|
},
|
|
69
69
|
"scripts": {
|
|
70
70
|
"build": "pnpm clean && pkg-utils build --strict --check --clean",
|