Comparing version 2.16.13 to 2.16.14
@@ -140,6 +140,12 @@ /* UNIQORM | ||
validateValue(value, otherValues) { | ||
/** | ||
* | ||
* @param {*} v | ||
* @param {Object} [values] | ||
* @param {*} [context] | ||
*/ | ||
validateValue(v, values, context) { | ||
if (this.validate) { | ||
try { | ||
this.validate(value, this, otherValues); | ||
this.validate(v, this, values, context); | ||
} catch (e) { | ||
@@ -146,0 +152,0 @@ throw new ValidationError(e); |
@@ -324,3 +324,3 @@ /* UNIQORM | ||
this.validateValuesForCreate(values, {silent}); | ||
this.validateValuesForCreate(values, {silent, context: options.context}); | ||
const dataValues = this._normalizeValues(values); | ||
@@ -680,7 +680,10 @@ const returning = this._prepareReturningOptions(options.returning, silent); | ||
* @param {boolean} [options.normalize=false] | ||
* @param {*} [options.context] | ||
* @return {Object} | ||
*/ | ||
validateValuesForCreate(values, options = {}) { | ||
options.forCreate = true; | ||
return this._validateValues(values, options); | ||
return this._validateValues(values, { | ||
...options, | ||
forCreate: true | ||
}); | ||
} | ||
@@ -694,7 +697,10 @@ | ||
* @param {boolean} [options.normalize=false] | ||
* * @param {*} [options.context] | ||
* @return {Object} | ||
*/ | ||
validateValuesForUpdate(values, options = {}) { | ||
options.forCreate = false; | ||
return this._validateValues(values, options); | ||
return this._validateValues(values, { | ||
...options, | ||
forCreate: false | ||
}); | ||
} | ||
@@ -708,2 +714,3 @@ | ||
* @param {boolean} [options.forCreate=false] | ||
* * @param {*} [options.context] | ||
* @private | ||
@@ -749,3 +756,3 @@ */ | ||
} | ||
field.validateValue(v, values); | ||
field.validateValue(v, values, options.context); | ||
} | ||
@@ -752,0 +759,0 @@ } |
{ | ||
"name": "uniqorm", | ||
"description": "Multi dialect and multi schema ORM framework for enterprise level NodeJS applications", | ||
"version": "2.16.13", | ||
"version": "2.16.14", | ||
"author": "Panates Ltd.", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
100925
3312