@bedrockio/model 0.2.0 → 0.2.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/dist/cjs/schema.js +0 -3
- package/dist/cjs/validation.js +2 -1
- package/package.json +3 -3
- package/src/schema.js +0 -4
- package/src/validation.js +2 -1
- package/types/include.d.ts +3 -0
- package/types/include.d.ts.map +1 -1
- package/types/search.d.ts +3 -0
- package/types/search.d.ts.map +1 -1
- package/types/validation.d.ts +3 -0
- package/types/validation.d.ts.map +1 -1
package/dist/cjs/schema.js
CHANGED
|
@@ -142,9 +142,6 @@ function attributesToMongoose(attributes) {
|
|
|
142
142
|
return definition;
|
|
143
143
|
}
|
|
144
144
|
function assertSchemaType(type, path) {
|
|
145
|
-
if (type === 'Mixed') {
|
|
146
|
-
throw new Error('Type "Mixed" is not allowed. Use "Object" instead.');
|
|
147
|
-
}
|
|
148
145
|
if (typeof type === 'string') {
|
|
149
146
|
if (!isMongooseType(type)) {
|
|
150
147
|
const p = path.join('.');
|
package/dist/cjs/validation.js
CHANGED
|
@@ -315,11 +315,12 @@ function getSchemaForType(type, options) {
|
|
|
315
315
|
return _yada.default.boolean();
|
|
316
316
|
case 'Date':
|
|
317
317
|
return _yada.default.date().iso().tag(DATE_TAGS);
|
|
318
|
-
case 'Mixed':
|
|
319
318
|
case 'Object':
|
|
320
319
|
return _yada.default.object();
|
|
321
320
|
case 'Array':
|
|
322
321
|
return _yada.default.array();
|
|
322
|
+
case 'Mixed':
|
|
323
|
+
return _yada.default.any();
|
|
323
324
|
case 'ObjectId':
|
|
324
325
|
if (options.allowExpandedRefs) {
|
|
325
326
|
return REFERENCE_SCHEMA;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bedrockio/model",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Bedrock utilities for model creation.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"lodash": "^4.17.21"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@bedrockio/yada": "^1.0.
|
|
32
|
+
"@bedrockio/yada": "^1.0.34",
|
|
33
33
|
"mongoose": "^6.9.0 || ^7.6.4"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@babel/core": "^7.20.12",
|
|
38
38
|
"@babel/preset-env": "^7.20.2",
|
|
39
39
|
"@bedrockio/prettier-config": "^1.0.2",
|
|
40
|
-
"@bedrockio/yada": "^1.0.
|
|
40
|
+
"@bedrockio/yada": "^1.0.34",
|
|
41
41
|
"@shelf/jest-mongodb": "^4.1.7",
|
|
42
42
|
"babel-plugin-import-replacement": "^1.0.1",
|
|
43
43
|
"eslint": "^8.33.0",
|
package/src/schema.js
CHANGED
|
@@ -156,10 +156,6 @@ function attributesToMongoose(attributes) {
|
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
function assertSchemaType(type, path) {
|
|
159
|
-
if (type === 'Mixed') {
|
|
160
|
-
throw new Error('Type "Mixed" is not allowed. Use "Object" instead.');
|
|
161
|
-
}
|
|
162
|
-
|
|
163
159
|
if (typeof type === 'string') {
|
|
164
160
|
if (!isMongooseType(type)) {
|
|
165
161
|
const p = path.join('.');
|
package/src/validation.js
CHANGED
|
@@ -333,11 +333,12 @@ function getSchemaForType(type, options) {
|
|
|
333
333
|
return yd.boolean();
|
|
334
334
|
case 'Date':
|
|
335
335
|
return yd.date().iso().tag(DATE_TAGS);
|
|
336
|
-
case 'Mixed':
|
|
337
336
|
case 'Object':
|
|
338
337
|
return yd.object();
|
|
339
338
|
case 'Array':
|
|
340
339
|
return yd.array();
|
|
340
|
+
case 'Mixed':
|
|
341
|
+
return yd.any();
|
|
341
342
|
case 'ObjectId':
|
|
342
343
|
if (options.allowExpandedRefs) {
|
|
343
344
|
return REFERENCE_SCHEMA;
|
package/types/include.d.ts
CHANGED
package/types/include.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"include.d.ts","sourceRoot":"","sources":["../src/include.js"],"names":[],"mappings":"AA2BA,gDAuEC;AAMD,uDA4BC;AAGD,2DAIC;AAvHD
|
|
1
|
+
{"version":3,"file":"include.d.ts","sourceRoot":"","sources":["../src/include.js"],"names":[],"mappings":"AA2BA,gDAuEC;AAMD,uDA4BC;AAGD,2DAIC;AAvHD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKG"}
|
package/types/search.d.ts
CHANGED
package/types/search.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../src/search.js"],"names":[],"mappings":"AAeA,gEAmDC;AAED
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../src/search.js"],"names":[],"mappings":"AAeA,gEAmDC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyBC"}
|
package/types/validation.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.js"],"names":[],"mappings":"AAiFA,kDAEC;AAED,oEAkFC;AAsBD,wEAkBC;
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.js"],"names":[],"mappings":"AAiFA,kDAEC;AAED,oEAkFC;AAsBD,wEAkBC;AAwRD;;;EAEC;AAED;;;EAOC;AAheD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQK"}
|