@decaf-ts/decorator-validation 1.5.8 → 1.5.10

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.
Files changed (212) hide show
  1. package/LICENSE.md +0 -0
  2. package/README.md +0 -0
  3. package/dist/decorator-validation.js +1 -1
  4. package/dist/decorator-validation.js.LICENSE.txt +0 -0
  5. package/dist/esm/decorator-validation.js +1 -1
  6. package/dist/esm/decorator-validation.js.LICENSE.txt +0 -0
  7. package/{lib/esm → dist/types}/index.d.ts +1 -1
  8. package/{lib/esm → dist/types}/model/Model.d.ts +1 -0
  9. package/{lib/esm → dist/types}/model/ModelErrorDefinition.d.ts +0 -0
  10. package/{lib/esm → dist/types}/model/constants.d.ts +0 -0
  11. package/{lib/esm → dist/types}/model/construction.d.ts +0 -0
  12. package/{lib/esm → dist/types}/model/decorators.d.ts +0 -0
  13. package/{lib/esm → dist/types}/model/index.d.ts +0 -1
  14. package/{lib/esm → dist/types}/model/types.d.ts +0 -0
  15. package/{lib/esm → dist/types}/model/validation.d.ts +0 -0
  16. package/{lib/esm → dist/types}/utils/constants.d.ts +0 -0
  17. package/{lib/esm → dist/types}/utils/dates.d.ts +0 -0
  18. package/{lib/esm → dist/types}/utils/decorators.d.ts +0 -0
  19. package/{lib → dist/types}/utils/hashing.d.ts +0 -14
  20. package/{lib → dist/types}/utils/index.d.ts +1 -0
  21. package/{lib/esm → dist/types}/utils/registry.d.ts +0 -0
  22. package/{lib → dist/types}/utils/serialization.d.ts +4 -30
  23. package/{lib/esm → dist/types}/utils/strings.d.ts +0 -0
  24. package/dist/types/utils/types.d.ts +29 -0
  25. package/{lib → dist/types}/validation/Validation.d.ts +1 -1
  26. package/{lib → dist/types}/validation/Validators/DateValidator.d.ts +1 -1
  27. package/{lib → dist/types}/validation/Validators/EmailValidator.d.ts +1 -1
  28. package/{lib → dist/types}/validation/Validators/ListValidator.d.ts +1 -1
  29. package/{lib → dist/types}/validation/Validators/MaxLengthValidator.d.ts +1 -1
  30. package/{lib/esm → dist/types}/validation/Validators/MaxValidator.d.ts +1 -1
  31. package/{lib/esm → dist/types}/validation/Validators/MinLengthValidator.d.ts +1 -1
  32. package/{lib/esm → dist/types}/validation/Validators/MinValidator.d.ts +1 -1
  33. package/{lib/esm → dist/types}/validation/Validators/PasswordValidator.d.ts +1 -1
  34. package/{lib → dist/types}/validation/Validators/PatternValidator.d.ts +1 -1
  35. package/{lib/esm → dist/types}/validation/Validators/RequiredValidator.d.ts +1 -1
  36. package/{lib/esm → dist/types}/validation/Validators/StepValidator.d.ts +1 -1
  37. package/{lib → dist/types}/validation/Validators/TypeValidator.d.ts +1 -1
  38. package/{lib/esm → dist/types}/validation/Validators/URLValidator.d.ts +1 -1
  39. package/{lib/esm → dist/types}/validation/Validators/Validator.d.ts +1 -1
  40. package/{lib/esm → dist/types}/validation/Validators/ValidatorRegistry.d.ts +2 -2
  41. package/{lib/esm → dist/types}/validation/Validators/constants.d.ts +0 -0
  42. package/{lib/esm → dist/types}/validation/Validators/decorators.d.ts +0 -0
  43. package/dist/types/validation/Validators/index.d.ts +17 -0
  44. package/{lib/esm → dist/types}/validation/decorators.d.ts +0 -0
  45. package/{lib/esm → dist/types}/validation/index.d.ts +0 -0
  46. package/{lib/validation/Validators → dist/types/validation}/types.d.ts +49 -3
  47. package/lib/esm/index.js +3 -1
  48. package/lib/esm/model/Model.js +8 -1
  49. package/lib/esm/model/ModelErrorDefinition.js +2 -0
  50. package/lib/esm/model/constants.js +2 -0
  51. package/lib/esm/model/construction.js +2 -0
  52. package/lib/esm/model/decorators.js +2 -0
  53. package/lib/esm/model/index.js +2 -1
  54. package/lib/esm/model/types.js +2 -0
  55. package/lib/esm/model/validation.js +2 -0
  56. package/lib/esm/utils/constants.js +2 -0
  57. package/lib/esm/utils/dates.js +2 -0
  58. package/lib/esm/utils/decorators.js +2 -0
  59. package/lib/esm/utils/hashing.js +2 -17
  60. package/lib/esm/utils/index.js +3 -0
  61. package/lib/esm/utils/registry.js +2 -0
  62. package/lib/esm/utils/serialization.js +4 -1
  63. package/lib/esm/utils/strings.js +2 -0
  64. package/lib/esm/utils/types.js +3 -0
  65. package/lib/esm/validation/Validation.js +2 -0
  66. package/lib/esm/validation/Validators/DateValidator.js +2 -0
  67. package/lib/esm/validation/Validators/EmailValidator.js +2 -0
  68. package/lib/esm/validation/Validators/ListValidator.js +2 -0
  69. package/lib/esm/validation/Validators/MaxLengthValidator.js +2 -0
  70. package/lib/esm/validation/Validators/MaxValidator.js +2 -0
  71. package/lib/esm/validation/Validators/MinLengthValidator.js +2 -0
  72. package/lib/esm/validation/Validators/MinValidator.js +2 -0
  73. package/lib/esm/validation/Validators/PasswordValidator.js +2 -0
  74. package/lib/esm/validation/Validators/PatternValidator.js +2 -0
  75. package/lib/esm/validation/Validators/RequiredValidator.js +2 -0
  76. package/lib/esm/validation/Validators/StepValidator.js +2 -0
  77. package/lib/esm/validation/Validators/TypeValidator.js +2 -0
  78. package/lib/esm/validation/Validators/URLValidator.js +2 -0
  79. package/lib/esm/validation/Validators/Validator.js +2 -0
  80. package/lib/esm/validation/Validators/ValidatorRegistry.js +2 -0
  81. package/lib/esm/validation/Validators/constants.js +2 -0
  82. package/lib/esm/validation/Validators/decorators.js +2 -0
  83. package/lib/esm/validation/Validators/index.js +2 -35
  84. package/lib/esm/validation/decorators.js +2 -0
  85. package/lib/esm/validation/index.js +2 -0
  86. package/lib/esm/validation/types.js +2 -0
  87. package/lib/index.cjs +61 -0
  88. package/lib/model/Model.cjs +397 -0
  89. package/lib/model/ModelErrorDefinition.cjs +58 -0
  90. package/lib/model/constants.cjs +74 -0
  91. package/lib/model/construction.cjs +70 -0
  92. package/lib/model/decorators.cjs +69 -0
  93. package/lib/model/index.cjs +25 -0
  94. package/lib/model/types.cjs +4 -0
  95. package/lib/model/validation.cjs +140 -0
  96. package/lib/utils/constants.cjs +32 -0
  97. package/lib/utils/dates.cjs +253 -0
  98. package/lib/utils/decorators.cjs +24 -0
  99. package/lib/utils/hashing.cjs +90 -0
  100. package/lib/utils/index.cjs +26 -0
  101. package/lib/utils/registry.cjs +4 -0
  102. package/lib/utils/serialization.cjs +96 -0
  103. package/lib/utils/strings.cjs +37 -0
  104. package/lib/utils/types.cjs +4 -0
  105. package/lib/validation/Validation.cjs +77 -0
  106. package/lib/validation/Validators/DateValidator.cjs +59 -0
  107. package/lib/validation/Validators/EmailValidator.cjs +55 -0
  108. package/lib/validation/Validators/ListValidator.cjs +72 -0
  109. package/lib/validation/Validators/MaxLengthValidator.cjs +57 -0
  110. package/lib/validation/Validators/MaxValidator.cjs +62 -0
  111. package/lib/validation/Validators/MinLengthValidator.cjs +57 -0
  112. package/lib/validation/Validators/MinValidator.cjs +62 -0
  113. package/lib/validation/Validators/PasswordValidator.cjs +55 -0
  114. package/lib/validation/Validators/PatternValidator.cjs +75 -0
  115. package/lib/validation/Validators/RequiredValidator.cjs +62 -0
  116. package/lib/validation/Validators/StepValidator.cjs +57 -0
  117. package/lib/validation/Validators/TypeValidator.cjs +65 -0
  118. package/lib/validation/Validators/URLValidator.cjs +54 -0
  119. package/lib/validation/Validators/Validator.cjs +53 -0
  120. package/lib/validation/Validators/ValidatorRegistry.cjs +87 -0
  121. package/lib/validation/Validators/constants.cjs +139 -0
  122. package/lib/validation/Validators/decorators.cjs +30 -0
  123. package/lib/validation/Validators/index.cjs +35 -0
  124. package/lib/validation/decorators.cjs +306 -0
  125. package/lib/validation/{index.js → index.cjs} +6 -4
  126. package/lib/validation/types.cjs +4 -0
  127. package/package.json +2 -2
  128. package/lib/esm/model/utils.d.ts +0 -2
  129. package/lib/esm/model/utils.js +0 -8
  130. package/lib/esm/utils/hashing.d.ts +0 -52
  131. package/lib/esm/utils/index.d.ts +0 -7
  132. package/lib/esm/utils/serialization.d.ts +0 -79
  133. package/lib/esm/validation/Validation.d.ts +0 -51
  134. package/lib/esm/validation/Validators/DateValidator.d.ts +0 -28
  135. package/lib/esm/validation/Validators/EmailValidator.d.ts +0 -28
  136. package/lib/esm/validation/Validators/ListValidator.d.ts +0 -28
  137. package/lib/esm/validation/Validators/MaxLengthValidator.d.ts +0 -29
  138. package/lib/esm/validation/Validators/PatternValidator.d.ts +0 -37
  139. package/lib/esm/validation/Validators/TypeValidator.d.ts +0 -25
  140. package/lib/esm/validation/Validators/index.d.ts +0 -52
  141. package/lib/esm/validation/Validators/types.js +0 -1
  142. package/lib/esm/validation/types.d.ts +0 -46
  143. package/lib/index.d.ts +0 -42
  144. package/lib/index.js +0 -59
  145. package/lib/model/Model.d.ts +0 -203
  146. package/lib/model/Model.js +0 -389
  147. package/lib/model/ModelErrorDefinition.d.ts +0 -22
  148. package/lib/model/ModelErrorDefinition.js +0 -56
  149. package/lib/model/constants.d.ts +0 -56
  150. package/lib/model/constants.js +0 -72
  151. package/lib/model/construction.d.ts +0 -29
  152. package/lib/model/construction.js +0 -68
  153. package/lib/model/decorators.d.ts +0 -25
  154. package/lib/model/decorators.js +0 -67
  155. package/lib/model/index.d.ts +0 -8
  156. package/lib/model/index.js +0 -24
  157. package/lib/model/types.d.ts +0 -79
  158. package/lib/model/types.js +0 -2
  159. package/lib/model/utils.d.ts +0 -2
  160. package/lib/model/utils.js +0 -11
  161. package/lib/model/validation.d.ts +0 -14
  162. package/lib/model/validation.js +0 -138
  163. package/lib/utils/constants.d.ts +0 -26
  164. package/lib/utils/constants.js +0 -30
  165. package/lib/utils/dates.d.ts +0 -76
  166. package/lib/utils/dates.js +0 -251
  167. package/lib/utils/decorators.d.ts +0 -2
  168. package/lib/utils/decorators.js +0 -22
  169. package/lib/utils/hashing.js +0 -106
  170. package/lib/utils/index.js +0 -23
  171. package/lib/utils/registry.d.ts +0 -68
  172. package/lib/utils/registry.js +0 -2
  173. package/lib/utils/serialization.js +0 -93
  174. package/lib/utils/strings.d.ts +0 -25
  175. package/lib/utils/strings.js +0 -35
  176. package/lib/validation/Validation.js +0 -75
  177. package/lib/validation/Validators/DateValidator.js +0 -57
  178. package/lib/validation/Validators/EmailValidator.js +0 -53
  179. package/lib/validation/Validators/ListValidator.js +0 -70
  180. package/lib/validation/Validators/MaxLengthValidator.js +0 -55
  181. package/lib/validation/Validators/MaxValidator.d.ts +0 -28
  182. package/lib/validation/Validators/MaxValidator.js +0 -60
  183. package/lib/validation/Validators/MinLengthValidator.d.ts +0 -29
  184. package/lib/validation/Validators/MinLengthValidator.js +0 -55
  185. package/lib/validation/Validators/MinValidator.d.ts +0 -28
  186. package/lib/validation/Validators/MinValidator.js +0 -60
  187. package/lib/validation/Validators/PasswordValidator.d.ts +0 -28
  188. package/lib/validation/Validators/PasswordValidator.js +0 -53
  189. package/lib/validation/Validators/PatternValidator.js +0 -73
  190. package/lib/validation/Validators/RequiredValidator.d.ts +0 -28
  191. package/lib/validation/Validators/RequiredValidator.js +0 -60
  192. package/lib/validation/Validators/StepValidator.d.ts +0 -29
  193. package/lib/validation/Validators/StepValidator.js +0 -55
  194. package/lib/validation/Validators/TypeValidator.js +0 -63
  195. package/lib/validation/Validators/URLValidator.d.ts +0 -27
  196. package/lib/validation/Validators/URLValidator.js +0 -52
  197. package/lib/validation/Validators/Validator.d.ts +0 -41
  198. package/lib/validation/Validators/Validator.js +0 -51
  199. package/lib/validation/Validators/ValidatorRegistry.d.ts +0 -47
  200. package/lib/validation/Validators/ValidatorRegistry.js +0 -85
  201. package/lib/validation/Validators/constants.d.ts +0 -96
  202. package/lib/validation/Validators/constants.js +0 -137
  203. package/lib/validation/Validators/decorators.d.ts +0 -12
  204. package/lib/validation/Validators/decorators.js +0 -28
  205. package/lib/validation/Validators/index.d.ts +0 -52
  206. package/lib/validation/Validators/index.js +0 -69
  207. package/lib/validation/Validators/types.js +0 -2
  208. package/lib/validation/decorators.d.ts +0 -178
  209. package/lib/validation/decorators.js +0 -304
  210. package/lib/validation/index.d.ts +0 -4
  211. package/lib/validation/types.d.ts +0 -46
  212. package/lib/validation/types.js +0 -2
@@ -1,96 +0,0 @@
1
- /**
2
- * @summary The keys used for validation
3
- *
4
- * @property {string} REFLECT prefixes others
5
- * @property {string} REQUIRED sets as required
6
- * @property {string} MIN defines min value
7
- * @property {string} MAX defines max value
8
- * @property {string} STEP defines step
9
- * @property {string} MIN_LENGTH defines min length
10
- * @property {string} MAX_LENGTH defines max length
11
- * @property {string} PATTERN defines pattern
12
- * @property {string} EMAIL defines email
13
- * @property {string} URL defines url
14
- * @property {string} DATE defines date
15
- * @property {string} TYPE defines type
16
- * @property {string} PASSWORD defines password
17
- * @property {string} LIST defines list
18
- *
19
- * @constant ValidationKeys
20
- * @memberOf module:decorator-validation.Validation
21
- * @category Validation
22
- */
23
- export declare const ValidationKeys: {
24
- REFLECT: string;
25
- VALIDATOR: string;
26
- REQUIRED: string;
27
- MIN: string;
28
- MAX: string;
29
- STEP: string;
30
- MIN_LENGTH: string;
31
- MAX_LENGTH: string;
32
- PATTERN: string;
33
- EMAIL: string;
34
- URL: string;
35
- DATE: string;
36
- TYPE: string;
37
- PASSWORD: string;
38
- LIST: string;
39
- };
40
- /**
41
- * @summary list of month names
42
- * @description Stores month names. Can be changed for localization purposes
43
- *
44
- * @constant MONTH_NAMES
45
- * @memberOf module:decorator-validation.Validation
46
- * @category Validation
47
- */
48
- export declare const MONTH_NAMES: string[];
49
- /**
50
- * @summary list of names of days of the week
51
- * @description Stores names for days of the week. Can be changed for localization purposes
52
- *
53
- * @constant DAYS_OF_WEEK_NAMES
54
- * @memberOf module:decorator-validation.Validation
55
- * @category Validation
56
- */
57
- export declare const DAYS_OF_WEEK_NAMES: string[];
58
- /**
59
- * @summary Defines the default error messages
60
- *
61
- * @property {string} REQUIRED default error message
62
- * @property {string} MIN default error message
63
- * @property {string} MAX default error message
64
- * @property {string} MIN_LENGTH default error message
65
- * @property {string} MAX_LENGTH default error message
66
- * @property {string} PATTERN default error message
67
- * @property {string} EMAIL default error message
68
- * @property {string} URL default error message
69
- * @property {string} TYPE default error message
70
- * @property {string} STEP default error message
71
- * @property {string} DATE default error message
72
- * @property {string} DEFAULT default error message
73
- * @property {string} PASSWORD default error message
74
- * @property {string} LIST default error message
75
- * @property {string} LIST_INSIDE default error message
76
- * @property {string} MODEL_NOT_FOUND default error message
77
- *
78
- * @constant DEFAULT_ERROR_MESSAGES
79
- * @memberOf module:decorator-validation.Validation
80
- * @category Validation
81
- */
82
- export declare const DEFAULT_ERROR_MESSAGES: Record<string, string>;
83
- /**
84
- * @summary Defines the various default regexp patterns used
85
- *
86
- * @enum DEFAULT_PATTERNS
87
- * @memberOf module:decorator-validation.Validation
88
- * @category Validation
89
- */
90
- export declare const DEFAULT_PATTERNS: {
91
- EMAIL: RegExp;
92
- URL: RegExp;
93
- PASSWORD: {
94
- CHAR8_ONE_OF_EACH: RegExp;
95
- };
96
- };
@@ -1,137 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_PATTERNS = exports.DEFAULT_ERROR_MESSAGES = exports.DAYS_OF_WEEK_NAMES = exports.MONTH_NAMES = exports.ValidationKeys = void 0;
4
- const constants_1 = require("../../utils/constants");
5
- /**
6
- * @summary The keys used for validation
7
- *
8
- * @property {string} REFLECT prefixes others
9
- * @property {string} REQUIRED sets as required
10
- * @property {string} MIN defines min value
11
- * @property {string} MAX defines max value
12
- * @property {string} STEP defines step
13
- * @property {string} MIN_LENGTH defines min length
14
- * @property {string} MAX_LENGTH defines max length
15
- * @property {string} PATTERN defines pattern
16
- * @property {string} EMAIL defines email
17
- * @property {string} URL defines url
18
- * @property {string} DATE defines date
19
- * @property {string} TYPE defines type
20
- * @property {string} PASSWORD defines password
21
- * @property {string} LIST defines list
22
- *
23
- * @constant ValidationKeys
24
- * @memberOf module:decorator-validation.Validation
25
- * @category Validation
26
- */
27
- exports.ValidationKeys = {
28
- REFLECT: `${constants_1.ModelKeys.REFLECT}validation.`,
29
- VALIDATOR: "validator",
30
- REQUIRED: "required",
31
- MIN: "min",
32
- MAX: "max",
33
- STEP: "step",
34
- MIN_LENGTH: "minlength",
35
- MAX_LENGTH: "maxlength",
36
- PATTERN: "pattern",
37
- EMAIL: "email",
38
- URL: "url",
39
- DATE: "date",
40
- TYPE: "type",
41
- PASSWORD: "password",
42
- LIST: "list",
43
- };
44
- /**
45
- * @summary list of month names
46
- * @description Stores month names. Can be changed for localization purposes
47
- *
48
- * @constant MONTH_NAMES
49
- * @memberOf module:decorator-validation.Validation
50
- * @category Validation
51
- */
52
- exports.MONTH_NAMES = [
53
- "January",
54
- "February",
55
- "March",
56
- "April",
57
- "May",
58
- "June",
59
- "July",
60
- "August",
61
- "September",
62
- "October",
63
- "November",
64
- "December",
65
- ];
66
- /**
67
- * @summary list of names of days of the week
68
- * @description Stores names for days of the week. Can be changed for localization purposes
69
- *
70
- * @constant DAYS_OF_WEEK_NAMES
71
- * @memberOf module:decorator-validation.Validation
72
- * @category Validation
73
- */
74
- exports.DAYS_OF_WEEK_NAMES = [
75
- "Sunday",
76
- "Monday",
77
- "Tuesday",
78
- "Wednesday",
79
- "Thursday",
80
- "Friday",
81
- "Saturday",
82
- ];
83
- /**
84
- * @summary Defines the default error messages
85
- *
86
- * @property {string} REQUIRED default error message
87
- * @property {string} MIN default error message
88
- * @property {string} MAX default error message
89
- * @property {string} MIN_LENGTH default error message
90
- * @property {string} MAX_LENGTH default error message
91
- * @property {string} PATTERN default error message
92
- * @property {string} EMAIL default error message
93
- * @property {string} URL default error message
94
- * @property {string} TYPE default error message
95
- * @property {string} STEP default error message
96
- * @property {string} DATE default error message
97
- * @property {string} DEFAULT default error message
98
- * @property {string} PASSWORD default error message
99
- * @property {string} LIST default error message
100
- * @property {string} LIST_INSIDE default error message
101
- * @property {string} MODEL_NOT_FOUND default error message
102
- *
103
- * @constant DEFAULT_ERROR_MESSAGES
104
- * @memberOf module:decorator-validation.Validation
105
- * @category Validation
106
- */
107
- exports.DEFAULT_ERROR_MESSAGES = {
108
- REQUIRED: "This field is required",
109
- MIN: "The minimum value is {0}",
110
- MAX: "The maximum value is {0}",
111
- MIN_LENGTH: "The minimum length is {0}",
112
- MAX_LENGTH: "The maximum length is {0}",
113
- PATTERN: "The value does not match the pattern",
114
- EMAIL: "The value is not a valid email",
115
- URL: "The value is not a valid URL",
116
- TYPE: "Invalid type. Expected {0}, received {1}",
117
- STEP: "Invalid value. Not a step of {0}",
118
- DATE: "Invalid value. not a valid Date",
119
- DEFAULT: "There is an Error",
120
- PASSWORD: "Must be at least 8 characters and contain one of number, lower and upper case letters, and special character (@$!%*?&_-.,)",
121
- LIST: "Invalid list of {0}",
122
- MODEL_NOT_FOUND: "No model registered under {0}",
123
- };
124
- /**
125
- * @summary Defines the various default regexp patterns used
126
- *
127
- * @enum DEFAULT_PATTERNS
128
- * @memberOf module:decorator-validation.Validation
129
- * @category Validation
130
- */
131
- exports.DEFAULT_PATTERNS = {
132
- EMAIL: /[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?/,
133
- URL: /^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/i,
134
- PASSWORD: {
135
- CHAR8_ONE_OF_EACH: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&_\-.,])[A-Za-z\d@$!%*?&_\-.,]{8,}$/g,
136
- },
137
- };
@@ -1,12 +0,0 @@
1
- import { Validator } from "./Validator";
2
- /**
3
- * @summary Marks the class as a validator for a certain key.
4
- * @description Registers the class in the {@link Validation} with the provided key
5
- *
6
- * @param {string} keys the validation key
7
- *
8
- * @function validator
9
- *
10
- * @category Decorators
11
- */
12
- export declare function validator<T extends Validator>(...keys: string[]): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => void;
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validator = validator;
4
- const Validation_1 = require("../Validation");
5
- const constants_1 = require("./constants");
6
- const reflection_1 = require("@decaf-ts/reflection");
7
- /**
8
- * @summary Marks the class as a validator for a certain key.
9
- * @description Registers the class in the {@link Validation} with the provided key
10
- *
11
- * @param {string} keys the validation key
12
- *
13
- * @function validator
14
- *
15
- * @category Decorators
16
- */
17
- function validator(...keys) {
18
- return (0, reflection_1.apply)(((original) => {
19
- keys.forEach((k) => {
20
- Validation_1.Validation.register({
21
- validator: original,
22
- validationKey: k,
23
- save: true,
24
- });
25
- });
26
- return original;
27
- }), (0, reflection_1.metadata)(Validation_1.Validation.key(constants_1.ValidationKeys.VALIDATOR), keys));
28
- }
@@ -1,52 +0,0 @@
1
- import { DateValidator } from "./DateValidator";
2
- import { TypeValidator } from "./TypeValidator";
3
- import { PasswordValidator } from "./PasswordValidator";
4
- import { StepValidator } from "./StepValidator";
5
- import { URLValidator } from "./URLValidator";
6
- import { PatternValidator } from "./PatternValidator";
7
- import { MinValidator } from "./MinValidator";
8
- import { MinLengthValidator } from "./MinLengthValidator";
9
- import { MaxValidator } from "./MaxValidator";
10
- import { MaxLengthValidator } from "./MaxLengthValidator";
11
- import { RequiredValidator } from "./RequiredValidator";
12
- import { EmailValidator } from "./EmailValidator";
13
- import { ListValidator } from "./ListValidator";
14
- export * from "./constants";
15
- export * from "./DateValidator";
16
- export * from "./decorators";
17
- export * from "./EmailValidator";
18
- export * from "./ListValidator";
19
- export * from "./MaxLengthValidator";
20
- export * from "./MaxValidator";
21
- export * from "./MinLengthValidator";
22
- export * from "./MinValidator";
23
- export * from "./PasswordValidator";
24
- export * from "./PatternValidator";
25
- export * from "./RequiredValidator";
26
- export * from "./StepValidator";
27
- export * from "./types";
28
- export * from "./TypeValidator";
29
- export * from "./URLValidator";
30
- export * from "./Validator";
31
- export * from "./ValidatorRegistry";
32
- /**
33
- * @summary constant holding all {@link Validator}s
34
- * @constant Validators
35
- * @memberOf module:decorator-validation.Validation.Validators
36
- * @category Validation
37
- */
38
- export declare const Validators: {
39
- DateValidator: typeof DateValidator;
40
- EmailValidator: typeof EmailValidator;
41
- ListValidator: typeof ListValidator;
42
- MaxLengthValidator: typeof MaxLengthValidator;
43
- MaxValidator: typeof MaxValidator;
44
- MinLengthValidator: typeof MinLengthValidator;
45
- MinValidator: typeof MinValidator;
46
- PasswordValidator: typeof PasswordValidator;
47
- PatternValidator: typeof PatternValidator;
48
- RequiredValidator: typeof RequiredValidator;
49
- StepValidator: typeof StepValidator;
50
- TypeValidator: typeof TypeValidator;
51
- URLValidator: typeof URLValidator;
52
- };
@@ -1,69 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.Validators = void 0;
18
- const DateValidator_1 = require("./DateValidator");
19
- const TypeValidator_1 = require("./TypeValidator");
20
- const PasswordValidator_1 = require("./PasswordValidator");
21
- const StepValidator_1 = require("./StepValidator");
22
- const URLValidator_1 = require("./URLValidator");
23
- const PatternValidator_1 = require("./PatternValidator");
24
- const MinValidator_1 = require("./MinValidator");
25
- const MinLengthValidator_1 = require("./MinLengthValidator");
26
- const MaxValidator_1 = require("./MaxValidator");
27
- const MaxLengthValidator_1 = require("./MaxLengthValidator");
28
- const RequiredValidator_1 = require("./RequiredValidator");
29
- const EmailValidator_1 = require("./EmailValidator");
30
- const ListValidator_1 = require("./ListValidator");
31
- __exportStar(require("./constants"), exports);
32
- __exportStar(require("./DateValidator"), exports);
33
- __exportStar(require("./decorators"), exports);
34
- __exportStar(require("./EmailValidator"), exports);
35
- __exportStar(require("./ListValidator"), exports);
36
- __exportStar(require("./MaxLengthValidator"), exports);
37
- __exportStar(require("./MaxValidator"), exports);
38
- __exportStar(require("./MinLengthValidator"), exports);
39
- __exportStar(require("./MinValidator"), exports);
40
- __exportStar(require("./PasswordValidator"), exports);
41
- __exportStar(require("./PatternValidator"), exports);
42
- __exportStar(require("./RequiredValidator"), exports);
43
- __exportStar(require("./StepValidator"), exports);
44
- __exportStar(require("./types"), exports);
45
- __exportStar(require("./TypeValidator"), exports);
46
- __exportStar(require("./URLValidator"), exports);
47
- __exportStar(require("./Validator"), exports);
48
- __exportStar(require("./ValidatorRegistry"), exports);
49
- /**
50
- * @summary constant holding all {@link Validator}s
51
- * @constant Validators
52
- * @memberOf module:decorator-validation.Validation.Validators
53
- * @category Validation
54
- */
55
- exports.Validators = {
56
- DateValidator: DateValidator_1.DateValidator,
57
- EmailValidator: EmailValidator_1.EmailValidator,
58
- ListValidator: ListValidator_1.ListValidator,
59
- MaxLengthValidator: MaxLengthValidator_1.MaxLengthValidator,
60
- MaxValidator: MaxValidator_1.MaxValidator,
61
- MinLengthValidator: MinLengthValidator_1.MinLengthValidator,
62
- MinValidator: MinValidator_1.MinValidator,
63
- PasswordValidator: PasswordValidator_1.PasswordValidator,
64
- PatternValidator: PatternValidator_1.PatternValidator,
65
- RequiredValidator: RequiredValidator_1.RequiredValidator,
66
- StepValidator: StepValidator_1.StepValidator,
67
- TypeValidator: TypeValidator_1.TypeValidator,
68
- URLValidator: URLValidator_1.URLValidator,
69
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,178 +0,0 @@
1
- import "reflect-metadata";
2
- import { ModelConstructor } from "../model/types";
3
- /**
4
- * @summary Marks the property as required.
5
- * @description Validators to validate a decorated property must use key {@link ValidationKeys#REQUIRED}
6
- *
7
- * @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#REQUIRED}
8
- *
9
- * @function required
10
- *
11
- * @category Decorators
12
- */
13
- export declare function required(message?: string): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => void;
14
- /**
15
- * @summary Defines a minimum value for the property
16
- * @description Validators to validate a decorated property must use key {@link ValidationKeys#MIN}
17
- *
18
- * @param {number | Date} value
19
- * @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#MIN}
20
- *
21
- * @function min
22
- * @memberOf module:decorator-validation.Decorators.Validation
23
- * @category Decorators
24
- */
25
- export declare function min(value: number | Date | string, message?: string): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => void;
26
- /**
27
- * @summary Defines a maximum value for the property
28
- * @description Validators to validate a decorated property must use key {@link ValidationKeys#MAX}
29
- *
30
- * @param {number | Date} value
31
- * @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#MAX}
32
- *
33
- * @function max
34
- * @memberOf module:decorator-validation.Decorators.Validation
35
- * @category Decorators
36
- */
37
- export declare function max(value: number | Date | string, message?: string): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => void;
38
- /**
39
- * @summary Defines a step value for the property
40
- * @description Validators to validate a decorated property must use key {@link ValidationKeys#STEP}
41
- *
42
- * @param {number} value
43
- * @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#STEP}
44
- *
45
- * @function step
46
- * @memberOf module:decorator-validation.Decorators.Validation
47
- * @category Decorators
48
- */
49
- export declare function step(value: number, message?: string): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => void;
50
- /**
51
- * @summary Defines a minimum length for the property
52
- * @description Validators to validate a decorated property must use key {@link ValidationKeys#MIN_LENGTH}
53
- *
54
- * @param {string} value
55
- * @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#MIN_LENGTH}
56
- *
57
- * @function minlength
58
- * @memberOf module:decorator-validation.Decorators.Validation
59
- * @category Decorators
60
- */
61
- export declare function minlength(value: number, message?: string): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => void;
62
- /**
63
- * @summary Defines a maximum length for the property
64
- * @description Validators to validate a decorated property must use key {@link ValidationKeys#MAX_LENGTH}
65
- *
66
- * @param {string} value
67
- * @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#MAX_LENGTH}
68
- *
69
- * @function maxlength
70
- * @memberOf module:decorator-validation.Decorators.Validation
71
- * @category Decorators
72
- */
73
- export declare function maxlength(value: number, message?: string): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => void;
74
- /**
75
- * @summary Defines a RegExp pattern the property must respect
76
- * @description Validators to validate a decorated property must use key {@link ValidationKeys#PATTERN}
77
- *
78
- * @param {string} value
79
- * @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#PATTERN}
80
- *
81
- * @function pattern
82
- * @memberOf module:decorator-validation.Decorators.Validation
83
- * @category Decorators
84
- */
85
- export declare function pattern(value: RegExp | string, message?: string): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => void;
86
- /**
87
- * @summary Defines the property as an email
88
- * @description Validators to validate a decorated property must use key {@link ValidationKeys#EMAIL}
89
- *
90
- * @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#EMAIL}
91
- *
92
- * @function email
93
- * @memberOf module:decorator-validation.Decorators.Validation
94
- * @category Decorators
95
- */
96
- export declare function email(message?: string): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => void;
97
- /**
98
- * @summary Defines the property as an URL
99
- * @description Validators to validate a decorated property must use key {@link ValidationKeys#URL}
100
- *
101
- * @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#URL}
102
- *
103
- * @function url
104
- * @memberOf module:decorator-validation.Decorators.Validation
105
- * @category Decorators
106
- */
107
- export declare function url(message?: string): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => void;
108
- /**
109
- * @summary Enforces type verification
110
- * @description Validators to validate a decorated property must use key {@link ValidationKeys#TYPE}
111
- *
112
- * @param {string[] | string} types accepted types
113
- * @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#TYPE}
114
- *
115
- * @function type
116
- * @memberOf module:decorator-validation.Decorators.Validation
117
- * @category Decorators
118
- */
119
- export declare function type(types: string[] | string, message?: string): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => void;
120
- /**
121
- * @summary Date Handler Decorator
122
- * @description Validators to validate a decorated property must use key {@link ValidationKeys#DATE}
123
- *
124
- * Will enforce serialization according to the selected format
125
- *
126
- * @param {string} format accepted format according to {@link formatDate}
127
- * @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#DATE}
128
- * @param {Constructor<Validator>} [validator] the Validator to be used. Defaults to {@link DateValidator}
129
- *
130
- * @function date
131
- *
132
- * @memberOf module:decorator-validation.Decorators.Validation
133
- * @category Decorators
134
- */
135
- export declare function date(format?: string, message?: string): (target: Record<string, any>, propertyKey?: any) => any;
136
- /**
137
- * @summary Password Handler Decorator
138
- * @description Validators to validate a decorated property must use key {@link ValidationKeys#PASSWORD}
139
- *
140
- * @param {RegExp} [pattern] defaults to {@link PasswordPatterns#CHAR8_ONE_OF_EACH}
141
- * @param {string} [message] the error message. Defaults to {@link DEFAULT_ERROR_MESSAGES#PASSWORD}
142
- * @param {Constructor<Validator>} [validator] Defaults to {@link PasswordValidator}
143
- *
144
- * @function password
145
- *
146
- * @memberOf module:decorator-validation.Decorators.Validation
147
- * @category Decorators
148
- */
149
- export declare function password(pattern?: RegExp, message?: string): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => void;
150
- /**
151
- * @summary List Decorator
152
- * @description Also sets the {@link type} to the provided collection
153
- *
154
- * @param {ModelConstructor} clazz
155
- * @param {string} [collection] The collection being used. defaults to Array
156
- * @param {string} [message] defaults to {@link DEFAULT_ERROR_MESSAGES#LIST}
157
- * @param {Constructor<Validator>} [validator] defaults to {@link ListValidator}
158
- *
159
- * @function list
160
- *
161
- * @memberOf module:decorator-validation.Decorators.Validation
162
- * @category Decorators
163
- */
164
- export declare function list(clazz: ModelConstructor<any> | ModelConstructor<any>[], collection?: "Array" | "Set", message?: string): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => void;
165
- /**
166
- * @summary Set Decorator
167
- * @description Wrapper for {@link list} with the 'Set' Collection
168
- *
169
- * @param {ModelConstructor} clazz
170
- * @param {string} [message] defaults to {@link DEFAULT_ERROR_MESSAGES#LIST}
171
- * @param {Constructor<Validator>} [validator]
172
- *
173
- * @function set
174
- *
175
- * @memberOf module:decorator-validation.Decorators.Validation
176
- * @category Decorators
177
- */
178
- export declare function set(clazz: ModelConstructor<any>, message?: string): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => void;