@imbricate/core 3.30.0 → 3.30.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/database/schema.js +33 -3
- package/package.json +1 -1
package/database/schema.js
CHANGED
|
@@ -25,18 +25,48 @@ const validateImbricateSchemaProperty = (property) => {
|
|
|
25
25
|
if (!Object.values(type_1.IMBRICATE_PROPERTY_TYPE).includes(property.propertyType)) {
|
|
26
26
|
return "Property type must be a valid type";
|
|
27
27
|
}
|
|
28
|
+
// IMBRICATE_PROPERTY_TYPE SWITCH
|
|
28
29
|
switch (property.propertyType) {
|
|
30
|
+
case type_1.IMBRICATE_PROPERTY_TYPE.BINARY: {
|
|
31
|
+
if (typeof property.propertyOptions !== "object") {
|
|
32
|
+
return "Property options must be an object";
|
|
33
|
+
}
|
|
34
|
+
const propertyOptions = property.propertyOptions;
|
|
35
|
+
if (typeof propertyOptions.allowMultiple !== "boolean") {
|
|
36
|
+
return "Property options allowMultiple must be a boolean";
|
|
37
|
+
}
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
case type_1.IMBRICATE_PROPERTY_TYPE.LABEL: {
|
|
41
|
+
if (typeof property.propertyOptions !== "object") {
|
|
42
|
+
return "Property options must be an object";
|
|
43
|
+
}
|
|
44
|
+
const propertyOptions = property.propertyOptions;
|
|
45
|
+
if (typeof propertyOptions.allowMultiple !== "boolean") {
|
|
46
|
+
return "Property options allowMultiple must be a boolean";
|
|
47
|
+
}
|
|
48
|
+
if (!Array.isArray(propertyOptions.labelOptions)) {
|
|
49
|
+
return "Property options labelOptions must be an array";
|
|
50
|
+
}
|
|
51
|
+
for (const labelOption of propertyOptions.labelOptions) {
|
|
52
|
+
if (typeof labelOption.labelIdentifier !== "string") {
|
|
53
|
+
return "Property options labelOptions labelIdentifier must be a string";
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
29
58
|
case type_1.IMBRICATE_PROPERTY_TYPE.REFERENCE: {
|
|
30
59
|
if (typeof property.propertyOptions !== "object") {
|
|
31
60
|
return "Property options must be an object";
|
|
32
61
|
}
|
|
33
|
-
|
|
62
|
+
const propertyOptions = property.propertyOptions;
|
|
63
|
+
if (typeof propertyOptions.allowMultiple !== "boolean") {
|
|
34
64
|
return "Property options allowMultiple must be a boolean";
|
|
35
65
|
}
|
|
36
|
-
if (!Array.isArray(
|
|
66
|
+
if (!Array.isArray(propertyOptions.databases)) {
|
|
37
67
|
return "Property options databases must be an array";
|
|
38
68
|
}
|
|
39
|
-
for (const database of
|
|
69
|
+
for (const database of propertyOptions.databases) {
|
|
40
70
|
if (typeof database.originUniqueIdentifier !== "string") {
|
|
41
71
|
return "Database originUniqueIdentifier must be a string";
|
|
42
72
|
}
|