@bedrockio/model 0.1.27 → 0.1.29
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 +4 -0
- package/package.json +3 -3
- package/src/validation.js +4 -0
- package/types/include.d.ts +6 -1
- package/types/include.d.ts.map +1 -1
- package/types/search.d.ts +6 -1
- package/types/search.d.ts.map +1 -1
- package/types/validation.d.ts +7 -2
- package/types/validation.d.ts.map +1 -1
package/dist/cjs/validation.js
CHANGED
|
@@ -268,6 +268,10 @@ function getSchemaForTypedef(typedef, options = {}) {
|
|
|
268
268
|
schema = schema.required();
|
|
269
269
|
}
|
|
270
270
|
if (typedef.default) {
|
|
271
|
+
// Note that adding a default in the validation is
|
|
272
|
+
// technically unnecessary as this will be handled
|
|
273
|
+
// at the model level, however passing this on will
|
|
274
|
+
// enrich OpenAPI documentation.
|
|
271
275
|
schema = schema.default(typedef.default);
|
|
272
276
|
}
|
|
273
277
|
if (typedef.validate?.schema) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bedrockio/model",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.29",
|
|
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.32",
|
|
33
33
|
"mongoose": ">=6.9.0"
|
|
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.32",
|
|
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
|
@@ -280,6 +280,10 @@ function getSchemaForTypedef(typedef, options = {}) {
|
|
|
280
280
|
schema = schema.required();
|
|
281
281
|
}
|
|
282
282
|
if (typedef.default) {
|
|
283
|
+
// Note that adding a default in the validation is
|
|
284
|
+
// technically unnecessary as this will be handled
|
|
285
|
+
// at the model level, however passing this on will
|
|
286
|
+
// enrich OpenAPI documentation.
|
|
283
287
|
schema = schema.default(typedef.default);
|
|
284
288
|
}
|
|
285
289
|
if (typedef.validate?.schema) {
|
package/types/include.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export const INCLUDE_FIELD_SCHEMA: {
|
|
|
12
12
|
assertions: any[];
|
|
13
13
|
meta: {};
|
|
14
14
|
required(): any;
|
|
15
|
-
default(
|
|
15
|
+
default(arg: any): any;
|
|
16
16
|
custom(...args: import("@bedrockio/yada/types/Schema").CustomSignature): any;
|
|
17
17
|
strip(strip: any): any;
|
|
18
18
|
allow(...set: any[]): any;
|
|
@@ -24,6 +24,11 @@ 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
|
+
getDefault(): {
|
|
28
|
+
default?: undefined;
|
|
29
|
+
} | {
|
|
30
|
+
default: any;
|
|
31
|
+
};
|
|
27
32
|
inspect(): string;
|
|
28
33
|
expandExtra(extra?: {}): {};
|
|
29
34
|
assertEnum(set: any, allow: 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,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
|
@@ -10,7 +10,7 @@ export function searchValidation(options?: {}): {
|
|
|
10
10
|
assertions: any[];
|
|
11
11
|
meta: {};
|
|
12
12
|
required(): any;
|
|
13
|
-
default(
|
|
13
|
+
default(arg: any): any;
|
|
14
14
|
custom(...args: import("@bedrockio/yada/types/Schema").CustomSignature): any;
|
|
15
15
|
strip(strip: any): any;
|
|
16
16
|
allow(...set: any[]): any;
|
|
@@ -22,6 +22,11 @@ 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
|
+
getDefault(): {
|
|
26
|
+
default?: undefined;
|
|
27
|
+
} | {
|
|
28
|
+
default: any;
|
|
29
|
+
};
|
|
25
30
|
inspect(): string;
|
|
26
31
|
expandExtra(extra?: {}): {};
|
|
27
32
|
assertEnum(set: any, allow: 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":"AAcA,gEAgEC;AAED
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../src/search.js"],"names":[],"mappings":"AAcA,gEAgEC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyBC"}
|
package/types/validation.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export function getTupleValidator(types: any): {
|
|
|
10
10
|
schema: any;
|
|
11
11
|
};
|
|
12
12
|
export const OBJECT_ID_SCHEMA: {
|
|
13
|
+
required(): any;
|
|
13
14
|
length(length: number): any;
|
|
14
15
|
min(length: number): any;
|
|
15
16
|
max(length: number): any;
|
|
@@ -69,8 +70,7 @@ export const OBJECT_ID_SCHEMA: {
|
|
|
69
70
|
toString(): any;
|
|
70
71
|
assertions: any[];
|
|
71
72
|
meta: {};
|
|
72
|
-
|
|
73
|
-
default(value: any): any;
|
|
73
|
+
default(arg: any): any;
|
|
74
74
|
custom(...args: import("@bedrockio/yada/types/Schema").CustomSignature): any;
|
|
75
75
|
strip(strip: any): any;
|
|
76
76
|
allow(...set: any[]): any;
|
|
@@ -83,6 +83,11 @@ export const OBJECT_ID_SCHEMA: {
|
|
|
83
83
|
clone(meta: any): any;
|
|
84
84
|
append(schema: any): any;
|
|
85
85
|
toOpenApi(extra: any): any;
|
|
86
|
+
getDefault(): {
|
|
87
|
+
default?: undefined;
|
|
88
|
+
} | {
|
|
89
|
+
default: any;
|
|
90
|
+
};
|
|
86
91
|
inspect(): string;
|
|
87
92
|
expandExtra(extra?: {}): {};
|
|
88
93
|
assertEnum(set: any, allow: any): any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.js"],"names":[],"mappings":"AAiFA,kDAEC;AAED,oEAiFC;AAsBD,wEAkBC;
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.js"],"names":[],"mappings":"AAiFA,kDAEC;AAED,oEAiFC;AAsBD,wEAkBC;AAiRD;;;EAEC;AAED;;;EAOC;AAxdD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQK"}
|