@dnax/core 0.1.16 → 0.1.18
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/schema.ts +12 -7
- package/package.json +1 -1
- package/types/index.ts +1 -0
package/lib/schema.ts
CHANGED
|
@@ -14,14 +14,18 @@ function buildSchema(col: Collection) {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
if (f?.type == "uuid" && f?.random?.toNumber) {
|
|
17
|
-
|
|
17
|
+
propertySchema[f.name] = v.string();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (f?.type == "random") {
|
|
21
|
+
propertySchema[f.name] = v.string().optional();
|
|
18
22
|
}
|
|
19
23
|
|
|
20
24
|
if (f?.type == "random" && f?.random?.toNumber) {
|
|
21
|
-
|
|
25
|
+
propertySchema[f.name] = v.number().optional();
|
|
22
26
|
}
|
|
23
27
|
if (f?.type == "random" && !f?.random?.toNumber) {
|
|
24
|
-
|
|
28
|
+
propertySchema[f.name] = v.string().optional();
|
|
25
29
|
}
|
|
26
30
|
|
|
27
31
|
if (f?.type.match(/(string|richText|textarea)/)) {
|
|
@@ -85,9 +89,7 @@ function buildSchema(col: Collection) {
|
|
|
85
89
|
});
|
|
86
90
|
}
|
|
87
91
|
|
|
88
|
-
|
|
89
|
-
// propertySchema[f.name] = v.any();
|
|
90
|
-
}
|
|
92
|
+
|
|
91
93
|
|
|
92
94
|
if (f?.type == "password") {
|
|
93
95
|
propertySchema[f.name] = v.string();
|
|
@@ -122,7 +124,10 @@ function buildSchema(col: Collection) {
|
|
|
122
124
|
if (!f?.validate?.schema) {
|
|
123
125
|
if (f?.nullable) {
|
|
124
126
|
propertySchema[f.name] = propertySchema[f.name].optional();
|
|
125
|
-
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if(f?.required){
|
|
130
|
+
if(!f?.type?.match(/(random)/))
|
|
126
131
|
propertySchema[f.name] = propertySchema[f.name].required();
|
|
127
132
|
}
|
|
128
133
|
}
|
package/package.json
CHANGED