Merge pull request #6997 from jocull/master

Changes to Sequelize validation promise returns…
This commit is contained in:
Horiuchi_H
2015-12-02 18:05:54 +09:00
+21 -6
View File
@@ -1994,7 +1994,7 @@ declare module "sequelize" {
INITIALLY_IMMEDIATE: DeferrableInitiallyImmediate;
NOT: DeferrableNot;
SET_DEFERRED: DeferrableSetDeferred;
SET_IMMEDIATE: DeferrableSetImmediate
SET_IMMEDIATE: DeferrableSetImmediate;
}
//
@@ -2007,7 +2007,7 @@ declare module "sequelize" {
/**
* The Base Error all Sequelize Errors inherit from.
*/
interface BaseError extends ErrorConstructor { }
interface BaseError extends Error, ErrorConstructor { }
interface ValidationError extends BaseError {
@@ -2026,7 +2026,10 @@ declare module "sequelize" {
* @param path The path to be checked for error items
*/
get( path : string ) : Array<ValidationErrorItem>;
/** Array of ValidationErrorItem objects describing the validation errors */
errors : Array<ValidationErrorItem>;
}
interface ValidationErrorItem extends BaseError {
@@ -2041,7 +2044,19 @@ declare module "sequelize" {
* @param value The value that generated the error
*/
new ( message : string, type : string, path : string, value : string ) : ValidationErrorItem;
/** An error message */
message : string;
/** The type of the validation error */
type : string;
/** The field that triggered the validation error */
path : string;
/** The value that generated the error */
value : string;
}
interface DatabaseError extends BaseError {
@@ -2790,7 +2805,7 @@ declare module "sequelize" {
*
* @param options.skip An array of strings. All properties that are in this array will not be validated
*/
validate( options? : { skip?: Array<string> } ) : Promise<void>;
validate( options? : { skip?: Array<string> } ) : Promise<ValidationError>;
/**
* This is the same as calling `set` and then calling `save`.
@@ -5571,7 +5586,7 @@ declare module "sequelize" {
* @param options Query Options for authentication
*/
authenticate( options? : QueryOptions ) : Promise<void>;
validate( options? : QueryOptions ) : Promise<void>;
validate( options? : QueryOptions ) : Promise<ValidationError>;
/**
* Start a transaction. When using transactions, you should pass the transaction in the options argument