knex 0.20.14 → 0.20.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Master (Unreleased)
2
2
 
3
+ # 0.20.15 - 16 April, 2020
4
+
5
+ ### Bug fixes:
6
+
7
+ - Support for `.finally(..)` on knex's Promise-alikes #3800
8
+
9
+ ### Typings:
10
+
11
+ - Add types for `.distinctOn` #3784
12
+
3
13
  # 0.20.14 - 13 April, 2020
4
14
 
5
15
  ### New features:
@@ -10,4 +10,4 @@ const finallyMixin = (prototype) =>
10
10
  // FYI: Support for `Promise.prototype.finally` was not introduced until Node 9.
11
11
  // Therefore, Knex will need to conditionally inject support for `.finally(..)`
12
12
  // until support for Node 8 is officially dropped.
13
- module.exports = Promise.prototype.finally ? noop : finallyMixin;
13
+ module.exports = Promise.prototype.finally ? finallyMixin : noop;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knex",
3
- "version": "0.20.14",
3
+ "version": "0.20.15",
4
4
  "description": "A batteries-included SQL query & schema builder for Postgres, MySQL and SQLite3 and the Browser",
5
5
  "main": "knex.js",
6
6
  "types": "types/index.d.ts",
package/types/index.d.ts CHANGED
@@ -433,6 +433,7 @@ declare namespace Knex {
433
433
  into: Table<TRecord, TResult>;
434
434
  table: Table<TRecord, TResult>;
435
435
  distinct: Distinct<TRecord, TResult>;
436
+ distinctOn: DistinctOn<TRecord, TResult>;
436
437
 
437
438
  // Joins
438
439
  join: Join<TRecord, TResult>;
@@ -909,6 +910,19 @@ declare namespace Knex {
909
910
  interface Distinct<TRecord extends {}, TResult = {}[]>
910
911
  extends ColumnNameQueryBuilder<TRecord, TResult> {}
911
912
 
913
+ interface DistinctOn<TRecord extends {}, TResult = {}[]> {
914
+ <ColNameUT extends keyof TRecord>(
915
+ ...columnNames: readonly ColNameUT[]
916
+ ): QueryBuilder<TRecord, TResult>;
917
+
918
+ <ColNameUT extends keyof TRecord>(
919
+ columnNames: readonly ColNameUT[]
920
+ ): QueryBuilder<TRecord, TResult>;
921
+
922
+ (...columnNames: readonly string[]): QueryBuilder<TRecord, TResult>;
923
+ (columnNames: readonly string[]): QueryBuilder<TRecord, TResult>;
924
+ }
925
+
912
926
  interface JoinCallback {
913
927
  (this: JoinClause, join: JoinClause): void;
914
928
  }