Skip to content

Commit b8b4716

Browse files
committed
dependencies fixed and updated
1 parent 0e66238 commit b8b4716

File tree

9 files changed

+179
-6
lines changed

9 files changed

+179
-6
lines changed

dist/amd/Validation.js

+36
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,24 @@ define(["require", "exports", 'underscore', 'q', './Utils'], function(require, e
158158
enumerable: true,
159159
configurable: true
160160
});
161+
162+
ValidationResult.prototype.add = function (child) {
163+
this.add(child);
164+
return true;
165+
};
166+
ValidationResult.prototype.remove = function (child) {
167+
this.remove(child);
168+
return true;
169+
};
170+
ValidationResult.prototype.getChildren = function () {
171+
return this.Children;
172+
};
173+
ValidationResult.prototype.getName = function () {
174+
return this.Name;
175+
};
176+
ValidationResult.prototype.isItem = function () {
177+
return true;
178+
};
161179
return ValidationResult;
162180
})();
163181
_Validation.ValidationResult = ValidationResult;
@@ -305,6 +323,24 @@ define(["require", "exports", 'underscore', 'q', './Utils'], function(require, e
305323
this.traverse(node.Children[i], indent);
306324
}
307325
};
326+
327+
CompositeValidationResult.prototype.add = function (child) {
328+
this.add(child);
329+
return true;
330+
};
331+
CompositeValidationResult.prototype.remove = function (child) {
332+
this.remove(child);
333+
return true;
334+
};
335+
CompositeValidationResult.prototype.getChildren = function () {
336+
return this.Children;
337+
};
338+
CompositeValidationResult.prototype.getName = function () {
339+
return this.Name;
340+
};
341+
CompositeValidationResult.prototype.isItem = function () {
342+
return false;
343+
};
308344
return CompositeValidationResult;
309345
})();
310346
_Validation.CompositeValidationResult = CompositeValidationResult;

dist/business-rules-engine.js

+37-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! business-rules-engine, v.1.2.5 06-12-2014 */
1+
/*! business-rules-engine, v.1.2.7 22-02-2015 */
22
var __extends = this.__extends || function (d, b) {
33
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
44
function __() { this.constructor = d; }
@@ -162,6 +162,24 @@ var Validation;
162162
enumerable: true,
163163
configurable: true
164164
});
165+
166+
ValidationResult.prototype.add = function (child) {
167+
this.add(child);
168+
return true;
169+
};
170+
ValidationResult.prototype.remove = function (child) {
171+
this.remove(child);
172+
return true;
173+
};
174+
ValidationResult.prototype.getChildren = function () {
175+
return this.Children;
176+
};
177+
ValidationResult.prototype.getName = function () {
178+
return this.Name;
179+
};
180+
ValidationResult.prototype.isItem = function () {
181+
return true;
182+
};
165183
return ValidationResult;
166184
})();
167185
_Validation.ValidationResult = ValidationResult;
@@ -309,6 +327,24 @@ var Validation;
309327
this.traverse(node.Children[i], indent);
310328
}
311329
};
330+
331+
CompositeValidationResult.prototype.add = function (child) {
332+
this.add(child);
333+
return true;
334+
};
335+
CompositeValidationResult.prototype.remove = function (child) {
336+
this.remove(child);
337+
return true;
338+
};
339+
CompositeValidationResult.prototype.getChildren = function () {
340+
return this.Children;
341+
};
342+
CompositeValidationResult.prototype.getName = function () {
343+
return this.Name;
344+
};
345+
CompositeValidationResult.prototype.isItem = function () {
346+
return false;
347+
};
312348
return CompositeValidationResult;
313349
})();
314350
_Validation.CompositeValidationResult = CompositeValidationResult;

dist/business-rules-engine.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/commonjs/Validation.js

+36
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,24 @@ var Validation;
161161
enumerable: true,
162162
configurable: true
163163
});
164+
165+
ValidationResult.prototype.add = function (child) {
166+
this.add(child);
167+
return true;
168+
};
169+
ValidationResult.prototype.remove = function (child) {
170+
this.remove(child);
171+
return true;
172+
};
173+
ValidationResult.prototype.getChildren = function () {
174+
return this.Children;
175+
};
176+
ValidationResult.prototype.getName = function () {
177+
return this.Name;
178+
};
179+
ValidationResult.prototype.isItem = function () {
180+
return true;
181+
};
164182
return ValidationResult;
165183
})();
166184
_Validation.ValidationResult = ValidationResult;
@@ -308,6 +326,24 @@ var Validation;
308326
this.traverse(node.Children[i], indent);
309327
}
310328
};
329+
330+
CompositeValidationResult.prototype.add = function (child) {
331+
this.add(child);
332+
return true;
333+
};
334+
CompositeValidationResult.prototype.remove = function (child) {
335+
this.remove(child);
336+
return true;
337+
};
338+
CompositeValidationResult.prototype.getChildren = function () {
339+
return this.Children;
340+
};
341+
CompositeValidationResult.prototype.getName = function () {
342+
return this.Name;
343+
};
344+
CompositeValidationResult.prototype.isItem = function () {
345+
return false;
346+
};
311347
return CompositeValidationResult;
312348
})();
313349
_Validation.CompositeValidationResult = CompositeValidationResult;

dist/module/Validation.js

+36
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,24 @@ var Validation;
161161
enumerable: true,
162162
configurable: true
163163
});
164+
165+
ValidationResult.prototype.add = function (child) {
166+
this.add(child);
167+
return true;
168+
};
169+
ValidationResult.prototype.remove = function (child) {
170+
this.remove(child);
171+
return true;
172+
};
173+
ValidationResult.prototype.getChildren = function () {
174+
return this.Children;
175+
};
176+
ValidationResult.prototype.getName = function () {
177+
return this.Name;
178+
};
179+
ValidationResult.prototype.isItem = function () {
180+
return true;
181+
};
164182
return ValidationResult;
165183
})();
166184
_Validation.ValidationResult = ValidationResult;
@@ -308,6 +326,24 @@ var Validation;
308326
this.traverse(node.Children[i], indent);
309327
}
310328
};
329+
330+
CompositeValidationResult.prototype.add = function (child) {
331+
this.add(child);
332+
return true;
333+
};
334+
CompositeValidationResult.prototype.remove = function (child) {
335+
this.remove(child);
336+
return true;
337+
};
338+
CompositeValidationResult.prototype.getChildren = function () {
339+
return this.Children;
340+
};
341+
CompositeValidationResult.prototype.getName = function () {
342+
return this.Name;
343+
};
344+
CompositeValidationResult.prototype.isItem = function () {
345+
return false;
346+
};
311347
return CompositeValidationResult;
312348
})();
313349
_Validation.CompositeValidationResult = CompositeValidationResult;

dist/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "business-rules-engine",
3-
"version": "1.2.6",
3+
"version": "1.2.7",
44
"description": "business rules engine",
55
"main": "./commonjs/Validation",
66
"repository": {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "business-rules-engine",
3-
"version": "1.2.6",
3+
"version": "1.2.7",
44
"description": "business rules engine",
55
"main": "src/validation",
66
"scripts": {

src/validation/Validation.ts

+14-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ module Validation {
127127
* This class provides unit of information about error.
128128
* Implements composite design pattern to enable nesting of error information.
129129
*/
130-
export interface IValidationResult {
130+
export interface IValidationResult extends Utils.IComponent {
131131

132132
/**
133133
* The name of error collection.
@@ -520,6 +520,13 @@ module Validation {
520520
public get ErrorMessage(): string {
521521
return "";
522522
}
523+
524+
add(child:Utils.IComponent):boolean {this.add(child); return true; }
525+
remove(child:Utils.IComponent):boolean {this.remove(child); return true;}
526+
getChildren():Utils.IComponent[] {return this.Children;}
527+
getName():string {return this.Name}
528+
isItem():boolean {return true;}
529+
523530
}
524531

525532
/**
@@ -654,6 +661,12 @@ module Validation {
654661
}
655662

656663
}
664+
665+
add(child:Utils.IComponent):boolean {this.add(child); return true; }
666+
remove(child:Utils.IComponent):boolean {this.remove(child); return true;}
667+
getChildren():Utils.IComponent[] {return this.Children;}
668+
getName():string {return this.Name}
669+
isItem():boolean {return false;}
657670
}
658671

659672
/**

test/validation/rulesNested.ts

+16
Original file line numberDiff line numberDiff line change
@@ -257,13 +257,22 @@ describe('nested validation rules', function () {
257257
var result = this.MainValidator.Validate(this.Data);
258258
var promiseResult = this.MainValidator.ValidateAsync(this.Data);
259259

260+
261+
260262
var compDotObject = Utils.CompositeDotObject.Transform(this.MainValidator);
261263

262264
//verify
263265
promiseResult.then(function (response) {
264266

267+
var dotResult = Utils.CompositeDotObject.Transform(result);
268+
265269
//verify
266270
expect(response.HasErrors).to.equal(false);
271+
272+
expect(dotResult.Main.Person1.Contact.Email.HasErrors).to.equal(false);
273+
expect(dotResult.Main.Person1.Contact.Mobile.CountryCode.HasErrors).to.equal(false);
274+
275+
267276
expect(compDotObject.Main.Person1.Contact.Rules["Email"].HasErrors).to.equal(false);
268277
expect(compDotObject.Main.Person1.Contact.Mobile.Rules["CountryCode"].HasErrors).to.equal(false);
269278

@@ -290,9 +299,16 @@ describe('nested validation rules', function () {
290299

291300
//verify
292301
promiseResult.then(function (response) {
302+
var dotResult = Utils.CompositeDotObject.Transform(result);
293303

294304
//verify
295305
expect(response.HasErrors).to.equal(true);
306+
307+
308+
expect(dotResult.Main.Person1.Contact.Email.HasErrors).to.equal(true);
309+
expect(dotResult.Main.Person1.Contact.Mobile.CountryCode.HasErrors).to.equal(true);
310+
311+
296312
expect(compDotObject.Main.Person1.Contact.Rules["Email"].HasErrors).to.equal(true);
297313
expect(compDotObject.Main.Person1.Contact.Mobile.Rules["CountryCode"].HasErrors).to.equal(true);
298314

0 commit comments

Comments
 (0)