mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 21:10:23 +00:00
Merge pull request #17602 from gloorx/master
[Sequelize] Add rejectOnEmpty mode types
This commit is contained in:
Vendored
+15
@@ -2190,6 +2190,15 @@ declare namespace sequelize {
|
||||
|
||||
}
|
||||
|
||||
interface EmptyResultError extends BaseError {
|
||||
|
||||
/**
|
||||
* Thrown when a record was not found, Usually used with rejectOnEmpty mode (see message for details)
|
||||
*/
|
||||
new (parent: Error): EmptyResultError;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sequelize provides a host of custom error classes, to allow you to do easier debugging. All of these errors
|
||||
* are exposed on the sequelize object and the sequelize constructor. All sequelize errors inherit from the
|
||||
@@ -2211,6 +2220,7 @@ declare namespace sequelize {
|
||||
HostNotReachableError: HostNotReachableError;
|
||||
InvalidConnectionError: InvalidConnectionError;
|
||||
ConnectionTimedOutError: ConnectionTimedOutError;
|
||||
EmptyResultError: EmptyResultError;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -3275,6 +3285,11 @@ declare namespace sequelize {
|
||||
* Prevents a subquery on the main table when using include
|
||||
*/
|
||||
subQuery?: boolean;
|
||||
|
||||
/**
|
||||
* Throw EmptyResultError if a record is not found
|
||||
*/
|
||||
rejectOnEmpty?: boolean;
|
||||
}
|
||||
|
||||
type AnyFindOptions = FindOptions<any>;
|
||||
|
||||
@@ -629,6 +629,7 @@ new s.HostNotFoundError( new Error( 'original connection error message' ) );
|
||||
new s.HostNotReachableError( new Error( 'original connection error message' ) );
|
||||
new s.InvalidConnectionError( new Error( 'original connection error message' ) );
|
||||
new s.ConnectionTimedOutError( new Error( 'original connection error message' ) );
|
||||
new s.EmptyResultError();
|
||||
|
||||
const uniqueConstraintError: Sequelize.ValidationError = new s.UniqueConstraintError({});
|
||||
|
||||
@@ -914,6 +915,7 @@ User.findAll( { attributes: [s.cast(s.fn('count', Sequelize.col('*')), 'INTEGER'
|
||||
User.findAll( { attributes: [[s.cast(s.fn('count', Sequelize.col('*')), 'INTEGER'), 'count']] });
|
||||
User.findAll( { where : s.fn('count', [0, 10]) } );
|
||||
User.findAll( { subQuery: false, include : [User], order : [[User, User, 'numYears', 'c']] } );
|
||||
User.findAll( { rejectOnEmpty: true });
|
||||
|
||||
|
||||
User.findById( 'a string' );
|
||||
|
||||
Reference in New Issue
Block a user