@mikro-orm/knex 6.0.0-dev.30 → 6.0.0-dev.301
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 +22 -4
- package/AbstractSqlConnection.js +47 -17
- package/AbstractSqlDriver.d.ts +30 -24
- package/AbstractSqlDriver.js +590 -264
- package/AbstractSqlPlatform.d.ts +9 -5
- package/AbstractSqlPlatform.js +25 -29
- package/MonkeyPatchable.d.ts +1 -0
- package/MonkeyPatchable.js +3 -0
- package/PivotCollectionPersister.d.ts +17 -0
- package/PivotCollectionPersister.js +128 -0
- package/README.md +64 -107
- package/SqlEntityManager.d.ts +4 -8
- package/SqlEntityManager.js +8 -12
- package/SqlEntityRepository.d.ts +7 -5
- package/SqlEntityRepository.js +11 -7
- package/index.mjs +24 -3
- package/package.json +8 -8
- package/query/ArrayCriteriaNode.d.ts +3 -2
- package/query/ArrayCriteriaNode.js +7 -2
- package/query/CriteriaNode.d.ts +6 -4
- package/query/CriteriaNode.js +22 -9
- package/query/CriteriaNodeFactory.d.ts +1 -1
- package/query/CriteriaNodeFactory.js +27 -11
- package/query/ObjectCriteriaNode.d.ts +3 -2
- package/query/ObjectCriteriaNode.js +72 -28
- package/query/QueryBuilder.d.ts +58 -26
- package/query/QueryBuilder.js +435 -139
- package/query/QueryBuilderHelper.d.ts +13 -18
- package/query/QueryBuilderHelper.js +196 -169
- package/query/ScalarCriteriaNode.d.ts +3 -2
- package/query/ScalarCriteriaNode.js +14 -4
- package/query/enums.d.ts +7 -0
- package/query/enums.js +10 -2
- package/schema/DatabaseSchema.d.ts +5 -2
- package/schema/DatabaseSchema.js +26 -8
- package/schema/DatabaseTable.d.ts +12 -4
- package/schema/DatabaseTable.js +369 -42
- package/schema/SchemaComparator.d.ts +7 -5
- package/schema/SchemaComparator.js +69 -35
- package/schema/SchemaHelper.d.ts +7 -5
- package/schema/SchemaHelper.js +30 -11
- package/schema/SqlSchemaGenerator.d.ts +3 -4
- package/schema/SqlSchemaGenerator.js +66 -23
- package/typings.d.ts +27 -8
package/typings.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Knex } from 'knex';
|
|
2
|
-
import type { CheckCallback, Dictionary, EntityProperty, GroupOperator, QBFilterQuery, QueryOrderMap, Type } from '@mikro-orm/core';
|
|
3
|
-
import type { QueryType } from './query/enums';
|
|
2
|
+
import type { CheckCallback, Dictionary, EntityProperty, GroupOperator, RawQueryFragment, QBFilterQuery, QueryOrderMap, Type, QueryFlag } from '@mikro-orm/core';
|
|
3
|
+
import type { JoinType, QueryType } from './query/enums';
|
|
4
4
|
import type { DatabaseSchema, DatabaseTable } from './schema';
|
|
5
5
|
export interface Table {
|
|
6
6
|
table_name: string;
|
|
@@ -11,11 +11,11 @@ export type KnexStringRef = Knex.Ref<string, {
|
|
|
11
11
|
[alias: string]: string;
|
|
12
12
|
}>;
|
|
13
13
|
type AnyString = string & {};
|
|
14
|
-
export type Field<T> = AnyString | keyof T | KnexStringRef | Knex.QueryBuilder;
|
|
14
|
+
export type Field<T> = AnyString | keyof T | RawQueryFragment | KnexStringRef | Knex.QueryBuilder;
|
|
15
15
|
export interface JoinOptions {
|
|
16
16
|
table: string;
|
|
17
17
|
schema?: string;
|
|
18
|
-
type:
|
|
18
|
+
type: JoinType;
|
|
19
19
|
alias: string;
|
|
20
20
|
ownerAlias: string;
|
|
21
21
|
inverseAlias?: string;
|
|
@@ -25,6 +25,8 @@ export interface JoinOptions {
|
|
|
25
25
|
path?: string;
|
|
26
26
|
prop: EntityProperty;
|
|
27
27
|
cond: Dictionary;
|
|
28
|
+
cond_?: Dictionary;
|
|
29
|
+
subquery?: string;
|
|
28
30
|
}
|
|
29
31
|
export interface Column {
|
|
30
32
|
name: string;
|
|
@@ -38,6 +40,8 @@ export interface Column {
|
|
|
38
40
|
scale?: number;
|
|
39
41
|
default?: string | null;
|
|
40
42
|
comment?: string;
|
|
43
|
+
generated?: string;
|
|
44
|
+
nativeEnumName?: string;
|
|
41
45
|
enumItems?: string[];
|
|
42
46
|
primary?: boolean;
|
|
43
47
|
unique?: boolean;
|
|
@@ -58,9 +62,11 @@ export interface IndexDef {
|
|
|
58
62
|
columnNames: string[];
|
|
59
63
|
keyName: string;
|
|
60
64
|
unique: boolean;
|
|
65
|
+
constraint: boolean;
|
|
61
66
|
primary: boolean;
|
|
62
67
|
composite?: boolean;
|
|
63
68
|
expression?: string;
|
|
69
|
+
options?: Dictionary;
|
|
64
70
|
type?: string | Readonly<{
|
|
65
71
|
indexType?: string;
|
|
66
72
|
storageEngineIndexType?: 'hash' | 'btree';
|
|
@@ -119,10 +125,12 @@ export interface IQueryBuilder<T> {
|
|
|
119
125
|
delete(cond?: QBFilterQuery): this;
|
|
120
126
|
truncate(): this;
|
|
121
127
|
count(field?: string | string[], distinct?: boolean): this;
|
|
122
|
-
join(field: string, alias: string, cond?: QBFilterQuery, type?:
|
|
128
|
+
join(field: string, alias: string, cond?: QBFilterQuery, type?: JoinType, path?: string): this;
|
|
129
|
+
innerJoin(field: string, alias: string, cond?: QBFilterQuery): this;
|
|
123
130
|
leftJoin(field: string, alias: string, cond?: QBFilterQuery): this;
|
|
124
131
|
joinAndSelect(field: string, alias: string, cond?: QBFilterQuery): this;
|
|
125
|
-
leftJoinAndSelect(field: string, alias: string, cond?: QBFilterQuery): this;
|
|
132
|
+
leftJoinAndSelect(field: string, alias: string, cond?: QBFilterQuery, fields?: string[]): this;
|
|
133
|
+
innerJoinAndSelect(field: string, alias: string, cond?: QBFilterQuery, fields?: string[]): this;
|
|
126
134
|
withSubQuery(subQuery: Knex.QueryBuilder, alias: string): this;
|
|
127
135
|
where(cond: QBFilterQuery<T>, operator?: keyof typeof GroupOperator): this;
|
|
128
136
|
where(cond: string, params?: any[], operator?: keyof typeof GroupOperator): this;
|
|
@@ -133,8 +141,19 @@ export interface IQueryBuilder<T> {
|
|
|
133
141
|
orderBy(orderBy: QueryOrderMap<T>): this;
|
|
134
142
|
groupBy(fields: (string | keyof T) | (string | keyof T)[]): this;
|
|
135
143
|
having(cond?: QBFilterQuery | string, params?: any[]): this;
|
|
136
|
-
getAliasForJoinPath(path: string): string | undefined;
|
|
144
|
+
getAliasForJoinPath(path: string, options?: ICriteriaNodeProcessOptions): string | undefined;
|
|
145
|
+
getJoinForPath(path?: string, options?: ICriteriaNodeProcessOptions): JoinOptions | undefined;
|
|
137
146
|
getNextAlias(entityName?: string): string;
|
|
147
|
+
clone(reset?: boolean): IQueryBuilder<T>;
|
|
148
|
+
setFlag(flag: QueryFlag): this;
|
|
149
|
+
unsetFlag(flag: QueryFlag): this;
|
|
150
|
+
hasFlag(flag: QueryFlag): boolean;
|
|
151
|
+
}
|
|
152
|
+
export interface ICriteriaNodeProcessOptions {
|
|
153
|
+
alias?: string;
|
|
154
|
+
matchPopulateJoins?: boolean;
|
|
155
|
+
ignoreBranching?: boolean;
|
|
156
|
+
preferNoBranch?: boolean;
|
|
138
157
|
}
|
|
139
158
|
export interface ICriteriaNode<T extends object> {
|
|
140
159
|
readonly entityName: string;
|
|
@@ -143,7 +162,7 @@ export interface ICriteriaNode<T extends object> {
|
|
|
143
162
|
payload: any;
|
|
144
163
|
prop?: EntityProperty;
|
|
145
164
|
index?: number;
|
|
146
|
-
process(qb: IQueryBuilder<T>,
|
|
165
|
+
process(qb: IQueryBuilder<T>, options?: ICriteriaNodeProcessOptions): any;
|
|
147
166
|
shouldInline(payload: any): boolean;
|
|
148
167
|
willAutoJoin(qb: IQueryBuilder<T>, alias?: string): boolean;
|
|
149
168
|
shouldRename(payload: any): boolean;
|