objection
Advanced tools
Comparing version 2.1.6 to 2.2.0
@@ -685,3 +685,3 @@ 'use strict'; | ||
} catch (error) { | ||
await handleExecuteError(builder, error); | ||
return await handleExecuteError(builder, error); | ||
} | ||
@@ -688,0 +688,0 @@ } |
@@ -175,2 +175,6 @@ 'use strict'; | ||
andWhereNot(...args) { | ||
return this.addOperation(new KnexOperation('andWhereNot'), args); | ||
} | ||
orWhereNot(...args) { | ||
@@ -177,0 +181,0 @@ return this.addOperation(new KnexOperation('orWhereNot'), args); |
@@ -7,7 +7,7 @@ 'use strict'; | ||
const { isSqlite, isMySql } = require('../../utils/knexUtils'); | ||
const { isSqlite } = require('../../utils/knexUtils'); | ||
const { inheritModel } = require('../../model/inheritModel'); | ||
const { resolveModel } = require('../../utils/resolveModel'); | ||
const { mapAfterAllReturn } = require('../../utils/promiseUtils'); | ||
const { isFunction, isObject } = require('../../utils/objectUtils'); | ||
const { isFunction, isObject, isString } = require('../../utils/objectUtils'); | ||
@@ -421,3 +421,7 @@ const { ManyToManyFindOperation } = require('./find/ManyToManyFindOperation'); | ||
if (Array.isArray(extraDef)) { | ||
if (isString(extraDef)) { | ||
extraDef = { | ||
[extraDef]: extraDef | ||
}; | ||
} else if (Array.isArray(extraDef)) { | ||
extraDef = extraDef.reduce((extraDef, col) => { | ||
@@ -424,0 +428,0 @@ extraDef[col] = col; |
{ | ||
"name": "objection", | ||
"version": "2.1.6", | ||
"version": "2.2.0", | ||
"description": "An SQL-friendly ORM for Node.js", | ||
@@ -19,3 +19,3 @@ "main": "lib/objection.js", | ||
"perf-opt": "mocha --slow 60000 --timeout 60000 --reporter spec --recursive perf --trace_opt --trace_deopt", | ||
"prettier": "prettier --write \"{examples,lib,tests,typings,doc}/**/*.{js,ts,md}\"", | ||
"prettier": "prettier --write \"{examples,lib,tests,typings,doc}/**/*.{js,ts}\"", | ||
"eslint": "eslint --format codeframe \"examples/**/*.js\" \"lib/**/*.js\" \"tests/**/*.js\"", | ||
@@ -119,3 +119,3 @@ "docs:dev": "vuepress dev doc", | ||
], | ||
"*.{md,yml,ts}": [ | ||
"*.{yml,ts}": [ | ||
"prettier --write", | ||
@@ -122,0 +122,0 @@ "git add" |
@@ -17,4 +17,3 @@ /// <reference types="node" /> | ||
import * as dbErrors from 'db-errors'; | ||
import * as knex from 'knex'; | ||
import Knex = require('knex'); | ||
import * as Knex from 'knex'; | ||
@@ -122,3 +121,3 @@ // Export the entire Objection namespace. | ||
type Raw = RawBuilder | knex.Raw; | ||
type Raw = RawBuilder | Knex.Raw; | ||
type Operator = string; | ||
@@ -194,3 +193,3 @@ type ColumnRef = string | Raw | ReferenceBuilder; | ||
type ModelObject<T extends Model> = { | ||
[K in NonFunctionPropertyNames<T>]: T[K]; | ||
[K in Exclude<NonFunctionPropertyNames<T>, 'QueryBuilderType'>]: T[K]; | ||
}; | ||
@@ -532,3 +531,3 @@ | ||
(table: TableRef, leftCol: ColumnRef, rightCol: ColumnRef): QB; | ||
(table: TableRef, cb: CallbackVoid<knex.JoinClause>): QB; | ||
(table: TableRef, cb: CallbackVoid<Knex.JoinClause>): QB; | ||
(table: TableRef, raw: Raw): QB; | ||
@@ -615,3 +614,3 @@ (raw: Raw): QB; | ||
interface ColumnInfoMethod<QB extends AnyQueryBuilder> { | ||
(): Promise<knex.ColumnInfo>; | ||
(): Promise<Knex.ColumnInfo>; | ||
} | ||
@@ -675,3 +674,3 @@ | ||
interface OnBuildKnexCallback<QB extends AnyQueryBuilder> { | ||
(this: QB, knexQuery: knex.QueryBuilder, query: QB): void; | ||
(this: QB, knexQuery: Knex.QueryBuilder, query: QB): void; | ||
} | ||
@@ -885,21 +884,26 @@ | ||
orHaving: WhereMethod<this>; | ||
havingRaw: WhereMethod<this>; | ||
orHavingRaw: WhereMethod<this>; | ||
havingIn: WhereMethod<this>; | ||
orHavingIn: WhereMethod<this>; | ||
havingNotIn: WhereMethod<this>; | ||
orHavingNotIn: WhereMethod<this>; | ||
havingNull: WhereMethod<this>; | ||
orHavingNull: WhereMethod<this>; | ||
havingNotNull: WhereMethod<this>; | ||
orHavingNotNull: WhereMethod<this>; | ||
havingExists: WhereMethod<this>; | ||
orHavingExists: WhereMethod<this>; | ||
havingNotExists: WhereMethod<this>; | ||
orHavingNotExists: WhereMethod<this>; | ||
havingBetween: WhereMethod<this>; | ||
orHavingBetween: WhereMethod<this>; | ||
havingNotBetween: WhereMethod<this>; | ||
orHavingNotBetween: WhereMethod<this>; | ||
havingRaw: WhereRawMethod<this>; | ||
orHavingRaw: WhereRawMethod<this>; | ||
havingIn: WhereInMethod<this>; | ||
orHavingIn: WhereInMethod<this>; | ||
havingNotIn: WhereInMethod<this>; | ||
orHavingNotIn: WhereInMethod<this>; | ||
havingNull: WhereNullMethod<this>; | ||
orHavingNull: WhereNullMethod<this>; | ||
havingNotNull: WhereNullMethod<this>; | ||
orHavingNotNull: WhereNullMethod<this>; | ||
havingExists: WhereExistsMethod<this>; | ||
orHavingExists: WhereExistsMethod<this>; | ||
havingNotExists: WhereExistsMethod<this>; | ||
orHavingNotExists: WhereExistsMethod<this>; | ||
havingBetween: WhereBetweenMethod<this>; | ||
orHavingBetween: WhereBetweenMethod<this>; | ||
havingNotBetween: WhereBetweenMethod<this>; | ||
orHavingNotBetween: WhereBetweenMethod<this>; | ||
whereComposite: WhereCompositeMethod<this>; | ||
@@ -1076,6 +1080,7 @@ whereInComposite: WhereInCompositeMethod<this>; | ||
omit(properties: string[]): this; | ||
// Deprecated | ||
traverse(filterConstructor: typeof Model, traverser: TraverserFunction): R; | ||
// Deprecated | ||
traverse(traverser: TraverserFunction): R; | ||
traverseAsync(filterConstructor: typeof Model, traverser: TraverserFunction): Promise<R>; | ||
traverseAsync(traverser: TraverserFunction): Promise<R>; | ||
@@ -1184,4 +1189,4 @@ page(page: number, pageSize: number): PageQueryBuilder<this>; | ||
export type Transaction = knex.Transaction; | ||
export type TransactionOrKnex = Transaction | knex; | ||
export type Transaction = Knex.Transaction; | ||
export type TransactionOrKnex = Transaction | Knex; | ||
@@ -1221,3 +1226,3 @@ export interface RelationMappings { | ||
to: RelationMappingColumnRef; | ||
extra?: string[] | Record<string, string>; | ||
extra?: string | string[] | Record<string, string>; | ||
modelClass?: ModelClassSpecifier; | ||
@@ -1372,3 +1377,3 @@ beforeInsert?: RelationMappingHook<M>; | ||
export interface FetchTableMetadataOptions { | ||
knex?: knex; | ||
knex?: Knex; | ||
force?: boolean; | ||
@@ -1449,4 +1454,4 @@ table?: string; | ||
knex(knex?: knex): knex; | ||
knexQuery(): knex.QueryBuilder; | ||
knex(knex?: Knex): Knex; | ||
knexQuery(): Knex.QueryBuilder; | ||
startTransaction(knexOrTransaction?: TransactionOrKnex): Promise<Transaction>; | ||
@@ -1580,4 +1585,4 @@ | ||
static knex(knex?: knex): knex; | ||
static knexQuery(): knex.QueryBuilder; | ||
static knex(knex?: Knex): Knex; | ||
static knexQuery(): Knex.QueryBuilder; | ||
static startTransaction(knexOrTransaction?: TransactionOrKnex): Promise<Transaction>; | ||
@@ -1691,4 +1696,4 @@ | ||
$toDatabaseJson(): Pojo; | ||
$toJson(opt?: ToJsonOptions): Pojo; | ||
toJSON(opt?: ToJsonOptions): Pojo; | ||
$toJson(opt?: ToJsonOptions): ModelObject<this>; | ||
toJSON(opt?: ToJsonOptions): ModelObject<this>; | ||
@@ -1714,5 +1719,7 @@ $setJson(json: object, opt?: ModelOptions): this; | ||
$traverse(traverser: TraverserFunction): this; | ||
$traverseAsync(filterConstructor: typeof Model, traverser: TraverserFunction): Promise<this>; | ||
$traverseAsync(traverser: TraverserFunction): Promise<this>; | ||
$knex(): knex; | ||
$transaction(): knex; | ||
$knex(): Knex; | ||
$transaction(): Knex; | ||
@@ -1731,3 +1738,3 @@ QueryBuilderType: QueryBuilder<this, this[]>; | ||
export interface transaction { | ||
start(knexOrModel: knex | AnyModelConstructor): Promise<Transaction>; | ||
start(knexOrModel: Knex | AnyModelConstructor): Promise<Transaction>; | ||
@@ -1809,3 +1816,3 @@ <MC1 extends AnyModelConstructor, ReturnValue>( | ||
<ReturnValue>(knex: knex, callback: (trx: Transaction) => Promise<ReturnValue>): Promise< | ||
<ReturnValue>(knex: Knex, callback: (trx: Transaction) => Promise<ReturnValue>): Promise< | ||
ReturnValue | ||
@@ -1812,0 +1819,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
639493
19846