@mikro-orm/knex 6.2.10-dev.30 → 6.2.10-dev.32
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/knex",
|
|
3
|
-
"version": "6.2.10-dev.
|
|
3
|
+
"version": "6.2.10-dev.32",
|
|
4
4
|
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@mikro-orm/core": "^6.2.9"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@mikro-orm/core": "6.2.10-dev.
|
|
69
|
+
"@mikro-orm/core": "6.2.10-dev.32",
|
|
70
70
|
"better-sqlite3": "*",
|
|
71
71
|
"libsql": "*",
|
|
72
72
|
"mariadb": "*"
|
package/query/QueryBuilder.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { inspect } from 'util';
|
|
3
3
|
import type { Knex } from 'knex';
|
|
4
|
-
import { type AnyEntity, type ConnectionType, type Dictionary, type EntityData, type EntityKey, type EntityMetadata, type EntityName, type EntityProperty, type FlushMode, type GroupOperator, type Loaded, LockMode, type LoggingOptions, type MetadataStorage, type ObjectQuery, PopulateHint, type PopulateOptions, type QBFilterQuery, type QBQueryOrderMap, QueryFlag, type QueryOrderMap, type QueryResult, type RequiredEntityData, type ExpandProperty } from '@mikro-orm/core';
|
|
4
|
+
import { type AnyEntity, type ConnectionType, type Dictionary, type EntityData, type EntityKey, type EntityMetadata, type EntityName, type EntityProperty, type FlushMode, type GroupOperator, type Loaded, LockMode, type LoggingOptions, type MetadataStorage, type ObjectQuery, PopulateHint, type PopulateOptions, type QBFilterQuery, type QBQueryOrderMap, QueryFlag, type QueryOrderMap, type QueryResult, RawQueryFragment, type RequiredEntityData, type ExpandProperty } from '@mikro-orm/core';
|
|
5
5
|
import { JoinType, QueryType } from './enums';
|
|
6
6
|
import type { AbstractSqlDriver } from '../AbstractSqlDriver';
|
|
7
7
|
import { type Alias, QueryBuilderHelper } from './QueryBuilderHelper';
|
|
@@ -88,7 +88,7 @@ export declare class QueryBuilder<Entity extends object = AnyEntity, RootAlias e
|
|
|
88
88
|
protected _having: Dictionary;
|
|
89
89
|
protected _returning?: Field<Entity>[];
|
|
90
90
|
protected _onConflict?: {
|
|
91
|
-
fields: string[];
|
|
91
|
+
fields: string[] | RawQueryFragment;
|
|
92
92
|
ignore?: boolean;
|
|
93
93
|
merge?: EntityData<Entity> | Field<Entity>[];
|
|
94
94
|
where?: QBFilterQuery<Entity>;
|
package/query/QueryBuilder.js
CHANGED
|
@@ -348,11 +348,13 @@ class QueryBuilder {
|
|
|
348
348
|
this.ensureNotFinalized();
|
|
349
349
|
this._onConflict ??= [];
|
|
350
350
|
this._onConflict.push({
|
|
351
|
-
fields: core_1.Utils.
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
351
|
+
fields: core_1.Utils.isRawSql(fields)
|
|
352
|
+
? fields
|
|
353
|
+
: core_1.Utils.asArray(fields).flatMap(f => {
|
|
354
|
+
const key = f.toString();
|
|
355
|
+
/* istanbul ignore next */
|
|
356
|
+
return meta.properties[key]?.fieldNames ?? [key];
|
|
357
|
+
}),
|
|
356
358
|
});
|
|
357
359
|
return this;
|
|
358
360
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Knex } from 'knex';
|
|
2
|
-
import { type Dictionary, type EntityData, type EntityKey, type EntityMetadata, type EntityProperty, type FlatQueryOrderMap, LockMode, type QBFilterQuery } from '@mikro-orm/core';
|
|
2
|
+
import { type Dictionary, type EntityData, type EntityKey, type EntityMetadata, type EntityProperty, type FlatQueryOrderMap, LockMode, type QBFilterQuery, RawQueryFragment } from '@mikro-orm/core';
|
|
3
3
|
import { JoinType, QueryType } from './enums';
|
|
4
4
|
import type { Field, JoinOptions } from '../typings';
|
|
5
5
|
import type { AbstractSqlDriver } from '../AbstractSqlDriver';
|
|
@@ -34,7 +34,7 @@ export declare class QueryBuilderHelper {
|
|
|
34
34
|
isSimpleRegExp(re: any): re is RegExp;
|
|
35
35
|
getRegExpParam(re: RegExp): string;
|
|
36
36
|
appendOnConflictClause<T>(type: QueryType, onConflict: {
|
|
37
|
-
fields: string[];
|
|
37
|
+
fields: string[] | RawQueryFragment;
|
|
38
38
|
ignore?: boolean;
|
|
39
39
|
merge?: EntityData<T> | Field<T>[];
|
|
40
40
|
where?: QBFilterQuery<T>;
|
|
@@ -352,7 +352,16 @@ class QueryBuilderHelper {
|
|
|
352
352
|
}
|
|
353
353
|
appendOnConflictClause(type, onConflict, qb) {
|
|
354
354
|
onConflict.forEach(item => {
|
|
355
|
-
|
|
355
|
+
let sub;
|
|
356
|
+
if (core_1.Utils.isRawSql(item.fields)) {
|
|
357
|
+
sub = qb.onConflict(this.knex.raw(item.fields.sql, item.fields.params));
|
|
358
|
+
}
|
|
359
|
+
else if (item.fields.length > 0) {
|
|
360
|
+
sub = qb.onConflict(item.fields);
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
sub = qb.onConflict();
|
|
364
|
+
}
|
|
356
365
|
core_1.Utils.runIfNotEmpty(() => sub.ignore(), item.ignore);
|
|
357
366
|
core_1.Utils.runIfNotEmpty(() => {
|
|
358
367
|
let mergeParam = item.merge;
|