@bedrockio/model 0.13.1 → 0.13.3
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/CHANGELOG.md +12 -0
- package/dist/cjs/assign.js +16 -2
- package/dist/cjs/validation.js +5 -8
- package/package.json +3 -3
- package/src/assign.js +16 -2
- package/src/validation.js +6 -8
- package/types/include.d.ts +8 -3
- package/types/include.d.ts.map +1 -1
- package/types/search.d.ts +14 -7
- package/types/search.d.ts.map +1 -1
- package/types/validation-schemas.d.ts +30 -13
- package/types/validation-schemas.d.ts.map +1 -1
- package/types/validation.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## 0.13.3
|
|
2
|
+
|
|
3
|
+
- Bumped yada version.
|
|
4
|
+
- Fix for empty string not unsetting nested enum string fields.
|
|
5
|
+
|
|
6
|
+
## 0.13.2
|
|
7
|
+
|
|
8
|
+
- Bumped yada version.
|
|
9
|
+
- Removed `expandDotSyntax` as default.
|
|
10
|
+
- Added `calendar` named validation.
|
|
11
|
+
- Updated OpenApi tests to match stricter JSON schema.
|
|
12
|
+
|
|
1
13
|
## 0.13.1
|
|
2
14
|
|
|
3
15
|
- Do not enforce unique constraints in search validation.
|
package/dist/cjs/assign.js
CHANGED
|
@@ -30,7 +30,7 @@ function unsetReferenceFields(fields, schema = {}) {
|
|
|
30
30
|
fields[key] = undefined;
|
|
31
31
|
} else if (value instanceof _mongoose.default.Document) {
|
|
32
32
|
fields[key] = value;
|
|
33
|
-
} else if (value
|
|
33
|
+
} else if (hasEnumerableFields(value)) {
|
|
34
34
|
unsetReferenceFields(value, (0, _utils.getField)(schema, key));
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -42,11 +42,25 @@ function unsetReferenceFields(fields, schema = {}) {
|
|
|
42
42
|
function flattenObject(obj, root = {}, rootPath = []) {
|
|
43
43
|
for (let [key, val] of Object.entries(obj)) {
|
|
44
44
|
const path = [...rootPath, key];
|
|
45
|
-
if ((
|
|
45
|
+
if (hasEnumerableFields(val)) {
|
|
46
46
|
flattenObject(val, root, path);
|
|
47
47
|
} else {
|
|
48
48
|
root[path.join('.')] = val;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
return root;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Only plain objects and arrays with fields should
|
|
55
|
+
// be enumerated to allow setting of their inner fields.
|
|
56
|
+
// Note that mongoose documents etc should NOT be enumerated
|
|
57
|
+
// over as their value should be set directly for the field.
|
|
58
|
+
// Additionally if an array is empty it should not have its
|
|
59
|
+
// fields enumerated but instead directly set the empty array
|
|
60
|
+
// for the field.
|
|
61
|
+
function hasEnumerableFields(arg) {
|
|
62
|
+
if ((0, _lodash.isPlainObject)(arg) || Array.isArray(arg)) {
|
|
63
|
+
return Object.keys(arg).length > 0;
|
|
64
|
+
}
|
|
65
|
+
return false;
|
|
52
66
|
}
|
package/dist/cjs/validation.js
CHANGED
|
@@ -26,6 +26,10 @@ const NAMED_SCHEMAS = {
|
|
|
26
26
|
// Force "objectId" to have parity with refs.
|
|
27
27
|
// "mongo" is notably excluded here for this reason.
|
|
28
28
|
objectId: _validationSchemas.OBJECT_ID_SCHEMA,
|
|
29
|
+
// Normal date validations must contain a time. The
|
|
30
|
+
// "calendar" validation is a special case to validate
|
|
31
|
+
// string fields in ISO-8601 format without a time.
|
|
32
|
+
calendar: _yada.default.string().calendar(),
|
|
29
33
|
ascii: _yada.default.string().ascii(),
|
|
30
34
|
base64: _yada.default.string().base64(),
|
|
31
35
|
btc: _yada.default.string().btc(),
|
|
@@ -99,7 +103,6 @@ function applyValidation(schema, definition) {
|
|
|
99
103
|
skipRequired: true,
|
|
100
104
|
allowInclude: true,
|
|
101
105
|
stripDeleted: true,
|
|
102
|
-
expandDotSyntax: true,
|
|
103
106
|
unwindArrayFields: true,
|
|
104
107
|
requireReadAccess: true,
|
|
105
108
|
...rest
|
|
@@ -184,8 +187,7 @@ function getObjectSchema(arg, options) {
|
|
|
184
187
|
} else if (typeof arg === 'object') {
|
|
185
188
|
const {
|
|
186
189
|
stripUnknown,
|
|
187
|
-
stripEmpty
|
|
188
|
-
expandDotSyntax
|
|
190
|
+
stripEmpty
|
|
189
191
|
} = options;
|
|
190
192
|
const map = {};
|
|
191
193
|
for (let [key, field] of Object.entries(arg)) {
|
|
@@ -204,11 +206,6 @@ function getObjectSchema(arg, options) {
|
|
|
204
206
|
stripEmpty: true
|
|
205
207
|
});
|
|
206
208
|
}
|
|
207
|
-
if (expandDotSyntax) {
|
|
208
|
-
schema = schema.options({
|
|
209
|
-
expandDotSyntax: true
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
209
|
return schema;
|
|
213
210
|
} else {
|
|
214
211
|
return getSchemaForType(arg, options);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bedrockio/model",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.3",
|
|
4
4
|
"description": "Bedrock utilities for model creation.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"lodash": "^4.17.21"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@bedrockio/yada": "^1.
|
|
33
|
+
"@bedrockio/yada": "^1.6.1",
|
|
34
34
|
"mongoose": "^8.13.1"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@babel/preset-env": "^7.26.0",
|
|
40
40
|
"@bedrockio/eslint-plugin": "^1.1.7",
|
|
41
41
|
"@bedrockio/prettier-config": "^1.0.2",
|
|
42
|
-
"@bedrockio/yada": "^1.
|
|
42
|
+
"@bedrockio/yada": "^1.6.1",
|
|
43
43
|
"@shelf/jest-mongodb": "^5.1.0",
|
|
44
44
|
"eslint": "^9.19.0",
|
|
45
45
|
"jest": "^29.7.0",
|
package/src/assign.js
CHANGED
|
@@ -25,7 +25,7 @@ function unsetReferenceFields(fields, schema = {}) {
|
|
|
25
25
|
fields[key] = undefined;
|
|
26
26
|
} else if (value instanceof mongoose.Document) {
|
|
27
27
|
fields[key] = value;
|
|
28
|
-
} else if (value
|
|
28
|
+
} else if (hasEnumerableFields(value)) {
|
|
29
29
|
unsetReferenceFields(value, getField(schema, key));
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -37,7 +37,7 @@ function unsetReferenceFields(fields, schema = {}) {
|
|
|
37
37
|
function flattenObject(obj, root = {}, rootPath = []) {
|
|
38
38
|
for (let [key, val] of Object.entries(obj)) {
|
|
39
39
|
const path = [...rootPath, key];
|
|
40
|
-
if (
|
|
40
|
+
if (hasEnumerableFields(val)) {
|
|
41
41
|
flattenObject(val, root, path);
|
|
42
42
|
} else {
|
|
43
43
|
root[path.join('.')] = val;
|
|
@@ -45,3 +45,17 @@ function flattenObject(obj, root = {}, rootPath = []) {
|
|
|
45
45
|
}
|
|
46
46
|
return root;
|
|
47
47
|
}
|
|
48
|
+
|
|
49
|
+
// Only plain objects and arrays with fields should
|
|
50
|
+
// be enumerated to allow setting of their inner fields.
|
|
51
|
+
// Note that mongoose documents etc should NOT be enumerated
|
|
52
|
+
// over as their value should be set directly for the field.
|
|
53
|
+
// Additionally if an array is empty it should not have its
|
|
54
|
+
// fields enumerated but instead directly set the empty array
|
|
55
|
+
// for the field.
|
|
56
|
+
function hasEnumerableFields(arg) {
|
|
57
|
+
if (isPlainObject(arg) || Array.isArray(arg)) {
|
|
58
|
+
return Object.keys(arg).length > 0;
|
|
59
|
+
}
|
|
60
|
+
return false;
|
|
61
|
+
}
|
package/src/validation.js
CHANGED
|
@@ -26,6 +26,11 @@ const NAMED_SCHEMAS = {
|
|
|
26
26
|
// "mongo" is notably excluded here for this reason.
|
|
27
27
|
objectId: OBJECT_ID_SCHEMA,
|
|
28
28
|
|
|
29
|
+
// Normal date validations must contain a time. The
|
|
30
|
+
// "calendar" validation is a special case to validate
|
|
31
|
+
// string fields in ISO-8601 format without a time.
|
|
32
|
+
calendar: yd.string().calendar(),
|
|
33
|
+
|
|
29
34
|
ascii: yd.string().ascii(),
|
|
30
35
|
base64: yd.string().base64(),
|
|
31
36
|
btc: yd.string().btc(),
|
|
@@ -101,7 +106,6 @@ export function applyValidation(schema, definition) {
|
|
|
101
106
|
skipRequired: true,
|
|
102
107
|
allowInclude: true,
|
|
103
108
|
stripDeleted: true,
|
|
104
|
-
expandDotSyntax: true,
|
|
105
109
|
unwindArrayFields: true,
|
|
106
110
|
requireReadAccess: true,
|
|
107
111
|
...rest,
|
|
@@ -195,7 +199,7 @@ function getObjectSchema(arg, options) {
|
|
|
195
199
|
} else if (Array.isArray(arg)) {
|
|
196
200
|
return getArraySchema(arg, options);
|
|
197
201
|
} else if (typeof arg === 'object') {
|
|
198
|
-
const { stripUnknown, stripEmpty
|
|
202
|
+
const { stripUnknown, stripEmpty } = options;
|
|
199
203
|
const map = {};
|
|
200
204
|
for (let [key, field] of Object.entries(arg)) {
|
|
201
205
|
if (!isExcludedField(field, options)) {
|
|
@@ -217,12 +221,6 @@ function getObjectSchema(arg, options) {
|
|
|
217
221
|
});
|
|
218
222
|
}
|
|
219
223
|
|
|
220
|
-
if (expandDotSyntax) {
|
|
221
|
-
schema = schema.options({
|
|
222
|
-
expandDotSyntax: true,
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
|
|
226
224
|
return schema;
|
|
227
225
|
} else {
|
|
228
226
|
return getSchemaForType(arg, options);
|
package/types/include.d.ts
CHANGED
|
@@ -11,6 +11,11 @@ export const INCLUDE_FIELD_SCHEMA: {
|
|
|
11
11
|
require(...fields: string[]): /*elided*/ any;
|
|
12
12
|
export(): any;
|
|
13
13
|
append(arg: import("@bedrockio/yada/types/object").SchemaMap | import("@bedrockio/yada/types/Schema").default): /*elided*/ any;
|
|
14
|
+
options(options?: {
|
|
15
|
+
stripEmpty?: boolean;
|
|
16
|
+
stripUnknown?: boolean;
|
|
17
|
+
preserveKeys?: boolean;
|
|
18
|
+
}): /*elided*/ any;
|
|
14
19
|
format(name: any, fn: any): /*elided*/ any;
|
|
15
20
|
toString(): any;
|
|
16
21
|
assertions: any[];
|
|
@@ -26,10 +31,10 @@ export const INCLUDE_FIELD_SCHEMA: {
|
|
|
26
31
|
message(message: any): /*elided*/ any;
|
|
27
32
|
tag(tags: any): /*elided*/ any;
|
|
28
33
|
description(description: any): /*elided*/ any;
|
|
29
|
-
options(options: any): /*elided*/ any;
|
|
30
34
|
validate(value: any, options?: {}): Promise<any>;
|
|
31
35
|
clone(meta: any): /*elided*/ any;
|
|
32
|
-
|
|
36
|
+
toJSON(extra?: any): any;
|
|
37
|
+
toOpenApi(...extra: any[]): any;
|
|
33
38
|
getAnyType(): {
|
|
34
39
|
type: string[];
|
|
35
40
|
};
|
|
@@ -41,6 +46,7 @@ export const INCLUDE_FIELD_SCHEMA: {
|
|
|
41
46
|
getNullable(): {
|
|
42
47
|
nullable: boolean;
|
|
43
48
|
};
|
|
49
|
+
getEnum(): any;
|
|
44
50
|
expandExtra(extra?: {}): {};
|
|
45
51
|
inspect(): string;
|
|
46
52
|
assertEnum(set: any, allow: any): /*elided*/ any;
|
|
@@ -50,6 +56,5 @@ export const INCLUDE_FIELD_SCHEMA: {
|
|
|
50
56
|
transform(fn: any): /*elided*/ any;
|
|
51
57
|
getSortIndex(type: any): number;
|
|
52
58
|
runAssertion(value: any, assertion: any, options?: {}): Promise<any>;
|
|
53
|
-
enumToOpenApi(): any;
|
|
54
59
|
};
|
|
55
60
|
//# sourceMappingURL=include.d.ts.map
|
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,yDAIC;AAaD,yEAUC;AA9ID
|
|
1
|
+
{"version":3,"file":"include.d.ts","sourceRoot":"","sources":["../src/include.js"],"names":[],"mappings":"AA2BA,gDAuEC;AAMD,uDA4BC;AAGD,yDAIC;AAaD,yEAUC;AA9ID;;;;;;;;;;kBAyFsB,CAAC;oBACD,CAAC;oBACE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;eApBT,CAAC;;;;;;;;;;;;;;;;;EAlEf"}
|
package/types/search.d.ts
CHANGED
|
@@ -8,6 +8,11 @@ export function searchValidation(options?: {}): {
|
|
|
8
8
|
require(...fields: string[]): /*elided*/ any;
|
|
9
9
|
export(): any;
|
|
10
10
|
append(arg: import("@bedrockio/yada/types/object").SchemaMap | import("@bedrockio/yada/types/Schema").default): /*elided*/ any;
|
|
11
|
+
options(options?: {
|
|
12
|
+
stripEmpty?: boolean;
|
|
13
|
+
stripUnknown?: boolean;
|
|
14
|
+
preserveKeys?: boolean;
|
|
15
|
+
}): /*elided*/ any;
|
|
11
16
|
format(name: any, fn: any): /*elided*/ any;
|
|
12
17
|
toString(): any;
|
|
13
18
|
assertions: any[];
|
|
@@ -23,10 +28,10 @@ export function searchValidation(options?: {}): {
|
|
|
23
28
|
message(message: any): /*elided*/ any;
|
|
24
29
|
tag(tags: any): /*elided*/ any;
|
|
25
30
|
description(description: any): /*elided*/ any;
|
|
26
|
-
options(options: any): /*elided*/ any;
|
|
27
31
|
validate(value: any, options?: {}): Promise<any>;
|
|
28
32
|
clone(meta: any): /*elided*/ any;
|
|
29
|
-
|
|
33
|
+
toJSON(extra?: any): any;
|
|
34
|
+
toOpenApi(...extra: any[]): any;
|
|
30
35
|
getAnyType(): {
|
|
31
36
|
type: string[];
|
|
32
37
|
};
|
|
@@ -38,6 +43,7 @@ export function searchValidation(options?: {}): {
|
|
|
38
43
|
getNullable(): {
|
|
39
44
|
nullable: boolean;
|
|
40
45
|
};
|
|
46
|
+
getEnum(): any;
|
|
41
47
|
expandExtra(extra?: {}): {};
|
|
42
48
|
inspect(): string;
|
|
43
49
|
assertEnum(set: any, allow: any): /*elided*/ any;
|
|
@@ -47,7 +53,6 @@ export function searchValidation(options?: {}): {
|
|
|
47
53
|
transform(fn: any): /*elided*/ any;
|
|
48
54
|
getSortIndex(type: any): number;
|
|
49
55
|
runAssertion(value: any, assertion: any, options?: {}): Promise<any>;
|
|
50
|
-
enumToOpenApi(): any;
|
|
51
56
|
};
|
|
52
57
|
export function exportValidation(options?: {}): {
|
|
53
58
|
filename: {
|
|
@@ -127,7 +132,8 @@ export function exportValidation(options?: {}): {
|
|
|
127
132
|
validate(value: any, options?: {}): Promise<any>;
|
|
128
133
|
clone(meta: any): /*elided*/ any;
|
|
129
134
|
append(schema: any): import("@bedrockio/yada/types/Schema").default;
|
|
130
|
-
|
|
135
|
+
toJSON(extra?: any): any;
|
|
136
|
+
toOpenApi(...extra: any[]): any;
|
|
131
137
|
getAnyType(): {
|
|
132
138
|
type: string[];
|
|
133
139
|
};
|
|
@@ -139,6 +145,7 @@ export function exportValidation(options?: {}): {
|
|
|
139
145
|
getNullable(): {
|
|
140
146
|
nullable: boolean;
|
|
141
147
|
};
|
|
148
|
+
getEnum(): any;
|
|
142
149
|
expandExtra(extra?: {}): {};
|
|
143
150
|
inspect(): string;
|
|
144
151
|
get(): void;
|
|
@@ -149,7 +156,6 @@ export function exportValidation(options?: {}): {
|
|
|
149
156
|
transform(fn: any): /*elided*/ any;
|
|
150
157
|
getSortIndex(type: any): number;
|
|
151
158
|
runAssertion(value: any, assertion: any, options?: {}): Promise<any>;
|
|
152
|
-
enumToOpenApi(): any;
|
|
153
159
|
};
|
|
154
160
|
format: {
|
|
155
161
|
required(): /*elided*/ any;
|
|
@@ -228,7 +234,8 @@ export function exportValidation(options?: {}): {
|
|
|
228
234
|
validate(value: any, options?: {}): Promise<any>;
|
|
229
235
|
clone(meta: any): /*elided*/ any;
|
|
230
236
|
append(schema: any): import("@bedrockio/yada/types/Schema").default;
|
|
231
|
-
|
|
237
|
+
toJSON(extra?: any): any;
|
|
238
|
+
toOpenApi(...extra: any[]): any;
|
|
232
239
|
getAnyType(): {
|
|
233
240
|
type: string[];
|
|
234
241
|
};
|
|
@@ -240,6 +247,7 @@ export function exportValidation(options?: {}): {
|
|
|
240
247
|
getNullable(): {
|
|
241
248
|
nullable: boolean;
|
|
242
249
|
};
|
|
250
|
+
getEnum(): any;
|
|
243
251
|
expandExtra(extra?: {}): {};
|
|
244
252
|
inspect(): string;
|
|
245
253
|
get(): void;
|
|
@@ -250,7 +258,6 @@ export function exportValidation(options?: {}): {
|
|
|
250
258
|
transform(fn: any): /*elided*/ any;
|
|
251
259
|
getSortIndex(type: any): number;
|
|
252
260
|
runAssertion(value: any, assertion: any, options?: {}): Promise<any>;
|
|
253
|
-
enumToOpenApi(): any;
|
|
254
261
|
};
|
|
255
262
|
};
|
|
256
263
|
//# sourceMappingURL=search.d.ts.map
|
package/types/search.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../src/search.js"],"names":[],"mappings":"AAuBA,gEAaC;AAED
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../src/search.js"],"names":[],"mappings":"AAuBA,gEAaC;AAED;;;;;;;;;;kBA0Fe,CAAC;oBAA+B,CAAC;oBAEtB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;eAhCvB,CAAF;;;;;;;;;;;;;;;;;EAnCD;AAED;;;;;;;;;;;;;;;;;mBAtBI,CAAA;;;;;;;;;;;;qBAuBC,CAAC;sBAA4B,CAAC;sBACvB,CAAC;wBAA8B,CAAC;wBAEnC,CAAC;;;4BA2BK,CAAC;kCACwB,CAAC;wBACrC,CAAA;wBAA+B,CAAC;wCAK9B,CAAJ;2BAAkC,CAAC;kCACP,CAAC;2BAIhB,CAAC;qBAA4B,CAAC;;;uBAsBT,CAAC;6BACH,CAAC;8BAI7B,CAAF;6BAAoC,CAAC;0BAClB,CAAC;6BAIhB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA1CJ,CAAF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAvDE,CAAA;;;;;;;;;;;;qBAuBC,CAAC;sBAA4B,CAAC;sBACvB,CAAC;wBAA8B,CAAC;wBAEnC,CAAC;;;4BA2BK,CAAC;kCACwB,CAAC;wBACrC,CAAA;wBAA+B,CAAC;wCAK9B,CAAJ;2BAAkC,CAAC;kCACP,CAAC;2BAIhB,CAAC;qBAA4B,CAAC;;;uBAsBT,CAAC;6BACH,CAAC;8BAI7B,CAAF;6BAAoC,CAAC;0BAClB,CAAC;6BAIhB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA1CJ,CAAF;;;;;;;;;;;;;;;;;;;EApBD"}
|
|
@@ -25,7 +25,8 @@ export const DATE_SCHEMA: {
|
|
|
25
25
|
validate(value: any, options?: {}): Promise<any>;
|
|
26
26
|
clone(meta: any): /*elided*/ any;
|
|
27
27
|
append(schema: any): import("@bedrockio/yada/types/Schema").default;
|
|
28
|
-
|
|
28
|
+
toJSON(extra?: any): any;
|
|
29
|
+
toOpenApi(...extra: any[]): any;
|
|
29
30
|
getAnyType(): {
|
|
30
31
|
type: string[];
|
|
31
32
|
};
|
|
@@ -37,6 +38,7 @@ export const DATE_SCHEMA: {
|
|
|
37
38
|
getNullable(): {
|
|
38
39
|
nullable: boolean;
|
|
39
40
|
};
|
|
41
|
+
getEnum(): any;
|
|
40
42
|
expandExtra(extra?: {}): {};
|
|
41
43
|
inspect(): string;
|
|
42
44
|
get(): void;
|
|
@@ -47,7 +49,6 @@ export const DATE_SCHEMA: {
|
|
|
47
49
|
transform(fn: any): /*elided*/ any;
|
|
48
50
|
getSortIndex(type: any): number;
|
|
49
51
|
runAssertion(value: any, assertion: any, options?: {}): Promise<any>;
|
|
50
|
-
enumToOpenApi(): any;
|
|
51
52
|
};
|
|
52
53
|
export const OBJECT_ID_SCHEMA: {
|
|
53
54
|
required(): /*elided*/ any;
|
|
@@ -126,7 +127,8 @@ export const OBJECT_ID_SCHEMA: {
|
|
|
126
127
|
validate(value: any, options?: {}): Promise<any>;
|
|
127
128
|
clone(meta: any): /*elided*/ any;
|
|
128
129
|
append(schema: any): import("@bedrockio/yada/types/Schema").default;
|
|
129
|
-
|
|
130
|
+
toJSON(extra?: any): any;
|
|
131
|
+
toOpenApi(...extra: any[]): any;
|
|
130
132
|
getAnyType(): {
|
|
131
133
|
type: string[];
|
|
132
134
|
};
|
|
@@ -138,6 +140,7 @@ export const OBJECT_ID_SCHEMA: {
|
|
|
138
140
|
getNullable(): {
|
|
139
141
|
nullable: boolean;
|
|
140
142
|
};
|
|
143
|
+
getEnum(): any;
|
|
141
144
|
expandExtra(extra?: {}): {};
|
|
142
145
|
inspect(): string;
|
|
143
146
|
get(): void;
|
|
@@ -148,7 +151,6 @@ export const OBJECT_ID_SCHEMA: {
|
|
|
148
151
|
transform(fn: any): /*elided*/ any;
|
|
149
152
|
getSortIndex(type: any): number;
|
|
150
153
|
runAssertion(value: any, assertion: any, options?: {}): Promise<any>;
|
|
151
|
-
enumToOpenApi(): any;
|
|
152
154
|
};
|
|
153
155
|
export const NUMBER_RANGE_SCHEMA: {
|
|
154
156
|
setup(): void;
|
|
@@ -159,6 +161,11 @@ export const NUMBER_RANGE_SCHEMA: {
|
|
|
159
161
|
require(...fields: string[]): /*elided*/ any;
|
|
160
162
|
export(): any;
|
|
161
163
|
append(arg: import("@bedrockio/yada/types/object").SchemaMap | import("@bedrockio/yada/types/Schema").default): /*elided*/ any;
|
|
164
|
+
options(options?: {
|
|
165
|
+
stripEmpty?: boolean;
|
|
166
|
+
stripUnknown?: boolean;
|
|
167
|
+
preserveKeys?: boolean;
|
|
168
|
+
}): /*elided*/ any;
|
|
162
169
|
format(name: any, fn: any): /*elided*/ any;
|
|
163
170
|
toString(): any;
|
|
164
171
|
assertions: any[];
|
|
@@ -174,10 +181,10 @@ export const NUMBER_RANGE_SCHEMA: {
|
|
|
174
181
|
message(message: any): /*elided*/ any;
|
|
175
182
|
tag(tags: any): /*elided*/ any;
|
|
176
183
|
description(description: any): /*elided*/ any;
|
|
177
|
-
options(options: any): /*elided*/ any;
|
|
178
184
|
validate(value: any, options?: {}): Promise<any>;
|
|
179
185
|
clone(meta: any): /*elided*/ any;
|
|
180
|
-
|
|
186
|
+
toJSON(extra?: any): any;
|
|
187
|
+
toOpenApi(...extra: any[]): any;
|
|
181
188
|
getAnyType(): {
|
|
182
189
|
type: string[];
|
|
183
190
|
};
|
|
@@ -189,6 +196,7 @@ export const NUMBER_RANGE_SCHEMA: {
|
|
|
189
196
|
getNullable(): {
|
|
190
197
|
nullable: boolean;
|
|
191
198
|
};
|
|
199
|
+
getEnum(): any;
|
|
192
200
|
expandExtra(extra?: {}): {};
|
|
193
201
|
inspect(): string;
|
|
194
202
|
assertEnum(set: any, allow: any): /*elided*/ any;
|
|
@@ -198,7 +206,6 @@ export const NUMBER_RANGE_SCHEMA: {
|
|
|
198
206
|
transform(fn: any): /*elided*/ any;
|
|
199
207
|
getSortIndex(type: any): number;
|
|
200
208
|
runAssertion(value: any, assertion: any, options?: {}): Promise<any>;
|
|
201
|
-
enumToOpenApi(): any;
|
|
202
209
|
};
|
|
203
210
|
export const STRING_RANGE_SCHEMA: {
|
|
204
211
|
setup(): void;
|
|
@@ -209,6 +216,11 @@ export const STRING_RANGE_SCHEMA: {
|
|
|
209
216
|
require(...fields: string[]): /*elided*/ any;
|
|
210
217
|
export(): any;
|
|
211
218
|
append(arg: import("@bedrockio/yada/types/object").SchemaMap | import("@bedrockio/yada/types/Schema").default): /*elided*/ any;
|
|
219
|
+
options(options?: {
|
|
220
|
+
stripEmpty?: boolean;
|
|
221
|
+
stripUnknown?: boolean;
|
|
222
|
+
preserveKeys?: boolean;
|
|
223
|
+
}): /*elided*/ any;
|
|
212
224
|
format(name: any, fn: any): /*elided*/ any;
|
|
213
225
|
toString(): any;
|
|
214
226
|
assertions: any[];
|
|
@@ -224,10 +236,10 @@ export const STRING_RANGE_SCHEMA: {
|
|
|
224
236
|
message(message: any): /*elided*/ any;
|
|
225
237
|
tag(tags: any): /*elided*/ any;
|
|
226
238
|
description(description: any): /*elided*/ any;
|
|
227
|
-
options(options: any): /*elided*/ any;
|
|
228
239
|
validate(value: any, options?: {}): Promise<any>;
|
|
229
240
|
clone(meta: any): /*elided*/ any;
|
|
230
|
-
|
|
241
|
+
toJSON(extra?: any): any;
|
|
242
|
+
toOpenApi(...extra: any[]): any;
|
|
231
243
|
getAnyType(): {
|
|
232
244
|
type: string[];
|
|
233
245
|
};
|
|
@@ -239,6 +251,7 @@ export const STRING_RANGE_SCHEMA: {
|
|
|
239
251
|
getNullable(): {
|
|
240
252
|
nullable: boolean;
|
|
241
253
|
};
|
|
254
|
+
getEnum(): any;
|
|
242
255
|
expandExtra(extra?: {}): {};
|
|
243
256
|
inspect(): string;
|
|
244
257
|
assertEnum(set: any, allow: any): /*elided*/ any;
|
|
@@ -248,7 +261,6 @@ export const STRING_RANGE_SCHEMA: {
|
|
|
248
261
|
transform(fn: any): /*elided*/ any;
|
|
249
262
|
getSortIndex(type: any): number;
|
|
250
263
|
runAssertion(value: any, assertion: any, options?: {}): Promise<any>;
|
|
251
|
-
enumToOpenApi(): any;
|
|
252
264
|
};
|
|
253
265
|
export const DATE_RANGE_SCHEMA: {
|
|
254
266
|
setup(): void;
|
|
@@ -259,6 +271,11 @@ export const DATE_RANGE_SCHEMA: {
|
|
|
259
271
|
require(...fields: string[]): /*elided*/ any;
|
|
260
272
|
export(): any;
|
|
261
273
|
append(arg: import("@bedrockio/yada/types/object").SchemaMap | import("@bedrockio/yada/types/Schema").default): /*elided*/ any;
|
|
274
|
+
options(options?: {
|
|
275
|
+
stripEmpty?: boolean;
|
|
276
|
+
stripUnknown?: boolean;
|
|
277
|
+
preserveKeys?: boolean;
|
|
278
|
+
}): /*elided*/ any;
|
|
262
279
|
format(name: any, fn: any): /*elided*/ any;
|
|
263
280
|
toString(): any;
|
|
264
281
|
assertions: any[];
|
|
@@ -274,10 +291,10 @@ export const DATE_RANGE_SCHEMA: {
|
|
|
274
291
|
message(message: any): /*elided*/ any;
|
|
275
292
|
tag(tags: any): /*elided*/ any;
|
|
276
293
|
description(description: any): /*elided*/ any;
|
|
277
|
-
options(options: any): /*elided*/ any;
|
|
278
294
|
validate(value: any, options?: {}): Promise<any>;
|
|
279
295
|
clone(meta: any): /*elided*/ any;
|
|
280
|
-
|
|
296
|
+
toJSON(extra?: any): any;
|
|
297
|
+
toOpenApi(...extra: any[]): any;
|
|
281
298
|
getAnyType(): {
|
|
282
299
|
type: string[];
|
|
283
300
|
};
|
|
@@ -289,6 +306,7 @@ export const DATE_RANGE_SCHEMA: {
|
|
|
289
306
|
getNullable(): {
|
|
290
307
|
nullable: boolean;
|
|
291
308
|
};
|
|
309
|
+
getEnum(): any;
|
|
292
310
|
expandExtra(extra?: {}): {};
|
|
293
311
|
inspect(): string;
|
|
294
312
|
assertEnum(set: any, allow: any): /*elided*/ any;
|
|
@@ -298,7 +316,6 @@ export const DATE_RANGE_SCHEMA: {
|
|
|
298
316
|
transform(fn: any): /*elided*/ any;
|
|
299
317
|
getSortIndex(type: any): number;
|
|
300
318
|
runAssertion(value: any, assertion: any, options?: {}): Promise<any>;
|
|
301
|
-
enumToOpenApi(): any;
|
|
302
319
|
};
|
|
303
320
|
export const REFERENCE_SCHEMA: import("@bedrockio/yada/types/Schema").default;
|
|
304
321
|
//# sourceMappingURL=validation-schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation-schemas.d.ts","sourceRoot":"","sources":["../src/validation-schemas.js"],"names":[],"mappings":"AAQA
|
|
1
|
+
{"version":3,"file":"validation-schemas.d.ts","sourceRoot":"","sources":["../src/validation-schemas.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAsFgD,CAAC;;;;;;;;;;;;;;;;;;EAtFS;AAE1D;;;;;;;;;;;;;;;;eAyBwB,CAAC;;;;;;;;;;;;iBAuBjB,CAAA;kBAA4B,CAAC;kBAEjC,CAAF;oBAEI,CAAC;oBAEI,CAAC;;;wBA2BC,CAAC;8BAGI,CAAC;oBAA+B,CAAC;oBAE1C,CAAC;oCAEL,CAAC;uBAAkC,CAAC;8BAAyC,CAAC;uBACzD,CAAC;iBAA4B,CAAC;;;mBAG0V,CAAC;yBAAoC,CAAC;0BAAqC,CAAC;yBAAoC,CAAC;sBAAiC,CAAC;yBAAoC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAR1hB,CAAC;;;;;;;;;;;;;;;;;;EA5E5C;AAEL;;;;;;;;;;kBAkFwU,CAAC;oBAA+B,CAAC;oBAA+B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;eARzV,CAAC;;;;;;;;;;;;;;;;;EAhE5C;AAEL;;;;;;;;;;kBAsEwU,CAAC;oBAA+B,CAAC;oBAA+B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;eARzV,CAAC;;;;;;;;;;;;;;;;;EApD5C;AAEL;;;;;;;;;;kBA0DwU,CAAC;oBAA+B,CAAC;oBAA+B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;eARzV,CAAC;;;;;;;;;;;;;;;;;EAhB5C;AAEL,8EAqBK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.js"],"names":[],"mappings":"AA0DA,kDAEC;AAED,oEA0FC;AAsBD,wEAiBC;AAwSD;;;EAEC;AAED;;;EAOC"}
|