@abedmurrar/objection 4.0.0-beta.0 → 4.0.0-beta.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.
- package/lib/queryBuilder/operations/DelegateOperation.js +6 -6
- package/lib/queryBuilder/operations/DeleteOperation.js +11 -11
- package/lib/queryBuilder/operations/FindByIdOperation.js +8 -8
- package/lib/queryBuilder/operations/FindByIdsOperation.js +6 -6
- package/lib/queryBuilder/operations/FindOperation.js +23 -23
- package/lib/queryBuilder/operations/FirstOperation.js +6 -6
- package/lib/queryBuilder/operations/FromOperation.js +13 -13
- package/lib/queryBuilder/operations/InsertAndFetchOperation.js +12 -12
- package/lib/queryBuilder/operations/InsertGraphAndFetchOperation.js +10 -10
- package/lib/queryBuilder/operations/InsertGraphOperation.js +11 -11
- package/lib/queryBuilder/operations/InsertOperation.js +23 -22
- package/lib/queryBuilder/operations/InstanceDeleteOperation.js +12 -12
- package/lib/queryBuilder/operations/InstanceFindOperation.js +10 -10
- package/lib/queryBuilder/operations/InstanceInsertOperation.js +6 -6
- package/lib/queryBuilder/operations/InstanceUpdateOperation.js +14 -14
- package/lib/queryBuilder/operations/JoinRelatedOperation.js +13 -13
- package/lib/queryBuilder/operations/KnexOperation.js +6 -6
- package/lib/queryBuilder/operations/MergeOperation.js +11 -11
- package/lib/queryBuilder/operations/ObjectionToKnexConvertingOperation.js +26 -22
- package/lib/queryBuilder/operations/OnBuildKnexOperation.js +6 -6
- package/lib/queryBuilder/operations/OnBuildOperation.js +6 -6
- package/lib/queryBuilder/operations/OnErrorOperation.js +6 -6
- package/lib/queryBuilder/operations/QueryBuilderOperation.js +6 -4
- package/lib/queryBuilder/operations/RangeOperation.js +7 -6
- package/lib/queryBuilder/operations/RelateOperation.js +6 -6
- package/lib/queryBuilder/operations/ReturningOperation.js +8 -8
- package/lib/queryBuilder/operations/RunAfterOperation.js +6 -6
- package/lib/queryBuilder/operations/RunBeforeOperation.js +6 -6
- package/lib/queryBuilder/operations/UnrelateOperation.js +6 -6
- package/lib/queryBuilder/operations/UpdateAndFetchOperation.js +12 -12
- package/lib/queryBuilder/operations/UpdateOperation.js +24 -24
- package/lib/queryBuilder/operations/UpsertGraphAndFetchOperation.js +10 -10
- package/lib/queryBuilder/operations/UpsertGraphOperation.js +10 -10
- package/lib/queryBuilder/operations/WhereCompositeOperation.js +8 -8
- package/lib/queryBuilder/operations/WhereInOperation.js +11 -9
- package/lib/queryBuilder/operations/eager/EagerOperation.js +11 -9
- package/lib/queryBuilder/operations/eager/JoinEagerOperation.js +10 -12
- package/lib/queryBuilder/operations/eager/NaiveEagerOperation.js +6 -6
- package/lib/queryBuilder/operations/eager/WhereInEagerOperation.js +64 -28
- package/lib/queryBuilder/operations/jsonApi/WhereJsonHasOperation.js +45 -12
- package/lib/queryBuilder/operations/jsonApi/WhereJsonNotObjectOperation.js +45 -12
- package/lib/queryBuilder/operations/jsonApi/WhereJsonOperation.js +45 -12
- package/lib/queryBuilder/operations/jsonApi/WhereJsonOverlapsOperation.js +46 -13
- package/lib/queryBuilder/operations/jsonApi/mysqlJsonApi.js +22 -27
- package/lib/queryBuilder/operations/jsonApi/postgresJsonApi.js +51 -17
- package/lib/queryBuilder/operations/select/SelectOperation.js +12 -12
- package/lib/queryBuilder/operations/select/Selection.js +23 -19
- package/lib/queryBuilder/operations/types.js +8 -0
- package/lib/queryBuilder/operations/whereInComposite/WhereInCompositeMsSqlOperation.js +13 -12
- package/lib/queryBuilder/operations/whereInComposite/WhereInCompositeOperation.js +11 -11
- package/lib/queryBuilder/operations/whereInComposite/WhereInCompositeSqliteOperation.js +10 -10
- package/lib/relations/Relation.js +31 -29
- package/lib/relations/RelationDeleteOperation.js +8 -8
- package/lib/relations/RelationFindOperation.js +8 -6
- package/lib/relations/RelationInsertOperation.js +6 -6
- package/lib/relations/RelationOwner.js +16 -13
- package/lib/relations/RelationProperty.js +18 -15
- package/lib/relations/RelationUpdateOperation.js +8 -8
- package/lib/relations/belongsToOne/BelongsToOneDeleteOperation.js +6 -6
- package/lib/relations/belongsToOne/BelongsToOneInsertOperation.js +8 -8
- package/lib/relations/belongsToOne/BelongsToOneRelateOperation.js +8 -8
- package/lib/relations/belongsToOne/BelongsToOneRelation.js +14 -14
- package/lib/relations/belongsToOne/BelongsToOneUnrelateOperation.js +6 -6
- package/lib/relations/hasMany/HasManyInsertOperation.js +6 -6
- package/lib/relations/hasMany/HasManyRelateOperation.js +11 -11
- package/lib/relations/hasMany/HasManyRelation.js +12 -12
- package/lib/relations/hasMany/HasManyUnrelateOperation.js +9 -9
- package/lib/relations/hasOne/HasOneRelation.js +6 -6
- package/lib/relations/hasOneThrough/HasOneThroughRelation.js +6 -6
- package/lib/relations/manyToMany/ManyToManyModifyMixin.js +9 -8
- package/lib/relations/manyToMany/ManyToManyRelation.js +52 -49
- package/lib/relations/manyToMany/ManyToManySqliteModifyMixin.js +6 -6
- package/lib/relations/manyToMany/delete/ManyToManyDeleteOperation.js +7 -7
- package/lib/relations/manyToMany/delete/ManyToManyDeleteOperationBase.js +6 -6
- package/lib/relations/manyToMany/delete/ManyToManyDeleteSqliteOperation.js +7 -7
- package/lib/relations/manyToMany/find/ManyToManyFindOperation.js +8 -8
- package/lib/relations/manyToMany/insert/ManyToManyInsertOperation.js +8 -8
- package/lib/relations/manyToMany/relate/ManyToManyRelateOperation.js +11 -10
- package/lib/relations/manyToMany/unrelate/ManyToManyUnrelateOperation.js +7 -7
- package/lib/relations/manyToMany/unrelate/ManyToManyUnrelateOperationBase.js +8 -8
- package/lib/relations/manyToMany/unrelate/ManyToManyUnrelateSqliteOperation.js +7 -7
- package/lib/relations/manyToMany/update/ManyToManyUpdateOperation.js +7 -7
- package/lib/relations/manyToMany/update/ManyToManyUpdateOperationBase.js +8 -8
- package/lib/relations/manyToMany/update/ManyToManyUpdateSqliteOperation.js +7 -7
- package/package.json +1 -1
|
@@ -1,17 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.WhereJsonNotObjectOperation = void 0;
|
|
37
|
+
const jsonApi = __importStar(require("./postgresJsonApi"));
|
|
38
|
+
const mysqlJsonApi = __importStar(require("./mysqlJsonApi"));
|
|
39
|
+
const postgresJsonPath_1 = require("../../../utils/postgresJsonPath");
|
|
40
|
+
const mysqlJsonPath_1 = require("../../../utils/mysqlJsonPath");
|
|
41
|
+
const ObjectionToKnexConvertingOperation_1 = require("../ObjectionToKnexConvertingOperation");
|
|
7
42
|
// `whereJsonNotArray` and `whereJsonNotObject`.
|
|
8
|
-
class WhereJsonNotObjectOperation extends ObjectionToKnexConvertingOperation {
|
|
43
|
+
class WhereJsonNotObjectOperation extends ObjectionToKnexConvertingOperation_1.ObjectionToKnexConvertingOperation {
|
|
9
44
|
onBuildKnex(knexBuilder, builder) {
|
|
10
|
-
const dialect = getJsonDialect(builder.unsafeKnex(), this.name);
|
|
45
|
+
const dialect = (0, postgresJsonPath_1.getJsonDialect)(builder.unsafeKnex(), this.name);
|
|
11
46
|
const fieldExpression = this.getKnexArgs(builder)[0];
|
|
12
47
|
if (dialect === 'mysql') {
|
|
13
48
|
const [rawSql, bindings] = mysqlJsonApi.whereJsonNotContains(fieldExpression, this.opt.compareValue);
|
|
14
|
-
const sql = jsonCastsForDialect(rawSql, builder.unsafeKnex());
|
|
49
|
+
const sql = (0, mysqlJsonPath_1.jsonCastsForDialect)(rawSql, builder.unsafeKnex());
|
|
15
50
|
return this.opt.bool === 'or'
|
|
16
51
|
? knexBuilder.orWhereRaw(sql, bindings)
|
|
17
52
|
: knexBuilder.whereRaw(sql, bindings);
|
|
@@ -32,6 +67,4 @@ class WhereJsonNotObjectOperation extends ObjectionToKnexConvertingOperation {
|
|
|
32
67
|
return knexBuilder;
|
|
33
68
|
}
|
|
34
69
|
}
|
|
35
|
-
|
|
36
|
-
WhereJsonNotObjectOperation,
|
|
37
|
-
};
|
|
70
|
+
exports.WhereJsonNotObjectOperation = WhereJsonNotObjectOperation;
|
|
@@ -1,20 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.WhereJsonOperation = void 0;
|
|
37
|
+
const postgresJsonApi = __importStar(require("./postgresJsonApi"));
|
|
38
|
+
const mysqlJsonApi = __importStar(require("./mysqlJsonApi"));
|
|
39
|
+
const postgresJsonPath_1 = require("../../../utils/postgresJsonPath");
|
|
40
|
+
const mysqlJsonPath_1 = require("../../../utils/mysqlJsonPath");
|
|
41
|
+
const ObjectionToKnexConvertingOperation_1 = require("../ObjectionToKnexConvertingOperation");
|
|
7
42
|
// `whereJsonSupersetOf`, `whereJsonSubsetOf` and their variants.
|
|
8
|
-
class WhereJsonOperation extends ObjectionToKnexConvertingOperation {
|
|
43
|
+
class WhereJsonOperation extends ObjectionToKnexConvertingOperation_1.ObjectionToKnexConvertingOperation {
|
|
9
44
|
onBuildKnex(knexBuilder, builder) {
|
|
10
|
-
const dialect = getJsonDialect(builder.unsafeKnex(), this.name);
|
|
45
|
+
const dialect = (0, postgresJsonPath_1.getJsonDialect)(builder.unsafeKnex(), this.name);
|
|
11
46
|
const args = this.getKnexArgs(builder);
|
|
12
47
|
const jsonApi = dialect === 'mysql'
|
|
13
48
|
? mysqlJsonApi.whereJsonContains
|
|
14
49
|
: postgresJsonApi.whereJsonbRefOnLeftJsonbValOrRefOnRightRawQueryParams;
|
|
15
50
|
const rawArgs = jsonApi(args[0], this.opt.operator, args[1], this.opt.prefix);
|
|
16
51
|
if (dialect === 'mysql') {
|
|
17
|
-
rawArgs[0] = jsonCastsForDialect(rawArgs[0], builder.unsafeKnex());
|
|
52
|
+
rawArgs[0] = (0, mysqlJsonPath_1.jsonCastsForDialect)(rawArgs[0], builder.unsafeKnex());
|
|
18
53
|
}
|
|
19
54
|
if (this.opt.bool === 'or') {
|
|
20
55
|
knexBuilder = knexBuilder.orWhereRaw.apply(knexBuilder, rawArgs);
|
|
@@ -25,6 +60,4 @@ class WhereJsonOperation extends ObjectionToKnexConvertingOperation {
|
|
|
25
60
|
return knexBuilder;
|
|
26
61
|
}
|
|
27
62
|
}
|
|
28
|
-
|
|
29
|
-
WhereJsonOperation,
|
|
30
|
-
};
|
|
63
|
+
exports.WhereJsonOperation = WhereJsonOperation;
|
|
@@ -1,24 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.WhereJsonOverlapsOperation = void 0;
|
|
37
|
+
const mysqlJsonApi = __importStar(require("./mysqlJsonApi"));
|
|
38
|
+
const postgresJsonPath_1 = require("../../../utils/postgresJsonPath");
|
|
39
|
+
const knexUtils_1 = require("../../../utils/knexUtils");
|
|
40
|
+
const mysqlJsonPath_1 = require("../../../utils/mysqlJsonPath");
|
|
41
|
+
const ObjectionToKnexConvertingOperation_1 = require("../ObjectionToKnexConvertingOperation");
|
|
7
42
|
// `whereJsonOverlaps` and its variants. Postgres has no operator for this.
|
|
8
|
-
class WhereJsonOverlapsOperation extends ObjectionToKnexConvertingOperation {
|
|
43
|
+
class WhereJsonOverlapsOperation extends ObjectionToKnexConvertingOperation_1.ObjectionToKnexConvertingOperation {
|
|
9
44
|
onBuildKnex(knexBuilder, builder) {
|
|
10
45
|
const knex = builder.unsafeKnex();
|
|
11
|
-
if (knex && getJsonDialect(knex, this.name) !== 'mysql') {
|
|
46
|
+
if (knex && (0, postgresJsonPath_1.getJsonDialect)(knex, this.name) !== 'mysql') {
|
|
12
47
|
throw new Error(`${this.name} is only supported on mysql.`);
|
|
13
48
|
}
|
|
14
|
-
const mariaDbVersion = knex && getMariaDbVersion(knex);
|
|
49
|
+
const mariaDbVersion = knex && (0, knexUtils_1.getMariaDbVersion)(knex);
|
|
15
50
|
if (mariaDbVersion &&
|
|
16
51
|
(mariaDbVersion[0] < 10 || (mariaDbVersion[0] === 10 && mariaDbVersion[1] < 9))) {
|
|
17
52
|
throw new Error(`${this.name} needs MariaDB 10.9 or newer, which has JSON_OVERLAPS().`);
|
|
18
53
|
}
|
|
19
54
|
const args = this.getKnexArgs(builder);
|
|
20
55
|
const [rawSql, bindings] = mysqlJsonApi.whereJsonOverlaps(args[0], args[1], this.opt.prefix);
|
|
21
|
-
const sql = jsonCastsForDialect(rawSql, knex);
|
|
56
|
+
const sql = (0, mysqlJsonPath_1.jsonCastsForDialect)(rawSql, knex);
|
|
22
57
|
if (this.opt.bool === 'or') {
|
|
23
58
|
knexBuilder = knexBuilder.orWhereRaw(sql, bindings);
|
|
24
59
|
}
|
|
@@ -28,6 +63,4 @@ class WhereJsonOverlapsOperation extends ObjectionToKnexConvertingOperation {
|
|
|
28
63
|
return knexBuilder;
|
|
29
64
|
}
|
|
30
65
|
}
|
|
31
|
-
|
|
32
|
-
WhereJsonOverlapsOperation,
|
|
33
|
-
};
|
|
66
|
+
exports.WhereJsonOverlapsOperation = WhereJsonOverlapsOperation;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
// `'object'` or `'nonObject'` when the JSON type of the part is known.
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.whereJsonContains = whereJsonContains;
|
|
4
|
+
exports.whereJsonNotContains = whereJsonNotContains;
|
|
5
|
+
exports.whereJsonHas = whereJsonHas;
|
|
6
|
+
exports.whereJsonOverlaps = whereJsonOverlaps;
|
|
7
|
+
const parseFieldExpression_1 = require("../../../utils/parseFieldExpression");
|
|
8
|
+
const objectUtils_1 = require("../../../utils/objectUtils");
|
|
9
|
+
const mysqlJsonPath_1 = require("../../../utils/mysqlJsonPath");
|
|
10
|
+
const knexUtils_1 = require("../../../utils/knexUtils");
|
|
12
11
|
// Joins sql parts: sql`JSON_CONTAINS(${target}, ${candidate})`.
|
|
13
12
|
function sql(strings, ...parts) {
|
|
14
13
|
let text = strings[0];
|
|
@@ -24,14 +23,14 @@ function literal(text) {
|
|
|
24
23
|
}
|
|
25
24
|
// A field expression like `Table.column:a.b[0]`.
|
|
26
25
|
function field(expression) {
|
|
27
|
-
const parsed = parseFieldExpression(expression);
|
|
26
|
+
const parsed = (0, parseFieldExpression_1.parseFieldExpression)(expression);
|
|
28
27
|
if (parsed.access.length === 0) {
|
|
29
28
|
return { sql: '??', bindings: [parsed.columnName] };
|
|
30
29
|
}
|
|
31
30
|
else {
|
|
32
31
|
return {
|
|
33
32
|
sql: 'JSON_EXTRACT(??, ?)',
|
|
34
|
-
bindings: [parsed.columnName, toMySqlJsonPath(parsed.access)],
|
|
33
|
+
bindings: [parsed.columnName, (0, mysqlJsonPath_1.toMySqlJsonPath)(parsed.access)],
|
|
35
34
|
};
|
|
36
35
|
}
|
|
37
36
|
}
|
|
@@ -39,15 +38,15 @@ function jsonValue(value) {
|
|
|
39
38
|
return {
|
|
40
39
|
sql: 'CAST(? AS JSON)',
|
|
41
40
|
bindings: [JSON.stringify(value)],
|
|
42
|
-
type: isPlainObject(value) ? 'object' : 'nonObject',
|
|
41
|
+
type: (0, objectUtils_1.isPlainObject)(value) ? 'object' : 'nonObject',
|
|
43
42
|
};
|
|
44
43
|
}
|
|
45
44
|
// The right hand side of the methods: a field expression or a JSON value.
|
|
46
45
|
function fieldOrValue(value) {
|
|
47
|
-
if (isString(value)) {
|
|
46
|
+
if ((0, objectUtils_1.isString)(value)) {
|
|
48
47
|
return field(value);
|
|
49
48
|
}
|
|
50
|
-
else if (isObject(value)) {
|
|
49
|
+
else if ((0, objectUtils_1.isObject)(value)) {
|
|
51
50
|
return jsonValue(value);
|
|
52
51
|
}
|
|
53
52
|
else {
|
|
@@ -95,12 +94,14 @@ function whereJsonNotContains(fieldExpression, compareValue) {
|
|
|
95
94
|
// `whereJsonHasAny` (`?|`) and `whereJsonHasAll` (`?&`). Like on postgres, the keys
|
|
96
95
|
// are looked for in the keys of objects, in the string items of arrays and in
|
|
97
96
|
// strings.
|
|
98
|
-
function whereJsonHas(fieldExpression, operator,
|
|
97
|
+
function whereJsonHas(fieldExpression, operator,
|
|
98
|
+
// A key or an array of keys, made an array below.
|
|
99
|
+
keys, knex = null) {
|
|
99
100
|
const left = field(fieldExpression);
|
|
100
101
|
const all = operator === '?&';
|
|
101
|
-
keys = asArray(keys);
|
|
102
|
+
keys = (0, objectUtils_1.asArray)(keys);
|
|
102
103
|
for (const key of keys) {
|
|
103
|
-
if (!isString(key)) {
|
|
104
|
+
if (!(0, objectUtils_1.isString)(key)) {
|
|
104
105
|
throw new Error('All keys to find must be strings.');
|
|
105
106
|
}
|
|
106
107
|
}
|
|
@@ -109,7 +110,7 @@ function whereJsonHas(fieldExpression, operator, keys, knex = null) {
|
|
|
109
110
|
}
|
|
110
111
|
const paths = {
|
|
111
112
|
sql: keys.map(() => '?').join(', '),
|
|
112
|
-
bindings: keys.map((key) => toMySqlJsonPath([{ type: 'object', ref: key }])),
|
|
113
|
+
bindings: keys.map((key) => (0, mysqlJsonPath_1.toMySqlJsonPath)([{ type: 'object', ref: key }])),
|
|
113
114
|
};
|
|
114
115
|
const keysJson = jsonValue(keys);
|
|
115
116
|
const stringChecks = keys.map((key) => ({
|
|
@@ -125,7 +126,7 @@ function whereJsonHas(fieldExpression, operator, keys, knex = null) {
|
|
|
125
126
|
if (all) {
|
|
126
127
|
arrayCheck = sql `JSON_CONTAINS(${left}, ${keysJson})`;
|
|
127
128
|
}
|
|
128
|
-
else if (knex && isMariaDb(knex)) {
|
|
129
|
+
else if (knex && (0, knexUtils_1.isMariaDb)(knex)) {
|
|
129
130
|
// MariaDB has JSON_OVERLAPS() only since 10.9.
|
|
130
131
|
const containsChecks = keys.map((key) => ({
|
|
131
132
|
sql: `JSON_CONTAINS(${left.sql}, ?)`,
|
|
@@ -147,9 +148,3 @@ function whereJsonOverlaps(fieldExpression, jsonObjectOrFieldExpression, prefix)
|
|
|
147
148
|
const overlaps = sql `JSON_OVERLAPS(${field(fieldExpression)}, ${fieldOrValue(jsonObjectOrFieldExpression)})`;
|
|
148
149
|
return toRawArgs(prefix === 'not' ? sql `NOT COALESCE(${overlaps}, FALSE)` : overlaps);
|
|
149
150
|
}
|
|
150
|
-
module.exports = {
|
|
151
|
-
whereJsonContains,
|
|
152
|
-
whereJsonNotContains,
|
|
153
|
-
whereJsonHas,
|
|
154
|
-
whereJsonOverlaps,
|
|
155
|
-
};
|
|
@@ -1,7 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.parseFieldExpression = parseFieldExpression;
|
|
37
|
+
exports.whereJsonbRefOnLeftJsonbValOrRefOnRight = whereJsonbRefOnLeftJsonbValOrRefOnRight;
|
|
38
|
+
exports.whereJsonbRefOnLeftJsonbValOrRefOnRightRawQueryParams = whereJsonbRefOnLeftJsonbValOrRefOnRightRawQueryParams;
|
|
39
|
+
exports.whereJsonFieldRightStringArrayOnLeftQuery = whereJsonFieldRightStringArrayOnLeftQuery;
|
|
40
|
+
exports.whereJsonFieldQuery = whereJsonFieldQuery;
|
|
41
|
+
const parser = __importStar(require("../../../utils/parseFieldExpression"));
|
|
42
|
+
const objectUtils_1 = require("../../../utils/objectUtils");
|
|
43
|
+
const postgresJsonPath_1 = require("../../../utils/postgresJsonPath");
|
|
5
44
|
/**
|
|
6
45
|
* @typedef {String} FieldExpression
|
|
7
46
|
*
|
|
@@ -43,7 +82,7 @@ const { toPgJsonPathLiteral, toPgQuotedColumn } = require('../../../utils/postgr
|
|
|
43
82
|
function parseFieldExpression(expression, extractAsText) {
|
|
44
83
|
const parsed = parser.parseFieldExpression(expression);
|
|
45
84
|
const extractor = extractAsText ? '#>>' : '#>';
|
|
46
|
-
return `${toPgQuotedColumn(parsed.columnName)}${extractor}${toPgJsonPathLiteral(parsed.access)}`;
|
|
85
|
+
return `${(0, postgresJsonPath_1.toPgQuotedColumn)(parsed.columnName)}${extractor}${(0, postgresJsonPath_1.toPgJsonPathLiteral)(parsed.access)}`;
|
|
47
86
|
}
|
|
48
87
|
function whereJsonbRefOnLeftJsonbValOrRefOnRight(builder, fieldExpression, operator, jsonObjectOrFieldExpression, queryPrefix) {
|
|
49
88
|
const queryParams = whereJsonbRefOnLeftJsonbValOrRefOnRightRawQueryParams(fieldExpression, operator, jsonObjectOrFieldExpression, queryPrefix);
|
|
@@ -51,7 +90,7 @@ function whereJsonbRefOnLeftJsonbValOrRefOnRight(builder, fieldExpression, opera
|
|
|
51
90
|
}
|
|
52
91
|
function whereJsonbRefOnLeftJsonbValOrRefOnRightRawQueryParams(fieldExpression, operator, jsonObjectOrFieldExpression, queryPrefix) {
|
|
53
92
|
const fieldReference = parseFieldExpression(fieldExpression);
|
|
54
|
-
if (isString(jsonObjectOrFieldExpression)) {
|
|
93
|
+
if ((0, objectUtils_1.isString)(jsonObjectOrFieldExpression)) {
|
|
55
94
|
const rightHandReference = parseFieldExpression(jsonObjectOrFieldExpression);
|
|
56
95
|
const refRefQuery = [
|
|
57
96
|
'(',
|
|
@@ -67,7 +106,7 @@ function whereJsonbRefOnLeftJsonbValOrRefOnRightRawQueryParams(fieldExpression,
|
|
|
67
106
|
}
|
|
68
107
|
return [refRefQuery.join(' ')];
|
|
69
108
|
}
|
|
70
|
-
else if (isObject(jsonObjectOrFieldExpression)) {
|
|
109
|
+
else if ((0, objectUtils_1.isObject)(jsonObjectOrFieldExpression)) {
|
|
71
110
|
const refValQuery = ['(', fieldReference, ')::jsonb', operator, '?::jsonb'];
|
|
72
111
|
if (queryPrefix) {
|
|
73
112
|
refValQuery.unshift(queryPrefix);
|
|
@@ -76,11 +115,13 @@ function whereJsonbRefOnLeftJsonbValOrRefOnRightRawQueryParams(fieldExpression,
|
|
|
76
115
|
}
|
|
77
116
|
throw new Error('Invalid right hand expression.');
|
|
78
117
|
}
|
|
79
|
-
function whereJsonFieldRightStringArrayOnLeftQuery(knex, fieldExpression, operator,
|
|
118
|
+
function whereJsonFieldRightStringArrayOnLeftQuery(knex, fieldExpression, operator,
|
|
119
|
+
// A key or an array of keys, made an array below.
|
|
120
|
+
keys) {
|
|
80
121
|
const fieldReference = parseFieldExpression(fieldExpression);
|
|
81
|
-
keys = asArray(keys);
|
|
122
|
+
keys = (0, objectUtils_1.asArray)(keys);
|
|
82
123
|
const questionMarksArray = keys.map((key) => {
|
|
83
|
-
if (!isString(key)) {
|
|
124
|
+
if (!(0, objectUtils_1.isString)(key)) {
|
|
84
125
|
throw new Error('All keys to find must be strings.');
|
|
85
126
|
}
|
|
86
127
|
return '?';
|
|
@@ -126,10 +167,3 @@ function normalizeOperator(knex, operator) {
|
|
|
126
167
|
throw new Error(`unsupported operator "${operator}" in a JSON field query`);
|
|
127
168
|
}
|
|
128
169
|
}
|
|
129
|
-
module.exports = {
|
|
130
|
-
parseFieldExpression: parseFieldExpression,
|
|
131
|
-
whereJsonbRefOnLeftJsonbValOrRefOnRight: whereJsonbRefOnLeftJsonbValOrRefOnRight,
|
|
132
|
-
whereJsonbRefOnLeftJsonbValOrRefOnRightRawQueryParams: whereJsonbRefOnLeftJsonbValOrRefOnRightRawQueryParams,
|
|
133
|
-
whereJsonFieldRightStringArrayOnLeftQuery: whereJsonFieldRightStringArrayOnLeftQuery,
|
|
134
|
-
whereJsonFieldQuery: whereJsonFieldQuery,
|
|
135
|
-
};
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SelectOperation = void 0;
|
|
4
|
+
const objectUtils_1 = require("../../../utils/objectUtils");
|
|
5
|
+
const Selection_1 = require("./Selection");
|
|
6
|
+
const ObjectionToKnexConvertingOperation_1 = require("../ObjectionToKnexConvertingOperation");
|
|
5
7
|
const COUNT_REGEX = /count/i;
|
|
6
|
-
class SelectOperation extends ObjectionToKnexConvertingOperation {
|
|
8
|
+
class SelectOperation extends ObjectionToKnexConvertingOperation_1.ObjectionToKnexConvertingOperation {
|
|
7
9
|
constructor(name, opt) {
|
|
8
10
|
super(name, opt);
|
|
9
11
|
this.selections = [];
|
|
10
12
|
}
|
|
11
13
|
onAdd(builder, args) {
|
|
12
|
-
const selections = flatten(args);
|
|
14
|
+
const selections = (0, objectUtils_1.flatten)(args);
|
|
13
15
|
// Don't add an empty selection. Empty list is accepted for `count`, `countDistinct`
|
|
14
16
|
// etc. because knex apparently supports it.
|
|
15
17
|
if (selections.length === 0 && !COUNT_REGEX.test(this.name)) {
|
|
@@ -17,7 +19,7 @@ class SelectOperation extends ObjectionToKnexConvertingOperation {
|
|
|
17
19
|
}
|
|
18
20
|
const ret = super.onAdd(builder, selections);
|
|
19
21
|
for (const selection of selections) {
|
|
20
|
-
const selectionInstance = Selection.create(selection);
|
|
22
|
+
const selectionInstance = Selection_1.Selection.create(selection);
|
|
21
23
|
if (selectionInstance) {
|
|
22
24
|
this.selections.push(selectionInstance);
|
|
23
25
|
}
|
|
@@ -28,12 +30,12 @@ class SelectOperation extends ObjectionToKnexConvertingOperation {
|
|
|
28
30
|
return knexBuilder[this.name].apply(knexBuilder, this.getKnexArgs(builder));
|
|
29
31
|
}
|
|
30
32
|
findSelection(builder, selectionToFind) {
|
|
31
|
-
const selectionInstanceToFind = Selection.create(selectionToFind);
|
|
33
|
+
const selectionInstanceToFind = Selection_1.Selection.create(selectionToFind);
|
|
32
34
|
if (!selectionInstanceToFind) {
|
|
33
35
|
return null;
|
|
34
36
|
}
|
|
35
37
|
for (const selection of this.selections) {
|
|
36
|
-
if (Selection.doesSelect(builder, selection, selectionInstanceToFind)) {
|
|
38
|
+
if (Selection_1.Selection.doesSelect(builder, selection, selectionInstanceToFind)) {
|
|
37
39
|
return selection;
|
|
38
40
|
}
|
|
39
41
|
}
|
|
@@ -45,6 +47,4 @@ class SelectOperation extends ObjectionToKnexConvertingOperation {
|
|
|
45
47
|
return clone;
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
|
-
|
|
49
|
-
SelectOperation,
|
|
50
|
-
};
|
|
50
|
+
exports.SelectOperation = SelectOperation;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Selection = void 0;
|
|
4
|
+
const objectUtils_1 = require("../../../utils/objectUtils");
|
|
3
5
|
const ALIAS_REGEX = /\s+as\s+/i;
|
|
4
6
|
class Selection {
|
|
5
7
|
constructor(table, column, alias) {
|
|
@@ -11,21 +13,22 @@ class Selection {
|
|
|
11
13
|
return this.alias || this.column;
|
|
12
14
|
}
|
|
13
15
|
static create(selection) {
|
|
14
|
-
if (isObject(selection)) {
|
|
15
|
-
|
|
16
|
+
if ((0, objectUtils_1.isObject)(selection)) {
|
|
17
|
+
const obj = selection;
|
|
18
|
+
if (obj.isObjectionSelection) {
|
|
16
19
|
return selection;
|
|
17
20
|
}
|
|
18
|
-
else if (
|
|
21
|
+
else if (obj.isObjectionReferenceBuilder) {
|
|
19
22
|
return createSelectionFromReference(selection);
|
|
20
23
|
}
|
|
21
|
-
else if (
|
|
24
|
+
else if (obj.isObjectionRawBuilder) {
|
|
22
25
|
return createSelectionFromRaw(selection);
|
|
23
26
|
}
|
|
24
27
|
else {
|
|
25
28
|
return null;
|
|
26
29
|
}
|
|
27
30
|
}
|
|
28
|
-
else if (isString(selection)) {
|
|
31
|
+
else if ((0, objectUtils_1.isString)(selection)) {
|
|
29
32
|
return createSelectionFromString(selection);
|
|
30
33
|
}
|
|
31
34
|
else {
|
|
@@ -45,13 +48,16 @@ class Selection {
|
|
|
45
48
|
static doesSelect(builder, selectionInBuilder, selectionToTest) {
|
|
46
49
|
selectionInBuilder = Selection.create(selectionInBuilder);
|
|
47
50
|
selectionToTest = Selection.create(selectionToTest);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
// Both must be selections. Others throw here.
|
|
52
|
+
const inBuilder = selectionInBuilder;
|
|
53
|
+
const toTest = selectionToTest;
|
|
54
|
+
if (inBuilder.column === '*') {
|
|
55
|
+
if (inBuilder.table) {
|
|
56
|
+
if (toTest.column === '*') {
|
|
57
|
+
return toTest.table === inBuilder.table;
|
|
52
58
|
}
|
|
53
59
|
else {
|
|
54
|
-
return
|
|
60
|
+
return toTest.table === null || toTest.table === inBuilder.table;
|
|
55
61
|
}
|
|
56
62
|
}
|
|
57
63
|
else {
|
|
@@ -59,17 +65,18 @@ class Selection {
|
|
|
59
65
|
}
|
|
60
66
|
}
|
|
61
67
|
else {
|
|
62
|
-
const selectionInBuilderTable =
|
|
63
|
-
if (
|
|
68
|
+
const selectionInBuilderTable = inBuilder.table || builder.tableRef();
|
|
69
|
+
if (toTest.column === '*') {
|
|
64
70
|
return false;
|
|
65
71
|
}
|
|
66
72
|
else {
|
|
67
|
-
return (
|
|
68
|
-
(
|
|
73
|
+
return (toTest.column === inBuilder.column &&
|
|
74
|
+
(toTest.table === null || toTest.table === selectionInBuilderTable));
|
|
69
75
|
}
|
|
70
76
|
}
|
|
71
77
|
}
|
|
72
78
|
}
|
|
79
|
+
exports.Selection = Selection;
|
|
73
80
|
Object.defineProperties(Selection.prototype, {
|
|
74
81
|
isObjectionSelection: {
|
|
75
82
|
enumerable: false,
|
|
@@ -107,6 +114,3 @@ function createSelectionFromString(selection) {
|
|
|
107
114
|
}
|
|
108
115
|
return new Selection(table, column, alias);
|
|
109
116
|
}
|
|
110
|
-
module.exports = {
|
|
111
|
-
Selection,
|
|
112
|
-
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Internal types for the query builder operations.
|
|
3
|
+
//
|
|
4
|
+
// The query builder and the model classes are still JavaScript, so these
|
|
5
|
+
// interfaces only describe the parts of them that the operations use. The
|
|
6
|
+
// relations are TypeScript, and their types are used here. The public types
|
|
7
|
+
// are the hand-written ones in `typings/`.
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WhereInCompositeMsSqlOperation = void 0;
|
|
4
|
+
const ObjectionToKnexConvertingOperation_1 = require("../ObjectionToKnexConvertingOperation");
|
|
5
|
+
const objectUtils_1 = require("../../../utils/objectUtils");
|
|
6
|
+
const tmpColumnUtils_1 = require("../../../utils/tmpColumnUtils");
|
|
7
|
+
class WhereInCompositeMsSqlOperation extends ObjectionToKnexConvertingOperation_1.ObjectionToKnexConvertingOperation {
|
|
6
8
|
constructor(name, opt) {
|
|
7
9
|
super(name, opt);
|
|
8
10
|
this.prefix = this.opt.prefix || null;
|
|
@@ -21,21 +23,22 @@ class WhereInCompositeMsSqlOperation extends ObjectionToKnexConvertingOperation
|
|
|
21
23
|
}
|
|
22
24
|
}
|
|
23
25
|
buildComposite(knex, knexBuilder, columns, values) {
|
|
24
|
-
const helperColumns = columns.map((_, index) => getTempColumn(index));
|
|
26
|
+
const helperColumns = columns.map((_, index) => (0, tmpColumnUtils_1.getTempColumn)(index));
|
|
25
27
|
if (Array.isArray(values)) {
|
|
26
28
|
return this.buildCompositeValue(knex, knexBuilder, columns, helperColumns, values);
|
|
27
29
|
}
|
|
28
30
|
else {
|
|
31
|
+
// A subquery.
|
|
29
32
|
return this.buildCompositeSubquery(knex, knexBuilder, columns, helperColumns, values.as(knex.raw(`V(${helperColumns.map((_) => '??')})`, helperColumns)));
|
|
30
33
|
}
|
|
31
34
|
}
|
|
32
35
|
buildCompositeValue(knex, knexBuilder, columns, helperColumns, values) {
|
|
33
36
|
return this.buildCompositeSubquery(knex, knexBuilder, columns, helperColumns, knex.raw(`(VALUES ${values
|
|
34
37
|
.map((value) => `(${value.map((_) => '?').join(',')})`)
|
|
35
|
-
.join(',')}) AS V(${helperColumns.map((_) => '??').join(',')})`, flatten(values).concat(helperColumns)));
|
|
38
|
+
.join(',')}) AS V(${helperColumns.map((_) => '??').join(',')})`, (0, objectUtils_1.flatten)(values).concat(helperColumns)));
|
|
36
39
|
}
|
|
37
40
|
buildCompositeSubquery(knex, knexBuilder, columns, helperColumns, subQuery) {
|
|
38
|
-
const wrapperQuery = knex.from(subQuery).where(zipObject(helperColumns, columns.map((column) => knex.raw('??', column))));
|
|
41
|
+
const wrapperQuery = knex.from(subQuery).where((0, objectUtils_1.zipObject)(helperColumns, columns.map((column) => knex.raw('??', column))));
|
|
39
42
|
if (this.prefix === 'not') {
|
|
40
43
|
return knexBuilder.whereNotExists(wrapperQuery);
|
|
41
44
|
}
|
|
@@ -44,7 +47,7 @@ class WhereInCompositeMsSqlOperation extends ObjectionToKnexConvertingOperation
|
|
|
44
47
|
}
|
|
45
48
|
}
|
|
46
49
|
buildNonComposite(knexBuilder, columns, values) {
|
|
47
|
-
const col = isString(columns) ? columns : columns[0];
|
|
50
|
+
const col = (0, objectUtils_1.isString)(columns) ? columns : columns[0];
|
|
48
51
|
if (Array.isArray(values)) {
|
|
49
52
|
values = pickNonNull(values, []);
|
|
50
53
|
}
|
|
@@ -67,6 +70,7 @@ class WhereInCompositeMsSqlOperation extends ObjectionToKnexConvertingOperation
|
|
|
67
70
|
return clone;
|
|
68
71
|
}
|
|
69
72
|
}
|
|
73
|
+
exports.WhereInCompositeMsSqlOperation = WhereInCompositeMsSqlOperation;
|
|
70
74
|
function pickNonNull(values, output) {
|
|
71
75
|
for (let i = 0, l = values.length; i < l; ++i) {
|
|
72
76
|
const val = values[i];
|
|
@@ -79,6 +83,3 @@ function pickNonNull(values, output) {
|
|
|
79
83
|
}
|
|
80
84
|
return output;
|
|
81
85
|
}
|
|
82
|
-
module.exports = {
|
|
83
|
-
WhereInCompositeMsSqlOperation,
|
|
84
|
-
};
|