Comparing version 0.20.4 to 0.20.6
# Master (Unreleased) | ||
# 0.20.6 - 29 December, 2019 | ||
### Bug fixes: | ||
- Enforce Unix (lf) line terminators #3598 | ||
# 0.20.5 - 29 December, 2019 | ||
### New features: | ||
- Return more information about empty updates #3597 | ||
### Bug fixes: | ||
- Fix colors in debug logs #3592 | ||
### Test / internal changes: | ||
- Use more efficient algorithm for generating internal ids #3595 #3596 | ||
- Use Buffer.alloc() instead of deprecated constructor #3574 | ||
# 0.20.4 - 08 December, 2019 | ||
@@ -4,0 +25,0 @@ |
@@ -6,3 +6,3 @@ ## How to contribute to Knex.js | ||
- Before sending a pull request for a feature or bug fix, be sure to have | ||
[tests](https://github.com/tgriesser/knex/tree/master/test). Every pull request that changes the queries should have | ||
[tests](https://github.com/knex/knex/tree/master/test). Every pull request that changes the queries should have | ||
also **integration tests which are ran against real database** (in addition to unit tests which checks which kind of queries | ||
@@ -12,3 +12,3 @@ are being created). | ||
- Use the same coding style as the rest of the | ||
[codebase](https://github.com/tgriesser/knex/blob/master/knex.js). | ||
[codebase](https://github.com/knex/knex/blob/master/knex.js). | ||
@@ -19,3 +19,3 @@ - All pull requests should be made to the `master` branch. | ||
- All pull requests that modify the public API should be updated in [types/index.d.ts](https://github.com/tgriesser/knex/blob/master/types/index.d.ts) | ||
- All pull requests that modify the public API should be updated in [types/index.d.ts](https://github.com/knex/knex/blob/master/types/index.d.ts) | ||
@@ -32,3 +32,3 @@ ## Documentation | ||
So if you like to write your own dialect, you can just inherit own dialect from knex base classes and use it by passing dilaect to knex in knex configuration (https://runkit.com/embed/90b3cpyr4jh2): | ||
So if you like to write your own dialect, you can just inherit own dialect from knex base classes and use it by passing dialect to knex in knex configuration (https://runkit.com/embed/90b3cpyr4jh2): | ||
@@ -151,3 +151,3 @@ ```js | ||
If you'd like to override the database configuration (to use a different host, for example), you can override the path to the [default test configuration](https://github.com/tgriesser/knex/blob/master/test/knexfile.js) using the `KNEX_TEST` environment variable. | ||
If you'd like to override the database configuration (to use a different host, for example), you can override the path to the [default test configuration](https://github.com/knex/knex/blob/master/test/knexfile.js) using the `KNEX_TEST` environment variable. | ||
@@ -160,3 +160,3 @@ ```bash | ||
If you are running tests agains own local database one might need to setup test user and databse for knex to connect. | ||
If you are running tests against own local database one might need to setup test user and database for knex to connect. | ||
@@ -163,0 +163,0 @@ To create a new user, login to Postgres and use the following queries to add the user. This assumes you've already created the `knex_test` database. |
@@ -33,3 +33,3 @@ const Bluebird = require('bluebird'); | ||
const debugQuery = (sql, txId) => _debugQuery(sql.replace(/%/g, '%%'), txId) | ||
const debugQuery = (sql, txId) => _debugQuery(sql.replace(/%/g, '%%'), txId); | ||
@@ -36,0 +36,0 @@ const { POOL_CONFIG_OPTIONS } = require('./constants'); |
@@ -81,3 +81,3 @@ // Oracledb Client | ||
const asyncConnection = new Bluebird(function(resolver, rejecter) { | ||
// If external authentication dont have to worry about username/password and | ||
// If external authentication don't have to worry about username/password and | ||
// if not need to set the username and password | ||
@@ -345,3 +345,3 @@ const oracleDbConfig = client.connectionSettings.externalAuth | ||
return new Promise((resolve, reject) => { | ||
let data = type === 'string' ? '' : Buffer(0); | ||
let data = type === 'string' ? '' : Buffer.alloc(0); | ||
@@ -348,0 +348,0 @@ stream.on('error', function(err) { |
@@ -163,5 +163,5 @@ // PostgreSQL Query Builder & Compiler | ||
return 'distinct on (' + this.formatter.columnize(value) + ') '; | ||
} | ||
}, | ||
}); | ||
module.exports = QueryCompiler_PG; |
@@ -10,5 +10,13 @@ /* eslint no-console:0 */ | ||
const { | ||
log: { debug, warn, error, deprecate, inspectionDepth } = {}, | ||
log: { | ||
debug, | ||
warn, | ||
error, | ||
deprecate, | ||
inspectionDepth, | ||
enableColors, | ||
} = {}, | ||
} = config; | ||
this._inspectionDepth = inspectionDepth || 5; | ||
this._enableColors = resolveIsEnabledColors(enableColors); | ||
this._debug = debug; | ||
@@ -31,3 +39,6 @@ this._warn = warn; | ||
if (!isString(message)) { | ||
message = inspect(message, { depth: this._inspectionDepth }); | ||
message = inspect(message, { | ||
depth: this._inspectionDepth, | ||
colors: this._enableColors, | ||
}); | ||
} | ||
@@ -57,2 +68,14 @@ | ||
function resolveIsEnabledColors(enableColorsParam) { | ||
if (!isNil(enableColorsParam)) { | ||
return enableColorsParam; | ||
} | ||
if (process && process.stdout) { | ||
return process.stdout.isTTY; | ||
} | ||
return false; | ||
} | ||
module.exports = Logger; |
@@ -204,3 +204,3 @@ // Builder | ||
value, | ||
distinctOn: true | ||
distinctOn: true, | ||
}); | ||
@@ -207,0 +207,0 @@ return this; |
@@ -21,3 +21,2 @@ // Query Compiler | ||
has, | ||
keys, | ||
} = require('lodash'); | ||
@@ -74,3 +73,3 @@ const uuid = require('uuid'); | ||
bindings: this.formatter.bindings || [], | ||
__knexQueryUid: uuid.v4(), | ||
__knexQueryUid: uuid.v1(), | ||
}; | ||
@@ -584,5 +583,3 @@ | ||
distinctOn(value) { | ||
throw new Error( | ||
'.distinctOn() is currently only supported on PostgreSQL' | ||
) | ||
throw new Error('.distinctOn() is currently only supported on PostgreSQL'); | ||
}, | ||
@@ -792,3 +789,3 @@ | ||
for (const column of keys(counter)) { | ||
for (const column of Object.keys(counter)) { | ||
//Skip? | ||
@@ -834,2 +831,6 @@ if (has(data, column)) { | ||
'This will result in a faulty query.', | ||
this.single.table ? `Table: ${this.single.table}.` : '', | ||
this.single.update | ||
? `Columns: ${Object.keys(this.single.update)}.` | ||
: '', | ||
].join(' ') | ||
@@ -836,0 +837,0 @@ ); |
@@ -116,3 +116,3 @@ // Raw | ||
obj.__knexQueryUid = uuid.v4(); | ||
obj.__knexQueryUid = uuid.v1(); | ||
@@ -119,0 +119,0 @@ return obj; |
@@ -80,3 +80,5 @@ // TableBuilder | ||
if (this.client.dialect !== dialect) { | ||
throw new Error(`Knex only supports ${method} statement with ${dialect}.`); | ||
throw new Error( | ||
`Knex only supports ${method} statement with ${dialect}.` | ||
); | ||
} | ||
@@ -86,3 +88,3 @@ if (this._method === 'alter') { | ||
`Knex does not support altering the ${method} outside of create ` + | ||
`table, please use knex.raw statement.` | ||
`table, please use knex.raw statement.` | ||
); | ||
@@ -89,0 +91,0 @@ } |
@@ -225,3 +225,3 @@ const { EventEmitter } = require('events'); | ||
// Unfortunately, something seems to be broken in Node 6 and removing events from a clone also mutates original Knex, | ||
// which is highly undesireable | ||
// which is highly undesirable | ||
if (knex._internalListeners) { | ||
@@ -228,0 +228,0 @@ knex._internalListeners.forEach(({ eventName, listener }) => { |
{ | ||
"name": "knex", | ||
"version": "0.20.4", | ||
"version": "0.20.6", | ||
"description": "A batteries-included SQL query & schema builder for Postgres, MySQL and SQLite3 and the Browser", | ||
@@ -31,3 +31,3 @@ "main": "knex.js", | ||
"dependencies": { | ||
"bluebird": "^3.7.1", | ||
"bluebird": "^3.7.2", | ||
"colorette": "1.1.0", | ||
@@ -79,3 +79,3 @@ "commander": "^4.0.1", | ||
"devDependencies": { | ||
"@types/node": "^10.17.5", | ||
"@types/node": "^10.17.13", | ||
"JSONStream": "^1.3.5", | ||
@@ -85,3 +85,3 @@ "chai": "^4.2.0", | ||
"cli-testlab": "^1.8.0", | ||
"coveralls": "^3.0.7", | ||
"coveralls": "^3.0.9", | ||
"cross-env": "^6.0.3", | ||
@@ -101,3 +101,3 @@ "dtslint": "^2.0.2", | ||
"nyc": "^14.1.1", | ||
"pg": "^7.12.1", | ||
"pg": "^7.16.1", | ||
"pg-query-stream": "^2.0.1", | ||
@@ -124,3 +124,3 @@ "prettier": "1.18.2", | ||
"type": "git", | ||
"url": "git://github.com/tgriesser/knex.git" | ||
"url": "git://github.com/knex/knex.git" | ||
}, | ||
@@ -127,0 +127,0 @@ "homepage": "https://knexjs.org", |
@@ -20,3 +20,3 @@ # [knex.js](http://knexjs.org) | ||
- both a [promise](http://knexjs.org/#Interfaces-Promises) and [callback](http://knexjs.org/#Interfaces-Callbacks) API | ||
- a [thorough test suite](https://travis-ci.org/tgriesser/knex) | ||
- a [thorough test suite](https://travis-ci.org/knex/knex) | ||
- the ability to [run in the Browser](http://knexjs.org/#Installation-browser) | ||
@@ -27,4 +27,4 @@ | ||
[Read the full documentation to get started!](http://knexjs.org) | ||
[Or check out our Recipes wiki to search for solutions to some specific problems](https://github.com/tgriesser/knex/wiki/Recipes) | ||
If upgrading from older version, see [Upgrading instructions](https://github.com/tgriesser/knex/blob/master/UPGRADING.md) | ||
[Or check out our Recipes wiki to search for solutions to some specific problems](https://github.com/knex/knex/wiki/Recipes) | ||
If upgrading from older version, see [Upgrading instructions](https://github.com/knex/knex/blob/master/UPGRADING.md) | ||
@@ -31,0 +31,0 @@ For support and questions, join the `#bookshelf` channel on freenode IRC |
@@ -52,3 +52,3 @@ // Originally based on contributions to DefinitelyTyped: | ||
type ComparisionOperator = '=' | '>' | '>=' | '<' | '<=' | '<>'; | ||
type ComparisonOperator = '=' | '>' | '>=' | '<' | '<=' | '<>'; | ||
@@ -101,3 +101,3 @@ // If T is an array, get the type of member, else fall back to never | ||
// If true, then we assume that some keys were selected, and if TKeys is never, we will fall back to any. | ||
// If false, and TKeys is never, then we select TBase in its entirity | ||
// If false, and TKeys is never, then we select TBase in its entirety | ||
THasSelect extends true | false = false, | ||
@@ -526,4 +526,4 @@ // Mapping of aliases <key in result> -> <key in TBase> | ||
// Aggregation | ||
count: AssymetricAggregation<TRecord, TResult, Lookup<ResultTypes.Registry, "Count", number | string>>; | ||
countDistinct: AssymetricAggregation<TRecord, TResult, Lookup<ResultTypes.Registry, "Count", number | string>>; | ||
count: AsymmetricAggregation<TRecord, TResult, Lookup<ResultTypes.Registry, "Count", number | string>>; | ||
countDistinct: AsymmetricAggregation<TRecord, TResult, Lookup<ResultTypes.Registry, "Count", number | string>>; | ||
min: TypePreservingAggregation<TRecord, TResult>; | ||
@@ -1063,3 +1063,3 @@ max: TypePreservingAggregation<TRecord, TResult>; | ||
columnName: T, | ||
operator: ComparisionOperator, | ||
operator: ComparisonOperator, | ||
value: TRecord[T] | null | ||
@@ -1074,3 +1074,3 @@ ): QueryBuilder<TRecord, TResult>; | ||
columnName: T, | ||
operator: ComparisionOperator, | ||
operator: ComparisonOperator, | ||
value: QueryBuilder<TRecordInner, TResultInner> | ||
@@ -1159,7 +1159,7 @@ ): QueryBuilder<TRecord, TResult>; | ||
// Note: Attempting to unify AssymetricAggregation & TypePreservingAggregation | ||
// Note: Attempting to unify AsymmetricAggregation & TypePreservingAggregation | ||
// by extracting out a common base interface will not work because order of overloads | ||
// is significant. | ||
interface AssymetricAggregation<TRecord = any, TResult = unknown[], TValue = any> { | ||
interface AsymmetricAggregation<TRecord = any, TResult = unknown[], TValue = any> { | ||
<TResult2 = AggregationQueryResult<TResult, Dict<TValue>>>( | ||
@@ -1241,3 +1241,3 @@ ...columnNames: (keyof TRecord)[] | ||
column1: K1, | ||
operator: ComparisionOperator, | ||
operator: ComparisonOperator, | ||
column2: K2 | ||
@@ -1864,2 +1864,3 @@ ): QueryBuilder<TRecord, TResult>; | ||
inspectionDepth?: number; | ||
enableColors?: boolean; | ||
deprecate?: (method: string, alternative: string) => void; | ||
@@ -1866,0 +1867,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
571038
15358
Updatedbluebird@^3.7.2