@mikro-orm/sql 7.0.4-dev.8 → 7.0.4
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 +94 -58
- package/AbstractSqlConnection.js +235 -238
- package/AbstractSqlDriver.d.ts +410 -155
- package/AbstractSqlDriver.js +2064 -1941
- package/AbstractSqlPlatform.d.ts +83 -73
- package/AbstractSqlPlatform.js +162 -158
- package/PivotCollectionPersister.d.ts +33 -15
- package/PivotCollectionPersister.js +158 -160
- package/README.md +1 -1
- package/SqlEntityManager.d.ts +67 -22
- package/SqlEntityManager.js +54 -38
- package/SqlEntityRepository.d.ts +14 -14
- package/SqlEntityRepository.js +23 -23
- package/dialects/mssql/MsSqlNativeQueryBuilder.d.ts +12 -12
- package/dialects/mssql/MsSqlNativeQueryBuilder.js +192 -194
- package/dialects/mysql/BaseMySqlPlatform.d.ts +64 -45
- package/dialects/mysql/BaseMySqlPlatform.js +134 -131
- package/dialects/mysql/MySqlExceptionConverter.d.ts +6 -6
- package/dialects/mysql/MySqlExceptionConverter.js +91 -77
- package/dialects/mysql/MySqlNativeQueryBuilder.d.ts +3 -3
- package/dialects/mysql/MySqlNativeQueryBuilder.js +66 -69
- package/dialects/mysql/MySqlSchemaHelper.d.ts +39 -39
- package/dialects/mysql/MySqlSchemaHelper.js +327 -319
- package/dialects/oracledb/OracleDialect.d.ts +81 -52
- package/dialects/oracledb/OracleDialect.js +155 -149
- package/dialects/oracledb/OracleNativeQueryBuilder.d.ts +12 -12
- package/dialects/oracledb/OracleNativeQueryBuilder.js +232 -236
- package/dialects/postgresql/BasePostgreSqlPlatform.d.ts +109 -105
- package/dialects/postgresql/BasePostgreSqlPlatform.js +354 -350
- package/dialects/postgresql/FullTextType.d.ts +10 -6
- package/dialects/postgresql/FullTextType.js +51 -51
- package/dialects/postgresql/PostgreSqlExceptionConverter.d.ts +5 -5
- package/dialects/postgresql/PostgreSqlExceptionConverter.js +55 -43
- package/dialects/postgresql/PostgreSqlNativeQueryBuilder.d.ts +1 -1
- package/dialects/postgresql/PostgreSqlNativeQueryBuilder.js +4 -4
- package/dialects/postgresql/PostgreSqlSchemaHelper.d.ts +102 -82
- package/dialects/postgresql/PostgreSqlSchemaHelper.js +733 -705
- package/dialects/sqlite/BaseSqliteConnection.d.ts +3 -5
- package/dialects/sqlite/BaseSqliteConnection.js +21 -19
- package/dialects/sqlite/NodeSqliteDialect.d.ts +1 -1
- package/dialects/sqlite/NodeSqliteDialect.js +23 -23
- package/dialects/sqlite/SqliteDriver.d.ts +1 -1
- package/dialects/sqlite/SqliteDriver.js +3 -3
- package/dialects/sqlite/SqliteExceptionConverter.d.ts +6 -6
- package/dialects/sqlite/SqliteExceptionConverter.js +67 -51
- package/dialects/sqlite/SqliteNativeQueryBuilder.d.ts +2 -2
- package/dialects/sqlite/SqliteNativeQueryBuilder.js +7 -7
- package/dialects/sqlite/SqlitePlatform.d.ts +63 -72
- package/dialects/sqlite/SqlitePlatform.js +139 -139
- package/dialects/sqlite/SqliteSchemaHelper.d.ts +70 -60
- package/dialects/sqlite/SqliteSchemaHelper.js +533 -520
- package/package.json +3 -3
- package/plugin/index.d.ts +42 -35
- package/plugin/index.js +43 -36
- package/plugin/transformer.d.ts +117 -94
- package/plugin/transformer.js +890 -881
- package/query/ArrayCriteriaNode.d.ts +4 -4
- package/query/ArrayCriteriaNode.js +18 -18
- package/query/CriteriaNode.d.ts +35 -25
- package/query/CriteriaNode.js +133 -123
- package/query/CriteriaNodeFactory.d.ts +49 -6
- package/query/CriteriaNodeFactory.js +97 -94
- package/query/NativeQueryBuilder.d.ts +118 -118
- package/query/NativeQueryBuilder.js +484 -480
- package/query/ObjectCriteriaNode.d.ts +12 -12
- package/query/ObjectCriteriaNode.js +298 -282
- package/query/QueryBuilder.d.ts +1557 -905
- package/query/QueryBuilder.js +2322 -2192
- package/query/QueryBuilderHelper.d.ts +153 -72
- package/query/QueryBuilderHelper.js +1079 -1028
- package/query/ScalarCriteriaNode.d.ts +3 -3
- package/query/ScalarCriteriaNode.js +53 -46
- package/query/enums.d.ts +14 -14
- package/query/enums.js +14 -14
- package/query/raw.d.ts +16 -6
- package/query/raw.js +10 -10
- package/schema/DatabaseSchema.d.ts +73 -50
- package/schema/DatabaseSchema.js +331 -307
- package/schema/DatabaseTable.d.ts +96 -73
- package/schema/DatabaseTable.js +1012 -927
- package/schema/SchemaComparator.d.ts +70 -66
- package/schema/SchemaComparator.js +766 -740
- package/schema/SchemaHelper.d.ts +109 -95
- package/schema/SchemaHelper.js +675 -659
- package/schema/SqlSchemaGenerator.d.ts +78 -58
- package/schema/SqlSchemaGenerator.js +535 -501
- package/typings.d.ts +380 -266
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
type Dictionary,
|
|
3
|
+
type EntityData,
|
|
4
|
+
type EntityKey,
|
|
5
|
+
type EntityMetadata,
|
|
6
|
+
type EntityName,
|
|
7
|
+
type EntityProperty,
|
|
8
|
+
type FilterQuery,
|
|
9
|
+
type FlatQueryOrderMap,
|
|
10
|
+
type FormulaTable,
|
|
11
|
+
LockMode,
|
|
12
|
+
type QueryOrderMap,
|
|
13
|
+
Raw,
|
|
14
|
+
type RawQueryFragment,
|
|
15
|
+
type RawQueryFragmentSymbol,
|
|
16
|
+
} from '@mikro-orm/core';
|
|
2
17
|
import { JoinType, QueryType } from './enums.js';
|
|
3
18
|
import type { InternalField, JoinOptions } from '../typings.js';
|
|
4
19
|
import type { AbstractSqlDriver } from '../AbstractSqlDriver.js';
|
|
@@ -7,79 +22,145 @@ import type { NativeQueryBuilder } from './NativeQueryBuilder.js';
|
|
|
7
22
|
* @internal
|
|
8
23
|
*/
|
|
9
24
|
export declare class QueryBuilderHelper {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
25
|
+
#private;
|
|
26
|
+
constructor(
|
|
27
|
+
entityName: EntityName,
|
|
28
|
+
alias: string,
|
|
29
|
+
aliasMap: Dictionary<Alias<any>>,
|
|
30
|
+
subQueries: Dictionary<string>,
|
|
31
|
+
driver: AbstractSqlDriver,
|
|
32
|
+
tptAliasMap?: Dictionary<string>,
|
|
33
|
+
);
|
|
34
|
+
/**
|
|
35
|
+
* For TPT inheritance, finds the correct alias for a property based on which entity owns it.
|
|
36
|
+
* Returns the main alias if not a TPT property or if the property belongs to the main entity.
|
|
37
|
+
*/
|
|
38
|
+
getTPTAliasForProperty(propName: string, defaultAlias: string): string;
|
|
39
|
+
mapper(field: string | Raw | RawQueryFragmentSymbol, type?: QueryType): string;
|
|
40
|
+
mapper(
|
|
41
|
+
field: string | Raw | RawQueryFragmentSymbol,
|
|
42
|
+
type?: QueryType,
|
|
43
|
+
value?: any,
|
|
44
|
+
alias?: string | null,
|
|
45
|
+
schema?: string,
|
|
46
|
+
): string;
|
|
47
|
+
processData(data: Dictionary, convertCustomTypes: boolean, multi?: boolean): any;
|
|
48
|
+
joinOneToReference(
|
|
49
|
+
prop: EntityProperty,
|
|
50
|
+
ownerAlias: string,
|
|
51
|
+
alias: string,
|
|
52
|
+
type: JoinType,
|
|
53
|
+
cond?: Dictionary,
|
|
54
|
+
schema?: string,
|
|
55
|
+
): JoinOptions;
|
|
56
|
+
joinManyToOneReference(
|
|
57
|
+
prop: EntityProperty,
|
|
58
|
+
ownerAlias: string,
|
|
59
|
+
alias: string,
|
|
60
|
+
type: JoinType,
|
|
61
|
+
cond?: Dictionary,
|
|
62
|
+
schema?: string,
|
|
63
|
+
): JoinOptions;
|
|
64
|
+
joinManyToManyReference(
|
|
65
|
+
prop: EntityProperty,
|
|
66
|
+
ownerAlias: string,
|
|
67
|
+
alias: string,
|
|
68
|
+
pivotAlias: string,
|
|
69
|
+
type: JoinType,
|
|
70
|
+
cond: Dictionary,
|
|
71
|
+
path: string,
|
|
72
|
+
schema?: string,
|
|
73
|
+
): Dictionary<JoinOptions>;
|
|
74
|
+
processJoins(qb: NativeQueryBuilder, joins: Dictionary<JoinOptions>, schema?: string, schemaOverride?: string): void;
|
|
75
|
+
createJoinExpression(
|
|
76
|
+
join: JoinOptions,
|
|
77
|
+
joins: Dictionary<JoinOptions>,
|
|
78
|
+
schema?: string,
|
|
79
|
+
schemaOverride?: string,
|
|
80
|
+
): {
|
|
81
|
+
sql: string;
|
|
82
|
+
params: unknown[];
|
|
83
|
+
};
|
|
84
|
+
mapJoinColumns(type: QueryType, join: JoinOptions): (string | Raw)[];
|
|
85
|
+
isOneToOneInverse(field: string, meta?: EntityMetadata): boolean;
|
|
86
|
+
getTableName(entityName: EntityName): string;
|
|
87
|
+
/**
|
|
88
|
+
* Checks whether the RE can be rewritten to simple LIKE query
|
|
89
|
+
*/
|
|
90
|
+
isSimpleRegExp(re: any): re is RegExp;
|
|
91
|
+
getRegExpParam(re: RegExp): string;
|
|
92
|
+
appendOnConflictClause<T>(type: QueryType, onConflict: OnConflictClause<T>[], qb: NativeQueryBuilder): void;
|
|
93
|
+
appendQueryCondition(
|
|
94
|
+
type: QueryType,
|
|
95
|
+
cond: any,
|
|
96
|
+
qb: NativeQueryBuilder,
|
|
97
|
+
operator?: '$and' | '$or',
|
|
98
|
+
method?: 'where' | 'having',
|
|
99
|
+
): void;
|
|
100
|
+
_appendQueryCondition(
|
|
101
|
+
type: QueryType,
|
|
102
|
+
cond: any,
|
|
103
|
+
operator?: '$and' | '$or',
|
|
104
|
+
): {
|
|
105
|
+
sql: string;
|
|
106
|
+
params: unknown[];
|
|
107
|
+
};
|
|
108
|
+
private append;
|
|
109
|
+
private appendQuerySubCondition;
|
|
110
|
+
private processObjectSubCondition;
|
|
111
|
+
private getValueReplacement;
|
|
112
|
+
private getOperatorReplacement;
|
|
113
|
+
validateQueryOrder<T>(orderBy: QueryOrderMap<T>): void;
|
|
114
|
+
getQueryOrder(
|
|
115
|
+
type: QueryType,
|
|
116
|
+
orderBy: FlatQueryOrderMap | FlatQueryOrderMap[],
|
|
117
|
+
populate: Dictionary<string>,
|
|
118
|
+
collation?: string,
|
|
119
|
+
): string[];
|
|
120
|
+
getQueryOrderFromObject(
|
|
121
|
+
type: QueryType,
|
|
122
|
+
orderBy: FlatQueryOrderMap,
|
|
123
|
+
populate: Dictionary<string>,
|
|
124
|
+
collation?: string,
|
|
125
|
+
): string[];
|
|
126
|
+
splitField<T>(field: EntityKey<T>, greedyAlias?: boolean): [string, EntityKey<T>, string | undefined];
|
|
127
|
+
getLockSQL(
|
|
128
|
+
qb: NativeQueryBuilder,
|
|
129
|
+
lockMode: LockMode,
|
|
130
|
+
lockTables?: string[],
|
|
131
|
+
joinsMap?: Dictionary<JoinOptions>,
|
|
132
|
+
): void;
|
|
133
|
+
updateVersionProperty(qb: NativeQueryBuilder, data: Dictionary): void;
|
|
134
|
+
private prefix;
|
|
135
|
+
private appendGroupCondition;
|
|
136
|
+
private isPrefixed;
|
|
137
|
+
private fieldName;
|
|
138
|
+
getProperty(field: string, alias?: string): EntityProperty | undefined;
|
|
139
|
+
isTableNameAliasRequired(type: QueryType): boolean;
|
|
140
|
+
private processEmbeddedArrayCondition;
|
|
141
|
+
private buildJsonArrayExists;
|
|
142
|
+
private resolveEmbeddedProp;
|
|
143
|
+
private buildEmbeddedArrayOperatorCondition;
|
|
144
|
+
private processJsonElemMatch;
|
|
145
|
+
/**
|
|
146
|
+
* Shared logic for building WHERE conditions inside JSON array EXISTS subqueries.
|
|
147
|
+
* Used by both embedded array queries (metadata-driven) and $elemMatch (type-inferred).
|
|
148
|
+
*/
|
|
149
|
+
private buildArrayElementWhere;
|
|
150
|
+
private inferJsonValueType;
|
|
151
|
+
processOnConflictCondition(cond: FilterQuery<any>, schema?: string): FilterQuery<any>;
|
|
152
|
+
createFormulaTable(alias: string, meta: EntityMetadata, schema?: string): FormulaTable;
|
|
72
153
|
}
|
|
73
154
|
export interface Alias<T> {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
155
|
+
aliasName: string;
|
|
156
|
+
entityName: EntityName<T>;
|
|
157
|
+
meta: EntityMetadata<T>;
|
|
158
|
+
subQuery?: NativeQueryBuilder | RawQueryFragment;
|
|
159
|
+
rawTableName?: string;
|
|
79
160
|
}
|
|
80
161
|
export interface OnConflictClause<T> {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
162
|
+
fields: string[] | Raw;
|
|
163
|
+
ignore?: boolean;
|
|
164
|
+
merge?: EntityData<T> | InternalField<T>[];
|
|
165
|
+
where?: FilterQuery<T>;
|
|
85
166
|
}
|