From 8d948f4a02ca04895b7f408f380bf2dbb4dab68e Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Fri, 15 Jan 2016 16:51:34 +0900 Subject: [PATCH] fix code format --- sequelize/sequelize-tests-2.0.0.ts | 17 +- sequelize/sequelize-tests.ts | 4 +- sequelize/sequelize.d.ts | 310 ++++++++++++++--------------- 3 files changed, 165 insertions(+), 166 deletions(-) diff --git a/sequelize/sequelize-tests-2.0.0.ts b/sequelize/sequelize-tests-2.0.0.ts index d35074e086..0ef636c859 100644 --- a/sequelize/sequelize-tests-2.0.0.ts +++ b/sequelize/sequelize-tests-2.0.0.ts @@ -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, 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(function (result: modelInst): Sequelize.PromiseT { return model.find(1) }); -model.find().then(function (result: modelInst): Sequelize.PromiseT { return model.find(1) }, function (): Sequelize.PromiseT { return model.find(1) }); +model.find().then(function (result: modelInst): Sequelize.PromiseT { return model.find(1); }); +model.find().then(function (result: modelInst): Sequelize.PromiseT { return model.find(1); }, function (): Sequelize.PromiseT { 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(function (result: modelInst): Sequelize.PromiseT { return model.find(1) }); -model.find().spread(function (result: modelInst) { }, function (): Sequelize.PromiseT { return model.find(1) }); -model.find().spread(function (result: modelInst): Sequelize.PromiseT { return model.find(1) }, function (): Sequelize.PromiseT { return model.find(1) }); +model.find().spread(function (result: modelInst): Sequelize.Promise { return model.find(1); }); +model.find().spread(function (result: modelInst): Sequelize.PromiseT { return model.find(1); }); +model.find().spread(function (result: modelInst) { }, function (): Sequelize.PromiseT { return model.find(1); }); +model.find().spread(function (result: modelInst): Sequelize.PromiseT { return model.find(1); }, function (): Sequelize.PromiseT { return model.find(1); }); promiseMe = model.findAll(findOpts, queryOpts); promiseMe = model.findAll(findOpts); diff --git a/sequelize/sequelize-tests.ts b/sequelize/sequelize-tests.ts index cda4aff119..74c7e06e80 100644 --- a/sequelize/sequelize-tests.ts +++ b/sequelize/sequelize-tests.ts @@ -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 ) { } ); diff --git a/sequelize/sequelize.d.ts b/sequelize/sequelize.d.ts index 3f1e2c86fc..e33b4b8d72 100644 --- a/sequelize/sequelize.d.ts +++ b/sequelize/sequelize.d.ts @@ -55,7 +55,7 @@ declare module "sequelize" { * Get the associated instance. * @param options The options to use when getting the association. */ - (options?: BelongsToGetAssociationMixinOptions): Promise + (options?: BelongsToGetAssociationMixinOptions): Promise; } /** @@ -96,7 +96,7 @@ declare module "sequelize" { ( newAssociation?: TInstance | TInstancePrimaryKey, options?: BelongsToSetAssociationMixinOptions | InstanceSaveOptions - ): Promise + ): Promise; } /** @@ -132,7 +132,7 @@ declare module "sequelize" { ( values?: TAttributes, options?: BelongsToCreateAssociationMixinOptions | CreateOptions | BelongsToSetAssociationMixinOptions - ): Promise + ): Promise; } /** @@ -169,7 +169,7 @@ declare module "sequelize" { * Get the associated instance. * @param options The options to use when getting the association. */ - (options?: HasOneGetAssociationMixinOptions): Promise + (options?: HasOneGetAssociationMixinOptions): Promise; } /** @@ -210,7 +210,7 @@ declare module "sequelize" { ( newAssociation?: TInstance | TInstancePrimaryKey, options?: HasOneSetAssociationMixinOptions | HasOneGetAssociationMixinOptions | InstanceSaveOptions - ): Promise + ): Promise; } /** @@ -246,7 +246,7 @@ declare module "sequelize" { ( values?: TAttributes, options?: HasOneCreateAssociationMixinOptions | HasOneSetAssociationMixinOptions | CreateOptions - ): Promise + ): Promise; } /** @@ -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 + (options?: HasManyGetAssociationsMixinOptions): Promise; } /** @@ -346,7 +346,7 @@ declare module "sequelize" { ( newAssociations?: Array, options?: HasManySetAssociationsMixinOptions | FindOptions | InstanceUpdateOptions - ): Promise + ): Promise; } /** @@ -395,7 +395,7 @@ declare module "sequelize" { ( newAssociations?: Array, options?: HasManyAddAssociationsMixinOptions | InstanceUpdateOptions - ): Promise + ): Promise; } /** @@ -444,7 +444,7 @@ declare module "sequelize" { ( newAssociation?: TInstance | TInstancePrimaryKey, options?: HasManyAddAssociationMixinOptions | InstanceUpdateOptions - ): Promise + ): Promise; } /** @@ -487,7 +487,7 @@ declare module "sequelize" { ( values?: TAttributes, options?: HasManyCreateAssociationMixinOptions | CreateOptions - ): Promise + ): Promise; } /** @@ -530,7 +530,7 @@ declare module "sequelize" { ( oldAssociated?: TInstance | TInstancePrimaryKey, options?: HasManyRemoveAssociationMixinOptions | InstanceUpdateOptions - ): Promise + ): Promise; } /** @@ -573,7 +573,7 @@ declare module "sequelize" { ( oldAssociateds?: Array, options?: HasManyRemoveAssociationsMixinOptions | InstanceUpdateOptions - ): Promise + ): Promise; } /** @@ -616,7 +616,7 @@ declare module "sequelize" { ( target: TInstance | TInstancePrimaryKey, options?: HasManyHasAssociationMixinOptions | HasManyGetAssociationsMixinOptions - ): Promise + ): Promise; } /** @@ -659,7 +659,7 @@ declare module "sequelize" { ( targets: Array, options?: HasManyHasAssociationsMixinOptions | HasManyGetAssociationsMixinOptions - ): Promise + ): Promise; } /** @@ -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 + (options?: HasManyCountAssociationsMixinOptions): Promise; } /** @@ -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 + (options?: BelongsToManyGetAssociationsMixinOptions): Promise; } /** @@ -809,7 +809,7 @@ declare module "sequelize" { ( newAssociations?: Array, options?: BelongsToManySetAssociationsMixinOptions | FindOptions | BulkCreateOptions | InstanceUpdateOptions | InstanceDestroyOptions | TJoinTableAttributes - ): Promise + ): Promise; } /** @@ -858,7 +858,7 @@ declare module "sequelize" { ( newAssociations?: Array, options?: BelongsToManyAddAssociationsMixinOptions | FindOptions | BulkCreateOptions | InstanceUpdateOptions | InstanceDestroyOptions | TJoinTableAttributes - ): Promise + ): Promise; } /** @@ -907,7 +907,7 @@ declare module "sequelize" { ( newAssociation?: TInstance | TInstancePrimaryKey, options?: BelongsToManyAddAssociationMixinOptions | FindOptions | BulkCreateOptions | InstanceUpdateOptions | InstanceDestroyOptions | TJoinTableAttributes - ): Promise + ): Promise; } /** @@ -950,7 +950,7 @@ declare module "sequelize" { ( values?: TAttributes, options?: BelongsToManyCreateAssociationMixinOptions | CreateOptions | TJoinTableAttributes - ): Promise + ): Promise; } /** @@ -993,7 +993,7 @@ declare module "sequelize" { ( oldAssociated?: TInstance | TInstancePrimaryKey, options?: BelongsToManyRemoveAssociationMixinOptions | InstanceDestroyOptions - ): Promise + ): Promise; } /** @@ -1036,7 +1036,7 @@ declare module "sequelize" { ( oldAssociateds?: Array, options?: BelongsToManyRemoveAssociationsMixinOptions | InstanceDestroyOptions - ): Promise + ): Promise; } /** @@ -1079,7 +1079,7 @@ declare module "sequelize" { ( target: TInstance | TInstancePrimaryKey, options?: BelongsToManyHasAssociationMixinOptions | BelongsToManyGetAssociationsMixinOptions - ): Promise + ): Promise; } /** @@ -1122,7 +1122,7 @@ declare module "sequelize" { ( targets: Array, options?: BelongsToManyHasAssociationsMixinOptions | BelongsToManyGetAssociationsMixinOptions - ): Promise + ): Promise; } /** @@ -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 + (options?: BelongsToManyCountAssociationsMixinOptions): Promise; } /** @@ -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 ) : 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 ) : 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 ) : 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; - + get( path : string ) : ValidationErrorItem[]; + /** Array of ValidationErrorItem objects describing the validation errors */ - errors : Array; - + 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, 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, 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, options : Object, fn? : Function ) => any; - afterBulkCreate? : ( instances : Array, 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, 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, options : Object, fn? : Function ) => void ): void; - beforeBulkCreate( fn : ( instances : Array, 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, options : Object, fn? : Function ) => void ): void; - afterBulkCreate( fn : ( instances : Array, 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, options : Object, + fn : ( instancesOrInstance : TInstance[] | TInstance, options : Object, fn? : Function ) => void ): void; - afterFind( fn : ( instancesOrInstance : Array | 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; + 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; + 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 } ) : Promise; + validate( options? : { skip?: string[] } ) : Promise; /** * 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 | Object, + increment( fields : string | string[] | Object, options? : InstanceIncrementDecrementOptions ) : Promise; /** @@ -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 | Object, + decrement( fields : string | string[] | Object, options? : InstanceIncrementDecrementOptions ) : Promise; /** @@ -2880,7 +2880,7 @@ declare module "sequelize" { /** * Check if this is eqaul to one of `others` by calling equals */ - equalsOneOf( others : Array> ) : boolean; + equalsOneOf( others : Instance[] ) : 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; + method : string | any[]; } @@ -2968,7 +2968,7 @@ declare module "sequelize" { */ interface WhereGeometryOptions { type: string; - coordinates: Array | number>; + coordinates: Array; } /** @@ -3023,7 +3023,7 @@ declare module "sequelize" { /** * A list of attributes to select from the join model for belongsToMany relations */ - attributes? : Array; + 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; + 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; + 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; + fields? : string[]; /** * On Duplicate @@ -3301,7 +3301,7 @@ declare module "sequelize" { /** * The fields to insert / update. Defaults to all fields */ - fields? : Array; + 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; + 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; + updateOnDuplicate? : string[]; /** * Transaction to run query under @@ -3477,7 +3477,7 @@ declare module "sequelize" { /** * Fields to update (defaults to all fields) */ - fields? : Array; + 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; + 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 | ScopeOptions | WhereOptions ) : Model; + scope( options? : string | string[] | ScopeOptions | WhereOptions ) : Model; /** * Search for multiple instances. @@ -3720,8 +3720,8 @@ declare module "sequelize" { * * @see {Sequelize#query} */ - findAll( options? : FindOptions ) : Promise>; - all( optionz? : FindOptions ) : Promise>; + findAll( options? : FindOptions ) : Promise; + all( optionz? : FindOptions ) : Promise; /** * 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, count : number }>; - findAndCountAll( options? : FindOptions ) : Promise<{ rows : Array, 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, options? : BuildOptions ) : Array; + 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, options? : BulkCreateOptions ) : Promise>; + bulkCreate( records : TAttributes[], options? : BulkCreateOptions ) : Promise; /** * 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]>; + 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>; + showAllTables( options? : QueryOptions ) : Promise; /** * Describe a table @@ -4062,7 +4062,7 @@ declare module "sequelize" { /** * Adds a new index to a table */ - addIndex( tableName : string | Object, attributes : Array, options? : QueryOptions, + addIndex( tableName : string | Object, attributes : string[], options? : QueryOptions, rawTablename? : string ) : Promise; /** @@ -4073,7 +4073,7 @@ declare module "sequelize" { /** * Put a name to an index */ - nameIndexes( indexes : Array, rawTablename : string ) : Promise; + nameIndexes( indexes : string[], rawTablename : string ) : Promise; /** * 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, + removeIndex( tableName : string, indexNameOrAttributes : string[] | string, options? : QueryInterfaceOptions ) : Promise; /** @@ -4101,8 +4101,8 @@ declare module "sequelize" { /** * Inserts multiple records at once */ - bulkInsert( tableName : string, records : Array, options? : QueryOptions, - attributes? : Array | string ) : Promise; + bulkInsert( tableName : string, records : Object[], options? : QueryOptions, + attributes? : string[] | string ) : Promise; /** * 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 ) : Promise; + attributes? : string[] | string ) : Promise; /** * Deletes a row @@ -4131,7 +4131,7 @@ declare module "sequelize" { /** * Returns selected rows */ - select( model : Model, tableName : string, options? : QueryOptions ) : Promise>; + select( model : Model, tableName : string, options? : QueryOptions ) : Promise; /** * 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, - model? : Model ) : Promise>; + rawSelect( tableName : string, options : QueryOptions, attributeSelector : string | string[], + model? : Model ) : Promise; /** * 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, - functionName : string, functionParams : Array, optionsArray : Array, + createTrigger( tableName : string, triggerName : string, timingType : string, fireOnArray : any[], + functionName : string, functionParams : any[], optionsArray : string[], options? : QueryInterfaceOptions ): Promise; /** @@ -4167,19 +4167,19 @@ declare module "sequelize" { /** * Postgres only. Create a function */ - createFunction( functionName : string, params : Array, returnType : string, language : string, + createFunction( functionName : string, params : any[], returnType : string, language : string, body : string, options? : QueryOptions ) : Promise; /** * Postgres only. Drops a function */ - dropFunction( functionName : string, params : Array, + dropFunction( functionName : string, params : any[], options? : QueryInterfaceOptions ) : Promise; /** * Postgres only. Rename a function */ - renameFunction( oldFunctionName : string, params : Array, newFunctionName : string, + renameFunction( oldFunctionName : string, params : any[], newFunctionName : string, options? : QueryInterfaceOptions ) : Promise; /** @@ -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; + 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; + 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> | { msg: string, args: Array> }; + notIn? : string[][] | { msg: string, args: string[][] }; /** * check the value is one of these */ - isIn? : Array> | { msg: string, args: Array> }; + isIn? : string[][] | { msg: string, args: string[][] }; /** * don't allow specific substrings */ - notContains? : Array | string | { msg: string, args: Array | 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 + fields? : Array; } @@ -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; + 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 ) : or; + or( ...args : Array ) : 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 }, options? : QueryOptions ) : Promise; + query( sql : string | { query: string, values: any[] }, options? : QueryOptions ) : Promise; /** * 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 ) : 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 ) : boolean; - notContains( str : string, element : Array ) : 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 ) : fn; + new ( fn : string, ...args : any[] ) : fn; } interface col { @@ -5906,7 +5906,7 @@ declare module "sequelize" { } interface and { - args: Array; + args: any[]; } interface andStatic { @@ -5919,7 +5919,7 @@ declare module "sequelize" { } interface or { - args: Array; + args: any[]; } interface orStatic { @@ -5929,7 +5929,7 @@ declare module "sequelize" { * * @param args Each argument will be joined by OR */ - new ( ...args : Array ) : or; + new ( ...args : Array ) : or; } interface json { @@ -5991,8 +5991,8 @@ declare module "sequelize" { * * @param arr Array to compact. */ - compactLite( arr : Array ): Array; - matchesDots( dots : string | Array, value : Object ) : ( item : Object ) => boolean; + compactLite( 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, dialect? : string ): string; + format( arr : any[], dialect? : string ): string; formatNamedParameters( sql : string, parameters : any, dialect? : string ): string; cloneDeep( obj : T, fn? : ( value : T ) => any ) : T; mapOptionFieldNames( options : T, Model : Model ) : T; - mapValueFieldNames( dataValues : Object, fields : Array, Model : Model ) : Object; - argsArePrimaryKeys( args : Array, primaryKeys : Object ) : boolean; - canTreatArrayAsAnd( arr : Array ) : boolean; + mapValueFieldNames( dataValues : Object, fields : string[], Model : Model ) : 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, begin? : number ) : Array; + sliceArgs( args : any[], begin? : number ) : any[]; now( dialect : string ): Date; tick( f : Function ): void; addTicks( s : string, tickChar? : string ): string;