@mikro-orm/knex 6.0.0-dev.18 → 6.0.0-dev.181
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 +8 -4
- package/AbstractSqlConnection.js +30 -18
- package/AbstractSqlDriver.d.ts +21 -23
- package/AbstractSqlDriver.js +389 -224
- 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 +5 -9
- package/SqlEntityRepository.d.ts +7 -6
- package/SqlEntityRepository.js +11 -8
- package/index.mjs +24 -5
- package/package.json +8 -8
- package/query/ArrayCriteriaNode.d.ts +4 -3
- package/query/ArrayCriteriaNode.js +5 -0
- package/query/CriteriaNode.d.ts +10 -8
- package/query/CriteriaNode.js +23 -10
- package/query/CriteriaNodeFactory.d.ts +6 -6
- package/query/CriteriaNodeFactory.js +28 -14
- package/query/ObjectCriteriaNode.d.ts +4 -3
- package/query/ObjectCriteriaNode.js +47 -17
- package/query/QueryBuilder.d.ts +53 -24
- package/query/QueryBuilder.js +393 -133
- package/query/QueryBuilderHelper.d.ts +11 -16
- package/query/QueryBuilderHelper.js +194 -155
- package/query/ScalarCriteriaNode.d.ts +3 -2
- package/query/ScalarCriteriaNode.js +10 -6
- 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 +382 -60
- package/schema/SchemaComparator.d.ts +5 -5
- package/schema/SchemaComparator.js +59 -35
- package/schema/SchemaHelper.d.ts +6 -4
- package/schema/SchemaHelper.js +19 -8
- package/schema/SqlSchemaGenerator.d.ts +3 -6
- package/schema/SqlSchemaGenerator.js +71 -36
- package/typings.d.ts +19 -10
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 } 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;
|
|
@@ -135,17 +143,18 @@ export interface IQueryBuilder<T> {
|
|
|
135
143
|
having(cond?: QBFilterQuery | string, params?: any[]): this;
|
|
136
144
|
getAliasForJoinPath(path: string): string | undefined;
|
|
137
145
|
getNextAlias(entityName?: string): string;
|
|
146
|
+
clone(reset?: boolean): IQueryBuilder<T>;
|
|
138
147
|
}
|
|
139
|
-
export interface ICriteriaNode {
|
|
148
|
+
export interface ICriteriaNode<T extends object> {
|
|
140
149
|
readonly entityName: string;
|
|
141
|
-
readonly parent?: ICriteriaNode | undefined;
|
|
150
|
+
readonly parent?: ICriteriaNode<T> | undefined;
|
|
142
151
|
readonly key?: string | undefined;
|
|
143
152
|
payload: any;
|
|
144
153
|
prop?: EntityProperty;
|
|
145
154
|
index?: number;
|
|
146
|
-
process
|
|
155
|
+
process(qb: IQueryBuilder<T>, alias?: string): any;
|
|
147
156
|
shouldInline(payload: any): boolean;
|
|
148
|
-
willAutoJoin
|
|
157
|
+
willAutoJoin(qb: IQueryBuilder<T>, alias?: string): boolean;
|
|
149
158
|
shouldRename(payload: any): boolean;
|
|
150
159
|
renameFieldToPK<T>(qb: IQueryBuilder<T>): string;
|
|
151
160
|
getPath(addIndex?: boolean): string;
|