@mikro-orm/knex 6.4.6-dev.9 → 7.0.0-dev.0
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/AbstractSqlConnection.d.ts +15 -25
- package/AbstractSqlConnection.js +98 -126
- package/AbstractSqlDriver.d.ts +20 -13
- package/AbstractSqlDriver.js +73 -54
- package/AbstractSqlPlatform.d.ts +15 -3
- package/AbstractSqlPlatform.js +32 -11
- package/README.md +0 -2
- package/SqlEntityManager.d.ts +5 -6
- package/SqlEntityManager.js +5 -5
- package/SqlEntityRepository.d.ts +1 -6
- package/SqlEntityRepository.js +0 -6
- package/dialects/mssql/MsSqlNativeQueryBuilder.d.ts +12 -0
- package/dialects/mssql/MsSqlNativeQueryBuilder.js +161 -0
- package/dialects/mssql/index.d.ts +1 -1
- package/dialects/mssql/index.js +1 -1
- package/dialects/mysql/MySqlExceptionConverter.js +1 -0
- package/dialects/mysql/MySqlNativeQueryBuilder.d.ts +7 -0
- package/dialects/mysql/MySqlNativeQueryBuilder.js +81 -0
- package/dialects/mysql/MySqlPlatform.d.ts +5 -1
- package/dialects/mysql/MySqlPlatform.js +9 -1
- package/dialects/mysql/MySqlSchemaHelper.d.ts +6 -12
- package/dialects/mysql/MySqlSchemaHelper.js +42 -75
- package/dialects/mysql/index.d.ts +1 -3
- package/dialects/mysql/index.js +1 -3
- package/dialects/postgresql/PostgreSqlNativeQueryBuilder.d.ts +5 -0
- package/dialects/postgresql/PostgreSqlNativeQueryBuilder.js +12 -0
- package/dialects/postgresql/index.d.ts +1 -1
- package/dialects/postgresql/index.js +1 -1
- package/dialects/sqlite/BaseSqliteConnection.d.ts +0 -5
- package/dialects/sqlite/BaseSqliteConnection.js +4 -42
- package/dialects/sqlite/BaseSqlitePlatform.d.ts +15 -3
- package/dialects/sqlite/BaseSqlitePlatform.js +20 -4
- package/dialects/sqlite/SqliteExceptionConverter.d.ts +9 -0
- package/dialects/sqlite/SqliteExceptionConverter.js +55 -0
- package/dialects/sqlite/SqliteNativeQueryBuilder.d.ts +6 -0
- package/dialects/sqlite/SqliteNativeQueryBuilder.js +15 -0
- package/dialects/sqlite/SqliteSchemaHelper.d.ts +38 -0
- package/dialects/sqlite/SqliteSchemaHelper.js +384 -0
- package/dialects/sqlite/index.d.ts +3 -5
- package/dialects/sqlite/index.js +3 -5
- package/index.d.ts +1 -2
- package/index.js +3 -5
- package/index.mjs +10 -13
- package/package.json +4 -18
- package/query/CriteriaNodeFactory.js +5 -5
- package/query/NativeQueryBuilder.d.ts +108 -0
- package/query/NativeQueryBuilder.js +429 -0
- package/query/ObjectCriteriaNode.js +3 -3
- package/query/QueryBuilder.d.ts +30 -34
- package/query/QueryBuilder.js +112 -123
- package/query/QueryBuilderHelper.d.ts +27 -23
- package/query/QueryBuilderHelper.js +174 -168
- package/query/ScalarCriteriaNode.js +4 -0
- package/query/index.d.ts +1 -0
- package/query/index.js +1 -0
- package/schema/DatabaseSchema.js +9 -6
- package/schema/DatabaseTable.d.ts +2 -1
- package/schema/DatabaseTable.js +9 -5
- package/schema/SchemaComparator.d.ts +1 -2
- package/schema/SchemaComparator.js +31 -18
- package/schema/SchemaHelper.d.ts +27 -33
- package/schema/SchemaHelper.js +294 -184
- package/schema/SqlSchemaGenerator.d.ts +3 -9
- package/schema/SqlSchemaGenerator.js +105 -229
- package/typings.d.ts +7 -17
- package/MonkeyPatchable.d.ts +0 -18
- package/MonkeyPatchable.js +0 -60
- package/dialects/mssql/MsSqlColumnCompiler.d.ts +0 -4
- package/dialects/mssql/MsSqlColumnCompiler.js +0 -10
- package/dialects/mssql/MsSqlKnexDialect.d.ts +0 -6
- package/dialects/mssql/MsSqlKnexDialect.js +0 -22
- package/dialects/mssql/MsSqlQueryCompiler.d.ts +0 -12
- package/dialects/mssql/MsSqlQueryCompiler.js +0 -94
- package/dialects/mssql/MsSqlTableCompiler.d.ts +0 -9
- package/dialects/mssql/MsSqlTableCompiler.js +0 -40
- package/dialects/mysql/MariaDbKnexDialect.d.ts +0 -6
- package/dialects/mysql/MariaDbKnexDialect.js +0 -16
- package/dialects/mysql/MySqlColumnCompiler.d.ts +0 -7
- package/dialects/mysql/MySqlColumnCompiler.js +0 -26
- package/dialects/mysql/MySqlConnection.d.ts +0 -8
- package/dialects/mysql/MySqlConnection.js +0 -43
- package/dialects/mysql/MySqlKnexDialect.d.ts +0 -5
- package/dialects/mysql/MySqlKnexDialect.js +0 -17
- package/dialects/mysql/MySqlQueryCompiler.d.ts +0 -5
- package/dialects/mysql/MySqlQueryCompiler.js +0 -23
- package/dialects/postgresql/PostgreSqlKnexDialect.d.ts +0 -7
- package/dialects/postgresql/PostgreSqlKnexDialect.js +0 -20
- package/dialects/postgresql/PostgreSqlQueryCompiler.d.ts +0 -4
- package/dialects/postgresql/PostgreSqlQueryCompiler.js +0 -13
- package/dialects/postgresql/PostgreSqlTableCompiler.d.ts +0 -11
- package/dialects/postgresql/PostgreSqlTableCompiler.js +0 -89
- package/dialects/sqlite/BaseSqliteSchemaHelper.d.ts +0 -28
- package/dialects/sqlite/BaseSqliteSchemaHelper.js +0 -200
- package/dialects/sqlite/BetterSqliteKnexDialect.d.ts +0 -5
- package/dialects/sqlite/BetterSqliteKnexDialect.js +0 -15
- package/dialects/sqlite/LibSqlKnexDialect.d.ts +0 -11
- package/dialects/sqlite/LibSqlKnexDialect.js +0 -85
- package/dialects/sqlite/SqliteKnexDialect.d.ts +0 -8
- package/dialects/sqlite/SqliteKnexDialect.js +0 -67
- package/dialects/sqlite/SqliteTableCompiler.d.ts +0 -6
- package/dialects/sqlite/SqliteTableCompiler.js +0 -71
|
@@ -1,35 +1,32 @@
|
|
|
1
|
-
import type { Knex } from 'knex';
|
|
2
1
|
import { type Dictionary, type EntityData, type EntityKey, type EntityMetadata, type EntityProperty, type FlatQueryOrderMap, LockMode, type QBFilterQuery, RawQueryFragment } from '@mikro-orm/core';
|
|
3
2
|
import { JoinType, QueryType } from './enums';
|
|
4
3
|
import type { Field, JoinOptions } from '../typings';
|
|
5
4
|
import type { AbstractSqlDriver } from '../AbstractSqlDriver';
|
|
5
|
+
import { NativeQueryBuilder } from './NativeQueryBuilder';
|
|
6
6
|
/**
|
|
7
7
|
* @internal
|
|
8
8
|
*/
|
|
9
9
|
export declare class QueryBuilderHelper {
|
|
10
10
|
private readonly entityName;
|
|
11
|
-
private
|
|
11
|
+
private alias;
|
|
12
12
|
private readonly aliasMap;
|
|
13
13
|
private readonly subQueries;
|
|
14
|
-
private readonly knex;
|
|
15
14
|
private readonly driver;
|
|
16
15
|
private readonly platform;
|
|
17
16
|
private readonly metadata;
|
|
18
|
-
constructor(entityName: string, alias: string, aliasMap: Dictionary<Alias<any>>, subQueries: Dictionary<string>,
|
|
19
|
-
mapper(field: string |
|
|
20
|
-
mapper(field: string |
|
|
17
|
+
constructor(entityName: string, alias: string, aliasMap: Dictionary<Alias<any>>, subQueries: Dictionary<string>, driver: AbstractSqlDriver);
|
|
18
|
+
mapper(field: string | RawQueryFragment, type?: QueryType): string;
|
|
19
|
+
mapper(field: string | RawQueryFragment, type?: QueryType, value?: any, alias?: string | null): string;
|
|
21
20
|
processData(data: Dictionary, convertCustomTypes: boolean, multi?: boolean): any;
|
|
22
21
|
joinOneToReference(prop: EntityProperty, ownerAlias: string, alias: string, type: JoinType, cond?: Dictionary, schema?: string): JoinOptions;
|
|
23
22
|
joinManyToOneReference(prop: EntityProperty, ownerAlias: string, alias: string, type: JoinType, cond?: Dictionary, schema?: string): JoinOptions;
|
|
24
23
|
joinManyToManyReference(prop: EntityProperty, ownerAlias: string, alias: string, pivotAlias: string, type: JoinType, cond: Dictionary, path: string, schema?: string): Dictionary<JoinOptions>;
|
|
25
|
-
processJoins(qb:
|
|
24
|
+
processJoins(qb: NativeQueryBuilder, joins: Dictionary<JoinOptions>, schema?: string): void;
|
|
26
25
|
createJoinExpression(join: JoinOptions, joins: Dictionary<JoinOptions>, schema?: string): {
|
|
27
26
|
sql: string;
|
|
28
|
-
params:
|
|
27
|
+
params: unknown[];
|
|
29
28
|
};
|
|
30
|
-
|
|
31
|
-
private wrapQueryGroup;
|
|
32
|
-
mapJoinColumns(type: QueryType, join: JoinOptions): (string | Knex.Raw)[];
|
|
29
|
+
mapJoinColumns(type: QueryType, join: JoinOptions): (string | RawQueryFragment)[];
|
|
33
30
|
isOneToOneInverse(field: string, meta?: EntityMetadata): boolean;
|
|
34
31
|
getTableName(entityName: string): string;
|
|
35
32
|
/**
|
|
@@ -37,33 +34,40 @@ export declare class QueryBuilderHelper {
|
|
|
37
34
|
*/
|
|
38
35
|
isSimpleRegExp(re: any): re is RegExp;
|
|
39
36
|
getRegExpParam(re: RegExp): string;
|
|
40
|
-
appendOnConflictClause<T>(type: QueryType, onConflict:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
37
|
+
appendOnConflictClause<T>(type: QueryType, onConflict: OnConflictClause<T>[], qb: NativeQueryBuilder): void;
|
|
38
|
+
appendQueryCondition(type: QueryType, cond: any, qb: NativeQueryBuilder, operator?: '$and' | '$or', method?: 'where' | 'having'): void;
|
|
39
|
+
_appendQueryCondition(type: QueryType, cond: any, operator?: '$and' | '$or'): {
|
|
40
|
+
sql: string;
|
|
41
|
+
params: unknown[];
|
|
42
|
+
};
|
|
43
|
+
private append;
|
|
47
44
|
private appendQuerySubCondition;
|
|
48
45
|
private processObjectSubCondition;
|
|
46
|
+
private getValueReplacement;
|
|
49
47
|
private getOperatorReplacement;
|
|
50
48
|
getQueryOrder(type: QueryType, orderBy: FlatQueryOrderMap | FlatQueryOrderMap[], populate: Dictionary<string>): string[];
|
|
51
49
|
getQueryOrderFromObject(type: QueryType, orderBy: FlatQueryOrderMap, populate: Dictionary<string>): string[];
|
|
52
|
-
finalize(type: QueryType, qb:
|
|
50
|
+
finalize(type: QueryType, qb: NativeQueryBuilder, meta?: EntityMetadata, data?: Dictionary, returning?: Field<any>[]): void;
|
|
53
51
|
splitField<T>(field: EntityKey<T>, greedyAlias?: boolean): [string, EntityKey<T>, string | undefined];
|
|
54
|
-
getLockSQL(qb:
|
|
55
|
-
updateVersionProperty(qb:
|
|
52
|
+
getLockSQL(qb: NativeQueryBuilder, lockMode: LockMode, lockTables?: string[]): void;
|
|
53
|
+
updateVersionProperty(qb: NativeQueryBuilder, data: Dictionary): void;
|
|
56
54
|
private prefix;
|
|
57
55
|
private appendGroupCondition;
|
|
58
56
|
private isPrefixed;
|
|
59
57
|
private fieldName;
|
|
60
58
|
getProperty(field: string, alias?: string): EntityProperty | undefined;
|
|
61
|
-
isTableNameAliasRequired(type
|
|
59
|
+
isTableNameAliasRequired(type: QueryType): boolean;
|
|
62
60
|
processOnConflictCondition(cond: QBFilterQuery, schema?: string): QBFilterQuery;
|
|
63
61
|
}
|
|
64
62
|
export interface Alias<T> {
|
|
65
63
|
aliasName: string;
|
|
66
64
|
entityName: string;
|
|
67
65
|
metadata?: EntityMetadata<T>;
|
|
68
|
-
subQuery?:
|
|
66
|
+
subQuery?: NativeQueryBuilder;
|
|
67
|
+
}
|
|
68
|
+
export interface OnConflictClause<T> {
|
|
69
|
+
fields: string[] | RawQueryFragment;
|
|
70
|
+
ignore?: boolean;
|
|
71
|
+
merge?: EntityData<T> | Field<T>[];
|
|
72
|
+
where?: QBFilterQuery<T>;
|
|
69
73
|
}
|