@bedrockio/yada 1.2.3 → 1.2.5
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/messages.js +10 -10
- package/package.json +5 -4
- package/src/messages.js +10 -8
- package/types/Schema.d.ts +2 -10
- package/types/Schema.d.ts.map +1 -1
- package/types/TypeSchema.d.ts +2 -2
- package/types/TypeSchema.d.ts.map +1 -1
- package/types/array.d.ts +6 -6
- package/types/array.d.ts.map +1 -1
- package/types/boolean.d.ts +1 -1
- package/types/boolean.d.ts.map +1 -1
- package/types/date.d.ts +10 -10
- package/types/date.d.ts.map +1 -1
- package/types/errors.d.ts +1 -1
- package/types/errors.d.ts.map +1 -1
- package/types/index.d.ts +13 -13
- package/types/index.d.ts.map +1 -1
- package/types/localization.d.ts.map +1 -1
- package/types/number.d.ts +7 -7
- package/types/number.d.ts.map +1 -1
- package/types/object.d.ts +4 -4
- package/types/object.d.ts.map +1 -1
- package/types/string.d.ts +33 -33
- package/types/string.d.ts.map +1 -1
- package/types/tuple.d.ts +2 -2
- package/types/tuple.d.ts.map +1 -1
package/dist/cjs/messages.js
CHANGED
|
@@ -44,9 +44,6 @@ function getInnerPath(error, options) {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
function getLabeledMessage(error, options) {
|
|
47
|
-
const {
|
|
48
|
-
type
|
|
49
|
-
} = error;
|
|
50
47
|
const {
|
|
51
48
|
path = []
|
|
52
49
|
} = options;
|
|
@@ -54,8 +51,10 @@ function getLabeledMessage(error, options) {
|
|
|
54
51
|
let template;
|
|
55
52
|
if (base.includes('{field}')) {
|
|
56
53
|
template = base;
|
|
57
|
-
} else if (canAutoAddField(
|
|
54
|
+
} else if (canAutoAddField(path, base)) {
|
|
58
55
|
template = `{field} ${downcase(base)}`;
|
|
56
|
+
} else {
|
|
57
|
+
template = error.message;
|
|
59
58
|
}
|
|
60
59
|
if (template) {
|
|
61
60
|
return (0, _localization.localize)(template, {
|
|
@@ -65,13 +64,14 @@ function getLabeledMessage(error, options) {
|
|
|
65
64
|
return (0, _localization.localize)(base);
|
|
66
65
|
}
|
|
67
66
|
}
|
|
68
|
-
const
|
|
67
|
+
const GENERIC_MESSAGE_REG = /^Must|is required\.?$/;
|
|
69
68
|
|
|
70
|
-
//
|
|
71
|
-
//
|
|
72
|
-
//
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
// Only "generic" error messages should automatically add the field.
|
|
70
|
+
// A custom error message may be "Please verify you are human" which
|
|
71
|
+
// is intended to be understood in context and does not benefit from
|
|
72
|
+
// the inclusion of the field name.
|
|
73
|
+
function canAutoAddField(path, base) {
|
|
74
|
+
return path.length && GENERIC_MESSAGE_REG.test(base);
|
|
75
75
|
}
|
|
76
76
|
function getFieldLabel(options) {
|
|
77
77
|
const {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bedrockio/yada",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"description": "Validation library inspired by Joi.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "jest",
|
|
@@ -24,17 +24,18 @@
|
|
|
24
24
|
"@babel/core": "^7.20.12",
|
|
25
25
|
"@babel/preset-env": "^7.20.2",
|
|
26
26
|
"@bedrockio/prettier-config": "^1.0.2",
|
|
27
|
+
"@types/node": "^22.10.2",
|
|
27
28
|
"babel-plugin-add-module-exports": "^1.0.4",
|
|
28
29
|
"eslint": "^8.26.0",
|
|
29
30
|
"eslint-plugin-bedrock": "^1.0.24",
|
|
30
31
|
"jest": "^29.6.2",
|
|
31
32
|
"prettier": "^2.7.1",
|
|
32
33
|
"prettier-eslint": "^15.0.1",
|
|
33
|
-
"typescript": "^
|
|
34
|
+
"typescript": "^5.7.2"
|
|
34
35
|
},
|
|
35
36
|
"prettier": "@bedrockio/prettier-config",
|
|
36
37
|
"volta": {
|
|
37
|
-
"node": "
|
|
38
|
-
"yarn": "1.22.
|
|
38
|
+
"node": "22.12.0",
|
|
39
|
+
"yarn": "1.22.22"
|
|
39
40
|
}
|
|
40
41
|
}
|
package/src/messages.js
CHANGED
|
@@ -40,15 +40,16 @@ function getInnerPath(error, options) {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
function getLabeledMessage(error, options) {
|
|
43
|
-
const { type } = error;
|
|
44
43
|
const { path = [] } = options;
|
|
45
44
|
const base = getBase(error.message);
|
|
46
45
|
|
|
47
46
|
let template;
|
|
48
47
|
if (base.includes('{field}')) {
|
|
49
48
|
template = base;
|
|
50
|
-
} else if (canAutoAddField(
|
|
49
|
+
} else if (canAutoAddField(path, base)) {
|
|
51
50
|
template = `{field} ${downcase(base)}`;
|
|
51
|
+
} else {
|
|
52
|
+
template = error.message;
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
if (template) {
|
|
@@ -60,13 +61,14 @@ function getLabeledMessage(error, options) {
|
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
63
|
|
|
63
|
-
const
|
|
64
|
+
const GENERIC_MESSAGE_REG = /^Must|is required\.?$/;
|
|
64
65
|
|
|
65
|
-
//
|
|
66
|
-
//
|
|
67
|
-
//
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
// Only "generic" error messages should automatically add the field.
|
|
67
|
+
// A custom error message may be "Please verify you are human" which
|
|
68
|
+
// is intended to be understood in context and does not benefit from
|
|
69
|
+
// the inclusion of the field name.
|
|
70
|
+
function canAutoAddField(path, base) {
|
|
71
|
+
return path.length && GENERIC_MESSAGE_REG.test(base);
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
function getFieldLabel(options) {
|
package/types/Schema.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function isSchema(arg: any):
|
|
1
|
+
export function isSchema(arg: any): arg is Schema;
|
|
2
2
|
export default class Schema {
|
|
3
3
|
constructor(meta?: {});
|
|
4
4
|
assertions: any[];
|
|
@@ -94,14 +94,6 @@ export default class Schema {
|
|
|
94
94
|
transform(fn: any): this;
|
|
95
95
|
getSortIndex(type: any): number;
|
|
96
96
|
runAssertion(assertion: any, value: any, options?: {}): Promise<any>;
|
|
97
|
-
enumToOpenApi():
|
|
98
|
-
type: "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
|
|
99
|
-
enum: any;
|
|
100
|
-
oneOf?: undefined;
|
|
101
|
-
} | {
|
|
102
|
-
oneOf: any[];
|
|
103
|
-
type?: undefined;
|
|
104
|
-
enum?: undefined;
|
|
105
|
-
};
|
|
97
|
+
enumToOpenApi(): any;
|
|
106
98
|
}
|
|
107
99
|
//# sourceMappingURL=Schema.d.ts.map
|
package/types/Schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Schema.d.ts","sourceRoot":"","sources":["../src/Schema.js"],"names":[],"mappings":"AAmYA,
|
|
1
|
+
{"version":3,"file":"Schema.d.ts","sourceRoot":"","sources":["../src/Schema.js"],"names":[],"mappings":"AAmYA,kDAEC;AAxXD;IACE,uBAGC;IAFC,kBAAoB;IACpB,SAAgB;IAKlB;;OAEG;IACH,YAFa,IAAI,CAQhB;IAED;;;OAGG;IACH,mBAFa,IAAI,CAShB;IAED;;;;OAIG;IACH,sBAFa,IAAI,CAShB;IAED;;;;OAIG;IACH,mBAFa,IAAI,CAIhB;IAED;;;OAGG;IACH,sBAFa,IAAI,CAIhB;IAED;;;OAGG;IACH,uBAFa,IAAI,CAIhB;IAED;;;OAGG;IACH,YAFa,IAAI,CAIhB;IAED;;OAEG;IACH,uBAFa,IAAI,CAIhB;IAED;;OAEG;IACH,gBAFa,IAAI,CAShB;IAED;;OAEG;IACH,+BAFa,IAAI,CAMhB;IAED;;OAEG;IACH,uBAFa,IAAI,CAIhB;IAED,iDA8CC;IAED;;OAEG;IACH,kBAFa,IAAI,CAOhB;IAED;;;OAGG;IACH,qBAFa,IAAI,CAMhB;IAED,2BAYC;IAED;;MAOC;IAED;;;;MASC;IAED;;MAOC;IAED,4BAMC;IAED,kBAEC;IAID;;OAEG;IACH,kCAFa,IAAI,CAiDhB;IAED;;OAEG;IACH,4BAFa,IAAI,CAUhB;IAED,oCAKC;IAED;;OAEG;IACH,oBAFa,IAAI,CAShB;IAED,gCAGC;IAED,qEAGC;IAED,qBAsCC;CACF"}
|
package/types/TypeSchema.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export default class TypeSchema extends Schema {
|
|
2
2
|
constructor(Class: any, meta: any);
|
|
3
|
-
format(name: any, fn: any):
|
|
3
|
+
format(name: any, fn: any): this;
|
|
4
4
|
toString(): any;
|
|
5
5
|
}
|
|
6
|
-
import Schema from
|
|
6
|
+
import Schema from './Schema';
|
|
7
7
|
//# sourceMappingURL=TypeSchema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeSchema.d.ts","sourceRoot":"","sources":["../src/TypeSchema.js"],"names":[],"mappings":"AAEA;IACE,mCAGC;IAED,
|
|
1
|
+
{"version":3,"file":"TypeSchema.d.ts","sourceRoot":"","sources":["../src/TypeSchema.js"],"names":[],"mappings":"AAEA;IACE,mCAGC;IAED,iCAEC;IAED,gBAEC;CAQF;mBAtBkB,UAAU"}
|
package/types/array.d.ts
CHANGED
|
@@ -7,19 +7,19 @@
|
|
|
7
7
|
* accepts a single array argument.
|
|
8
8
|
*/
|
|
9
9
|
export default function _default(...schemas?: Schema[]): ArraySchema;
|
|
10
|
-
import Schema from
|
|
10
|
+
import Schema from './Schema';
|
|
11
11
|
declare class ArraySchema extends TypeSchema {
|
|
12
12
|
constructor(schemas: any);
|
|
13
13
|
/**
|
|
14
14
|
* @private
|
|
15
15
|
*/
|
|
16
16
|
private setup;
|
|
17
|
-
length(length: any):
|
|
18
|
-
min(length: any):
|
|
19
|
-
max(length: any):
|
|
20
|
-
latlng():
|
|
17
|
+
length(length: any): this;
|
|
18
|
+
min(length: any): this;
|
|
19
|
+
max(length: any): this;
|
|
20
|
+
latlng(): this;
|
|
21
21
|
toString(): string;
|
|
22
22
|
}
|
|
23
|
-
import TypeSchema from
|
|
23
|
+
import TypeSchema from './TypeSchema';
|
|
24
24
|
export {};
|
|
25
25
|
//# sourceMappingURL=array.d.ts.map
|
package/types/array.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../src/array.js"],"names":[],"mappings":"AAuIA;;;;;;;GAOG;AACH,8CALc,MAAM,
|
|
1
|
+
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../src/array.js"],"names":[],"mappings":"AAuIA;;;;;;;GAOG;AACH,8CALc,MAAM,EAAA,eAUnB;mBApJkB,UAAU;AAK7B;IACE,0BAGC;IAED;;OAEG;IACH,cAsCC;IAED,0BAUC;IAED,uBAUC;IAED,uBAaC;IAED,eAaC;IAED,mBAEC;CAuBF;uBApIsB,cAAc"}
|
package/types/boolean.d.ts
CHANGED
package/types/boolean.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boolean.d.ts","sourceRoot":"","sources":["../src/boolean.js"],"names":[],"mappings":"AAuBA;;GAEG;AACH,kDAEC;AAzBD;IACE,cAgBC;CACF"}
|
|
1
|
+
{"version":3,"file":"boolean.d.ts","sourceRoot":"","sources":["../src/boolean.js"],"names":[],"mappings":"AAuBA;;GAEG;AACH,kDAEC;AAzBD;IACE,cAgBC;CACF;uBArBsB,cAAc"}
|
package/types/date.d.ts
CHANGED
|
@@ -7,28 +7,28 @@ declare class DateSchema extends Schema {
|
|
|
7
7
|
/**
|
|
8
8
|
* @param {string|number|Date} min
|
|
9
9
|
*/
|
|
10
|
-
min(min: string | number | Date):
|
|
10
|
+
min(min: string | number | Date): this;
|
|
11
11
|
/**
|
|
12
12
|
* @param {string|number|Date} max
|
|
13
13
|
*/
|
|
14
|
-
max(max: string | number | Date):
|
|
14
|
+
max(max: string | number | Date): this;
|
|
15
15
|
/**
|
|
16
16
|
* @param {string|number|Date} max
|
|
17
17
|
*/
|
|
18
|
-
before(max: string | number | Date):
|
|
18
|
+
before(max: string | number | Date): this;
|
|
19
19
|
/**
|
|
20
20
|
* @param {string|number|Date} min
|
|
21
21
|
*/
|
|
22
|
-
after(min: string | number | Date):
|
|
23
|
-
past():
|
|
24
|
-
future():
|
|
22
|
+
after(min: string | number | Date): this;
|
|
23
|
+
past(): this;
|
|
24
|
+
future(): this;
|
|
25
25
|
/**
|
|
26
26
|
* @param {"date" | "date-time"} format
|
|
27
27
|
*/
|
|
28
|
-
iso(format?: "date" | "date-time"):
|
|
29
|
-
timestamp():
|
|
30
|
-
unix():
|
|
28
|
+
iso(format?: "date" | "date-time"): this;
|
|
29
|
+
timestamp(): this;
|
|
30
|
+
unix(): this;
|
|
31
31
|
}
|
|
32
|
-
import Schema from
|
|
32
|
+
import Schema from './Schema';
|
|
33
33
|
export {};
|
|
34
34
|
//# sourceMappingURL=date.d.ts.map
|
package/types/date.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../src/date.js"],"names":[],"mappings":"AAoKA;;GAEG;AACH,+CAEC;AApKD;IACE,cAUC;IAED;;OAEG;IACH,SAFW,MAAM,GAAC,MAAM,GAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../src/date.js"],"names":[],"mappings":"AAoKA;;GAEG;AACH,+CAEC;AApKD;IACE,cAUC;IAED;;OAEG;IACH,SAFW,MAAM,GAAC,MAAM,GAAC,IAAI,QAY5B;IAED;;OAEG;IACH,SAFW,MAAM,GAAC,MAAM,GAAC,IAAI,QAY5B;IAED;;OAEG;IACH,YAFW,MAAM,GAAC,MAAM,GAAC,IAAI,QAY5B;IAED;;OAEG;IACH,WAFW,MAAM,GAAC,MAAM,GAAC,IAAI,QAY5B;IAED,aAOC;IAED,eAOC;IAED;;OAEG;IACH,aAFW,MAAM,GAAG,WAAW,QAa9B;IAED,kBAUC;IAED,aAcC;CAwBF;mBA/JkB,UAAU"}
|
package/types/errors.d.ts
CHANGED
package/types/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.js"],"names":[],"mappings":"AAyIA,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.js"],"names":[],"mappings":"AAyIA,gEAEC;AAxID;IACE,uCAEC;CACF;AAED;IACE,+BAA8C;IAE9C,+CAIC;IAFC,aAAwB;IACxB,eAAsB;IAGxB;;;;MAWC;IAED,kBAOC;IAED,kCAKC;CACF;AAED;IACE,yCAGC;CACF;AAED;IACE,qCAIC;IADC,UAAgB;IAGlB,2BAEC;IAED;;;;;MAKC;CACF;AAED;IACE,uCAIC;IADC,YAAoB;IAGtB;;;;;MAKC;CACF;AAED;IAGE,uDAIC;IADC,WAAkB;IAGpB;;;;;MAKC;CACF;AAED;IAGE,uDAIC;IADC,WAAkB;IAGpB;;;;;MAKC;CACF;AAED;IACE,wCAGC;CACF;AAED;IACE,wCAGC;CACF"}
|
package/types/index.d.ts
CHANGED
|
@@ -17,13 +17,13 @@ declare namespace _default {
|
|
|
17
17
|
export { LocalizedError };
|
|
18
18
|
}
|
|
19
19
|
export default _default;
|
|
20
|
-
import array from
|
|
21
|
-
import boolean from
|
|
22
|
-
import date from
|
|
23
|
-
import number from
|
|
24
|
-
import object from
|
|
25
|
-
import string from
|
|
26
|
-
import tuple from
|
|
20
|
+
import array from './array';
|
|
21
|
+
import boolean from './boolean';
|
|
22
|
+
import date from './date';
|
|
23
|
+
import number from './number';
|
|
24
|
+
import object from './object';
|
|
25
|
+
import string from './string';
|
|
26
|
+
import tuple from './tuple';
|
|
27
27
|
/**
|
|
28
28
|
* Accepts anything.
|
|
29
29
|
*/
|
|
@@ -41,11 +41,11 @@ export function reject(...args: any[]): Schema;
|
|
|
41
41
|
* @param {Function} fn
|
|
42
42
|
*/
|
|
43
43
|
export function custom(fn: Function): Schema;
|
|
44
|
-
import { isSchema } from
|
|
45
|
-
import { isSchemaError } from
|
|
46
|
-
import { useLocalizer } from
|
|
47
|
-
import { getLocalizedMessages } from
|
|
48
|
-
import { LocalizedError } from
|
|
49
|
-
import Schema from
|
|
44
|
+
import { isSchema } from './utils';
|
|
45
|
+
import { isSchemaError } from './utils';
|
|
46
|
+
import { useLocalizer } from './localization';
|
|
47
|
+
import { getLocalizedMessages } from './localization';
|
|
48
|
+
import { LocalizedError } from './errors';
|
|
49
|
+
import Schema from './Schema';
|
|
50
50
|
export { array, boolean, date, number, object, string, tuple, isSchema, isSchemaError, useLocalizer, getLocalizedMessages, LocalizedError };
|
|
51
51
|
//# sourceMappingURL=index.d.ts.map
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;kBAKkB,SAAS;oBAHP,WAAW;iBACd,QAAQ;mBAFN,UAAU;mBAGV,UAAU;mBAJV,UAAU;kBAMX,SAAS;AAO3B;;GAEG;AACH,8BAEC;AAED;;GAEG;AACH,8CAEC;AAED;;GAEG;AACH,+CAEC;AAED;;;GAGG;AACH,6CAEC;yBA/BuC,SAAS;8BAAT,SAAS;6BACE,gBAAgB;qCAAhB,gBAAgB;+BACpC,UAAU;mBAHtB,UAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localization.d.ts","sourceRoot":"","sources":["../src/localization.js"],"names":[],"mappings":"AASA;;;;;GAKG;AACH
|
|
1
|
+
{"version":3,"file":"localization.d.ts","sourceRoot":"","sources":["../src/localization.js"],"names":[],"mappings":"AASA;;;;;GAKG;AACH,kCALW;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GAAG,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC,QAS/D;AAED,gDAIC;AAED,yDAmBC;AAED;;;GAGG;AACH;;EAEC"}
|
package/types/number.d.ts
CHANGED
|
@@ -8,17 +8,17 @@ declare class NumberSchema extends TypeSchema {
|
|
|
8
8
|
* @param {number} min
|
|
9
9
|
* @param {string} message
|
|
10
10
|
*/
|
|
11
|
-
min(min: number, message?: string):
|
|
11
|
+
min(min: number, message?: string): this;
|
|
12
12
|
/**
|
|
13
13
|
* @param {number} max
|
|
14
14
|
* @param {string} message
|
|
15
15
|
*/
|
|
16
|
-
max(max: number, message?: string):
|
|
17
|
-
negative():
|
|
18
|
-
positive():
|
|
19
|
-
integer():
|
|
20
|
-
multiple(multiple: any):
|
|
16
|
+
max(max: number, message?: string): this;
|
|
17
|
+
negative(): this;
|
|
18
|
+
positive(): this;
|
|
19
|
+
integer(): this;
|
|
20
|
+
multiple(multiple: any): this;
|
|
21
21
|
}
|
|
22
|
-
import TypeSchema from
|
|
22
|
+
import TypeSchema from './TypeSchema';
|
|
23
23
|
export {};
|
|
24
24
|
//# sourceMappingURL=number.d.ts.map
|
package/types/number.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../src/number.js"],"names":[],"mappings":"AAwFA;;GAEG;AACH,iDAEC;AA1FD;IACE,cAWC;IAED;;;OAGG;IACH,SAHW,MAAM,YACN,MAAM,
|
|
1
|
+
{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../src/number.js"],"names":[],"mappings":"AAwFA;;GAEG;AACH,iDAEC;AA1FD;IACE,cAWC;IAED;;;OAGG;IACH,SAHW,MAAM,YACN,MAAM,QAUhB;IAED;;;OAGG;IACH,SAHW,MAAM,YACN,MAAM,QAUhB;IAED,iBAEC;IAED,iBAEC;IAED,gBAMC;IAED,8BAQC;CAiBF;uBAtFsB,cAAc"}
|
package/types/object.d.ts
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* empty object is passed then no keys will be allowed.
|
|
7
7
|
*/
|
|
8
8
|
export default function _default(map?: SchemaMap): ObjectSchema;
|
|
9
|
-
export type SchemaMap = {
|
|
9
|
+
export type SchemaMap = {
|
|
10
10
|
[key: string]: Schema;
|
|
11
|
-
};
|
|
11
|
+
} | {};
|
|
12
12
|
/**
|
|
13
13
|
* @typedef {{ [key: string]: Schema } | {}} SchemaMap
|
|
14
14
|
*/
|
|
@@ -34,7 +34,7 @@ declare class ObjectSchema extends TypeSchema {
|
|
|
34
34
|
*/
|
|
35
35
|
omit(...names?: string[]): ObjectSchema;
|
|
36
36
|
}
|
|
37
|
-
import Schema from
|
|
38
|
-
import TypeSchema from
|
|
37
|
+
import Schema from './Schema';
|
|
38
|
+
import TypeSchema from './TypeSchema';
|
|
39
39
|
export {};
|
|
40
40
|
//# sourceMappingURL=object.d.ts.map
|
package/types/object.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../src/object.js"],"names":[],"mappings":"AAuMA;;;;;;GAMG;AACH,uCAJW,SAAS,gBAMnB
|
|
1
|
+
{"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../src/object.js"],"names":[],"mappings":"AAuMA;;;;;;GAMG;AACH,uCAJW,SAAS,gBAMnB;wBAxMY;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GAAG,EAAE;AAD3C;;GAEG;AAEH;IAME;;OAEG;IACH,cAqEC;IAED;;OAEG;IACH,kBAEC;IAED;;OAEG;IAEH,YAHW,SAAS,GAAC,MAAM,gBAkC1B;IAED;;OAEG;IACH,gBAFc,MAAM,EAAA,gBAWnB;IAED;;OAEG;IACH,gBAFc,MAAM,EAAA,gBAWnB;CAcF;mBA5KgC,UAAU;uBAHpB,cAAc"}
|
package/types/string.d.ts
CHANGED
|
@@ -11,53 +11,53 @@ declare class StringSchema extends TypeSchema {
|
|
|
11
11
|
/**
|
|
12
12
|
* @param {number} length
|
|
13
13
|
*/
|
|
14
|
-
length(length: number):
|
|
14
|
+
length(length: number): this;
|
|
15
15
|
/**
|
|
16
16
|
* @param {number} length
|
|
17
17
|
*/
|
|
18
|
-
min(length: number):
|
|
18
|
+
min(length: number): this;
|
|
19
19
|
/**
|
|
20
20
|
* @param {number} length
|
|
21
21
|
*/
|
|
22
|
-
max(length: number):
|
|
23
|
-
trim():
|
|
22
|
+
max(length: number): this;
|
|
23
|
+
trim(): this;
|
|
24
24
|
/**
|
|
25
25
|
* @param {boolean} [assert] Throws an error if not lowercase. Default: `false`.
|
|
26
26
|
*/
|
|
27
|
-
lowercase(assert?: boolean):
|
|
27
|
+
lowercase(assert?: boolean): this;
|
|
28
28
|
/**
|
|
29
29
|
* @param {boolean} [assert] Throws an error if not uppercase. Default: `false`.
|
|
30
30
|
*/
|
|
31
|
-
uppercase(assert?: boolean):
|
|
31
|
+
uppercase(assert?: boolean): this;
|
|
32
32
|
/**
|
|
33
33
|
* @param {RegExp} reg
|
|
34
34
|
*/
|
|
35
|
-
match(reg: RegExp):
|
|
36
|
-
email():
|
|
37
|
-
phone(code: any):
|
|
38
|
-
hex():
|
|
39
|
-
md5():
|
|
40
|
-
sha1():
|
|
41
|
-
ascii():
|
|
35
|
+
match(reg: RegExp): this;
|
|
36
|
+
email(): this;
|
|
37
|
+
phone(code: any): this;
|
|
38
|
+
hex(): this;
|
|
39
|
+
md5(): this;
|
|
40
|
+
sha1(): this;
|
|
41
|
+
ascii(): this;
|
|
42
42
|
/**
|
|
43
43
|
* @param {object} [options]
|
|
44
44
|
* @param {boolean} [options.urlSafe]
|
|
45
45
|
*/
|
|
46
46
|
base64(options?: {
|
|
47
47
|
urlSafe?: boolean;
|
|
48
|
-
}):
|
|
49
|
-
creditCard():
|
|
50
|
-
ip():
|
|
51
|
-
country():
|
|
52
|
-
locale():
|
|
53
|
-
jwt():
|
|
54
|
-
slug():
|
|
55
|
-
latlng():
|
|
48
|
+
}): this;
|
|
49
|
+
creditCard(): this;
|
|
50
|
+
ip(): this;
|
|
51
|
+
country(): this;
|
|
52
|
+
locale(): this;
|
|
53
|
+
jwt(): this;
|
|
54
|
+
slug(): this;
|
|
55
|
+
latlng(): this;
|
|
56
56
|
/**
|
|
57
57
|
* @param {string} locale
|
|
58
58
|
*/
|
|
59
|
-
postalCode(locale?: string):
|
|
60
|
-
zipcode():
|
|
59
|
+
postalCode(locale?: string): this;
|
|
60
|
+
zipcode(): this;
|
|
61
61
|
/**
|
|
62
62
|
* @param {object} [options]
|
|
63
63
|
* @param {number} [options.minLength]
|
|
@@ -72,7 +72,7 @@ declare class StringSchema extends TypeSchema {
|
|
|
72
72
|
minSymbols?: number;
|
|
73
73
|
minLowercase?: number;
|
|
74
74
|
minUppercase?: number;
|
|
75
|
-
}):
|
|
75
|
+
}): this;
|
|
76
76
|
/**
|
|
77
77
|
* @param {object} [options]
|
|
78
78
|
* @param {boolean} [options.require_protocol]
|
|
@@ -95,7 +95,7 @@ declare class StringSchema extends TypeSchema {
|
|
|
95
95
|
allow_query_components?: boolean;
|
|
96
96
|
validate_length?: boolean;
|
|
97
97
|
protocols?: string[];
|
|
98
|
-
}):
|
|
98
|
+
}): this;
|
|
99
99
|
/**
|
|
100
100
|
* @param {object} [options]
|
|
101
101
|
* @param {boolean} [options.require_tld=true]
|
|
@@ -112,17 +112,17 @@ declare class StringSchema extends TypeSchema {
|
|
|
112
112
|
allow_numeric_tld?: boolean;
|
|
113
113
|
allow_wildcard?: boolean;
|
|
114
114
|
ignore_max_length?: boolean;
|
|
115
|
-
}):
|
|
115
|
+
}): this;
|
|
116
116
|
/**
|
|
117
117
|
* @param {1 | 2 | 3 | 4 | 5} [version] Version of UUID to check.
|
|
118
118
|
*/
|
|
119
|
-
uuid(version?: 1 | 2 | 3 | 4 | 5):
|
|
120
|
-
btc():
|
|
121
|
-
eth():
|
|
122
|
-
swift():
|
|
123
|
-
mongo():
|
|
124
|
-
format(name: any, fn: any):
|
|
119
|
+
uuid(version?: 1 | 2 | 3 | 4 | 5): this;
|
|
120
|
+
btc(): this;
|
|
121
|
+
eth(): this;
|
|
122
|
+
swift(): this;
|
|
123
|
+
mongo(): this;
|
|
124
|
+
format(name: any, fn: any): this;
|
|
125
125
|
}
|
|
126
|
-
import TypeSchema from
|
|
126
|
+
import TypeSchema from './TypeSchema';
|
|
127
127
|
export {};
|
|
128
128
|
//# sourceMappingURL=string.d.ts.map
|
package/types/string.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../src/string.js"],"names":[],"mappings":"AAgbA;;GAEG;AACH,iDAEC;AA/ZD;IACE,cAoBC;IAED;;OAEG;IACH,YAFa,IAAI,CAQhB;IAED;;OAEG;IACH,eAFW,MAAM,
|
|
1
|
+
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../src/string.js"],"names":[],"mappings":"AAgbA;;GAEG;AACH,iDAEC;AA/ZD;IACE,cAoBC;IAED;;OAEG;IACH,YAFa,IAAI,CAQhB;IAED;;OAEG;IACH,eAFW,MAAM,QAUhB;IAED;;OAEG;IACH,YAFW,MAAM,QAUhB;IAED;;OAEG;IACH,YAFW,MAAM,QAUhB;IAED,aAIC;IAED;;OAEG;IACH,mBAFW,OAAO,QAYjB;IAED;;OAEG;IACH,mBAFW,OAAO,QAYjB;IAED;;OAEG;IACH,WAFW,MAAM,QAahB;IAED,cAMC;IAED,uBASC;IAED,YAMC;IAED,YAMC;IAED,aAMC;IAED,cAMC;IAED;;;OAGG;IACH,iBAFG;QAA0B,OAAO,GAAzB,OAAO;KAAmB,QAQpC;IAED,mBAMC;IAED,WAMC;IAED,gBAMC;IAED,eAMC;IAED,YAMC;IAED,aAOC;IAED,eAMC;IAED;;OAEG;IACH,oBAFW,MAAM,QAQhB;IAED,gBAMC;IAED;;;;;;;OAOG;IACH,mBANG;QAAyB,SAAS,GAA1B,MAAM;QACW,UAAU,GAA3B,MAAM;QACW,UAAU,GAA3B,MAAM;QACW,YAAY,GAA7B,MAAM;QACW,YAAY,GAA7B,MAAM;KAAwB,QA+BxC;IAED;;;;;;;;;;;OAWG;IACH,cAVG;QAA0B,gBAAgB,GAAlC,OAAO;QACW,sBAAsB,GAAxC,OAAO;QACW,YAAY,GAA9B,OAAO;QACW,YAAY,GAA9B,OAAO;QACW,4BAA4B,GAA9C,OAAO;QACW,eAAe,GAAjC,OAAO;QACW,sBAAsB,GAAxC,OAAO;QACW,eAAe,GAAjC,OAAO;QACY,SAAS,GAA5B,MAAM,EAAE;KAAqB,QAQvC;IAED;;;;;;;;OAQG;IACH,iBAPG;QAA0B,WAAW,GAA7B,OAAO;QACW,iBAAiB,GAAnC,OAAO;QACW,kBAAkB,GAApC,OAAO;QACW,iBAAiB,GAAnC,OAAO;QACW,cAAc,GAAhC,OAAO;QACW,iBAAiB,GAAnC,OAAO;KAAmC,QAQpD;IAED;;OAEG;IACH,eAFW,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,QAQ3B;IAED,YAMC;IAED,YAMC;IAED,cAMC;IAED,cAMC;IAED,iCAWC;CAcF;uBA7asB,cAAc"}
|
package/types/tuple.d.ts
CHANGED
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
* accepts a single array argument.
|
|
7
7
|
*/
|
|
8
8
|
export default function _default(...schemas?: Schema[]): TupleSchema;
|
|
9
|
-
import Schema from
|
|
9
|
+
import Schema from './Schema';
|
|
10
10
|
declare class TupleSchema extends Schema {
|
|
11
11
|
constructor(schemas: any);
|
|
12
12
|
/**
|
|
13
13
|
* @private
|
|
14
14
|
*/
|
|
15
15
|
private setup;
|
|
16
|
-
loose():
|
|
16
|
+
loose(): this;
|
|
17
17
|
}
|
|
18
18
|
export {};
|
|
19
19
|
//# sourceMappingURL=tuple.d.ts.map
|
package/types/tuple.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tuple.d.ts","sourceRoot":"","sources":["../src/tuple.js"],"names":[],"mappings":"AAsFA;;;;;;GAMG;AACH,8CAJc,MAAM,
|
|
1
|
+
{"version":3,"file":"tuple.d.ts","sourceRoot":"","sources":["../src/tuple.js"],"names":[],"mappings":"AAsFA;;;;;;GAMG;AACH,8CAJc,MAAM,EAAA,eASnB;mBAlGkB,UAAU;AAG7B;IACE,0BAGC;IAED;;OAEG;IACH,cAoDC;IAED,cAEC;CAgBF"}
|