Skip to content

Commit 9a66f21

Browse files
committed
Fix a bug with typescript 4 and allowGraph
1 parent 0ececc7 commit 9a66f21

File tree

6 files changed

+6
-108
lines changed

6 files changed

+6
-108
lines changed

lib/model/modelFilter.js

Lines changed: 0 additions & 103 deletions
This file was deleted.

lib/queryBuilder/QueryBuilderOperationSupport.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const { isString, isFunction, isRegExp, last } = require('../utils/objectUtils');
44
const { QueryBuilderContextBase } = require('./QueryBuilderContextBase');
55
const { QueryBuilderUserContext } = require('./QueryBuilderUserContext');
6+
const { deprecate } = require('../utils/deprecate');
67

78
const AllSelector = () => true;
89
const SelectSelector =
@@ -494,6 +495,7 @@ class QueryBuilderOperationSupport {
494495
}
495496

496497
skipUndefined() {
498+
deprecate('skipUndefined() is deprecated and will be removed in objection 4.0');
497499
this.internalOptions().skipUndefined = true;
498500
return this;
499501
}

lib/queryBuilder/RelationExpression.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ function modelToNode(model, node) {
291291
for (let r = 0, lr = relationNames.length; r < lr; ++r) {
292292
const relName = relationNames[r];
293293

294-
if (model.hasOwnProperty(relName)) {
294+
if (model[relName] !== undefined) {
295295
let childNode = node[relName];
296296

297297
if (!childNode) {

lib/queryBuilder/graph/recursiveUpsert/GraphRecursiveUpsert.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class GraphRecursiveUpsert extends GraphOperation {
1818

1919
function hasRelations(obj) {
2020
for (const relationName of obj.constructor.getRelationNames()) {
21-
if (obj.hasOwnProperty(relationName)) {
21+
if (obj[relationName] !== undefined) {
2222
return true;
2323
}
2424
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "objection",
3-
"version": "3.0.0-rc.2",
3+
"version": "3.0.0-rc.3",
44
"description": "An SQL-friendly ORM for Node.js",
55
"main": "lib/objection.js",
66
"license": "MIT",

tests/integration/insert.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1699,8 +1699,7 @@ module.exports = (session) => {
16991699
const result = await Model2.query()
17001700
.insert({ idCol: 1, model2Prop1: 'updated', model2Prop2: 123456 })
17011701
.onConflict('id_col')
1702-
.merge(['model2_prop1'])
1703-
.debug();
1702+
.merge(['model2_prop1']);
17041703
expect(result instanceof Model2).to.equal(true);
17051704

17061705
const rows = await Model2.query();

0 commit comments

Comments
 (0)