fix code format

This commit is contained in:
Horiuchi_H
2016-01-15 16:51:34 +09:00
parent 7577a2f4c1
commit 8d948f4a02
3 changed files with 165 additions and 166 deletions

View File

@@ -18,7 +18,7 @@ var transOpts: Sequelize.TransactionOptions;
var syncOpts: Sequelize.SyncOptions;
var assocOpts: Sequelize.AssociationOptions;
var schemaOpts: Sequelize.SchemaOptions;
var findOpts: Sequelize.FindOptions
var findOpts: Sequelize.FindOptions;
var findCrOpts: Sequelize.FindOrCreateOptions;
var queryOpts: Sequelize.QueryOptions;
var buildOpts: Sequelize.BuildOptions;
@@ -45,7 +45,6 @@ interface modelPojo {
}
interface modelInst extends Sequelize.Instance<modelInst, modelPojo>, modelPojo {
};
var myModelInst: modelInst;
@@ -117,12 +116,12 @@ model.find().then(function () { }, function () { });
model.find().then(function () { });
model.find().then(null, function () { });
model.find().then(function (result: modelInst) { });
model.find().then<modelInst>(function (result: modelInst): Sequelize.PromiseT<modelInst> { return model.find(1) });
model.find().then<modelInst, any>(function (result: modelInst): Sequelize.PromiseT<modelInst> { return model.find(1) }, function (): Sequelize.PromiseT<any> { return model.find(1) });
model.find().then<modelInst>(function (result: modelInst): Sequelize.PromiseT<modelInst> { return model.find(1); });
model.find().then<modelInst, any>(function (result: modelInst): Sequelize.PromiseT<modelInst> { return model.find(1); }, function (): Sequelize.PromiseT<any> { return model.find(1); });
model.find().catch(function () { });
model.find().catch(function (result: modelInst) { });
model.find().catch(function (result: modelInst): Sequelize.Promise { return model.find(1) });
model.find().catch(function (result: modelInst): Sequelize.Promise { return model.find(1); });
model.find().spread(function () { }, function () { });
model.find().spread(function () { });
@@ -130,10 +129,10 @@ model.find().spread(null, function () { });
model.find().spread(function (result: modelInst) { });
model.find().spread(function (result1: modelInst, result2: any) { });
model.find().spread(null, function (result1: any, result2: boolean) { });
model.find().spread(function (result: modelInst): Sequelize.Promise { return model.find(1) });
model.find().spread<modelInst>(function (result: modelInst): Sequelize.PromiseT<modelInst> { return model.find(1) });
model.find().spread<modelInst>(function (result: modelInst) { }, function (): Sequelize.PromiseT<modelInst> { return model.find(1) });
model.find().spread<modelInst, any>(function (result: modelInst): Sequelize.PromiseT<modelInst> { return model.find(1) }, function (): Sequelize.PromiseT<any> { return model.find(1) });
model.find().spread(function (result: modelInst): Sequelize.Promise { return model.find(1); });
model.find().spread<modelInst>(function (result: modelInst): Sequelize.PromiseT<modelInst> { return model.find(1); });
model.find().spread<modelInst>(function (result: modelInst) { }, function (): Sequelize.PromiseT<modelInst> { return model.find(1); });
model.find().spread<modelInst, any>(function (result: modelInst): Sequelize.PromiseT<modelInst> { return model.find(1); }, function (): Sequelize.PromiseT<any> { return model.find(1); });
promiseMe = model.findAll(findOpts, queryOpts);
promiseMe = model.findAll(findOpts);

View File

@@ -906,7 +906,7 @@ User.find( { where : { intVal : { lte : 5 } } } );
User.count();
User.count( { transaction : t } );
User.count().then( function( c ) { c.toFixed() } );
User.count().then( function( c ) { c.toFixed(); } );
User.count( { where : ["username LIKE '%us%'"] } );
User.count( { include : [{ model : User, required : false }] } );
User.count( { distinct : true, include : [{ model : User, required : false }] } );
@@ -1122,7 +1122,7 @@ s.query( '', { raw : true, nest : false } );
s.query( 'select ? as foo, ? as bar', { type : this.sequelize.QueryTypes.SELECT, replacements : [1, 2] } );
s.query( { query : 'select ? as foo, ? as bar', values : [1, 2] }, { type : s.QueryTypes.SELECT } );
s.query( 'select :one as foo, :two as bar', { raw : true, replacements : { one : 1, two : 2 } } );
s.transaction().then( function( t ) { s.set( { foo : 'bar' }, { transaction : t } ) } );
s.transaction().then( function( t ) { s.set( { foo : 'bar' }, { transaction : t } ); } );
s.define( 'foo', { bar : Sequelize.STRING }, { collate : 'utf8_bin' } );
s.define( 'Foto', { name : Sequelize.STRING }, { tableName : 'photos' } );
s.databaseVersion().then( function( version ) { } );

View File

@@ -55,7 +55,7 @@ declare module "sequelize" {
* Get the associated instance.
* @param options The options to use when getting the association.
*/
(options?: BelongsToGetAssociationMixinOptions): Promise<TInstance>
(options?: BelongsToGetAssociationMixinOptions): Promise<TInstance>;
}
/**
@@ -96,7 +96,7 @@ declare module "sequelize" {
(
newAssociation?: TInstance | TInstancePrimaryKey,
options?: BelongsToSetAssociationMixinOptions | InstanceSaveOptions
): Promise<void>
): Promise<void>;
}
/**
@@ -132,7 +132,7 @@ declare module "sequelize" {
(
values?: TAttributes,
options?: BelongsToCreateAssociationMixinOptions | CreateOptions | BelongsToSetAssociationMixinOptions
): Promise<void>
): Promise<void>;
}
/**
@@ -169,7 +169,7 @@ declare module "sequelize" {
* Get the associated instance.
* @param options The options to use when getting the association.
*/
(options?: HasOneGetAssociationMixinOptions): Promise<TInstance>
(options?: HasOneGetAssociationMixinOptions): Promise<TInstance>;
}
/**
@@ -210,7 +210,7 @@ declare module "sequelize" {
(
newAssociation?: TInstance | TInstancePrimaryKey,
options?: HasOneSetAssociationMixinOptions | HasOneGetAssociationMixinOptions | InstanceSaveOptions
): Promise<void>
): Promise<void>;
}
/**
@@ -246,7 +246,7 @@ declare module "sequelize" {
(
values?: TAttributes,
options?: HasOneCreateAssociationMixinOptions | HasOneSetAssociationMixinOptions | CreateOptions
): Promise<void>
): Promise<void>;
}
/**
@@ -296,7 +296,7 @@ declare module "sequelize" {
* Get everything currently associated with this, using an optional where clause.
* @param options The options to use when getting the associations.
*/
(options?: HasManyGetAssociationsMixinOptions): Promise<TInstance[]>
(options?: HasManyGetAssociationsMixinOptions): Promise<TInstance[]>;
}
/**
@@ -346,7 +346,7 @@ declare module "sequelize" {
(
newAssociations?: Array<TInstance | TInstancePrimaryKey>,
options?: HasManySetAssociationsMixinOptions | FindOptions | InstanceUpdateOptions
): Promise<void>
): Promise<void>;
}
/**
@@ -395,7 +395,7 @@ declare module "sequelize" {
(
newAssociations?: Array<TInstance | TInstancePrimaryKey>,
options?: HasManyAddAssociationsMixinOptions | InstanceUpdateOptions
): Promise<void>
): Promise<void>;
}
/**
@@ -444,7 +444,7 @@ declare module "sequelize" {
(
newAssociation?: TInstance | TInstancePrimaryKey,
options?: HasManyAddAssociationMixinOptions | InstanceUpdateOptions
): Promise<void>
): Promise<void>;
}
/**
@@ -487,7 +487,7 @@ declare module "sequelize" {
(
values?: TAttributes,
options?: HasManyCreateAssociationMixinOptions | CreateOptions
): Promise<void>
): Promise<void>;
}
/**
@@ -530,7 +530,7 @@ declare module "sequelize" {
(
oldAssociated?: TInstance | TInstancePrimaryKey,
options?: HasManyRemoveAssociationMixinOptions | InstanceUpdateOptions
): Promise<void>
): Promise<void>;
}
/**
@@ -573,7 +573,7 @@ declare module "sequelize" {
(
oldAssociateds?: Array<TInstance | TInstancePrimaryKey>,
options?: HasManyRemoveAssociationsMixinOptions | InstanceUpdateOptions
): Promise<void>
): Promise<void>;
}
/**
@@ -616,7 +616,7 @@ declare module "sequelize" {
(
target: TInstance | TInstancePrimaryKey,
options?: HasManyHasAssociationMixinOptions | HasManyGetAssociationsMixinOptions
): Promise<boolean>
): Promise<boolean>;
}
/**
@@ -659,7 +659,7 @@ declare module "sequelize" {
(
targets: Array<TInstance | TInstancePrimaryKey>,
options?: HasManyHasAssociationsMixinOptions | HasManyGetAssociationsMixinOptions
): Promise<boolean>
): Promise<boolean>;
}
/**
@@ -709,7 +709,7 @@ declare module "sequelize" {
* Count everything currently associated with this, using an optional where clause.
* @param options The options to use when counting the associations.
*/
(options?: HasManyCountAssociationsMixinOptions): Promise<number>
(options?: HasManyCountAssociationsMixinOptions): Promise<number>;
}
/**
@@ -759,7 +759,7 @@ declare module "sequelize" {
* Get everything currently associated with this, using an optional where clause.
* @param options The options to use when getting the associations.
*/
(options?: BelongsToManyGetAssociationsMixinOptions): Promise<TInstance[]>
(options?: BelongsToManyGetAssociationsMixinOptions): Promise<TInstance[]>;
}
/**
@@ -809,7 +809,7 @@ declare module "sequelize" {
(
newAssociations?: Array<TInstance | TInstancePrimaryKey>,
options?: BelongsToManySetAssociationsMixinOptions | FindOptions | BulkCreateOptions | InstanceUpdateOptions | InstanceDestroyOptions | TJoinTableAttributes
): Promise<void>
): Promise<void>;
}
/**
@@ -858,7 +858,7 @@ declare module "sequelize" {
(
newAssociations?: Array<TInstance | TInstancePrimaryKey>,
options?: BelongsToManyAddAssociationsMixinOptions | FindOptions | BulkCreateOptions | InstanceUpdateOptions | InstanceDestroyOptions | TJoinTableAttributes
): Promise<void>
): Promise<void>;
}
/**
@@ -907,7 +907,7 @@ declare module "sequelize" {
(
newAssociation?: TInstance | TInstancePrimaryKey,
options?: BelongsToManyAddAssociationMixinOptions | FindOptions | BulkCreateOptions | InstanceUpdateOptions | InstanceDestroyOptions | TJoinTableAttributes
): Promise<void>
): Promise<void>;
}
/**
@@ -950,7 +950,7 @@ declare module "sequelize" {
(
values?: TAttributes,
options?: BelongsToManyCreateAssociationMixinOptions | CreateOptions | TJoinTableAttributes
): Promise<void>
): Promise<void>;
}
/**
@@ -993,7 +993,7 @@ declare module "sequelize" {
(
oldAssociated?: TInstance | TInstancePrimaryKey,
options?: BelongsToManyRemoveAssociationMixinOptions | InstanceDestroyOptions
): Promise<void>
): Promise<void>;
}
/**
@@ -1036,7 +1036,7 @@ declare module "sequelize" {
(
oldAssociateds?: Array<TInstance | TInstancePrimaryKey>,
options?: BelongsToManyRemoveAssociationsMixinOptions | InstanceDestroyOptions
): Promise<void>
): Promise<void>;
}
/**
@@ -1079,7 +1079,7 @@ declare module "sequelize" {
(
target: TInstance | TInstancePrimaryKey,
options?: BelongsToManyHasAssociationMixinOptions | BelongsToManyGetAssociationsMixinOptions
): Promise<boolean>
): Promise<boolean>;
}
/**
@@ -1122,7 +1122,7 @@ declare module "sequelize" {
(
targets: Array<TInstance | TInstancePrimaryKey>,
options?: BelongsToManyHasAssociationsMixinOptions | BelongsToManyGetAssociationsMixinOptions
): Promise<boolean>
): Promise<boolean>;
}
/**
@@ -1172,7 +1172,7 @@ declare module "sequelize" {
* Count everything currently associated with this, using an optional where clause.
* @param options The options to use when counting the associations.
*/
(options?: BelongsToManyCountAssociationsMixinOptions): Promise<number>
(options?: BelongsToManyCountAssociationsMixinOptions): Promise<number>;
}
/**
@@ -1879,9 +1879,9 @@ declare module "sequelize" {
ENUM: DataTypeEnum;
RANGE: DataTypeRange;
REAL: DataTypeReal;
DOUBLE: DataTypeDouble,
'DOUBLE PRECISION': DataTypeDouble,
GEOMETRY: DataTypeGeometry
DOUBLE: DataTypeDouble;
"DOUBLE PRECISION": DataTypeDouble;
GEOMETRY: DataTypeGeometry;
}
//
@@ -1942,7 +1942,7 @@ declare module "sequelize" {
*
* @param constraints An array of constraint names. Will defer all constraints by default.
*/
( constraints : Array<string> ) : DeferrableSetDeferred;
( constraints : string[] ) : DeferrableSetDeferred;
}
@@ -1954,7 +1954,7 @@ declare module "sequelize" {
*
* @param constraints An array of constraint names. Will defer all constraints by default.
*/
( constraints : Array<string> ) : DeferrableSetImmediate;
( constraints : string[] ) : DeferrableSetImmediate;
}
@@ -2018,18 +2018,18 @@ declare module "sequelize" {
* @param message Error message
* @param errors Array of ValidationErrorItem objects describing the validation errors
*/
new ( message : string, errors? : Array<ValidationErrorItem> ) : ValidationError;
new ( message : string, errors? : ValidationErrorItem[] ) : ValidationError;
/**
* Gets all validation error items for the path / field specified.
*
* @param path The path to be checked for error items
*/
get( path : string ) : Array<ValidationErrorItem>;
get( path : string ) : ValidationErrorItem[];
/** Array of ValidationErrorItem objects describing the validation errors */
errors : Array<ValidationErrorItem>;
errors : ValidationErrorItem[];
}
interface ValidationErrorItem extends BaseError {
@@ -2044,19 +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 {
@@ -2091,7 +2091,7 @@ declare module "sequelize" {
/**
* Thrown when a foreign key constraint is violated in the database
*/
new ( options : { parent? : Error, message? : string, index? : string, fields? : Array<string>, table? : string } ) : ForeignKeyConstraintError;
new ( options : { parent? : Error, message? : string, index? : string, fields? : string[], table? : string } ) : ForeignKeyConstraintError;
}
@@ -2100,7 +2100,7 @@ declare module "sequelize" {
/**
* Thrown when an exclusion constraint is violated in the database
*/
new ( options : { parent? : Error, message? : string, constraint? : string, fields? : Array<string>, table? : string } ) : ExclusionConstraintError;
new ( options : { parent? : Error, message? : string, constraint? : string, fields? : string[], table? : string } ) : ExclusionConstraintError;
}
@@ -2217,8 +2217,8 @@ declare module "sequelize" {
afterDelete? : ( instance : TInstance, options : Object, fn? : Function ) => any;
beforeUpdate? : ( instance : TInstance, options : Object, fn? : Function ) => any;
afterUpdate? : ( instance : TInstance, options : Object, fn? : Function ) => any;
beforeBulkCreate? : ( instances : Array<TInstance>, options : Object, fn? : Function ) => any;
afterBulkCreate? : ( instances : Array<TInstance>, options : Object, fn? : Function ) => any;
beforeBulkCreate? : ( instances : TInstance[], options : Object, fn? : Function ) => any;
afterBulkCreate? : ( instances : TInstance[], options : Object, fn? : Function ) => any;
beforeBulkDestroy? : ( options : Object, fn? : Function ) => any;
beforeBulkDelete? : ( options : Object, fn? : Function ) => any;
afterBulkDestroy? : ( options : Object, fn? : Function ) => any;
@@ -2228,7 +2228,7 @@ declare module "sequelize" {
beforeFind? : ( options : Object, fn? : Function ) => any;
beforeFindAfterExpandIncludeAll? : ( options : Object, fn? : Function ) => any;
beforeFindAfterOptions? : ( options : Object, fn? : Function ) => any;
afterFind? : ( instancesOrInstance : Array<TInstance> | TInstance, options : Object,
afterFind? : ( instancesOrInstance : TInstance[] | TInstance, options : Object,
fn? : Function ) => any;
}
@@ -2392,8 +2392,8 @@ declare module "sequelize" {
* @param fn A callback function that is called with instances, options
*/
beforeBulkCreate( name : string,
fn : ( instances : Array<TInstance>, options : Object, fn? : Function ) => void ): void;
beforeBulkCreate( fn : ( instances : Array<TInstance>, options : Object, fn? : Function ) => void ): void;
fn : ( instances : TInstance[], options : Object, fn? : Function ) => void ): void;
beforeBulkCreate( fn : ( instances : TInstance[], options : Object, fn? : Function ) => void ): void;
/**
* A hook that is run after creating instances in bulk
@@ -2403,8 +2403,8 @@ declare module "sequelize" {
* @name afterBulkCreate
*/
afterBulkCreate( name : string,
fn : ( instances : Array<TInstance>, options : Object, fn? : Function ) => void ): void;
afterBulkCreate( fn : ( instances : Array<TInstance>, options : Object, fn? : Function ) => void ): void;
fn : ( instances : TInstance[], options : Object, fn? : Function ) => void ): void;
afterBulkCreate( fn : ( instances : TInstance[], options : Object, fn? : Function ) => void ): void;
/**
* A hook that is run before destroying instances in bulk
@@ -2485,9 +2485,9 @@ declare module "sequelize" {
* @param fn A callback function that is called with instance(s), options
*/
afterFind( name : string,
fn : ( instancesOrInstance : Array<TInstance> | TInstance, options : Object,
fn : ( instancesOrInstance : TInstance[] | TInstance, options : Object,
fn? : Function ) => void ): void;
afterFind( fn : ( instancesOrInstance : Array<TInstance> | TInstance, options : Object,
afterFind( fn : ( instancesOrInstance : TInstance[] | TInstance, options : Object,
fn? : Function ) => void ): void;
/**
@@ -2641,7 +2641,7 @@ declare module "sequelize" {
* An optional array of strings, representing database columns. If fields is provided, only those columns
* will be validated and saved.
*/
fields? : Array<string>;
fields? : string[];
/**
* If true, the updatedAt timestamp will not be updated.
@@ -2773,7 +2773,7 @@ declare module "sequelize" {
* If changed is called without an argument and no keys have changed, it will return `false`.
*/
changed( key : string ) : boolean;
changed() : boolean | Array<string>;
changed() : boolean | string[];
/**
* Returns the previous value for key from `_previousDataValues`.
@@ -2805,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<ValidationError>;
validate( options? : { skip?: string[] } ) : Promise<ValidationError>;
/**
* This is the same as calling `set` and then calling `save`.
@@ -2846,7 +2846,7 @@ declare module "sequelize" {
* If an array is provided, the same is true for each column.
* If and object is provided, each column is incremented by the value given.
*/
increment( fields : string | Array<string> | Object,
increment( fields : string | string[] | Object,
options? : InstanceIncrementDecrementOptions ) : Promise<TInstance>;
/**
@@ -2869,7 +2869,7 @@ declare module "sequelize" {
* If an array is provided, the same is true for each column.
* If and object is provided, each column is decremented by the value given
*/
decrement( fields : string | Array<string> | Object,
decrement( fields : string | string[] | Object,
options? : InstanceIncrementDecrementOptions ) : Promise<TInstance>;
/**
@@ -2880,7 +2880,7 @@ declare module "sequelize" {
/**
* Check if this is eqaul to one of `others` by calling equals
*/
equalsOneOf( others : Array<Instance<any, any>> ) : boolean;
equalsOneOf( others : Instance<any, any>[] ) : boolean;
/**
* Convert the instance to a JSON representation. Proxies to calling `get` with no keys. This means get all
@@ -2922,12 +2922,12 @@ declare module "sequelize" {
/**
* The character(s) that separates the schema name from the table name
*/
schemaDelimeter? : string,
schemaDelimeter? : string;
/**
* A function that gets executed while running the query to log the sql.
*/
logging? : Function | boolean
logging? : Function | boolean;
}
@@ -2943,7 +2943,7 @@ declare module "sequelize" {
* any arguments, or an array, where the first element is the name of the method, and consecutive elements
* are arguments to that method. Pass null to remove all scopes, including the default.
*/
method : string | Array<any>;
method : string | any[];
}
@@ -2968,7 +2968,7 @@ declare module "sequelize" {
*/
interface WhereGeometryOptions {
type: string;
coordinates: Array<Array<number> | number>;
coordinates: Array<number[] | number>;
}
/**
@@ -3023,7 +3023,7 @@ declare module "sequelize" {
/**
* A list of attributes to select from the join model for belongsToMany relations
*/
attributes? : Array<string>;
attributes? : string[];
}
@@ -3050,7 +3050,7 @@ declare module "sequelize" {
* The alias of the relation, in case the model you want to eagerly load is aliassed. For `hasOne` /
* `belongsTo`, this should be the singular name, and for `hasMany`, it should be the plural
*/
as? : string;
as? : string;
/**
* The association you want to eagerly load. (This can be used instead of providing a model/as pair)
@@ -3066,7 +3066,7 @@ declare module "sequelize" {
/**
* A list of attributes to select from the child model
*/
attributes? : Array<string>;
attributes? : string[];
/**
* If true, converts to an inner join, which means that the parent model will only be loaded if it has any
@@ -3175,7 +3175,7 @@ declare module "sequelize" {
/**
* A hash of search attributes.
*/
where? : WhereOptions | Array<string>;
where? : WhereOptions | string[];
/**
* Include options. See `find` for details
@@ -3239,7 +3239,7 @@ declare module "sequelize" {
/**
* If set, only columns matching those in fields will be saved
*/
fields? : Array<string>;
fields? : string[];
/**
* On Duplicate
@@ -3301,7 +3301,7 @@ declare module "sequelize" {
/**
* The fields to insert / update. Defaults to all fields
*/
fields? : Array<string>;
fields? : string[];
/**
* A function that gets executed while running the query to log the sql.
@@ -3318,7 +3318,7 @@ declare module "sequelize" {
/**
* Fields to insert (defaults to all fields)
*/
fields? : Array<string>;
fields? : string[];
/**
* Should each row be subject to validation before it is inserted. The whole insert will fail if one row
@@ -3348,7 +3348,7 @@ declare module "sequelize" {
* Fields to update if row key already exists (on duplicate key update)? (only supported by mysql &
* mariadb). By default, all fields are updated.
*/
updateOnDuplicate? : Array<string>;
updateOnDuplicate? : string[];
/**
* Transaction to run query under
@@ -3477,7 +3477,7 @@ declare module "sequelize" {
/**
* Fields to update (defaults to all fields)
*/
fields? : Array<string>;
fields? : string[];
/**
* Should each row be subject to validation before it is inserted. The whole insert will fail if one row
@@ -3564,7 +3564,7 @@ declare module "sequelize" {
/**
* The Instance class
*/
Instance() : Instance<TInstance, TAttributes>;
Instance() : TInstance;
/**
* Remove attribute from model definition
@@ -3656,7 +3656,7 @@ declare module "sequelize" {
* @return Model A reference to the model, with the scope(s) applied. Calling scope again on the returned
* model will clear the previous scope.
*/
scope( options? : string | Array<string> | ScopeOptions | WhereOptions ) : Model<TInstance, TAttributes>;
scope( options? : string | string[] | ScopeOptions | WhereOptions ) : Model<TInstance, TAttributes>;
/**
* Search for multiple instances.
@@ -3720,8 +3720,8 @@ declare module "sequelize" {
*
* @see {Sequelize#query}
*/
findAll( options? : FindOptions ) : Promise<Array<TInstance>>;
all( optionz? : FindOptions ) : Promise<Array<TInstance>>;
findAll( options? : FindOptions ) : Promise<TInstance[]>;
all( optionz? : FindOptions ) : Promise<TInstance[]>;
/**
* Search for a single instance by its primary key. This applies LIMIT 1, so the listener will
@@ -3790,8 +3790,8 @@ declare module "sequelize" {
* without
* profiles will be counted
*/
findAndCount( options? : FindOptions ) : Promise<{ rows : Array<TInstance>, count : number }>;
findAndCountAll( options? : FindOptions ) : Promise<{ rows : Array<TInstance>, count : number }>;
findAndCount( options? : FindOptions ) : Promise<{ rows : TInstance[], count : number }>;
findAndCountAll( options? : FindOptions ) : Promise<{ rows : TInstance[], count : number }>;
/**
* Find the maximum value of field
@@ -3816,7 +3816,7 @@ declare module "sequelize" {
/**
* Undocumented bulkBuild
*/
bulkBuild( records : Array<TAttributes>, options? : BuildOptions ) : Array<TInstance>;
bulkBuild( records : TAttributes[], options? : BuildOptions ) : TInstance[];
/**
* Builds a new model instance and calls save on it.
@@ -3876,7 +3876,7 @@ declare module "sequelize" {
*
* @param records List of objects (key/value pairs) to create instances from
*/
bulkCreate( records : Array<TAttributes>, options? : BulkCreateOptions ) : Promise<Array<TInstance>>;
bulkCreate( records : TAttributes[], options? : BulkCreateOptions ) : Promise<TInstance[]>;
/**
* Truncate all instances of the model. This is a convenient method for Model.destroy({ truncate: true }).
@@ -3900,7 +3900,7 @@ declare module "sequelize" {
* elements. The first element is always the number of affected rows, while the second element is the actual
* affected rows (only supported in postgres with `options.returning` true.)
*/
update( values : TAttributes, options : UpdateOptions ) : Promise<[number, Array<TInstance>]>;
update( values : TAttributes, options : UpdateOptions ) : Promise<[number, TInstance[]]>;
/**
* Run a describe query on the table. The result will be return to the listener as a hash of attributes and
@@ -3949,7 +3949,7 @@ declare module "sequelize" {
* We don't have a definition for the QueryGenerator, because I doubt it is commonly in use separately.
*/
QueryGenerator: any;
/**
* Returns the current sequelize instance.
*/
@@ -4026,7 +4026,7 @@ declare module "sequelize" {
/**
* Returns all tables
*/
showAllTables( options? : QueryOptions ) : Promise<Array<string>>;
showAllTables( options? : QueryOptions ) : Promise<string[]>;
/**
* Describe a table
@@ -4062,7 +4062,7 @@ declare module "sequelize" {
/**
* Adds a new index to a table
*/
addIndex( tableName : string | Object, attributes : Array<string>, options? : QueryOptions,
addIndex( tableName : string | Object, attributes : string[], options? : QueryOptions,
rawTablename? : string ) : Promise<void>;
/**
@@ -4073,7 +4073,7 @@ declare module "sequelize" {
/**
* Put a name to an index
*/
nameIndexes( indexes : Array<string>, rawTablename : string ) : Promise<void>;
nameIndexes( indexes : string[], rawTablename : string ) : Promise<void>;
/**
* Returns all foreign key constraints of a table
@@ -4083,7 +4083,7 @@ declare module "sequelize" {
/**
* Removes an index of a table
*/
removeIndex( tableName : string, indexNameOrAttributes : Array<string> | string,
removeIndex( tableName : string, indexNameOrAttributes : string[] | string,
options? : QueryInterfaceOptions ) : Promise<void>;
/**
@@ -4101,8 +4101,8 @@ declare module "sequelize" {
/**
* Inserts multiple records at once
*/
bulkInsert( tableName : string, records : Array<Object>, options? : QueryOptions,
attributes? : Array<string> | string ) : Promise<Object>;
bulkInsert( tableName : string, records : Object[], options? : QueryOptions,
attributes? : string[] | string ) : Promise<Object>;
/**
* Updates a row
@@ -4114,7 +4114,7 @@ declare module "sequelize" {
* Updates multiple rows at once
*/
bulkUpdate( tableName : string, values : Object, identifier : Object, options? : QueryOptions,
attributes? : Array<string> | string ) : Promise<Object>;
attributes? : string[] | string ) : Promise<Object>;
/**
* Deletes a row
@@ -4131,7 +4131,7 @@ declare module "sequelize" {
/**
* Returns selected rows
*/
select( model : Model<any, any>, tableName : string, options? : QueryOptions ) : Promise<Array<Object>>;
select( model : Model<any, any>, tableName : string, options? : QueryOptions ) : Promise<Object[]>;
/**
* Increments a row value
@@ -4142,15 +4142,15 @@ declare module "sequelize" {
/**
* Selects raw without parsing the string into an object
*/
rawSelect( tableName : string, options : QueryOptions, attributeSelector : string | Array<string>,
model? : Model<any, any> ) : Promise<Array<string>>;
rawSelect( tableName : string, options : QueryOptions, attributeSelector : string | string[],
model? : Model<any, any> ) : Promise<string[]>;
/**
* Postgres only. Creates a trigger on specified table to call the specified function with supplied
* parameters.
*/
createTrigger( tableName : string, triggerName : string, timingType : string, fireOnArray : Array<any>,
functionName : string, functionParams : Array<any>, optionsArray : Array<string>,
createTrigger( tableName : string, triggerName : string, timingType : string, fireOnArray : any[],
functionName : string, functionParams : any[], optionsArray : string[],
options? : QueryInterfaceOptions ): Promise<void>;
/**
@@ -4167,19 +4167,19 @@ declare module "sequelize" {
/**
* Postgres only. Create a function
*/
createFunction( functionName : string, params : Array<any>, returnType : string, language : string,
createFunction( functionName : string, params : any[], returnType : string, language : string,
body : string, options? : QueryOptions ) : Promise<void>;
/**
* Postgres only. Drops a function
*/
dropFunction( functionName : string, params : Array<any>,
dropFunction( functionName : string, params : any[],
options? : QueryInterfaceOptions ) : Promise<void>;
/**
* Postgres only. Rename a function
*/
renameFunction( oldFunctionName : string, params : Array<any>, newFunctionName : string,
renameFunction( oldFunctionName : string, params : any[], newFunctionName : string,
options? : QueryInterfaceOptions ) : Promise<void>;
/**
@@ -4244,19 +4244,19 @@ declare module "sequelize" {
//
interface QueryTypes {
SELECT: string // 'SELECT'
INSERT: string // 'INSERT'
UPDATE: string // 'UPDATE'
BULKUPDATE: string // 'BULKUPDATE'
BULKDELETE: string // 'BULKDELETE'
DELETE: string // 'DELETE'
UPSERT: string // 'UPSERT'
VERSION: string // 'VERSION'
SHOWTABLES: string // 'SHOWTABLES'
SHOWINDEXES: string // 'SHOWINDEXES'
DESCRIBE: string // 'DESCRIBE'
RAW: string // 'RAW'
FOREIGNKEYS: string // 'FOREIGNKEYS'
SELECT: string; // 'SELECT'
INSERT: string; // 'INSERT'
UPDATE: string; // 'UPDATE'
BULKUPDATE: string; // 'BULKUPDATE'
BULKDELETE: string; // 'BULKDELETE'
DELETE: string; // 'DELETE'
UPSERT: string; // 'UPSERT'
VERSION: string; // 'VERSION'
SHOWTABLES: string; // 'SHOWTABLES'
SHOWINDEXES: string; // 'SHOWINDEXES'
DESCRIBE: string; // 'DESCRIBE'
RAW: string; // 'RAW'
FOREIGNKEYS: string; // 'FOREIGNKEYS'
}
//
@@ -4404,7 +4404,7 @@ declare module "sequelize" {
* })
* ```
*/
values? : Array<string>;
values? : string[];
}
@@ -4465,7 +4465,7 @@ declare module "sequelize" {
* Either an object of named parameter replacements in the format `:param` or an array of unnamed
* replacements to replace `?` in your SQL.
*/
replacements? : Object | Array<string>;
replacements? : Object | string[];
/**
* Force the query to use the write pool, regardless of the query type.
@@ -4477,7 +4477,7 @@ declare module "sequelize" {
/**
* A function that gets executed while running the query to log the sql.
*/
logging? : Function
logging? : Function;
/**
* A sequelize instance used to build the return instance
@@ -4608,17 +4608,17 @@ declare module "sequelize" {
/**
* check the value is not one of these
*/
notIn? : Array<Array<string>> | { msg: string, args: Array<Array<string>> };
notIn? : string[][] | { msg: string, args: string[][] };
/**
* check the value is one of these
*/
isIn? : Array<Array<string>> | { msg: string, args: Array<Array<string>> };
isIn? : string[][] | { msg: string, args: string[][] };
/**
* don't allow specific substrings
*/
notContains? : Array<string> | string | { msg: string, args: Array<string> | string };
notContains? : string[] | string | { msg: string, args: string[] | string };
/**
* only allow values with length between 2 and 10
@@ -4694,32 +4694,32 @@ declare module "sequelize" {
/**
* The name of the index. Defaults to model name + _ + fields concatenated
*/
name? : string,
name? : string;
/**
* Index type. Only used by mysql. One of `UNIQUE`, `FULLTEXT` and `SPATIAL`
*/
index? : string,
index? : string;
/**
* The method to create the index by (`USING` statement in SQL). BTREE and HASH are supported by mysql and
* postgres, and postgres additionally supports GIST and GIN.
*/
method? : string,
method? : string;
/**
* Should the index by unique? Can also be triggered by setting type to `UNIQUE`
*
* Defaults to false
*/
unique? : boolean,
unique? : boolean;
/**
* PostgreSQL will build the index without taking any write locks. Postgres only
*
* Defaults to false
*/
concurrently? : boolean,
concurrently? : boolean;
/**
* An array of the fields to index. Each field can either be a string containing the name of the field,
@@ -4727,7 +4727,7 @@ declare module "sequelize" {
* (field name), `length` (create a prefix index of length chars), `order` (the direction the column
* should be sorted in), `collate` (the collation (sort order) for the column)
*/
fields? : Array<string|{ attribute: string, length: number, order: string, collate: string }>
fields? : Array<string|{ attribute: string, length: number, order: string, collate: string }>;
}
@@ -4741,12 +4741,12 @@ declare module "sequelize" {
/**
* Singular model name
*/
singular? : string,
singular? : string;
/**
* Plural model name
*/
plural? : string,
plural? : string;
}
@@ -4842,7 +4842,7 @@ declare module "sequelize" {
/**
* Indexes for the provided database table
*/
indexes? : Array<DefineIndexesOptions>;
indexes? : DefineIndexesOptions[];
/**
* Override the name of the createdAt column if a string is provided, or disable it if false. Timestamps
@@ -5009,20 +5009,20 @@ declare module "sequelize" {
interface ReplicationOptions {
read?: {
host?: string,
port?: string | number,
username?: string,
password?: string,
database?: string
}
host?: string;
port?: string | number;
username?: string;
password?: string;
database?: string;
};
write?: {
host?: string,
port?: string | number,
username?: string,
password?: string,
database?: string
}
host?: string;
port?: string | number;
username?: string;
password?: string;
database?: string;
};
}
@@ -5265,7 +5265,7 @@ declare module "sequelize" {
*
* @param args Each argument will be joined by OR
*/
or( ...args : Array<string|Object> ) : or;
or( ...args : Array<string | Object> ) : or;
/**
* Creates an object representing nested where conditions for postgres's json data-type.
@@ -5462,7 +5462,7 @@ declare module "sequelize" {
*
* @param path The path to the file that holds the model you want to import. If the part is relative, it
* will be resolved relatively to the calling file
*
*
* @param defineFunction An optional function that provides model definitions. Useful if you do not
* want to use the module root as the define function
*/
@@ -5490,7 +5490,7 @@ declare module "sequelize" {
* @param sql
* @param options Query options
*/
query( sql : string | { query: string, values: Array<any> }, options? : QueryOptions ) : Promise<any>;
query( sql : string | { query: string, values: any[] }, options? : QueryOptions ) : Promise<any>;
/**
* Execute a query which would set an environment or user variable. The variables are set per connection,
@@ -5671,17 +5671,17 @@ declare module "sequelize" {
notEmpty( str : string ) : boolean;
len( str : string, min : number, max : number ) : boolean;
isUrl( str : string ) : boolean;
isIPv6( str : string ) : boolean
isIPv4( str : string ) : boolean
notIn( str : string, values : Array<string> ) : boolean;
isIPv6( str : string ) : boolean;
isIPv4( str : string ) : boolean;
notIn( str : string, values : string[] ) : boolean;
regex( str : string, pattern : string, modifiers : string ) : boolean;
notRegex( str : string, pattern : string, modifiers : string ) : boolean;
isDecimal( str : string ) : boolean;
min( str : string, val : number ) : boolean;
max( str : string, val : number ) : boolean;
not( str : string, pattern : string, modifiers : string ) : boolean;
contains( str : string, element : Array<string> ) : boolean;
notContains( str : string, element : Array<string> ) : boolean;
contains( str : string, element : string[] ) : boolean;
notContains( str : string, element : string[] ) : boolean;
is( str : string, pattern : string, modifiers : string ) : boolean;
}
@@ -5859,7 +5859,7 @@ declare module "sequelize" {
* @param fn The function you want to call
* @param args All further arguments will be passed as arguments to the function
*/
new ( fn : string, ...args : Array<any> ) : fn;
new ( fn : string, ...args : any[] ) : fn;
}
interface col {
@@ -5906,7 +5906,7 @@ declare module "sequelize" {
}
interface and {
args: Array<any>;
args: any[];
}
interface andStatic {
@@ -5919,7 +5919,7 @@ declare module "sequelize" {
}
interface or {
args: Array<any>;
args: any[];
}
interface orStatic {
@@ -5929,7 +5929,7 @@ declare module "sequelize" {
*
* @param args Each argument will be joined by OR
*/
new ( ...args : Array<String|Object> ) : or;
new ( ...args : Array<string | Object> ) : or;
}
interface json {
@@ -5991,8 +5991,8 @@ declare module "sequelize" {
*
* @param arr Array to compact.
*/
compactLite<T>( arr : Array<T> ): Array<T>;
matchesDots( dots : string | Array<string>, value : Object ) : ( item : Object ) => boolean;
compactLite<T>( arr : T[] ): T[];
matchesDots( dots : string | string[], value : Object ) : ( item : Object ) => boolean;
}
@@ -6009,13 +6009,13 @@ declare module "sequelize" {
uppercaseFirst( str : string ): string;
spliceStr( str : string, index : number, count : number, add : string ): string;
camelize( str : string ): string;
format( arr : Array<any>, dialect? : string ): string;
format( arr : any[], dialect? : string ): string;
formatNamedParameters( sql : string, parameters : any, dialect? : string ): string;
cloneDeep<T extends Object>( obj : T, fn? : ( value : T ) => any ) : T;
mapOptionFieldNames<T extends Object>( options : T, Model : Model<any, any> ) : T;
mapValueFieldNames( dataValues : Object, fields : Array<string>, Model : Model<any, any> ) : Object;
argsArePrimaryKeys( args : Array<any>, primaryKeys : Object ) : boolean;
canTreatArrayAsAnd( arr : Array<any> ) : boolean;
mapValueFieldNames( dataValues : Object, fields : string[], Model : Model<any, any> ) : Object;
argsArePrimaryKeys( args : any[], primaryKeys : Object ) : boolean;
canTreatArrayAsAnd( arr : any[] ) : boolean;
combineTableNames( tableName1 : string, tableName2 : string ): string;
singularize( s : string ): string;
pluralize( s : string ): string;
@@ -6032,7 +6032,7 @@ declare module "sequelize" {
removeNullValuesFromHash( hash : Object, omitNull? : boolean, options? : Object ): any;
inherit( subClass : Object, superClass : Object ): Object;
stack(): string;
sliceArgs( args : Array<any>, begin? : number ) : Array<any>;
sliceArgs( args : any[], begin? : number ) : any[];
now( dialect : string ): Date;
tick( f : Function ): void;
addTicks( s : string, tickChar? : string ): string;