@sanity/schema 4.19.1-next.1 → 4.19.1-next.11
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/_chunks-es/{Rule.mjs → Rule.js} +1 -1
- package/lib/{_chunks-cjs → _chunks-es}/Rule.js.map +1 -1
- package/lib/_internal.js +111 -99
- package/lib/_internal.js.map +1 -1
- package/lib/index.js +8 -7
- package/lib/index.js.map +1 -1
- package/package.json +8 -13
- package/lib/_chunks-cjs/Rule.js +0 -1723
- package/lib/_chunks-es/Rule.mjs.map +0 -1
- package/lib/_internal.d.mts +0 -407
- package/lib/_internal.mjs +0 -2723
- package/lib/_internal.mjs.map +0 -1
- package/lib/index.d.mts +0 -57
- package/lib/index.mjs +0 -9
- package/lib/index.mjs.map +0 -1
package/lib/_internal.js
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { SetBuilder, processSetSynchronization } from "@sanity/descriptors";
|
|
2
|
+
import isEqual from "lodash/isEqual.js";
|
|
3
|
+
import isObject from "lodash/isObject.js";
|
|
4
|
+
import { OWN_PROPS_NAME, Rule, Schema } from "./_chunks-es/Rule.js";
|
|
5
|
+
import { ALL_FIELDS_GROUP_NAME, DEFAULT_MAX_FIELD_DEPTH, resolveSearchConfig, resolveSearchConfigForBaseFieldPaths } from "./_chunks-es/Rule.js";
|
|
6
|
+
import difference from "lodash/difference.js";
|
|
7
|
+
import cloneDeep from "lodash/cloneDeep.js";
|
|
8
|
+
import flatten from "lodash/flatten.js";
|
|
9
|
+
import get from "lodash/get.js";
|
|
10
|
+
import uniq from "lodash/uniq.js";
|
|
11
|
+
import humanizeList from "humanize-list";
|
|
12
|
+
import partition from "lodash/partition.js";
|
|
13
|
+
import isPlainObject from "lodash/isPlainObject.js";
|
|
14
|
+
import omit from "lodash/omit.js";
|
|
15
|
+
import leven from "leven";
|
|
16
|
+
import inspect from "object-inspect";
|
|
17
|
+
import { createReferenceTypeNode } from "groq-js";
|
|
8
18
|
const MAX_DEPTH_UKNOWN = 5;
|
|
9
19
|
class DescriptorConverter {
|
|
10
20
|
opts;
|
|
@@ -20,7 +30,7 @@ class DescriptorConverter {
|
|
|
20
30
|
get(schema) {
|
|
21
31
|
let value = this.cache.get(schema);
|
|
22
32
|
if (value) return value;
|
|
23
|
-
const builder = new
|
|
33
|
+
const builder = new SetBuilder();
|
|
24
34
|
for (const name of schema.getLocalTypeNames()) {
|
|
25
35
|
const typeDef = convertTypeDef(schema.get(name));
|
|
26
36
|
builder.addObject("sanity.schema.namedType", { name, typeDef });
|
|
@@ -29,7 +39,7 @@ class DescriptorConverter {
|
|
|
29
39
|
}
|
|
30
40
|
}
|
|
31
41
|
function convertCommonTypeDef(schemaType, opts) {
|
|
32
|
-
const ownProps =
|
|
42
|
+
const ownProps = OWN_PROPS_NAME in schemaType ? schemaType[OWN_PROPS_NAME] : schemaType;
|
|
33
43
|
let fields;
|
|
34
44
|
Array.isArray(ownProps.fields) && (fields = ownProps.fields.map(
|
|
35
45
|
({ name, group, fieldset, type }) => ({
|
|
@@ -151,7 +161,7 @@ function convertUnknown(val, seen = /* @__PURE__ */ new Set(), maxDepth = MAX_DE
|
|
|
151
161
|
if (typeof val == "function") return FUNCTION_MARKER;
|
|
152
162
|
if (seen.has(val))
|
|
153
163
|
return CYCLIC_MARKER;
|
|
154
|
-
if (seen.add(val),
|
|
164
|
+
if (seen.add(val), isObject(val)) {
|
|
155
165
|
if (Array.isArray(val))
|
|
156
166
|
return val.map((elem) => {
|
|
157
167
|
const res = convertUnknown(elem, seen, maxDepth - 1);
|
|
@@ -175,15 +185,15 @@ function convertUnknown(val, seen = /* @__PURE__ */ new Set(), maxDepth = MAX_DE
|
|
|
175
185
|
}
|
|
176
186
|
function maybeStringOrJSX(val) {
|
|
177
187
|
if (typeof val == "string") return val;
|
|
178
|
-
if (
|
|
188
|
+
if (isObject(val) && "$$typeof" in val && "type" in val && "props" in val) {
|
|
179
189
|
const { type, props } = val, strType = typeof type == "function" ? type.name : type;
|
|
180
190
|
return typeof strType != "string" ? void 0 : { __type: "jsx", type: strType, props: convertUnknown(props) };
|
|
181
191
|
}
|
|
182
192
|
}
|
|
183
193
|
function maybeValidations(obj) {
|
|
184
|
-
if (!
|
|
194
|
+
if (!isObject(obj) || !("type" in obj)) return;
|
|
185
195
|
const impliedRules = [];
|
|
186
|
-
switch ("options" in obj &&
|
|
196
|
+
switch ("options" in obj && isObject(obj.options) && "list" in obj.options && Array.isArray(obj.options.list) && impliedRules.push({
|
|
187
197
|
type: "enum",
|
|
188
198
|
values: obj.options.list.map((o) => convertUnknown(extractValueFromListOption(o, obj))).filter((v) => v !== void 0)
|
|
189
199
|
}), obj.type) {
|
|
@@ -221,8 +231,8 @@ function maybeValidations(obj) {
|
|
|
221
231
|
const validation = maybeValidation(rule);
|
|
222
232
|
if (validation === void 0)
|
|
223
233
|
continue;
|
|
224
|
-
const rulesToAdd = impliedRules.filter((ir) => !validation.rules.some((r) =>
|
|
225
|
-
rulesToAdd.length > 0 && validation.rules.unshift(...rulesToAdd), !validations.some((v) =>
|
|
234
|
+
const rulesToAdd = impliedRules.filter((ir) => !validation.rules.some((r) => isEqual(r, ir)));
|
|
235
|
+
rulesToAdd.length > 0 && validation.rules.unshift(...rulesToAdd), !validations.some((v) => isEqual(v, validation)) && validations.push(validation);
|
|
226
236
|
}
|
|
227
237
|
return validations.length > 0 ? validations : void 0;
|
|
228
238
|
}
|
|
@@ -230,13 +240,13 @@ function hasValueField(typeDef) {
|
|
|
230
240
|
return !typeDef || typeof typeDef != "object" ? !1 : "fields" in typeDef ? Array.isArray(typeDef.fields) ? typeDef.fields.some((field) => field.name === "value") : !1 : "type" in typeDef && typeDef.type ? hasValueField(typeDef.type) : !1;
|
|
231
241
|
}
|
|
232
242
|
function extractValueFromListOption(option, typeDef) {
|
|
233
|
-
return typeDef.jsonType === "object" && hasValueField(typeDef) ? option :
|
|
243
|
+
return typeDef.jsonType === "object" && hasValueField(typeDef) ? option : isObject(option) && "value" in option && option.value ? option.value : option;
|
|
234
244
|
}
|
|
235
245
|
function maybeValidation(val) {
|
|
236
246
|
if (val) {
|
|
237
247
|
if (isIRuleFunction(val))
|
|
238
248
|
try {
|
|
239
|
-
const result = val(new Rule
|
|
249
|
+
const result = val(new Rule());
|
|
240
250
|
if (isIRule(result))
|
|
241
251
|
return maybeValidation(result);
|
|
242
252
|
throw new Error("failed to convert to plain rule");
|
|
@@ -250,7 +260,7 @@ function maybeValidation(val) {
|
|
|
250
260
|
const level = val._level || "error", message = maybeValidationMessage(val._message), rules = [];
|
|
251
261
|
for (const spec of val._rules || []) {
|
|
252
262
|
const optional = val._required === "optional" || void 0, convertedRule = convertRuleSpec(spec, optional);
|
|
253
|
-
convertedRule !== void 0 && (rules.some((r) =>
|
|
263
|
+
convertedRule !== void 0 && (rules.some((r) => isEqual(r, convertedRule)) || rules.push(convertedRule));
|
|
254
264
|
}
|
|
255
265
|
return rules.length === 0 ? void 0 : {
|
|
256
266
|
level,
|
|
@@ -261,11 +271,11 @@ function maybeValidation(val) {
|
|
|
261
271
|
}
|
|
262
272
|
}
|
|
263
273
|
function isIRule(val) {
|
|
264
|
-
return
|
|
274
|
+
return isObject(val) && "_rules" in val;
|
|
265
275
|
}
|
|
266
276
|
function maybeValidationMessage(val) {
|
|
267
277
|
if (typeof val == "string") return val;
|
|
268
|
-
if (!
|
|
278
|
+
if (!isObject(val) || Array.isArray(val)) return;
|
|
269
279
|
const objectMessage = {};
|
|
270
280
|
for (const [field, value] of Object.entries(val))
|
|
271
281
|
typeof field != "string" || typeof value != "string" || (objectMessage[field] = value);
|
|
@@ -275,7 +285,7 @@ function isIRuleFunction(val) {
|
|
|
275
285
|
return typeof val == "function";
|
|
276
286
|
}
|
|
277
287
|
function convertRuleSpec(spec, optional) {
|
|
278
|
-
if (!
|
|
288
|
+
if (!isObject(spec) || !("flag" in spec))
|
|
279
289
|
return;
|
|
280
290
|
const constraint = "constraint" in spec ? spec.constraint : void 0;
|
|
281
291
|
switch (spec.flag) {
|
|
@@ -323,7 +333,7 @@ function convertRuleSpec(spec, optional) {
|
|
|
323
333
|
case "greaterThan":
|
|
324
334
|
return { type: "exclusiveMinimum", value: convertConstraintValue(constraint) };
|
|
325
335
|
case "regex":
|
|
326
|
-
if (
|
|
336
|
+
if (isObject(constraint) && "pattern" in constraint) {
|
|
327
337
|
const { pattern } = constraint, invert = "invert" in constraint ? maybeBoolean(constraint.invert) : void 0;
|
|
328
338
|
if (pattern instanceof RegExp)
|
|
329
339
|
return {
|
|
@@ -334,7 +344,7 @@ function convertRuleSpec(spec, optional) {
|
|
|
334
344
|
}
|
|
335
345
|
return;
|
|
336
346
|
case "uri": {
|
|
337
|
-
const allowRelative =
|
|
347
|
+
const allowRelative = isObject(constraint) && "options" in constraint && isObject(constraint.options) && "allowRelative" in constraint.options ? maybeBoolean(constraint.options.allowRelative) : void 0;
|
|
338
348
|
return {
|
|
339
349
|
type: "uri",
|
|
340
350
|
...allowRelative !== void 0 && { allowRelative }
|
|
@@ -353,7 +363,7 @@ function convertRuleSpec(spec, optional) {
|
|
|
353
363
|
}
|
|
354
364
|
}
|
|
355
365
|
function convertConstraintValue(constraint) {
|
|
356
|
-
return
|
|
366
|
+
return isObject(constraint) && "type" in constraint && "path" in constraint && constraint.type && constraint.path ? {
|
|
357
367
|
type: "fieldReference",
|
|
358
368
|
path: Array.isArray(constraint.path) ? constraint.path : [constraint.path]
|
|
359
369
|
} : String(constraint);
|
|
@@ -363,7 +373,7 @@ function maybeBoolean(val) {
|
|
|
363
373
|
return val;
|
|
364
374
|
}
|
|
365
375
|
function maybeI18n(val) {
|
|
366
|
-
if (!
|
|
376
|
+
if (!isObject(val) || Array.isArray(val)) return;
|
|
367
377
|
const localizedMessage = {};
|
|
368
378
|
for (const entry of Object.entries(val))
|
|
369
379
|
if (isI18nEntry(entry)) {
|
|
@@ -380,7 +390,7 @@ function isI18nEntry(entry) {
|
|
|
380
390
|
return typeof key == "string" && !!value && typeof value == "object" && "key" in value && "ns" in value && typeof value.key == "string" && typeof value.ns == "string";
|
|
381
391
|
}
|
|
382
392
|
function maybeOrdering(val) {
|
|
383
|
-
if (!
|
|
393
|
+
if (!isObject(val) || Array.isArray(val)) return;
|
|
384
394
|
const name = "name" in val && typeof val.name == "string" ? val.name : void 0;
|
|
385
395
|
if (name === void 0) return;
|
|
386
396
|
const title = "title" in val && typeof val.title == "string" ? val.title : name, by = "by" in val && Array.isArray(val.by) ? val.by : [], orderingBy = [];
|
|
@@ -398,13 +408,13 @@ function maybeOrdering(val) {
|
|
|
398
408
|
};
|
|
399
409
|
}
|
|
400
410
|
function maybeOrderingBy(val) {
|
|
401
|
-
if (!
|
|
411
|
+
if (!isObject(val) || Array.isArray(val)) return;
|
|
402
412
|
const field = "field" in val && typeof val.field == "string" ? val.field : void 0, direction = "direction" in val && (val.direction === "asc" || val.direction === "desc") ? val.direction : void 0;
|
|
403
413
|
if (!(!field || !direction))
|
|
404
414
|
return { field, direction };
|
|
405
415
|
}
|
|
406
416
|
function processSchemaSynchronization(sync, response) {
|
|
407
|
-
return
|
|
417
|
+
return processSetSynchronization(sync, response);
|
|
408
418
|
}
|
|
409
419
|
const ACTIONS_FLAG = "__experimental_actions", DEFAULT_ACTIONS = ["create", "update", "delete", "publish"], VALID_ACTIONS = DEFAULT_ACTIONS, readActions = (schemaType) => ACTIONS_FLAG in schemaType ? schemaType[ACTIONS_FLAG] : DEFAULT_ACTIONS, validateActions = (typeName, actions) => {
|
|
410
420
|
if (!Array.isArray(actions))
|
|
@@ -413,7 +423,7 @@ const ACTIONS_FLAG = "__experimental_actions", DEFAULT_ACTIONS = ["create", "upd
|
|
|
413
423
|
", "
|
|
414
424
|
)}`
|
|
415
425
|
);
|
|
416
|
-
const invalid =
|
|
426
|
+
const invalid = difference(actions, VALID_ACTIONS);
|
|
417
427
|
if (invalid.length > 0)
|
|
418
428
|
throw new Error(
|
|
419
429
|
`Invalid action${invalid.length > 1 ? "s" : ""} configured for schema type "${typeName}": ${invalid.join(
|
|
@@ -953,11 +963,11 @@ function createValidationResult(severity, message, helpId) {
|
|
|
953
963
|
}
|
|
954
964
|
const error = (message, helpId) => createValidationResult("error", message, helpId), warning = (message, helpId) => createValidationResult("warning", message, helpId);
|
|
955
965
|
function groupProblems(types) {
|
|
956
|
-
return
|
|
966
|
+
return flatten(types.map((type) => getTypeProblems(type))).filter(
|
|
957
967
|
(type) => type.problems.length > 0
|
|
958
968
|
);
|
|
959
969
|
}
|
|
960
|
-
function createTypeWithMembersProblemsAccessor(memberPropertyName, getMembers = (type) =>
|
|
970
|
+
function createTypeWithMembersProblemsAccessor(memberPropertyName, getMembers = (type) => get(type, memberPropertyName)) {
|
|
961
971
|
return function(type, parentPath) {
|
|
962
972
|
const currentPath = [
|
|
963
973
|
...parentPath,
|
|
@@ -981,7 +991,7 @@ function createTypeWithMembersProblemsAccessor(memberPropertyName, getMembers =
|
|
|
981
991
|
path: currentPath,
|
|
982
992
|
problems: type._problems || []
|
|
983
993
|
},
|
|
984
|
-
...
|
|
994
|
+
...flatten(memberProblems)
|
|
985
995
|
];
|
|
986
996
|
};
|
|
987
997
|
}
|
|
@@ -1038,7 +1048,7 @@ function traverseSchema(types = [], coreTypes2 = [], visitor = NOOP_VISITOR) {
|
|
|
1038
1048
|
function getType(typeName) {
|
|
1039
1049
|
return typeName === "type" ? TYPE_TYPE : coreTypesRegistry[typeName] || registry[typeName] || null;
|
|
1040
1050
|
}
|
|
1041
|
-
const duplicateNames =
|
|
1051
|
+
const duplicateNames = uniq(flatten(getDupes(typeNames)));
|
|
1042
1052
|
function isDuplicate(typeName) {
|
|
1043
1053
|
return duplicateNames.includes(typeName);
|
|
1044
1054
|
}
|
|
@@ -1124,7 +1134,7 @@ function pluralize(arr, suf = "s") {
|
|
|
1124
1134
|
return arr.length === 1 ? "" : suf;
|
|
1125
1135
|
}
|
|
1126
1136
|
function format(value) {
|
|
1127
|
-
return Array.isArray(value) ? `array with ${value.length} entries` : typeof value == "object" && value !== null ? `object with keys ${
|
|
1137
|
+
return Array.isArray(value) ? `array with ${value.length} entries` : typeof value == "object" && value !== null ? `object with keys ${humanizeList(Object.keys(value).map(quote$2))}` : quote$2(value);
|
|
1128
1138
|
}
|
|
1129
1139
|
var array = (typeDef, visitorContext) => {
|
|
1130
1140
|
const ofIsArray = Array.isArray(typeDef.of);
|
|
@@ -1170,7 +1180,7 @@ var array = (typeDef, visitorContext) => {
|
|
|
1170
1180
|
_problems: invalid
|
|
1171
1181
|
};
|
|
1172
1182
|
}
|
|
1173
|
-
const problems =
|
|
1183
|
+
const problems = flatten([
|
|
1174
1184
|
ofIsArray ? getDupes(typeDef.of, (t) => `${t.name};${t.type}`).map(
|
|
1175
1185
|
(dupes) => error(
|
|
1176
1186
|
`Found ${dupes.length} members with same type, but not unique names "${dupes[0].type}" in array. This makes it impossible to tell their values apart and you should consider naming them`,
|
|
@@ -1189,7 +1199,7 @@ var array = (typeDef, visitorContext) => {
|
|
|
1189
1199
|
HELP_IDS.ARRAY_OF_INVALID
|
|
1190
1200
|
)
|
|
1191
1201
|
);
|
|
1192
|
-
const [primitiveTypes, objectTypes] =
|
|
1202
|
+
const [primitiveTypes, objectTypes] = partition(
|
|
1193
1203
|
of,
|
|
1194
1204
|
(ofType) => isPrimitiveTypeName(ofType.type) || isPrimitiveTypeName(visitorContext.getType(ofType.type)?.jsonType)
|
|
1195
1205
|
), isMixedArray = primitiveTypes.length > 0 && objectTypes.length > 0;
|
|
@@ -1199,9 +1209,9 @@ var array = (typeDef, visitorContext) => {
|
|
|
1199
1209
|
error(
|
|
1200
1210
|
`The array type's 'of' property can't have both object types and primitive types (found primitive type ${pluralize(
|
|
1201
1211
|
primitiveTypeNames
|
|
1202
|
-
)} ${
|
|
1212
|
+
)} ${humanizeList(primitiveTypeNames.map(quote$2))} and object type${pluralize(
|
|
1203
1213
|
objectTypeNames
|
|
1204
|
-
)} ${
|
|
1214
|
+
)} ${humanizeList(objectTypeNames.map(quote$2))})`,
|
|
1205
1215
|
HELP_IDS.ARRAY_OF_INVALID
|
|
1206
1216
|
)
|
|
1207
1217
|
);
|
|
@@ -1210,7 +1220,7 @@ var array = (typeDef, visitorContext) => {
|
|
|
1210
1220
|
return !isMixedArray && Array.isArray(list) && (primitiveTypes.length > 0 ? list.forEach((option) => {
|
|
1211
1221
|
const value = option?.value ?? option;
|
|
1212
1222
|
if (!primitiveTypes.some((primitiveType) => typeof value === visitorContext.getType(primitiveType.type).jsonType)) {
|
|
1213
|
-
const formattedTypeList =
|
|
1223
|
+
const formattedTypeList = humanizeList(
|
|
1214
1224
|
primitiveTypes.map((t) => t.name || t.type),
|
|
1215
1225
|
{ conjunction: "or" }
|
|
1216
1226
|
);
|
|
@@ -1231,7 +1241,7 @@ var array = (typeDef, visitorContext) => {
|
|
|
1231
1241
|
error(
|
|
1232
1242
|
`An invalid entry found in options.list: ${format(
|
|
1233
1243
|
option
|
|
1234
|
-
)}. Must be an object with "_type" set to ${
|
|
1244
|
+
)}. Must be an object with "_type" set to ${humanizeList(
|
|
1235
1245
|
objectTypes.map((t) => t.name || t.type).map((t) => t === "object" ? "undefined" : quote$2(t)),
|
|
1236
1246
|
{ conjunction: "or" }
|
|
1237
1247
|
)}`,
|
|
@@ -1283,12 +1293,12 @@ function validateBlockType(typeDef, visitorContext) {
|
|
|
1283
1293
|
);
|
|
1284
1294
|
return disallowedKeys.length > 0 && problems.push(
|
|
1285
1295
|
error(
|
|
1286
|
-
`Found unknown properties for block declaration: ${
|
|
1296
|
+
`Found unknown properties for block declaration: ${humanizeList(
|
|
1287
1297
|
disallowedKeys.map(quote$1)
|
|
1288
1298
|
)}`
|
|
1289
1299
|
)
|
|
1290
1300
|
), marks && (marks = validateMarks(typeDef.marks, visitorContext, problems)), styles && (styles = validateStyles(styles, visitorContext, problems)), lists && (lists = validateLists(lists, visitorContext, problems)), members && (members = validateMembers(members, visitorContext, problems)), {
|
|
1291
|
-
...
|
|
1301
|
+
...omit(typeDef, disallowedKeys),
|
|
1292
1302
|
marks,
|
|
1293
1303
|
styles,
|
|
1294
1304
|
name: typeDef.name || typeDef.type,
|
|
@@ -1298,14 +1308,14 @@ function validateBlockType(typeDef, visitorContext) {
|
|
|
1298
1308
|
}
|
|
1299
1309
|
function validateMarks(marks, visitorContext, problems) {
|
|
1300
1310
|
let decorators = marks.decorators, annotations = marks.annotations;
|
|
1301
|
-
if (!
|
|
1311
|
+
if (!isPlainObject(marks))
|
|
1302
1312
|
return problems.push(error(`"marks" declaration should be an object, got ${getTypeOf(marks)}`)), problems;
|
|
1303
1313
|
const disallowedMarkKeys = Object.keys(marks).filter(
|
|
1304
1314
|
(key) => !allowedMarkKeys.includes(key) && !key.startsWith("_")
|
|
1305
1315
|
);
|
|
1306
1316
|
return disallowedMarkKeys.length > 0 && problems.push(
|
|
1307
1317
|
error(
|
|
1308
|
-
`Found unknown properties for block declaration: ${
|
|
1318
|
+
`Found unknown properties for block declaration: ${humanizeList(
|
|
1309
1319
|
disallowedMarkKeys.map(quote$1)
|
|
1310
1320
|
)}`
|
|
1311
1321
|
)
|
|
@@ -1319,7 +1329,7 @@ function validateMarks(marks, visitorContext, problems) {
|
|
|
1319
1329
|
}
|
|
1320
1330
|
function validateLists(lists, visitorContext, problems) {
|
|
1321
1331
|
return Array.isArray(lists) ? (lists.forEach((list, index) => {
|
|
1322
|
-
if (!
|
|
1332
|
+
if (!isPlainObject(list)) {
|
|
1323
1333
|
problems.push(error(`List must be an object, got ${getTypeOf(list)}`));
|
|
1324
1334
|
return;
|
|
1325
1335
|
}
|
|
@@ -1328,7 +1338,7 @@ function validateLists(lists, visitorContext, problems) {
|
|
|
1328
1338
|
);
|
|
1329
1339
|
disallowedKeys.length > 0 && problems.push(
|
|
1330
1340
|
error(
|
|
1331
|
-
`Found unknown properties for list ${name}: ${
|
|
1341
|
+
`Found unknown properties for list ${name}: ${humanizeList(disallowedKeys.map(quote$1))}`
|
|
1332
1342
|
)
|
|
1333
1343
|
), list.value ? typeof list.value != "string" ? problems.push(
|
|
1334
1344
|
error(
|
|
@@ -1341,7 +1351,7 @@ function validateLists(lists, visitorContext, problems) {
|
|
|
1341
1351
|
}
|
|
1342
1352
|
function validateStyles(styles, visitorContext, problems) {
|
|
1343
1353
|
return Array.isArray(styles) ? (styles.forEach((style, index) => {
|
|
1344
|
-
if (!
|
|
1354
|
+
if (!isPlainObject(style)) {
|
|
1345
1355
|
problems.push(error(`Style must be an object, got ${getTypeOf(style)}`));
|
|
1346
1356
|
return;
|
|
1347
1357
|
}
|
|
@@ -1350,7 +1360,7 @@ function validateStyles(styles, visitorContext, problems) {
|
|
|
1350
1360
|
);
|
|
1351
1361
|
disallowedKeys.length > 0 && problems.push(
|
|
1352
1362
|
error(
|
|
1353
|
-
`Found unknown properties for style ${name}: ${
|
|
1363
|
+
`Found unknown properties for style ${name}: ${humanizeList(disallowedKeys.map(quote$1))}`
|
|
1354
1364
|
)
|
|
1355
1365
|
), style.value ? typeof style.value != "string" ? problems.push(
|
|
1356
1366
|
error(
|
|
@@ -1368,7 +1378,7 @@ function validateStyles(styles, visitorContext, problems) {
|
|
|
1368
1378
|
}
|
|
1369
1379
|
function validateDecorators(decorators, visitorContext, problems) {
|
|
1370
1380
|
return decorators.forEach((decorator, index) => {
|
|
1371
|
-
if (!
|
|
1381
|
+
if (!isPlainObject(decorator)) {
|
|
1372
1382
|
problems.push(error(`Annotation must be an object, got ${getTypeOf(decorator)}`));
|
|
1373
1383
|
return;
|
|
1374
1384
|
}
|
|
@@ -1377,7 +1387,7 @@ function validateDecorators(decorators, visitorContext, problems) {
|
|
|
1377
1387
|
);
|
|
1378
1388
|
disallowedKeys.length > 0 && problems.push(
|
|
1379
1389
|
error(
|
|
1380
|
-
`Found unknown properties for decorator ${name}: ${
|
|
1390
|
+
`Found unknown properties for decorator ${name}: ${humanizeList(
|
|
1381
1391
|
disallowedKeys.map(quote$1)
|
|
1382
1392
|
)}`
|
|
1383
1393
|
)
|
|
@@ -1397,7 +1407,7 @@ function validateDecorators(decorators, visitorContext, problems) {
|
|
|
1397
1407
|
}
|
|
1398
1408
|
function validateAnnotations(annotations, visitorContext, problems) {
|
|
1399
1409
|
return annotations.map((annotation) => {
|
|
1400
|
-
if (!
|
|
1410
|
+
if (!isPlainObject(annotation))
|
|
1401
1411
|
return {
|
|
1402
1412
|
...annotation,
|
|
1403
1413
|
_problems: [error(`Annotation must be an object, got ${getTypeOf(annotation)}`)]
|
|
@@ -1474,7 +1484,7 @@ function validateTypeName(typeName, visitorContext) {
|
|
|
1474
1484
|
)
|
|
1475
1485
|
];
|
|
1476
1486
|
if (!possibleTypeNames.includes(typeName)) {
|
|
1477
|
-
const suggestions = possibleTypeNames.map((possibleTypeName) => [
|
|
1487
|
+
const suggestions = possibleTypeNames.map((possibleTypeName) => [leven(typeName, possibleTypeName), possibleTypeName]).filter(([distance]) => distance < 3).map(([_, name]) => name), suggestion = suggestions.length > 0 ? ` Did you mean ${humanizeList(suggestions.map(quote), { conjunction: "or" })}?` : "";
|
|
1478
1488
|
return [error(`Unknown type: ${typeName}.${suggestion}`)];
|
|
1479
1489
|
}
|
|
1480
1490
|
return [];
|
|
@@ -1511,7 +1521,7 @@ function isValidDatasetName(name) {
|
|
|
1511
1521
|
return name.length >= 2 && name.toLowerCase() === name && VALID_DATASET.test(name) || `The provided dataset "${name}" doesn't look like a valid dataset. Dataset names must be more than 2 characters, can only contain lowercase characters, numbers, underscores and dashes and can not start with a dash or an underscore`;
|
|
1512
1522
|
}
|
|
1513
1523
|
var crossDatasetReference = (typeDef, visitorContext) => {
|
|
1514
|
-
const isValidTo = Array.isArray(typeDef.to) ||
|
|
1524
|
+
const isValidTo = Array.isArray(typeDef.to) || isPlainObject(typeDef.to), normalizedTo = normalizeToProp$2(typeDef), problems = flatten([
|
|
1515
1525
|
isValidTo ? getDupes(normalizedTo, (t) => `${t.name};${t.type}`).map(
|
|
1516
1526
|
(dupes) => error(
|
|
1517
1527
|
`Found ${dupes.length} members with same type, but not unique names "${dupes[0].type}" in reference. This makes it impossible to tell their values apart and you should consider naming them`,
|
|
@@ -1533,7 +1543,7 @@ var crossDatasetReference = (typeDef, visitorContext) => {
|
|
|
1533
1543
|
`The referenced type at index ${index} must be named. Specify the name of the type you want to create references to.`,
|
|
1534
1544
|
HELP_IDS.CROSS_DATASET_REFERENCE_INVALID
|
|
1535
1545
|
)
|
|
1536
|
-
),
|
|
1546
|
+
), isPlainObject(crossDatasetTypeDef.preview) || problems.push(
|
|
1537
1547
|
error(
|
|
1538
1548
|
`Missing required preview config for the referenced type "${crossDatasetTypeDef.type || "<unknown type>"}"`,
|
|
1539
1549
|
HELP_IDS.CROSS_DATASET_REFERENCE_INVALID
|
|
@@ -1568,14 +1578,14 @@ function getOptionErrors$2(typeDef) {
|
|
|
1568
1578
|
HELP_IDS.REFERENCE_INVALID_OPTIONS_LOCATION
|
|
1569
1579
|
)
|
|
1570
1580
|
)
|
|
1571
|
-
), options ?
|
|
1581
|
+
), options ? isPlainObject(options) ? typeof options.filter == "function" && typeof options.filterParams < "u" ? problems.concat(
|
|
1572
1582
|
error(
|
|
1573
1583
|
"`filterParams` cannot be used if `filter` is a function. Either statically define `filter` as a string, or return `params` from the `filter`-function.",
|
|
1574
1584
|
HELP_IDS.REFERENCE_INVALID_FILTER_PARAMS_COMBINATION
|
|
1575
1585
|
)
|
|
1576
1586
|
) : typeof options.filter == "function" || !options.filter && !options.filterParams ? problems : typeof options.filter != "string" ? problems.concat(
|
|
1577
1587
|
error(`If set, \`filter\` must be a string. Got ${typeof options.filter}`)
|
|
1578
|
-
) : typeof options.filterParams < "u" && !
|
|
1588
|
+
) : typeof options.filterParams < "u" && !isPlainObject(options.filterParams) ? problems.concat(error("If set, `filterParams` must be an object.")) : options.filterParams ? problems.concat(
|
|
1579
1589
|
Object.keys(options.filterParams).filter((key) => key.startsWith("__") || key.startsWith("$")).map((key) => error(`Filter parameter cannot be prefixed with "$" or "__". Got ${key}".`))
|
|
1580
1590
|
) : problems : problems.concat(
|
|
1581
1591
|
error(
|
|
@@ -1595,25 +1605,25 @@ function validateComponent(typeDef) {
|
|
|
1595
1605
|
const warnings = [];
|
|
1596
1606
|
return components.input && !isComponentLike(components.input) && warnings.push(
|
|
1597
1607
|
warning(
|
|
1598
|
-
`The \`components.input\` property is set but does not appear to be a valid React component (expected a function, but saw ${
|
|
1608
|
+
`The \`components.input\` property is set but does not appear to be a valid React component (expected a function, but saw ${inspect(
|
|
1599
1609
|
components.input
|
|
1600
1610
|
)}). If you have imported a custom input component, please verify that you have imported the correct named/default export.`
|
|
1601
1611
|
)
|
|
1602
1612
|
), components.field && !isComponentLike(components.field) && warnings.push(
|
|
1603
1613
|
warning(
|
|
1604
|
-
`The \`components.field\` property is set but does not appear to be a valid React component (expected a function, but saw ${
|
|
1614
|
+
`The \`components.field\` property is set but does not appear to be a valid React component (expected a function, but saw ${inspect(
|
|
1605
1615
|
components.field
|
|
1606
1616
|
)}). If you have imported a custom field component, please verify that you have imported the correct named/default export.`
|
|
1607
1617
|
)
|
|
1608
1618
|
), components.item && !isComponentLike(components.item) && warnings.push(
|
|
1609
1619
|
warning(
|
|
1610
|
-
`The \`components.item\` property is set but does not appear to be a valid React component (expected a function, but saw ${
|
|
1620
|
+
`The \`components.item\` property is set but does not appear to be a valid React component (expected a function, but saw ${inspect(
|
|
1611
1621
|
components.item
|
|
1612
1622
|
)}). If you have imported a custom item component, please verify that you have imported the correct named/default export.`
|
|
1613
1623
|
)
|
|
1614
1624
|
), components.preview && !isComponentLike(components.preview) && warnings.push(
|
|
1615
1625
|
warning(
|
|
1616
|
-
`The \`components.preview\` property is set but does not appear to be a valid React component (expected a function, but saw ${
|
|
1626
|
+
`The \`components.preview\` property is set but does not appear to be a valid React component (expected a function, but saw ${inspect(
|
|
1617
1627
|
components.preview
|
|
1618
1628
|
)}). If you have imported a custom preview component, please verify that you have imported the correct named/default export.`
|
|
1619
1629
|
)
|
|
@@ -1623,7 +1633,7 @@ const VALID_FIELD_RE = /^[A-Za-z]+[0-9A-Za-z_]*$/, CONVENTIONAL_FIELD_RE = /^[A-
|
|
|
1623
1633
|
function validateFieldName(name) {
|
|
1624
1634
|
return typeof name != "string" ? [
|
|
1625
1635
|
error(
|
|
1626
|
-
`Field names must be strings. Saw "${
|
|
1636
|
+
`Field names must be strings. Saw "${inspect(name)}"`,
|
|
1627
1637
|
HELP_IDS.OBJECT_FIELD_NAME_INVALID
|
|
1628
1638
|
)
|
|
1629
1639
|
] : name.startsWith("_") ? [
|
|
@@ -1646,10 +1656,10 @@ function validateFieldName(name) {
|
|
|
1646
1656
|
];
|
|
1647
1657
|
}
|
|
1648
1658
|
function validateField(field, _visitorContext) {
|
|
1649
|
-
if (!
|
|
1659
|
+
if (!isPlainObject(field))
|
|
1650
1660
|
return [
|
|
1651
1661
|
error(
|
|
1652
|
-
`Incorrect type for field definition - should be an object, saw ${
|
|
1662
|
+
`Incorrect type for field definition - should be an object, saw ${inspect(field)}`,
|
|
1653
1663
|
HELP_IDS.OBJECT_FIELD_DEFINITION_INVALID_TYPE
|
|
1654
1664
|
)
|
|
1655
1665
|
];
|
|
@@ -1695,11 +1705,11 @@ function validateFields(fields, options = { allowEmpty: !1 }) {
|
|
|
1695
1705
|
return problems;
|
|
1696
1706
|
}
|
|
1697
1707
|
function validatePreview(preview) {
|
|
1698
|
-
return
|
|
1708
|
+
return isPlainObject(preview) ? typeof preview.prepare < "u" && typeof preview.prepare != "function" ? [
|
|
1699
1709
|
error(
|
|
1700
1710
|
`The "preview.prepare" property must be a function, instead saw "${typeof preview.prepare}"`
|
|
1701
1711
|
)
|
|
1702
|
-
] : preview.select ?
|
|
1712
|
+
] : preview.select ? isPlainObject(preview.select) ? Object.keys(preview.select).reduce((errs, key) => typeof preview.select[key] == "string" ? errs : errs.concat(
|
|
1703
1713
|
error(
|
|
1704
1714
|
`The key "${key}" of "preview.select" must be a string, instead saw "${typeof preview.select[key]}"`
|
|
1705
1715
|
)
|
|
@@ -1732,7 +1742,7 @@ var object = (typeDef, visitorContext) => {
|
|
|
1732
1742
|
};
|
|
1733
1743
|
}, documentVisitor = (typeDefinition, visitorContext) => {
|
|
1734
1744
|
const typeDef = object(typeDefinition, visitorContext), { initialValue, initialValues } = typeDef;
|
|
1735
|
-
return typeof initialValue < "u" && !
|
|
1745
|
+
return typeof initialValue < "u" && !isPlainObject(initialValue) && typeof initialValue != "function" && typeDef._problems.push(
|
|
1736
1746
|
error('The "initialValue" property must be either a plain object or a function')
|
|
1737
1747
|
), typeof initialValues < "u" && typeDef._problems.push(error('Found property "initialValues" - did you mean "initialValue"?')), typeDef;
|
|
1738
1748
|
}, file = (typeDef, visitorContext) => {
|
|
@@ -1767,7 +1777,7 @@ function isValidResourceId(resourceType, resourceId) {
|
|
|
1767
1777
|
return resourceId ? resourceType === "dataset" ? resourceId.split(".").length !== 2 ? 'The resource ID for a dataset reference must be on the form "<projectId>.<datasetName>"' : !0 : resourceType === "media-library" ? !0 : `Cannot validate resource ID for resource type: ${resourceType}` : "The resource ID must be a non-empty string";
|
|
1768
1778
|
}
|
|
1769
1779
|
var globalDocumentReference = (typeDef, visitorContext) => {
|
|
1770
|
-
const isValidTo = Array.isArray(typeDef.to) ||
|
|
1780
|
+
const isValidTo = Array.isArray(typeDef.to) || isPlainObject(typeDef.to), normalizedTo = normalizeToProp$1(typeDef), problems = flatten([
|
|
1771
1781
|
isValidTo ? getDupes(normalizedTo, (t) => `${t.name};${t.type}`).map(
|
|
1772
1782
|
(dupes) => error(
|
|
1773
1783
|
`Found ${dupes.length} members with same type, but not unique names "${dupes[0].type}" in reference. This makes it impossible to tell their values apart and you should consider naming them`,
|
|
@@ -1789,7 +1799,7 @@ var globalDocumentReference = (typeDef, visitorContext) => {
|
|
|
1789
1799
|
`The referenced type at index ${index} must be named. Specify the name of the type you want to create references to.`,
|
|
1790
1800
|
HELP_IDS.GLOBAL_DOCUMENT_REFERENCE_INVALID
|
|
1791
1801
|
)
|
|
1792
|
-
),
|
|
1802
|
+
), isPlainObject(crossDatasetTypeDef.preview) || problems.push(
|
|
1793
1803
|
error(
|
|
1794
1804
|
`Missing required preview config for the referenced type "${crossDatasetTypeDef.type || "<unknown type>"}"`,
|
|
1795
1805
|
HELP_IDS.GLOBAL_DOCUMENT_REFERENCE_INVALID
|
|
@@ -1834,14 +1844,14 @@ function getOptionErrors$1(typeDef) {
|
|
|
1834
1844
|
HELP_IDS.REFERENCE_INVALID_OPTIONS_LOCATION
|
|
1835
1845
|
)
|
|
1836
1846
|
)
|
|
1837
|
-
), options ?
|
|
1847
|
+
), options ? isPlainObject(options) ? typeof options.filter == "function" && typeof options.filterParams < "u" ? problems.concat(
|
|
1838
1848
|
error(
|
|
1839
1849
|
"`filterParams` cannot be used if `filter` is a function. Either statically define `filter` as a string, or return `params` from the `filter`-function.",
|
|
1840
1850
|
HELP_IDS.REFERENCE_INVALID_FILTER_PARAMS_COMBINATION
|
|
1841
1851
|
)
|
|
1842
1852
|
) : typeof options.filter == "function" || !options.filter && !options.filterParams ? problems : typeof options.filter != "string" ? problems.concat(
|
|
1843
1853
|
error(`If set, \`filter\` must be a string. Got ${typeof options.filter}`)
|
|
1844
|
-
) : typeof options.filterParams < "u" && !
|
|
1854
|
+
) : typeof options.filterParams < "u" && !isPlainObject(options.filterParams) ? problems.concat(error("If set, `filterParams` must be an object.")) : options.filterParams ? problems.concat(
|
|
1845
1855
|
Object.keys(options.filterParams).filter((key) => key.startsWith("__") || key.startsWith("$")).map((key) => error(`Filter parameter cannot be prefixed with "$" or "__". Got ${key}".`))
|
|
1846
1856
|
) : problems : problems.concat(
|
|
1847
1857
|
error(
|
|
@@ -1891,7 +1901,7 @@ function normalizeToProp(typeDef) {
|
|
|
1891
1901
|
return Array.isArray(typeDef.to) ? typeDef.to : typeDef.to ? [typeDef.to] : typeDef.to;
|
|
1892
1902
|
}
|
|
1893
1903
|
var reference = (typeDef, visitorContext) => {
|
|
1894
|
-
const isValidTo = Array.isArray(typeDef.to) ||
|
|
1904
|
+
const isValidTo = Array.isArray(typeDef.to) || isPlainObject(typeDef.to), normalizedTo = normalizeToProp(typeDef), problems = flatten([
|
|
1895
1905
|
isValidTo ? getDupes(normalizedTo, (t) => `${t.name};${t.type}`).map(
|
|
1896
1906
|
(dupes) => error(
|
|
1897
1907
|
`Found ${dupes.length} members with same type, but not unique names "${dupes[0].type}" in reference. This makes it impossible to tell their values apart and you should consider naming them`,
|
|
@@ -1922,14 +1932,14 @@ function getOptionErrors(typeDef) {
|
|
|
1922
1932
|
HELP_IDS.REFERENCE_INVALID_OPTIONS_LOCATION
|
|
1923
1933
|
)
|
|
1924
1934
|
)
|
|
1925
|
-
), options ?
|
|
1935
|
+
), options ? isPlainObject(options) ? typeof options.filter == "function" && typeof options.filterParams < "u" ? problems.concat(
|
|
1926
1936
|
error(
|
|
1927
1937
|
"`filterParams` cannot be used if `filter` is a function. Either statically define `filter` as a string, or return `params` from the `filter`-function.",
|
|
1928
1938
|
HELP_IDS.REFERENCE_INVALID_FILTER_PARAMS_COMBINATION
|
|
1929
1939
|
)
|
|
1930
1940
|
) : typeof options.filter == "function" || !options.filter && !options.filterParams ? problems : typeof options.filter != "string" ? problems.concat(
|
|
1931
1941
|
error(`If set, \`filter\` must be a string. Got ${typeof options.filter}`)
|
|
1932
|
-
) : typeof options.filterParams < "u" && !
|
|
1942
|
+
) : typeof options.filterParams < "u" && !isPlainObject(options.filterParams) ? problems.concat(error("If set, `filterParams` must be an object.")) : options.filterParams ? problems.concat(
|
|
1933
1943
|
Object.keys(options.filterParams).filter((key) => key.startsWith("__") || key.startsWith("$")).map((key) => error(`Filter parameter cannot be prefixed with "$" or "__". Got ${key}".`))
|
|
1934
1944
|
) : problems : problems.concat(
|
|
1935
1945
|
error(
|
|
@@ -2028,7 +2038,7 @@ class ValidationError extends Error {
|
|
|
2028
2038
|
super("ValidationError"), this.problems = problems, this.name = "ValidationError";
|
|
2029
2039
|
}
|
|
2030
2040
|
}
|
|
2031
|
-
const builtinSchema =
|
|
2041
|
+
const builtinSchema = Schema.compile({
|
|
2032
2042
|
name: "studio",
|
|
2033
2043
|
types: builtinTypes
|
|
2034
2044
|
});
|
|
@@ -2038,19 +2048,19 @@ function createSchemaFromManifestTypes(schemaDef) {
|
|
|
2038
2048
|
);
|
|
2039
2049
|
if (problems.length > 0)
|
|
2040
2050
|
throw new ValidationError(problems);
|
|
2041
|
-
return
|
|
2051
|
+
return Schema.compile({
|
|
2042
2052
|
name: schemaDef.name,
|
|
2043
2053
|
types: schemaDef.types.map(coerceType).filter(Boolean),
|
|
2044
2054
|
parent: builtinSchema
|
|
2045
2055
|
});
|
|
2046
2056
|
}
|
|
2047
2057
|
function coerceType(obj) {
|
|
2048
|
-
if (!
|
|
2049
|
-
const typ =
|
|
2058
|
+
if (!isObject(obj)) return;
|
|
2059
|
+
const typ = cloneDeep(obj);
|
|
2050
2060
|
return traverse(typ), typ;
|
|
2051
2061
|
}
|
|
2052
2062
|
function traverse(obj) {
|
|
2053
|
-
if (
|
|
2063
|
+
if (isObject(obj)) {
|
|
2054
2064
|
if (Array.isArray(obj)) {
|
|
2055
2065
|
obj.forEach(traverse);
|
|
2056
2066
|
return;
|
|
@@ -2061,10 +2071,10 @@ function traverse(obj) {
|
|
|
2061
2071
|
}
|
|
2062
2072
|
}
|
|
2063
2073
|
function coerceValidation(val) {
|
|
2064
|
-
if (!
|
|
2074
|
+
if (!isObject(val) || !("validation" in val)) return;
|
|
2065
2075
|
const manifestValidation = Array.isArray(val.validation) ? val.validation : [val.validation];
|
|
2066
2076
|
val.validation = manifestValidation.map((group) => {
|
|
2067
|
-
if (
|
|
2077
|
+
if (isObject(group))
|
|
2068
2078
|
return (baseRule) => {
|
|
2069
2079
|
let rule = baseRule;
|
|
2070
2080
|
const level = "level" in group ? group.level : void 0, rules = "rules" in group ? group.rules : void 0, message = "message" in group ? group.message : void 0;
|
|
@@ -2078,7 +2088,7 @@ function coerceValidation(val) {
|
|
|
2078
2088
|
}).filter(Boolean);
|
|
2079
2089
|
}
|
|
2080
2090
|
function coerceConstraintRule(val) {
|
|
2081
|
-
if (
|
|
2091
|
+
if (isObject(val))
|
|
2082
2092
|
return Array.isArray(val) ? val.map(coerceConstraintRule).filter(Boolean) : (baseRule) => {
|
|
2083
2093
|
let rule = baseRule;
|
|
2084
2094
|
const rules = "_rules" in val ? val._rules : void 0, level = "_level" in val ? val._level : void 0, message = "_message" in val ? val._message : void 0;
|
|
@@ -2152,7 +2162,7 @@ function applyRuleSpec(rule, ruleSpec) {
|
|
|
2152
2162
|
return rule.valid(constraint);
|
|
2153
2163
|
break;
|
|
2154
2164
|
case "regex":
|
|
2155
|
-
if (
|
|
2165
|
+
if (isObject(constraint) && "pattern" in constraint && (typeof constraint.pattern == "string" || constraint.pattern instanceof RegExp)) {
|
|
2156
2166
|
const options = {};
|
|
2157
2167
|
"name" in constraint && typeof constraint.name == "string" && (options.name = constraint.name), "invert" in constraint && (options.invert = constraint.invert);
|
|
2158
2168
|
const pattern = typeof constraint.pattern == "string" ? stringToRegExp(constraint.pattern) : constraint.pattern;
|
|
@@ -2160,7 +2170,7 @@ function applyRuleSpec(rule, ruleSpec) {
|
|
|
2160
2170
|
}
|
|
2161
2171
|
break;
|
|
2162
2172
|
case "uri":
|
|
2163
|
-
if (
|
|
2173
|
+
if (isObject(constraint) && "options" in constraint)
|
|
2164
2174
|
return rule.uri(constraint.options);
|
|
2165
2175
|
break;
|
|
2166
2176
|
case "assetRequired":
|
|
@@ -2426,9 +2436,9 @@ function createNumberTypeNodeDefintion(numberSchemaType) {
|
|
|
2426
2436
|
}
|
|
2427
2437
|
function createReferenceTypeNodeDefintion(reference2) {
|
|
2428
2438
|
const references = gatherReferenceNames(reference2);
|
|
2429
|
-
return references.length === 1 ?
|
|
2439
|
+
return references.length === 1 ? createReferenceTypeNode(references[0]) : {
|
|
2430
2440
|
type: "union",
|
|
2431
|
-
of: references.map((name) =>
|
|
2441
|
+
of: references.map((name) => createReferenceTypeNode(name))
|
|
2432
2442
|
};
|
|
2433
2443
|
}
|
|
2434
2444
|
function gatherReferenceNames(type) {
|
|
@@ -2694,18 +2704,20 @@ function validateMediaLibraryAssetAspect(maybeAspect) {
|
|
|
2694
2704
|
}), errors = groupProblems(validated.getTypes()).map((group) => group.problems.filter(({ severity }) => severity === "error")).filter((problems) => problems.length);
|
|
2695
2705
|
return [errors.length === 0, errors];
|
|
2696
2706
|
}
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2707
|
+
export {
|
|
2708
|
+
ALL_FIELDS_GROUP_NAME,
|
|
2709
|
+
DEFAULT_MAX_FIELD_DEPTH,
|
|
2710
|
+
DescriptorConverter,
|
|
2711
|
+
ValidationError,
|
|
2712
|
+
builtinTypes,
|
|
2713
|
+
createSchemaFromManifestTypes,
|
|
2714
|
+
extractSchema,
|
|
2715
|
+
groupProblems,
|
|
2716
|
+
isActionEnabled,
|
|
2717
|
+
processSchemaSynchronization,
|
|
2718
|
+
resolveSearchConfig,
|
|
2719
|
+
resolveSearchConfigForBaseFieldPaths,
|
|
2720
|
+
validateMediaLibraryAssetAspect,
|
|
2721
|
+
validateSchema
|
|
2722
|
+
};
|
|
2711
2723
|
//# sourceMappingURL=_internal.js.map
|