1 | "use strict";
|
2 |
|
3 | var _interopRequireDefault = require("@babel/runtime/helpers/builtin/interopRequireDefault");
|
4 |
|
5 | exports.__esModule = true;
|
6 | exports.default = exports.array = exports.object = exports.boolean = exports.date = exports.number = exports.string = exports.mixed = void 0;
|
7 |
|
8 | var _printValue = _interopRequireDefault(require("./util/printValue"));
|
9 |
|
10 | var mixed = {
|
11 | default: '${path} is invalid',
|
12 | required: '${path} is a required field',
|
13 | oneOf: '${path} must be one of the following values: ${values}',
|
14 | notOneOf: '${path} must not be one of the following values: ${values}',
|
15 | notType: function notType(_ref) {
|
16 | var path = _ref.path,
|
17 | type = _ref.type,
|
18 | value = _ref.value,
|
19 | originalValue = _ref.originalValue;
|
20 | var isCast = originalValue != null && originalValue !== value;
|
21 | var msg = path + " must be a `" + type + "` type, " + ("but the final value was: `" + (0, _printValue.default)(value, true) + "`") + (isCast ? " (cast from the value `" + (0, _printValue.default)(originalValue, true) + "`)." : '.');
|
22 |
|
23 | if (value === null) {
|
24 | msg += "\n If \"null\" is intended as an empty value be sure to mark the schema as `.nullable()`";
|
25 | }
|
26 |
|
27 | return msg;
|
28 | }
|
29 | };
|
30 | exports.mixed = mixed;
|
31 | var string = {
|
32 | length: '${path} must be exactly ${length} characters',
|
33 | min: '${path} must be at least ${min} characters',
|
34 | max: '${path} must be at most ${max} characters',
|
35 | matches: '${path} must match the following: "${regex}"',
|
36 | email: '${path} must be a valid email',
|
37 | url: '${path} must be a valid URL',
|
38 | trim: '${path} must be a trimmed string',
|
39 | lowercase: '${path} must be a lowercase string',
|
40 | uppercase: '${path} must be a upper case string'
|
41 | };
|
42 | exports.string = string;
|
43 | var number = {
|
44 | min: '${path} must be greater than or equal to ${min}',
|
45 | max: '${path} must be less than or equal to ${max}',
|
46 | lessThan: '${path} must be less than ${less}',
|
47 | moreThan: '${path} must be greater than ${more}',
|
48 | notEqual: '${path} must be not equal to ${notEqual}',
|
49 | positive: '${path} must be a positive number',
|
50 | negative: '${path} must be a negative number',
|
51 | integer: '${path} must be an integer'
|
52 | };
|
53 | exports.number = number;
|
54 | var date = {
|
55 | min: '${path} field must be later than ${min}',
|
56 | max: '${path} field must be at earlier than ${max}'
|
57 | };
|
58 | exports.date = date;
|
59 | var boolean = {};
|
60 | exports.boolean = boolean;
|
61 | var object = {
|
62 | noUnknown: '${path} field cannot have keys not specified in the object shape'
|
63 | };
|
64 | exports.object = object;
|
65 | var array = {
|
66 | min: '${path} field must have at least ${min} items',
|
67 | max: '${path} field must have less than or equal to ${max} items'
|
68 | };
|
69 | exports.array = array;
|
70 | var _default = {
|
71 | mixed: mixed,
|
72 | string: string,
|
73 | number: number,
|
74 | date: date,
|
75 | object: object,
|
76 | array: array,
|
77 | boolean: boolean
|
78 | };
|
79 | exports.default = _default; |
\ | No newline at end of file |