objection
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -28,2 +28,6 @@ 'use strict'; | ||
get relation() { | ||
return this.delegate.relation; | ||
} | ||
onAdd(builder, args) { | ||
@@ -51,13 +55,23 @@ const retVal = super.onAdd(builder, args); | ||
onBefore1() { | ||
onBefore1(_, result) { | ||
// Do nothing. | ||
return result; | ||
} | ||
onBefore2() { | ||
// Do nothing. We override this with empty implementation so that | ||
// the $beforeInsert() hooks are not called twice for the root models. | ||
onBefore2(builder, result) { | ||
// We override this with empty implementation so that the $beforeInsert() | ||
// hooks are not called twice for the root models. | ||
if (this.relation) { | ||
// We still need to call the relation before insert hook if the the | ||
// delegate operation is a RelationInsertOperation. | ||
return this.relation.executeBeforeInsert(this.models, builder.context(), result); | ||
} else { | ||
return result; | ||
} | ||
} | ||
onBefore3() { | ||
onBefore3(_, result) { | ||
// Do nothing. | ||
return result; | ||
} | ||
@@ -64,0 +78,0 @@ |
{ | ||
"name": "objection", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "An SQL-friendly ORM for Node.js", | ||
@@ -113,3 +113,3 @@ "main": "lib/objection.js", | ||
"lint-staged": { | ||
"*.{js}": [ | ||
"*.js": [ | ||
"prettier --write", | ||
@@ -119,3 +119,3 @@ "eslint --fix", | ||
], | ||
"*.{md,yml}": [ | ||
"*.{md,yml,ts}": [ | ||
"prettier --write", | ||
@@ -122,0 +122,0 @@ "git add" |
@@ -602,2 +602,10 @@ /// <reference types="node" /> | ||
interface HasMethod { | ||
(selector: string | RegExp): boolean; | ||
} | ||
interface ClearMethod<QB extends AnyQueryBuilder> { | ||
(selector: string | RegExp): QB; | ||
} | ||
interface ColumnInfoMethod<QB extends AnyQueryBuilder> { | ||
@@ -779,2 +787,3 @@ (): Promise<knex.ColumnInfo>; | ||
(modifiers: Modifiers): QB; | ||
(): QB; | ||
} | ||
@@ -1116,2 +1125,3 @@ | ||
isUnrelate: BooleanReturningMethod; | ||
isInternal: BooleanReturningMethod; | ||
hasWheres: BooleanReturningMethod; | ||
@@ -1123,2 +1133,5 @@ hasSelects: BooleanReturningMethod; | ||
has: HasMethod; | ||
clear: ClearMethod<this>; | ||
clearSelect: IdentityMethod<this>; | ||
@@ -1125,0 +1138,0 @@ clearOrder: IdentityMethod<this>; |
637354
19807