objection 3.0.0-rc.1 → 3.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -8,10 +8,13 @@ class MergeOperation extends QueryBuilderOperation {
|
|
|
8
8
|
constructor(name, opt) {
|
|
9
9
|
super(name, opt);
|
|
10
10
|
this.model = null;
|
|
11
|
+
this.args = null;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
onAdd(builder, args) {
|
|
14
|
-
|
|
15
|
+
this.args = args;
|
|
16
|
+
|
|
17
|
+
if (!isEmpty(args) && isObject(args[0]) && !Array.isArray(args[0])) {
|
|
15
18
|
const json = args[0];
|
|
16
19
|
const modelClass = builder.modelClass();
|
|
17
20
|
|
|
@@ -33,7 +36,7 @@ class MergeOperation extends QueryBuilderOperation {
|
|
|
33
36
|
return knexBuilder.merge(convertedJson);
|
|
34
37
|
}
|
|
35
38
|
|
|
36
|
-
return knexBuilder.merge();
|
|
39
|
+
return knexBuilder.merge(...this.args);
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
toFindOperation() {
|
|
@@ -43,6 +46,7 @@ class MergeOperation extends QueryBuilderOperation {
|
|
|
43
46
|
clone() {
|
|
44
47
|
const clone = super.clone();
|
|
45
48
|
clone.model = this.model;
|
|
49
|
+
clone.args = this.args;
|
|
46
50
|
return clone;
|
|
47
51
|
}
|
|
48
52
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "objection",
|
|
3
|
-
"version": "3.0.0-rc.
|
|
3
|
+
"version": "3.0.0-rc.2",
|
|
4
4
|
"description": "An SQL-friendly ORM for Node.js",
|
|
5
5
|
"main": "lib/objection.js",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"test": "npm run eslint && mocha --slow 10 --timeout 15000 --reporter spec --recursive tests --exclude \"tests/unit/relations/files/**\"",
|
|
9
|
-
"test
|
|
10
|
-
"test
|
|
8
|
+
"test": "npm run eslint && mocha --slow 10 --timeout 15000 --reporter spec --recursive tests --exclude \"tests/unit/relations/files/**\" && npm run test:typings",
|
|
9
|
+
"test:fast": "mocha --slow 10 --timeout 15000 --reporter spec --recursive tests --bail --exclude \"tests/unit/relations/files/**\"",
|
|
10
|
+
"test:typings": "tsc",
|
|
11
11
|
"prettier": "prettier --write \"{examples,lib,tests,typings,doc}/**/*.{js,ts}\"",
|
|
12
12
|
"eslint": "eslint --format codeframe \"examples/**/*.js\" \"lib/**/*.js\" \"tests/**/*.js\"",
|
|
13
13
|
"docs:dev": "vuepress dev doc",
|
|
@@ -960,7 +960,7 @@ declare namespace Objection {
|
|
|
960
960
|
|
|
961
961
|
onConflict(column?: string | string[] | true): this;
|
|
962
962
|
ignore(): this;
|
|
963
|
-
merge(merge?: PartialModelObject<M>): this;
|
|
963
|
+
merge(merge?: PartialModelObject<M> | string[]): this;
|
|
964
964
|
|
|
965
965
|
insertAndFetch(insert: PartialModelObject<M>): SingleQueryBuilder<this>;
|
|
966
966
|
insertAndFetch(insert: PartialModelObject<M>[]): ArrayQueryBuilder<this>;
|