@dnax/core 0.1.15 → 0.1.17

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.
Files changed (2) hide show
  1. package/lib/schema.ts +8 -5
  2. package/package.json +1 -1
package/lib/schema.ts CHANGED
@@ -17,11 +17,15 @@ function buildSchema(col: Collection) {
17
17
  propertySchema[f.name] = v.string();
18
18
  }
19
19
 
20
+ if (f?.type == "random") {
21
+ propertySchema[f.name] = v.string().optional();
22
+ }
23
+
20
24
  if (f?.type == "random" && f?.random?.toNumber) {
21
- propertySchema[f.name] = v.number();
25
+ propertySchema[f.name] = v.number().optional();
22
26
  }
23
27
  if (f?.type == "random" && !f?.random?.toNumber) {
24
- propertySchema[f.name] = v.string();
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
- if (f?.type == "random") {
89
- propertySchema[f.name] = v.any();
90
- }
92
+
91
93
 
92
94
  if (f?.type == "password") {
93
95
  propertySchema[f.name] = v.string();
@@ -123,6 +125,7 @@ function buildSchema(col: Collection) {
123
125
  if (f?.nullable) {
124
126
  propertySchema[f.name] = propertySchema[f.name].optional();
125
127
  } else {
128
+ if(!f?.type?.match(/(random)/))
126
129
  propertySchema[f.name] = propertySchema[f.name].required();
127
130
  }
128
131
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dnax/core",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "devDependencies": {