@bedrockio/model 0.1.10 → 0.1.12
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/validation.js +3 -0
- package/package.json +2 -2
- package/src/validation.js +3 -0
- package/types/include.d.ts +1 -0
- package/types/include.d.ts.map +1 -1
- package/types/search.d.ts +1 -0
- package/types/search.d.ts.map +1 -1
- package/types/validation.d.ts +1 -0
- package/types/validation.d.ts.map +1 -1
package/dist/cjs/validation.js
CHANGED
|
@@ -256,6 +256,9 @@ function getSchemaForTypedef(typedef, options = {}) {
|
|
|
256
256
|
if (isRequired(typedef, options)) {
|
|
257
257
|
schema = schema.required();
|
|
258
258
|
}
|
|
259
|
+
if (typedef.default) {
|
|
260
|
+
schema = schema.default(typedef.default);
|
|
261
|
+
}
|
|
259
262
|
if (typedef.validate?.schema) {
|
|
260
263
|
schema = schema.append(typedef.validate.schema);
|
|
261
264
|
} else if (typeof typedef.validate === 'function') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bedrockio/model",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"description": "Bedrock utilities for model creation.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -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.26",
|
|
41
41
|
"@shelf/jest-mongodb": "^4.1.6",
|
|
42
42
|
"babel-plugin-import-replacement": "^1.0.1",
|
|
43
43
|
"eslint": "^8.33.0",
|
package/src/validation.js
CHANGED
|
@@ -268,6 +268,9 @@ function getSchemaForTypedef(typedef, options = {}) {
|
|
|
268
268
|
if (isRequired(typedef, options)) {
|
|
269
269
|
schema = schema.required();
|
|
270
270
|
}
|
|
271
|
+
if (typedef.default) {
|
|
272
|
+
schema = schema.default(typedef.default);
|
|
273
|
+
}
|
|
271
274
|
if (typedef.validate?.schema) {
|
|
272
275
|
schema = schema.append(typedef.validate.schema);
|
|
273
276
|
} else if (typeof typedef.validate === 'function') {
|
package/types/include.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export const INCLUDE_FIELD_SCHEMA: {
|
|
|
24
24
|
validate(value: any, options?: {}): Promise<any>;
|
|
25
25
|
clone(meta: any): any;
|
|
26
26
|
toOpenApi(extra: any): any;
|
|
27
|
+
inspect(): string;
|
|
27
28
|
expandExtra(extra?: {}): {};
|
|
28
29
|
assertEnum(set: any, allow: any): any;
|
|
29
30
|
assert(type: any, fn: any): any;
|
package/types/include.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"include.d.ts","sourceRoot":"","sources":["../src/include.js"],"names":[],"mappings":"AA2BA,gDAoCC;AAMD,uDA4BC;AAGD,2DAIC;AApFD
|
|
1
|
+
{"version":3,"file":"include.d.ts","sourceRoot":"","sources":["../src/include.js"],"names":[],"mappings":"AA2BA,gDAoCC;AAMD,uDA4BC;AAGD,2DAIC;AApFD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKG"}
|
package/types/search.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export function searchValidation(options?: {}): {
|
|
|
22
22
|
validate(value: any, options?: {}): Promise<any>;
|
|
23
23
|
clone(meta: any): any;
|
|
24
24
|
toOpenApi(extra: any): any;
|
|
25
|
+
inspect(): string;
|
|
25
26
|
expandExtra(extra?: {}): {};
|
|
26
27
|
assertEnum(set: any, allow: any): any;
|
|
27
28
|
assert(type: any, fn: any): any;
|
package/types/search.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../src/search.js"],"names":[],"mappings":"AAYA,gEAyDC;AAED
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../src/search.js"],"names":[],"mappings":"AAYA,gEAyDC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyBC"}
|
package/types/validation.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.js"],"names":[],"mappings":"AAyEA,kDAEC;AAED,oEA8EC;AAsBD,wEAkBC;
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.js"],"names":[],"mappings":"AAyEA,kDAEC;AAED,oEA8EC;AAsBD,wEAkBC;AA6QD;;;EAEC;AAED;;;EAOC;AAzcD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIG"}
|