thesimplevalidation 1.1.2 → 2.0.0

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 (123) hide show
  1. package/README.md +158 -140
  2. package/dist/Validation.d.ts +16 -0
  3. package/dist/Validation.js +99 -0
  4. package/dist/Validation.js.map +1 -0
  5. package/{src/validation-errors-model.ts → dist/ValidationErrorsModel.d.ts} +3 -3
  6. package/dist/ValidationErrorsModel.js +2 -0
  7. package/dist/ValidationErrorsModel.js.map +1 -0
  8. package/{src/validation-model.ts → dist/ValidationModel.d.ts} +3 -3
  9. package/dist/ValidationModel.js +2 -0
  10. package/dist/ValidationModel.js.map +1 -0
  11. package/dist/ValidationPropertyResult.d.ts +4 -0
  12. package/dist/ValidationPropertyResult.js +2 -0
  13. package/dist/ValidationPropertyResult.js.map +1 -0
  14. package/dist/ValidationResult.d.ts +8 -0
  15. package/dist/ValidationResult.js +2 -0
  16. package/dist/ValidationResult.js.map +1 -0
  17. package/dist/ValidationScope.d.ts +15 -0
  18. package/dist/ValidationScope.js +95 -0
  19. package/dist/ValidationScope.js.map +1 -0
  20. package/dist/Validator.d.ts +10 -0
  21. package/dist/Validator.js +28 -0
  22. package/dist/Validator.js.map +1 -0
  23. package/{src/validator-setup.ts → dist/ValidatorSetup.d.ts} +4 -4
  24. package/dist/ValidatorSetup.js +2 -0
  25. package/dist/ValidatorSetup.js.map +1 -0
  26. package/dist/index.d.ts +8 -1
  27. package/dist/index.js +5 -6
  28. package/dist/index.js.map +1 -1
  29. package/dist/validators/boolean/BooleanValidator.d.ts +7 -0
  30. package/dist/validators/boolean/BooleanValidator.js +18 -0
  31. package/dist/validators/boolean/BooleanValidator.js.map +1 -0
  32. package/dist/validators/boolean/BooleanValidatorSetup.d.ts +4 -0
  33. package/dist/validators/boolean/BooleanValidatorSetup.js +2 -0
  34. package/dist/validators/boolean/BooleanValidatorSetup.js.map +1 -0
  35. package/dist/validators/index.d.ts +9 -0
  36. package/dist/validators/index.js +6 -0
  37. package/dist/validators/index.js.map +1 -0
  38. package/dist/validators/max/MaxValidator.d.ts +7 -0
  39. package/dist/validators/max/MaxValidator.js +26 -0
  40. package/dist/validators/max/MaxValidator.js.map +1 -0
  41. package/dist/validators/max/MaxValidatorSetup.d.ts +4 -0
  42. package/dist/validators/max/MaxValidatorSetup.js +2 -0
  43. package/dist/validators/max/MaxValidatorSetup.js.map +1 -0
  44. package/dist/validators/min/MinValidator.d.ts +7 -0
  45. package/dist/validators/min/MinValidator.js +27 -0
  46. package/dist/validators/min/MinValidator.js.map +1 -0
  47. package/dist/validators/min/MinValidatorSetup.d.ts +4 -0
  48. package/dist/validators/min/MinValidatorSetup.js +2 -0
  49. package/dist/validators/min/MinValidatorSetup.js.map +1 -0
  50. package/dist/validators/required/RequiredValidator.d.ts +7 -0
  51. package/dist/validators/required/RequiredValidator.js +21 -0
  52. package/dist/validators/required/RequiredValidator.js.map +1 -0
  53. package/dist/validators/simple/SimpleValidator.d.ts +7 -0
  54. package/dist/validators/simple/SimpleValidator.js +14 -0
  55. package/dist/validators/simple/SimpleValidator.js.map +1 -0
  56. package/dist/validators/simple/SimpleValidatorSetup.d.ts +4 -0
  57. package/dist/validators/simple/SimpleValidatorSetup.js +2 -0
  58. package/dist/validators/simple/SimpleValidatorSetup.js.map +1 -0
  59. package/package.json +13 -16
  60. package/.editorconfig +0 -11
  61. package/.travis.yml +0 -7
  62. package/.yo-rc.json +0 -9
  63. package/dist/src/index.d.ts +0 -8
  64. package/dist/src/index.js +0 -11
  65. package/dist/src/index.js.map +0 -1
  66. package/dist/src/validation-errors-model.d.ts +0 -3
  67. package/dist/src/validation-errors-model.js +0 -3
  68. package/dist/src/validation-errors-model.js.map +0 -1
  69. package/dist/src/validation-model.d.ts +0 -3
  70. package/dist/src/validation-model.js +0 -3
  71. package/dist/src/validation-model.js.map +0 -1
  72. package/dist/src/validation-property-result.d.ts +0 -4
  73. package/dist/src/validation-property-result.js +0 -3
  74. package/dist/src/validation-property-result.js.map +0 -1
  75. package/dist/src/validation-result.d.ts +0 -8
  76. package/dist/src/validation-result.js +0 -3
  77. package/dist/src/validation-result.js.map +0 -1
  78. package/dist/src/validation-scope.d.ts +0 -19
  79. package/dist/src/validation-scope.js +0 -197
  80. package/dist/src/validation-scope.js.map +0 -1
  81. package/dist/src/validator-setup.d.ts +0 -4
  82. package/dist/src/validator-setup.js +0 -3
  83. package/dist/src/validator-setup.js.map +0 -1
  84. package/dist/src/validator.d.ts +0 -8
  85. package/dist/src/validator.js +0 -68
  86. package/dist/src/validator.js.map +0 -1
  87. package/dist/src/validators/boolean/index.d.ts +0 -10
  88. package/dist/src/validators/boolean/index.js +0 -77
  89. package/dist/src/validators/boolean/index.js.map +0 -1
  90. package/dist/src/validators/index.d.ts +0 -5
  91. package/dist/src/validators/index.js +0 -13
  92. package/dist/src/validators/index.js.map +0 -1
  93. package/dist/src/validators/max/index.d.ts +0 -11
  94. package/dist/src/validators/max/index.js +0 -86
  95. package/dist/src/validators/max/index.js.map +0 -1
  96. package/dist/src/validators/min/index.d.ts +0 -11
  97. package/dist/src/validators/min/index.js +0 -87
  98. package/dist/src/validators/min/index.js.map +0 -1
  99. package/dist/src/validators/required/index.d.ts +0 -7
  100. package/dist/src/validators/required/index.js +0 -81
  101. package/dist/src/validators/required/index.js.map +0 -1
  102. package/dist/src/validators/simple/index.d.ts +0 -10
  103. package/dist/src/validators/simple/index.js +0 -73
  104. package/dist/src/validators/simple/index.js.map +0 -1
  105. package/index.ts +0 -1
  106. package/jest.config.js +0 -192
  107. package/src/index.ts +0 -9
  108. package/src/validation-property-result.ts +0 -5
  109. package/src/validation-result.ts +0 -11
  110. package/src/validation-scope.ts +0 -118
  111. package/src/validator.ts +0 -25
  112. package/src/validators/boolean/index.ts +0 -27
  113. package/src/validators/index.ts +0 -5
  114. package/src/validators/max/__tests__/index.test.ts +0 -92
  115. package/src/validators/max/index.ts +0 -34
  116. package/src/validators/min/__tests__/index.test.ts +0 -92
  117. package/src/validators/min/index.ts +0 -35
  118. package/src/validators/required/__tests__/index.test.ts +0 -229
  119. package/src/validators/required/index.ts +0 -24
  120. package/src/validators/simple/index.ts +0 -22
  121. package/thesimplevalidation.code-workspace +0 -10
  122. package/tsconfig.json +0 -23
  123. package/tslint.json +0 -18
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=validation-result.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validation-result.js","sourceRoot":"","sources":["../../src/validation-result.ts"],"names":[],"mappings":""}
@@ -1,19 +0,0 @@
1
- import { IValidationPropertyResult } from "./validation-property-result";
2
- import { IValidationResult } from "./validation-result";
3
- import { Validator } from "./validator";
4
- export declare class ValidationScope<TModel extends {}> {
5
- private setup;
6
- private originalModel;
7
- private modelInfo;
8
- constructor(setup: {
9
- getModel: () => TModel;
10
- onValidationChanged?: (result: IValidationResult<TModel>, scope: ValidationScope<TModel>) => Promise<void>;
11
- });
12
- useOriginal: (model: TModel) => ValidationScope<TModel>;
13
- useValidators: <K extends keyof TModel>(key: K, ...validators: Validator<TModel, K, import("./validator-setup").IValidatorSetup<TModel, K>>[]) => ValidationScope<TModel>;
14
- isPropertyDirty: (field: keyof TModel, key?: string) => boolean;
15
- getOriginalProperty: <K extends keyof TModel>(field: K) => TModel[K];
16
- isDirty: (...fields: (keyof TModel)[]) => boolean;
17
- isPropertyValid: <K extends keyof TModel>(field: K) => Promise<IValidationPropertyResult>;
18
- isValid: () => Promise<IValidationResult<TModel>>;
19
- }
@@ -1,197 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- var __spreadArrays = (this && this.__spreadArrays) || function () {
39
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
40
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
41
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
42
- r[k] = a[j];
43
- return r;
44
- };
45
- var __importDefault = (this && this.__importDefault) || function (mod) {
46
- return (mod && mod.__esModule) ? mod : { "default": mod };
47
- };
48
- Object.defineProperty(exports, "__esModule", { value: true });
49
- var lodash_clonedeep_1 = __importDefault(require("lodash.clonedeep"));
50
- var lodash_get_1 = __importDefault(require("lodash.get"));
51
- var lodash_isequal_1 = __importDefault(require("lodash.isequal"));
52
- var lodash_keys_1 = __importDefault(require("lodash.keys"));
53
- var ValidationScope = /** @class */ (function () {
54
- function ValidationScope(setup) {
55
- var _this = this;
56
- this.setup = setup;
57
- this.useOriginal = function (model) {
58
- _this.originalModel = lodash_clonedeep_1.default(model);
59
- return _this;
60
- };
61
- this.useValidators = function (key) {
62
- var validators = [];
63
- for (var _i = 1; _i < arguments.length; _i++) {
64
- validators[_i - 1] = arguments[_i];
65
- }
66
- _this.modelInfo[key] = {
67
- validators: validators
68
- };
69
- return _this;
70
- };
71
- this.isPropertyDirty = function (field, key) {
72
- if (key === void 0) { key = null; }
73
- var model = _this.setup.getModel();
74
- var originalField = _this.originalModel[field];
75
- var modelField = model[field];
76
- if (Array.isArray(originalField) && Array.isArray(modelField)) {
77
- if (originalField.length !== modelField.length)
78
- return true;
79
- for (var index = 0; index < originalField.length; index++) {
80
- if (originalField[index] === modelField[index])
81
- continue;
82
- if (key == null)
83
- return true;
84
- if (lodash_get_1.default(originalField[index], key) !== lodash_get_1.default(modelField[index], key))
85
- return true;
86
- }
87
- return false;
88
- }
89
- if (key == null)
90
- return !lodash_isequal_1.default(_this.originalModel[field], model[field]);
91
- return lodash_get_1.default(_this.originalModel[field], key) !== lodash_get_1.default(model[field], key);
92
- };
93
- this.getOriginalProperty = function (field) {
94
- return _this.originalModel[field];
95
- };
96
- this.isDirty = function () {
97
- var fields = [];
98
- for (var _i = 0; _i < arguments.length; _i++) {
99
- fields[_i] = arguments[_i];
100
- }
101
- var _loop_1 = function (property) {
102
- if (!_this.originalModel.hasOwnProperty(property))
103
- return "continue";
104
- if (fields && fields.length > 0) {
105
- if (!fields.some(function (x) { return x === property; }))
106
- return "continue";
107
- }
108
- if (_this.isPropertyDirty(property))
109
- return { value: true };
110
- };
111
- for (var property in _this.originalModel) {
112
- var state_1 = _loop_1(property);
113
- if (typeof state_1 === "object")
114
- return state_1.value;
115
- }
116
- return false;
117
- };
118
- this.isPropertyValid = function (field) { return __awaiter(_this, void 0, void 0, function () {
119
- var isValid, errors, model, value, _i, _a, validator, validatorResult;
120
- return __generator(this, function (_b) {
121
- switch (_b.label) {
122
- case 0:
123
- if (!(this.modelInfo[field] && this.modelInfo[field].validators && this.modelInfo[field].validators)) return [3 /*break*/, 5];
124
- isValid = true;
125
- errors = [];
126
- model = this.setup.getModel();
127
- value = model[field];
128
- _i = 0, _a = this.modelInfo[field].validators;
129
- _b.label = 1;
130
- case 1:
131
- if (!(_i < _a.length)) return [3 /*break*/, 4];
132
- validator = _a[_i];
133
- return [4 /*yield*/, validator.isValid(value, model, field)];
134
- case 2:
135
- validatorResult = _b.sent();
136
- isValid = isValid && validatorResult.isValid;
137
- if (!validatorResult.isValid)
138
- errors = __spreadArrays(errors, validatorResult.errors);
139
- _b.label = 3;
140
- case 3:
141
- _i++;
142
- return [3 /*break*/, 1];
143
- case 4: return [2 /*return*/, {
144
- isValid: isValid,
145
- errors: errors
146
- }];
147
- case 5: return [2 /*return*/, {
148
- isValid: true,
149
- errors: []
150
- }];
151
- }
152
- });
153
- }); };
154
- this.isValid = function () { return __awaiter(_this, void 0, void 0, function () {
155
- var properties, result, _i, properties_1, property, propertyValidationResult;
156
- return __generator(this, function (_a) {
157
- switch (_a.label) {
158
- case 0:
159
- properties = lodash_keys_1.default(this.setup.getModel());
160
- result = {
161
- isValid: true,
162
- errors: [],
163
- properties: {}
164
- };
165
- _i = 0, properties_1 = properties;
166
- _a.label = 1;
167
- case 1:
168
- if (!(_i < properties_1.length)) return [3 /*break*/, 4];
169
- property = properties_1[_i];
170
- return [4 /*yield*/, this.isPropertyValid(property)];
171
- case 2:
172
- propertyValidationResult = _a.sent();
173
- result.isValid = result.isValid && propertyValidationResult.isValid;
174
- result.properties[property] = propertyValidationResult;
175
- if (!propertyValidationResult.isValid)
176
- result.errors = __spreadArrays(result.errors, propertyValidationResult.errors);
177
- _a.label = 3;
178
- case 3:
179
- _i++;
180
- return [3 /*break*/, 1];
181
- case 4:
182
- if (!(this.setup.onValidationChanged != null)) return [3 /*break*/, 6];
183
- return [4 /*yield*/, this.setup.onValidationChanged(result, this)];
184
- case 5:
185
- _a.sent();
186
- _a.label = 6;
187
- case 6: return [2 /*return*/, result];
188
- }
189
- });
190
- }); };
191
- this.originalModel = lodash_clonedeep_1.default(setup.getModel());
192
- this.modelInfo = {};
193
- }
194
- return ValidationScope;
195
- }());
196
- exports.ValidationScope = ValidationScope;
197
- //# sourceMappingURL=validation-scope.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validation-scope.js","sourceRoot":"","sources":["../../src/validation-scope.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sEAAyC;AACzC,0DAA6B;AAC7B,kEAAqC;AACrC,4DAA+B;AAK/B;IAQI,yBAAoB,KAGnB;QAHD,iBAMC;QANmB,UAAK,GAAL,KAAK,CAGxB;QAKM,gBAAW,GAAG,UAAC,KAAa;YAC/B,KAAI,CAAC,aAAa,GAAG,0BAAS,CAAC,KAAK,CAAC,CAAC;YACtC,OAAO,KAAI,CAAC;QAChB,CAAC,CAAA;QAEM,kBAAa,GAAG,UAAyB,GAAM;YAAE,oBAA0C;iBAA1C,UAA0C,EAA1C,qBAA0C,EAA1C,IAA0C;gBAA1C,mCAA0C;;YAC9F,KAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG;gBAClB,UAAU,EAAE,UAAU;aACzB,CAAC;YACF,OAAO,KAAI,CAAC;QAChB,CAAC,CAAA;QAEM,oBAAe,GAAG,UAAC,KAAmB,EA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a,GAAG,0BAAS,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,SAAS,GAAG,EAAS,CAAC;IAC/B,CAAC;IA+FL,sBAAC;AAAD,CAAC,AA7GD,IA6GC;AA7GY,0CAAe"}
@@ -1,4 +0,0 @@
1
- export interface IValidatorSetup<TModel, K extends keyof TModel> {
2
- isDisabled?: (value: TModel[K]) => boolean;
3
- getErrors?: (value: TModel[K]) => string[];
4
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=validator-setup.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validator-setup.js","sourceRoot":"","sources":["../../src/validator-setup.ts"],"names":[],"mappings":""}
@@ -1,8 +0,0 @@
1
- import { IValidationPropertyResult } from "./validation-property-result";
2
- import { IValidatorSetup } from "./validator-setup";
3
- export declare abstract class Validator<TModel, K extends keyof TModel, TSetup extends IValidatorSetup<TModel, K> = IValidatorSetup<TModel, K>> {
4
- protected setup: TSetup;
5
- constructor(setup: TSetup);
6
- isValid: (value: TModel[K], model: TModel, field: K) => Promise<IValidationPropertyResult>;
7
- protected abstract isValidInternal(value: TModel[K], model: TModel, field: K): Promise<IValidationPropertyResult>;
8
- }
@@ -1,68 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- var Validator = /** @class */ (function () {
40
- function Validator(setup) {
41
- var _this = this;
42
- this.setup = setup;
43
- this.isValid = function (value, model, field) { return __awaiter(_this, void 0, void 0, function () {
44
- var result;
45
- return __generator(this, function (_a) {
46
- switch (_a.label) {
47
- case 0:
48
- if (this.setup.isDisabled != null && this.setup.isDisabled(value)) {
49
- return [2 /*return*/, {
50
- isValid: true,
51
- errors: []
52
- }];
53
- }
54
- return [4 /*yield*/, this.isValidInternal(value, model, field)];
55
- case 1:
56
- result = _a.sent();
57
- if (result.isValid !== true && this.setup.getErrors != null) {
58
- result.errors = this.setup.getErrors(value);
59
- }
60
- return [2 /*return*/, result];
61
- }
62
- });
63
- }); };
64
- }
65
- return Validator;
66
- }());
67
- exports.Validator = Validator;
68
- //# sourceMappingURL=validator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validator.js","sourceRoot":"","sources":["../../src/validator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;IAEI,mBAAsB,KAAa;QAAnC,iBAAwC;QAAlB,UAAK,GAAL,KAAK,CAAQ;QAE5B,YAAO,GAAG,UAAO,KAAgB,EAAE,KAAa,EAAE,KAAQ;;;;;wBAC7D,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,IAAI,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;4BAC/D,sBAAO;oCACH,OAAO,EAAE,IAAI;oCACb,MAAM,EAAE,EAAE;iCACb,EAAC;yBACL;wBAEyC,qBAAM,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,EAAA;;wBAAnF,MAAM,GAA8B,SAA+C;wBACzF,IAAI,MAAM,CAAC,OAAO,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,IAAI,IAAI,EAAE;4BACzD,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;yBAC/C;wBAED,sBAAO,MAAM,EAAC;;;aACjB,CAAA;IAhBsC,CAAC;IAmB5C,gBAAC;AAAD,CAAC,AArBD,IAqBC;AArBqB,8BAAS"}
@@ -1,10 +0,0 @@
1
- import { IValidationPropertyResult } from "../../validation-property-result";
2
- import { IValidatorSetup } from "../../validator-setup";
3
- import { Validator } from "../../validator";
4
- export interface IBooleanValidatorSetup<TModel, K extends keyof TModel> extends IValidatorSetup<TModel, K> {
5
- target: () => boolean;
6
- }
7
- export declare class BooleanValidator<TModel, K extends keyof TModel> extends Validator<TModel, K, IBooleanValidatorSetup<TModel, K>> {
8
- constructor(setup: IBooleanValidatorSetup<TModel, K>);
9
- isValidInternal(value: TModel[K]): Promise<IValidationPropertyResult>;
10
- }
@@ -1,77 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- extendStatics(d, b);
11
- function __() { this.constructor = d; }
12
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
- };
14
- })();
15
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
16
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
17
- return new (P || (P = Promise))(function (resolve, reject) {
18
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
19
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
20
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
21
- step((generator = generator.apply(thisArg, _arguments || [])).next());
22
- });
23
- };
24
- var __generator = (this && this.__generator) || function (thisArg, body) {
25
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
26
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
27
- function verb(n) { return function (v) { return step([n, v]); }; }
28
- function step(op) {
29
- if (f) throw new TypeError("Generator is already executing.");
30
- while (_) try {
31
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
32
- if (y = 0, t) op = [op[0] & 2, t.value];
33
- switch (op[0]) {
34
- case 0: case 1: t = op; break;
35
- case 4: _.label++; return { value: op[1], done: false };
36
- case 5: _.label++; y = op[1]; op = [0]; continue;
37
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
38
- default:
39
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
40
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
41
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
42
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
43
- if (t[2]) _.ops.pop();
44
- _.trys.pop(); continue;
45
- }
46
- op = body.call(thisArg, _);
47
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
48
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
49
- }
50
- };
51
- Object.defineProperty(exports, "__esModule", { value: true });
52
- var validator_1 = require("../../validator");
53
- var BooleanValidator = /** @class */ (function (_super) {
54
- __extends(BooleanValidator, _super);
55
- function BooleanValidator(setup) {
56
- return _super.call(this, setup) || this;
57
- }
58
- BooleanValidator.prototype.isValidInternal = function (value) {
59
- return __awaiter(this, void 0, void 0, function () {
60
- var isValid, targetValue;
61
- return __generator(this, function (_a) {
62
- isValid = true;
63
- targetValue = this.setup.target();
64
- if (value != null && typeof value === "boolean") {
65
- isValid = targetValue === value;
66
- }
67
- return [2 /*return*/, {
68
- isValid: isValid,
69
- errors: []
70
- }];
71
- });
72
- });
73
- };
74
- return BooleanValidator;
75
- }(validator_1.Validator));
76
- exports.BooleanValidator = BooleanValidator;
77
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/validators/boolean/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,6CAA4C;AAM5C;IAAsE,oCAAuD;IACzH,0BAAY,KAAwC;eAChD,kBAAM,KAAK,CAAC;IAChB,CAAC;IAEY,0CAAe,GAA5B,UAA6B,KAAgB;;;;gBACrC,OAAO,GAAY,IAAI,CAAC;gBACtB,WAAW,GAAY,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;gBAEjD,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE;oBAC7C,OAAO,GAAG,WAAW,KAAK,KAAK,CAAC;iBACnC;gBAED,sBAAO;wBACH,OAAO,EAAE,OAAO;wBAChB,MAAM,EAAE,EAAE;qBACb,EAAC;;;KACL;IACL,uBAAC;AAAD,CAAC,AAlBD,CAAsE,qBAAS,GAkB9E;AAlBY,4CAAgB"}
@@ -1,5 +0,0 @@
1
- export { SimpleValidator, ISimpleValidatorSetup } from "./simple";
2
- export { BooleanValidator, IBooleanValidatorSetup } from "./boolean";
3
- export { RequiredValidator } from "./required";
4
- export { MinValidator, IMinValidatorSetup } from "./min";
5
- export { MaxValidator, IMaxValidatorSetup } from "./max";
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var simple_1 = require("./simple");
4
- exports.SimpleValidator = simple_1.SimpleValidator;
5
- var boolean_1 = require("./boolean");
6
- exports.BooleanValidator = boolean_1.BooleanValidator;
7
- var required_1 = require("./required");
8
- exports.RequiredValidator = required_1.RequiredValidator;
9
- var min_1 = require("./min");
10
- exports.MinValidator = min_1.MinValidator;
11
- var max_1 = require("./max");
12
- exports.MaxValidator = max_1.MaxValidator;
13
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/validators/index.ts"],"names":[],"mappings":";;AAAA,mCAAkE;AAAzD,mCAAA,eAAe,CAAA;AACxB,qCAAqE;AAA5D,qCAAA,gBAAgB,CAAA;AACzB,uCAA+C;AAAtC,uCAAA,iBAAiB,CAAA;AAC1B,6BAAyD;AAAhD,6BAAA,YAAY,CAAA;AACrB,6BAAyD;AAAhD,6BAAA,YAAY,CAAA"}
@@ -1,11 +0,0 @@
1
- import { IValidatorSetup } from "../../validator-setup";
2
- import { IValidationPropertyResult } from "../../validation-property-result";
3
- import { Validator } from "../../validator";
4
- export interface IMaxValidatorSetup<TModel, K extends keyof TModel> extends IValidatorSetup<TModel, K> {
5
- maxValue: () => number;
6
- converter?: (val: TModel[K]) => unknown;
7
- }
8
- export declare class MaxValidator<TModel, K extends keyof TModel> extends Validator<TModel, K, IMaxValidatorSetup<TModel, K>> {
9
- constructor(setup: IMaxValidatorSetup<TModel, K>);
10
- isValidInternal(value: TModel[K]): Promise<IValidationPropertyResult>;
11
- }
@@ -1,86 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- extendStatics(d, b);
11
- function __() { this.constructor = d; }
12
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
- };
14
- })();
15
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
16
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
17
- return new (P || (P = Promise))(function (resolve, reject) {
18
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
19
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
20
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
21
- step((generator = generator.apply(thisArg, _arguments || [])).next());
22
- });
23
- };
24
- var __generator = (this && this.__generator) || function (thisArg, body) {
25
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
26
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
27
- function verb(n) { return function (v) { return step([n, v]); }; }
28
- function step(op) {
29
- if (f) throw new TypeError("Generator is already executing.");
30
- while (_) try {
31
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
32
- if (y = 0, t) op = [op[0] & 2, t.value];
33
- switch (op[0]) {
34
- case 0: case 1: t = op; break;
35
- case 4: _.label++; return { value: op[1], done: false };
36
- case 5: _.label++; y = op[1]; op = [0]; continue;
37
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
38
- default:
39
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
40
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
41
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
42
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
43
- if (t[2]) _.ops.pop();
44
- _.trys.pop(); continue;
45
- }
46
- op = body.call(thisArg, _);
47
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
48
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
49
- }
50
- };
51
- Object.defineProperty(exports, "__esModule", { value: true });
52
- var validator_1 = require("../../validator");
53
- var MaxValidator = /** @class */ (function (_super) {
54
- __extends(MaxValidator, _super);
55
- function MaxValidator(setup) {
56
- return _super.call(this, setup) || this;
57
- }
58
- MaxValidator.prototype.isValidInternal = function (value) {
59
- return __awaiter(this, void 0, void 0, function () {
60
- var isValid, val, maxValue;
61
- return __generator(this, function (_a) {
62
- isValid = true;
63
- val = this.setup.converter ? this.setup.converter(value) : value;
64
- if (val != null) {
65
- maxValue = this.setup.maxValue();
66
- if (Array.isArray(val)) {
67
- isValid = val.length <= maxValue;
68
- }
69
- else if (typeof val === "string") {
70
- isValid = val.length <= maxValue;
71
- }
72
- else if (typeof val === "number") {
73
- isValid = val <= maxValue;
74
- }
75
- }
76
- return [2 /*return*/, {
77
- isValid: isValid,
78
- errors: []
79
- }];
80
- });
81
- });
82
- };
83
- return MaxValidator;
84
- }(validator_1.Validator));
85
- exports.MaxValidator = MaxValidator;
86
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/validators/max/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,6CAA4C;AAO5C;IAAkE,gCAAmD;IACjH,sBAAY,KAAoC;eAC5C,kBAAM,KAAK,CAAC;IAChB,CAAC;IAEY,sCAAe,GAA5B,UAA6B,KAAgB;;;;gBACrC,OAAO,GAAY,IAAI,CAAC;gBACtB,GAAG,GAAY,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;gBAChF,IAAI,GAAG,IAAI,IAAI,EAAE;oBACP,QAAQ,GAAW,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;oBAC/C,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;wBACpB,OAAO,GAAG,GAAG,CAAC,MAAM,IAAI,QAAQ,CAAC;qBACpC;yBAAM,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;wBAChC,OAAO,GAAG,GAAG,CAAC,MAAM,IAAI,QAAQ,CAAC;qBACpC;yBAAM,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;wBAChC,OAAO,GAAG,GAAG,IAAI,QAAQ,CAAC;qBAC7B;iBACJ;gBAED,sBAAO;wBACH,OAAO,EAAE,OAAO;wBAChB,MAAM,EAAE,EAAE;qBACb,EAAC;;;KACL;IACL,mBAAC;AAAD,CAAC,AAxBD,CAAkE,qBAAS,GAwB1E;AAxBY,oCAAY"}
@@ -1,11 +0,0 @@
1
- import { IValidationPropertyResult } from "../../validation-property-result";
2
- import { IValidatorSetup } from "../../validator-setup";
3
- import { Validator } from "../../validator";
4
- export interface IMinValidatorSetup<TModel, K extends keyof TModel> extends IValidatorSetup<TModel, K> {
5
- minValue: () => number;
6
- converter?: (val: TModel[K]) => unknown;
7
- }
8
- export declare class MinValidator<TModel, K extends keyof TModel> extends Validator<TModel, K, IMinValidatorSetup<TModel, K>> {
9
- constructor(setup: IMinValidatorSetup<TModel, K>);
10
- isValidInternal(value: TModel[K]): Promise<IValidationPropertyResult>;
11
- }