From 9c4b25ea328ed3e7fab3709bf6368bde91ada36e Mon Sep 17 00:00:00 2001 From: Abdul Raheem Date: Sun, 29 Aug 2021 01:37:59 +0500 Subject: [PATCH 1/3] fix(types): change attributes type to 'object | undefined' change attributes type to 'object': - attributes param in QueryInterface.bulkInsert() change to 'object | undefined' from 'string[] | string | undefined'. - attributes param in QueryInterface.bulkUpdate() change to 'object | undefined' from 'string[] | string | undefined'. - add '{}' as last param in bulkInsert() & bulkUpdate() tests Closes #13466 --- types/lib/query-interface.d.ts | 4 ++-- types/test/query-interface.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/types/lib/query-interface.d.ts b/types/lib/query-interface.d.ts index ec4529af6d42..77f3c98a030a 100644 --- a/types/lib/query-interface.d.ts +++ b/types/lib/query-interface.d.ts @@ -498,7 +498,7 @@ export class QueryInterface { tableName: TableName, records: object[], options?: QueryOptions, - attributes?: string[] | string + attributes?: object ): Promise; /** @@ -520,7 +520,7 @@ export class QueryInterface { values: object, identifier: WhereOptions, options?: QueryOptions, - attributes?: string[] | string + attributes?: object, ): Promise; /** diff --git a/types/test/query-interface.ts b/types/test/query-interface.ts index 09c403b23810..02f15bfd121c 100644 --- a/types/test/query-interface.ts +++ b/types/test/query-interface.ts @@ -65,9 +65,9 @@ async function test() { await queryInterface.bulkDelete({ tableName: 'foo', schema: 'bar' }, {}, {}); - const bulkInsertRes: Promise = queryInterface.bulkInsert({ tableName: 'foo', as: 'bar', name: 'as' }, [{}], {}); + const bulkInsertRes: Promise = queryInterface.bulkInsert({ tableName: 'foo', as: 'bar', name: 'as' }, [{}], {}, {}); - await queryInterface.bulkUpdate({ tableName: 'foo', delimiter: 'bar', as: 'baz', name: 'quz' }, {}, {}); + await queryInterface.bulkUpdate({ tableName: 'foo', delimiter: 'bar', as: 'baz', name: 'quz' }, {}, {}, {}); await queryInterface.dropTrigger({ tableName: 'foo', as: 'bar', name: 'baz' }, 'foo', {}); From 12e1b49f05ce6700d95e54457adcda4ff27a2e9b Mon Sep 17 00:00:00 2001 From: Abdul Raheem Date: Sun, 29 Aug 2021 01:52:34 +0500 Subject: [PATCH 2/3] style: remove addition semi colon --- types/lib/query-interface.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/lib/query-interface.d.ts b/types/lib/query-interface.d.ts index 77f3c98a030a..1a3cc0fd2db6 100644 --- a/types/lib/query-interface.d.ts +++ b/types/lib/query-interface.d.ts @@ -520,7 +520,7 @@ export class QueryInterface { values: object, identifier: WhereOptions, options?: QueryOptions, - attributes?: object, + attributes?: object ): Promise; /** From 60f64b19c86aad511ff36f8ace200c36367e752a Mon Sep 17 00:00:00 2001 From: Abdul Raheem Date: Wed, 13 Oct 2021 14:21:50 +0500 Subject: [PATCH 3/3] fix(types): update type of attributes in 'BulkUpdate' & 'BulkInsert' - In BulkUpdate function update attributes type to ModelAttributes. - In BulkInsert function update attributes type to ModelAttributes. --- types/lib/query-interface.d.ts | 4 ++-- types/test/query-interface.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/types/lib/query-interface.d.ts b/types/lib/query-interface.d.ts index 1a3cc0fd2db6..7a977bb0390e 100644 --- a/types/lib/query-interface.d.ts +++ b/types/lib/query-interface.d.ts @@ -498,7 +498,7 @@ export class QueryInterface { tableName: TableName, records: object[], options?: QueryOptions, - attributes?: object + attributes?: ModelAttributes ): Promise; /** @@ -520,7 +520,7 @@ export class QueryInterface { values: object, identifier: WhereOptions, options?: QueryOptions, - attributes?: object + attributes?: ModelAttributes ): Promise; /** diff --git a/types/test/query-interface.ts b/types/test/query-interface.ts index 02f15bfd121c..d893496b4d45 100644 --- a/types/test/query-interface.ts +++ b/types/test/query-interface.ts @@ -65,9 +65,9 @@ async function test() { await queryInterface.bulkDelete({ tableName: 'foo', schema: 'bar' }, {}, {}); - const bulkInsertRes: Promise = queryInterface.bulkInsert({ tableName: 'foo', as: 'bar', name: 'as' }, [{}], {}, {}); + const bulkInsertRes: Promise = queryInterface.bulkInsert({ tableName: 'foo', as: 'bar', name: 'as' }, [{}], {}, { attr1: { type: DataTypes.STRING }, attr2: { type: DataTypes.JSON, } }); - await queryInterface.bulkUpdate({ tableName: 'foo', delimiter: 'bar', as: 'baz', name: 'quz' }, {}, {}, {}); + await queryInterface.bulkUpdate({ tableName: 'foo', delimiter: 'bar', as: 'baz', name: 'quz' }, {}, {}, {}, { attr1: { type: DataTypes.STRING }, attr2: { type: DataTypes.JSON } }); await queryInterface.dropTrigger({ tableName: 'foo', as: 'bar', name: 'baz' }, 'foo', {});