From d93d6a53a4a294afa953bda3a731c9bc0ea4a43d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vesa=20Poikaj=C3=A4rvi?= Date: Wed, 3 May 2017 23:19:42 +0300 Subject: [PATCH] [bookshelf] fetchAll supports same parameters as fetch (#16170) * fetchAll supports same parameters as fetch Latest Bookshelf's instance.fetchAll calls collection.fetch() with given options, ie. it supports the same options than fetch. For example (new User).fetchAll({columns: ['id', 'name']}).then(...) * Update version number * Revert "Update version number" This reverts commit cf4a3e6c51554d75f5408acd23bb0fade6acafef. * remove extra slash from contributor's name --- types/bookshelf/bookshelf-tests.ts | 9 +++++++++ types/bookshelf/index.d.ts | 3 +-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/types/bookshelf/bookshelf-tests.ts b/types/bookshelf/bookshelf-tests.ts index de7c73b085..f42a1bf784 100644 --- a/types/bookshelf/bookshelf-tests.ts +++ b/types/bookshelf/bookshelf-tests.ts @@ -481,6 +481,15 @@ new Book({'ISBN-13': '9780440180296'}) /* model.fetchAll(), see http://bookshelfjs.org/#Model-instance-fetchAll */ +{ + (new User).fetchAll({ + columns: ['id', 'name'], + withRelated: ['posts.tags'] + }).then((user: any) => { + console.log(user); + }) +} + /* model.format(), see http://bookshelfjs.org/#Model-instance-format */ /* model.get(), see http://bookshelfjs.org/#Model-instance-get */ diff --git a/types/bookshelf/index.d.ts b/types/bookshelf/index.d.ts index e6b61eb1cc..86176ed2e8 100644 --- a/types/bookshelf/index.d.ts +++ b/types/bookshelf/index.d.ts @@ -282,8 +282,7 @@ declare namespace Bookshelf { [index: string]: (query: Knex.QueryBuilder) => Knex.QueryBuilder; } - interface FetchAllOptions extends SyncOptions { - require?: boolean; + interface FetchAllOptions extends FetchOptions { } interface SaveOptions extends SyncOptions {