Skip to content

Commit

Permalink
chore(all): prepare release 0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed May 10, 2016
1 parent c6a0edc commit 2d310c1
Show file tree
Hide file tree
Showing 80 changed files with 1,647 additions and 1,282 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aurelia-validatejs",
"version": "0.2.1",
"version": "0.3.0",
"description": "This is a plugin that will allow using validate.js in your Aurelia application for expressive validation.",
"keywords": [
"aurelia",
Expand Down
111 changes: 111 additions & 0 deletions dist/amd/aurelia-validatejs.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
declare module 'aurelia-validatejs' {
import {
DOM
} from 'aurelia-pal';
import {
ValidationError
} from 'aurelia-validation';
import {
inject
} from 'aurelia-dependency-injection';
import {
metadata
} from 'aurelia-metadata';
import validate from 'validate.js';
export class ValidationRenderer {
renderErrors(node: any, relevantErrors: any): any;
unrenderErrors(node: any): any;
}
export class ValidationConfig {
__validationRules__: any;
addRule(key: any, rule: any): any;
validate(instance: any, reporter: any, key: any): any;
getValidationRules(): any;
aggregateValidationRules(): any;
}

//get __validationRules__ from class using metadata
//merge with any instance specific __validationRules__
export const validationMetadataKey: any;
export class ValidationObserver {
id: any;
callback: any;
reporter: any;
constructor(reporter: any, callback: any);
dispose(): any;
}
export class ValidationReporter {
callback: any;
__callbacks__: any;
subscribe(callback: any): any;
publish(errors: any): any;
destroyObserver(observer: any): any;
}
export class ValidationRule {
name: any;
config: any;
constructor(name: any, config: any);
validate(target: any, propName: any): any;
static date(config?: any): any;
static datetime(config?: any): any;
static email(config?: any): any;
static equality(config: any): any;
static exclusion(config: any): any;
static format(config: any): any;
static inclusion(config: any): any;
static lengthRule(config: any): any;
static numericality(config?: any): any;
static presence(config?: any): any;
static url(config?: any): any;
}
export function cleanResult(data: any): any;
export class ValidateBindingBehavior {
constructor(renderer: any);
bind(binding: any, source: any): any;
unbind(binding: any, source: any): any;

// let targetProperty = this.getTargetProperty(source);
// let target = this.getPropertyContext(source, targetProperty);
// let reporter = this.getReporter(source);
getTargetProperty(binding: any): any;
getPropertyContext(source: any, targetProperty: any): any;
getReporter(source: any): any;
}
export class ValidationEngine {
static getValidationReporter(instance: any): any;
}
export function observeProperty(target: any, key: any, descriptor: any, targetOrConfig: any, rule: any): any;
export class Validator {
object: any;
config: any;
constructor(object: any);
validate(prop: any): any;
getProperties(): any;
ensure(prop: any): any;
length(configuration: any): any;
presence(): any;
required(): any;
numericality(): any;
date(): any;
datetime(): any;
email(): any;
equality(configuration: any): any;
format(configuration: any): any;
inclusion(configuration: any): any;
exclusion(configuration: any): any;
url(): any;
}
export function base(targetOrConfig: any, key: any, descriptor: any, rule: any): any;
export function length(targetOrConfig: any, key: any, descriptor: any): any;
export function presence(targetOrConfig: any, key: any, descriptor: any): any;
export function required(targetOrConfig: any, key: any, descriptor: any): any;
export function date(targetOrConfig: any, key: any, descriptor: any): any;
export function datetime(targetOrConfig: any, key: any, descriptor: any): any;
export function email(targetOrConfig: any, key: any, descriptor: any): any;
export function equality(targetOrConfig: any, key: any, descriptor: any): any;
export function exclusion(targetOrConfig: any, key: any, descriptor: any): any;
export function inclusion(targetOrConfig: any, key: any, descriptor: any): any;
export function format(targetOrConfig: any, key: any, descriptor: any): any;
export function url(targetOrConfig: any, key: any, descriptor: any): any;
export function numericality(targetOrConfig: any, key: any, descriptor: any): any;
}
37 changes: 6 additions & 31 deletions dist/amd/base-decorator.js
Original file line number Diff line number Diff line change
@@ -1,43 +1,18 @@
define(['exports', 'aurelia-metadata', './validation-config', './validation-engine', 'aurelia-validation'], function (exports, _aureliaMetadata, _validationConfig, _validationEngine, _aureliaValidation) {
define(['exports', './property-observer'], function (exports, _propertyObserver) {
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.base = base;
function base(targetOrConfig, key, descriptor, Rule) {
var deco = function deco(target, key2, descriptor2) {
var config = _aureliaMetadata.metadata.getOrCreateOwn(_aureliaValidation.validationMetadataKey, _validationConfig.ValidationConfig, target);
config.addRule(key2, new Rule(targetOrConfig));

var innerPropertyName = '_' + key2;

if (descriptor2.initializer) {
target[innerPropertyName] = descriptor2.initializer();
}

delete descriptor2.writable;
delete descriptor2.initializer;

descriptor2.get = function () {
return this[innerPropertyName];
};
descriptor2.set = function (newValue) {
var reporter = _validationEngine.ValidationEngine.getValidationReporter(this);

this[innerPropertyName] = newValue;

config.validate(this, reporter);
};

descriptor2.get.dependencies = [innerPropertyName];
};

function base(targetOrConfig, key, descriptor, rule) {
if (key) {
var target = targetOrConfig;
targetOrConfig = null;
return deco(target, key, descriptor);
return (0, _propertyObserver.observeProperty)(target, key, descriptor, targetOrConfig, rule);
}
return deco;
return function (t, k, d) {
return (0, _propertyObserver.observeProperty)(t, k, d, targetOrConfig, rule);
};
}
});
29 changes: 17 additions & 12 deletions dist/amd/decorators.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
define(['exports', './base-decorator', './rules/length', './rules/required', './rules/date', './rules/datetime', './rules/email', './rules/equality', './rules/exclusion', './rules/inclusion', './rules/format', './rules/url', './rules/numericality'], function (exports, _baseDecorator, _length, _required, _date, _datetime, _email, _equality, _exclusion, _inclusion, _format, _url, _numericality) {
define(['exports', './validation-rule', './base-decorator'], function (exports, _validationRule, _baseDecorator) {
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.length = length;
exports.presence = presence;
exports.required = required;
exports.date = date;
exports.datetime = datetime;
Expand All @@ -16,46 +17,50 @@ define(['exports', './base-decorator', './rules/length', './rules/required', './
exports.url = url;
exports.numericality = numericality;
function length(targetOrConfig, key, descriptor) {
return (0, _baseDecorator.base)(targetOrConfig, key, descriptor, _length.LengthRule);
return (0, _baseDecorator.base)(targetOrConfig, key, descriptor, _validationRule.ValidationRule.lengthRule);
}

function presence(targetOrConfig, key, descriptor) {
return (0, _baseDecorator.base)(targetOrConfig, key, descriptor, _validationRule.ValidationRule.presence);
}

function required(targetOrConfig, key, descriptor) {
return (0, _baseDecorator.base)(targetOrConfig, key, descriptor, _required.RequiredRule);
return (0, _baseDecorator.base)(targetOrConfig, key, descriptor, _validationRule.ValidationRule.presence);
}

function date(targetOrConfig, key, descriptor) {
return (0, _baseDecorator.base)(targetOrConfig, key, descriptor, _date.DateRule);
return (0, _baseDecorator.base)(targetOrConfig, key, descriptor, _validationRule.ValidationRule.date);
}

function datetime(targetOrConfig, key, descriptor) {
return (0, _baseDecorator.base)(targetOrConfig, key, descriptor, _datetime.DatetimeRule);
return (0, _baseDecorator.base)(targetOrConfig, key, descriptor, _validationRule.ValidationRule.datetime);
}

function email(targetOrConfig, key, descriptor) {
return (0, _baseDecorator.base)(targetOrConfig, key, descriptor, _email.EmailRule);
return (0, _baseDecorator.base)(targetOrConfig, key, descriptor, _validationRule.ValidationRule.email);
}

function equality(targetOrConfig, key, descriptor) {
return (0, _baseDecorator.base)(targetOrConfig, key, descriptor, _equality.EqualityRule);
return (0, _baseDecorator.base)(targetOrConfig, key, descriptor, _validationRule.ValidationRule.equality);
}

function exclusion(targetOrConfig, key, descriptor) {
return (0, _baseDecorator.base)(targetOrConfig, key, descriptor, _exclusion.ExclusionRule);
return (0, _baseDecorator.base)(targetOrConfig, key, descriptor, _validationRule.ValidationRule.exclusion);
}

function inclusion(targetOrConfig, key, descriptor) {
return (0, _baseDecorator.base)(targetOrConfig, key, descriptor, _inclusion.InclusionRule);
return (0, _baseDecorator.base)(targetOrConfig, key, descriptor, _validationRule.ValidationRule.inclusion);
}

function format(targetOrConfig, key, descriptor) {
return (0, _baseDecorator.base)(targetOrConfig, key, descriptor, _format.FormatRule);
return (0, _baseDecorator.base)(targetOrConfig, key, descriptor, _validationRule.ValidationRule.format);
}

function url(targetOrConfig, key, descriptor) {
return (0, _baseDecorator.base)(targetOrConfig, key, descriptor, _url.UrlRule);
return (0, _baseDecorator.base)(targetOrConfig, key, descriptor, _validationRule.ValidationRule.url);
}

function numericality(targetOrConfig, key, descriptor) {
return (0, _baseDecorator.base)(targetOrConfig, key, descriptor, _numericality.NumericalityRule);
return (0, _baseDecorator.base)(targetOrConfig, key, descriptor, _validationRule.ValidationRule.numericality);
}
});
44 changes: 44 additions & 0 deletions dist/amd/property-observer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
define(['exports', 'aurelia-metadata', './validation-config', './validation-engine', './metadata-key'], function (exports, _aureliaMetadata, _validationConfig, _validationEngine, _metadataKey) {
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.observeProperty = observeProperty;
function observeProperty(target, key, descriptor, targetOrConfig, rule) {
var config = _aureliaMetadata.metadata.getOrCreateOwn(_metadataKey.validationMetadataKey, _validationConfig.ValidationConfig, target);
config.addRule(key, rule(targetOrConfig));

var innerPropertyName = '_' + key;

var babel = descriptor !== undefined;

if (babel) {
if (typeof descriptor.initializer === 'function') {
target[innerPropertyName] = descriptor.initializer();
}
} else {
descriptor = {};
}

delete descriptor.writable;
delete descriptor.initializer;

descriptor.get = function () {
return this[innerPropertyName];
};
descriptor.set = function (newValue) {
var reporter = _validationEngine.ValidationEngine.getValidationReporter(this);

this[innerPropertyName] = newValue;

config.validate(this, reporter);
};

descriptor.get.dependencies = [innerPropertyName];

if (!babel) {
Reflect.defineProperty(target, key, descriptor);
}
}
});
20 changes: 0 additions & 20 deletions dist/amd/rules/date.js

This file was deleted.

20 changes: 0 additions & 20 deletions dist/amd/rules/datetime.js

This file was deleted.

20 changes: 0 additions & 20 deletions dist/amd/rules/email.js

This file was deleted.

20 changes: 0 additions & 20 deletions dist/amd/rules/equality.js

This file was deleted.

Loading

0 comments on commit 2d310c1

Please sign in to comment.