objection
Advanced tools
Comparing version 0.8.6 to 0.8.7
@@ -12,2 +12,4 @@ 'use strict'; | ||
const Validator = require('./model/Validator'); | ||
const compose = require('./utils/mixin').compose; | ||
const mixin = require('./utils/mixin').mixin; | ||
@@ -24,2 +26,4 @@ const Relation = require('./relations/Relation'); | ||
const raw = require('./queryBuilder/RawBuilder').raw; | ||
const lodash = require('lodash'); | ||
const Promise = require('bluebird'); | ||
@@ -44,6 +48,10 @@ | ||
transaction, | ||
compose, | ||
mixin, | ||
ref, | ||
raw, | ||
Promise, | ||
ref, | ||
raw | ||
lodash | ||
}; | ||
@@ -98,3 +98,3 @@ 'use strict'; | ||
// skipValidation flag. We need to explicitly call $validate here. | ||
node.upsertModel.$validate(); | ||
node.upsertModel.$validate(node.upsertModel, {patch: true}); | ||
@@ -101,0 +101,0 @@ if (node.parentNode) { |
@@ -85,3 +85,3 @@ 'use strict'; | ||
const tableMap = ctx.tableMap; | ||
return (tableMap && tableMap[modelClass.tableName]) || modelClass.tableName; | ||
@@ -540,3 +540,3 @@ } | ||
throw this._modelClass.createNotFoundError(builder.context()); | ||
} else if (result === null || result === undefined) { | ||
} else if (result === null || result === undefined || result === 0) { | ||
throw this._modelClass.createNotFoundError(builder.context()); | ||
@@ -1090,2 +1090,2 @@ } else { | ||
module.exports = QueryBuilder; | ||
module.exports = QueryBuilder; |
{ | ||
"name": "objection", | ||
"version": "0.8.6", | ||
"version": "0.8.7", | ||
"description": "An SQL-friendly ORM for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "lib/objection.js", |
@@ -60,2 +60,12 @@ // Type definitions for objection v0.8.4 | ||
export interface UpsertOptions { | ||
relate?: boolean; | ||
unrelate?: boolean; | ||
} | ||
export interface QueryContext { | ||
transaction: Transaction; | ||
[key: string]: any; | ||
} | ||
/** | ||
@@ -229,4 +239,5 @@ * @see http://vincit.github.io/objection.js/#fieldexpression | ||
static JoinEagerAlgorithm: () => any; | ||
static WhereInEagerAlgorithm: () => any; | ||
static JoinEagerAlgorithm: EagerAlgorithm; | ||
static WhereInEagerAlgorithm: EagerAlgorithm | ||
static NaiveEagerAlgorithm: EagerAlgorithm; | ||
@@ -306,6 +317,9 @@ // "{ new(): T }" | ||
$beforeInsert(queryContext: object): Promise<any> | void; | ||
$afterInsert(queryContext: object): Promise<any> | void; | ||
$afterUpdate(opt: ModelOptions, queryContext: object): Promise<any> | void; | ||
$beforeUpdate(opt: ModelOptions, queryContext: object): Promise<any> | void; | ||
$beforeInsert(queryContext: QueryContext): Promise<any> | void; | ||
$afterInsert(queryContext: QueryContext): Promise<any> | void; | ||
$afterUpdate(opt: ModelOptions, queryContext: QueryContext): Promise<any> | void; | ||
$beforeUpdate(opt: ModelOptions, queryContext: QueryContext): Promise<any> | void; | ||
$afterGet(queryContext: QueryContext): Promise<any> | void; | ||
$beforeDelete(queryContext: QueryContext): Promise<any> | void; | ||
$afterDelete(queryContext: QueryContext): Promise<any> | void; | ||
} | ||
@@ -341,5 +355,4 @@ | ||
interface Upsert<T> { | ||
(modelsOrObjects?: Array<Partial<T>>): QueryBuilder<T>; | ||
(modelOrObject?: Partial<T>): QueryBuilderSingle<T>; | ||
(): this; | ||
(modelsOrObjects?: Array<Partial<T>>, options?: UpsertOptions): QueryBuilder<T>; | ||
(modelOrObject?: Partial<T>, options?: UpsertOptions): QueryBuilderSingle<T>; | ||
} | ||
@@ -465,2 +478,3 @@ | ||
context(queryContext: object): this; | ||
mergeContext(queryContext: object): this; | ||
@@ -467,0 +481,0 @@ reject(reason: any): this; |
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
384679
131
11201