@mikro-orm/knex 6.0.0-dev.25 → 6.0.0-dev.251
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 +48 -18
- package/AbstractSqlDriver.d.ts +33 -25
- package/AbstractSqlDriver.js +565 -274
- package/AbstractSqlPlatform.d.ts +5 -4
- package/AbstractSqlPlatform.js +34 -5
- 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 +2 -6
- package/SqlEntityManager.js +4 -8
- package/SqlEntityRepository.d.ts +7 -6
- package/SqlEntityRepository.js +11 -8
- package/index.mjs +23 -5
- package/package.json +8 -8
- package/query/ArrayCriteriaNode.d.ts +5 -4
- package/query/ArrayCriteriaNode.js +7 -2
- package/query/CriteriaNode.d.ts +12 -10
- package/query/CriteriaNode.js +30 -17
- package/query/CriteriaNodeFactory.d.ts +6 -6
- package/query/CriteriaNodeFactory.js +33 -17
- package/query/ObjectCriteriaNode.d.ts +5 -4
- package/query/ObjectCriteriaNode.js +67 -27
- package/query/QueryBuilder.d.ts +58 -26
- package/query/QueryBuilder.js +444 -148
- package/query/QueryBuilderHelper.d.ts +13 -18
- package/query/QueryBuilderHelper.js +194 -167
- package/query/ScalarCriteriaNode.d.ts +4 -3
- package/query/ScalarCriteriaNode.js +18 -8
- package/query/enums.d.ts +7 -0
- package/query/enums.js +10 -2
- package/schema/DatabaseSchema.d.ts +5 -2
- package/schema/DatabaseSchema.js +28 -10
- package/schema/DatabaseTable.d.ts +13 -5
- package/schema/DatabaseTable.js +385 -60
- package/schema/SchemaComparator.d.ts +7 -5
- package/schema/SchemaComparator.js +68 -35
- package/schema/SchemaHelper.d.ts +7 -5
- package/schema/SchemaHelper.js +25 -11
- package/schema/SqlSchemaGenerator.d.ts +3 -4
- package/schema/SqlSchemaGenerator.js +71 -28
- package/typings.d.ts +30 -11
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,19 +141,30 @@ 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;
|
|
138
151
|
}
|
|
139
|
-
export interface
|
|
152
|
+
export interface ICriteriaNodeProcessOptions {
|
|
153
|
+
alias?: string;
|
|
154
|
+
matchPopulateJoins?: boolean;
|
|
155
|
+
ignoreBranching?: boolean;
|
|
156
|
+
preferNoBranch?: boolean;
|
|
157
|
+
}
|
|
158
|
+
export interface ICriteriaNode<T extends object> {
|
|
140
159
|
readonly entityName: string;
|
|
141
|
-
readonly parent?: ICriteriaNode | undefined;
|
|
160
|
+
readonly parent?: ICriteriaNode<T> | undefined;
|
|
142
161
|
readonly key?: string | undefined;
|
|
143
162
|
payload: any;
|
|
144
163
|
prop?: EntityProperty;
|
|
145
164
|
index?: number;
|
|
146
|
-
process
|
|
165
|
+
process(qb: IQueryBuilder<T>, options?: ICriteriaNodeProcessOptions): any;
|
|
147
166
|
shouldInline(payload: any): boolean;
|
|
148
|
-
willAutoJoin
|
|
167
|
+
willAutoJoin(qb: IQueryBuilder<T>, alias?: string): boolean;
|
|
149
168
|
shouldRename(payload: any): boolean;
|
|
150
169
|
renameFieldToPK<T>(qb: IQueryBuilder<T>): string;
|
|
151
170
|
getPath(addIndex?: boolean): string;
|