@yandjin-mikro-orm/knex 6.1.4-rc-sti-changes-1

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.
Files changed (52) hide show
  1. package/AbstractSqlConnection.d.ts +58 -0
  2. package/AbstractSqlConnection.js +206 -0
  3. package/AbstractSqlDriver.d.ts +73 -0
  4. package/AbstractSqlDriver.js +1378 -0
  5. package/AbstractSqlPlatform.d.ts +25 -0
  6. package/AbstractSqlPlatform.js +86 -0
  7. package/LICENSE +21 -0
  8. package/MonkeyPatchable.d.ts +11 -0
  9. package/MonkeyPatchable.js +39 -0
  10. package/PivotCollectionPersister.d.ts +17 -0
  11. package/PivotCollectionPersister.js +131 -0
  12. package/README.md +383 -0
  13. package/SqlEntityManager.d.ts +25 -0
  14. package/SqlEntityManager.js +40 -0
  15. package/SqlEntityRepository.d.ts +24 -0
  16. package/SqlEntityRepository.js +36 -0
  17. package/index.d.ts +18 -0
  18. package/index.js +40 -0
  19. package/index.mjs +215 -0
  20. package/package.json +71 -0
  21. package/query/ArrayCriteriaNode.d.ts +10 -0
  22. package/query/ArrayCriteriaNode.js +25 -0
  23. package/query/CriteriaNode.d.ts +31 -0
  24. package/query/CriteriaNode.js +147 -0
  25. package/query/CriteriaNodeFactory.d.ts +12 -0
  26. package/query/CriteriaNodeFactory.js +90 -0
  27. package/query/ObjectCriteriaNode.d.ts +15 -0
  28. package/query/ObjectCriteriaNode.js +233 -0
  29. package/query/QueryBuilder.d.ts +291 -0
  30. package/query/QueryBuilder.js +1445 -0
  31. package/query/QueryBuilderHelper.d.ts +64 -0
  32. package/query/QueryBuilderHelper.js +747 -0
  33. package/query/ScalarCriteriaNode.d.ts +10 -0
  34. package/query/ScalarCriteriaNode.js +56 -0
  35. package/query/enums.d.ts +15 -0
  36. package/query/enums.js +20 -0
  37. package/query/index.d.ts +8 -0
  38. package/query/index.js +24 -0
  39. package/schema/DatabaseSchema.d.ts +29 -0
  40. package/schema/DatabaseSchema.js +140 -0
  41. package/schema/DatabaseTable.d.ts +61 -0
  42. package/schema/DatabaseTable.js +727 -0
  43. package/schema/SchemaComparator.d.ts +59 -0
  44. package/schema/SchemaComparator.js +603 -0
  45. package/schema/SchemaHelper.d.ts +56 -0
  46. package/schema/SchemaHelper.js +274 -0
  47. package/schema/SqlSchemaGenerator.d.ts +63 -0
  48. package/schema/SqlSchemaGenerator.js +598 -0
  49. package/schema/index.d.ts +5 -0
  50. package/schema/index.js +21 -0
  51. package/typings.d.ts +174 -0
  52. package/typings.js +2 -0
package/typings.d.ts ADDED
@@ -0,0 +1,174 @@
1
+ import type { Knex } from "knex";
2
+ import type { CheckCallback, Dictionary, EntityProperty, GroupOperator, RawQueryFragment, QBFilterQuery, QueryOrderMap, Type, QueryFlag, AnyEntity, EntityName } from "@yandjin-mikro-orm/core";
3
+ import type { JoinType, QueryType } from "./query/enums";
4
+ import type { DatabaseSchema, DatabaseTable } from "./schema";
5
+ export interface Table {
6
+ table_name: string;
7
+ schema_name?: string;
8
+ table_comment?: string;
9
+ }
10
+ export type KnexStringRef = Knex.Ref<string, {
11
+ [alias: string]: string;
12
+ }>;
13
+ type AnyString = string & {};
14
+ export type Field<T> = AnyString | keyof T | RawQueryFragment | KnexStringRef | Knex.QueryBuilder;
15
+ export interface JoinOptions {
16
+ table: string;
17
+ schema?: string;
18
+ type: JoinType;
19
+ alias: string;
20
+ ownerAlias: string;
21
+ inverseAlias?: string;
22
+ joinColumns?: string[];
23
+ inverseJoinColumns?: string[];
24
+ primaryKeys?: string[];
25
+ path?: string;
26
+ prop: EntityProperty;
27
+ cond: Dictionary;
28
+ cond_?: Dictionary;
29
+ subquery?: string;
30
+ }
31
+ export interface Column {
32
+ name: string;
33
+ type: string;
34
+ mappedType: Type<unknown>;
35
+ unsigned?: boolean;
36
+ autoincrement?: boolean;
37
+ nullable?: boolean;
38
+ length?: number;
39
+ precision?: number;
40
+ scale?: number;
41
+ default?: string | null;
42
+ comment?: string;
43
+ generated?: string;
44
+ nativeEnumName?: string;
45
+ enumItems?: string[];
46
+ primary?: boolean;
47
+ unique?: boolean;
48
+ /** mysql only */
49
+ extra?: string;
50
+ ignoreSchemaChanges?: ("type" | "extra")[];
51
+ }
52
+ export interface ForeignKey {
53
+ columnNames: string[];
54
+ constraintName: string;
55
+ localTableName: string;
56
+ referencedTableName: string;
57
+ referencedColumnNames: string[];
58
+ updateRule?: string;
59
+ deleteRule?: string;
60
+ }
61
+ export interface IndexDef {
62
+ columnNames: string[];
63
+ keyName: string;
64
+ unique: boolean;
65
+ constraint: boolean;
66
+ primary: boolean;
67
+ composite?: boolean;
68
+ expression?: string;
69
+ options?: Dictionary;
70
+ type?: string | Readonly<{
71
+ indexType?: string;
72
+ storageEngineIndexType?: "hash" | "btree";
73
+ predicate?: Knex.QueryBuilder;
74
+ }>;
75
+ }
76
+ export interface CheckDef<T = unknown> {
77
+ name: string;
78
+ expression: string | CheckCallback<T>;
79
+ definition?: string;
80
+ columnName?: string;
81
+ }
82
+ export interface ColumnDifference {
83
+ oldColumnName: string;
84
+ column: Column;
85
+ fromColumn: Column;
86
+ changedProperties: Set<string>;
87
+ }
88
+ export interface TableDifference {
89
+ name: string;
90
+ changedComment?: string;
91
+ fromTable: DatabaseTable;
92
+ toTable: DatabaseTable;
93
+ addedColumns: Dictionary<Column>;
94
+ changedColumns: Dictionary<ColumnDifference>;
95
+ removedColumns: Dictionary<Column>;
96
+ renamedColumns: Dictionary<Column>;
97
+ addedIndexes: Dictionary<IndexDef>;
98
+ changedIndexes: Dictionary<IndexDef>;
99
+ removedIndexes: Dictionary<IndexDef>;
100
+ renamedIndexes: Dictionary<IndexDef>;
101
+ addedChecks: Dictionary<CheckDef>;
102
+ changedChecks: Dictionary<CheckDef>;
103
+ removedChecks: Dictionary<CheckDef>;
104
+ addedForeignKeys: Dictionary<ForeignKey>;
105
+ changedForeignKeys: Dictionary<ForeignKey>;
106
+ removedForeignKeys: Dictionary<ForeignKey>;
107
+ }
108
+ export interface SchemaDifference {
109
+ newNamespaces: Set<string>;
110
+ newTables: Dictionary<DatabaseTable>;
111
+ changedTables: Dictionary<TableDifference>;
112
+ removedTables: Dictionary<DatabaseTable>;
113
+ removedNamespaces: Set<string>;
114
+ orphanedForeignKeys: ForeignKey[];
115
+ fromSchema: DatabaseSchema;
116
+ }
117
+ export interface IQueryBuilder<T> {
118
+ readonly alias: string;
119
+ readonly type?: QueryType;
120
+ _fields?: Field<T>[];
121
+ select(fields: Field<T> | Field<T>[], distinct?: boolean): this;
122
+ addSelect(fields: string | string[]): this;
123
+ from<T extends AnyEntity<T> = AnyEntity>(target: EntityName<T> | IQueryBuilder<T>, aliasName?: string): IQueryBuilder<T>;
124
+ insert(data: any): this;
125
+ update(data: any): this;
126
+ delete(cond?: QBFilterQuery): this;
127
+ truncate(): this;
128
+ count(field?: string | string[], distinct?: boolean): this;
129
+ join(field: string, alias: string, cond?: QBFilterQuery, type?: JoinType, path?: string): this;
130
+ innerJoin(field: string, alias: string, cond?: QBFilterQuery): this;
131
+ leftJoin(field: string, alias: string, cond?: QBFilterQuery): this;
132
+ joinAndSelect(field: string, alias: string, cond?: QBFilterQuery): this;
133
+ leftJoinAndSelect(field: string, alias: string, cond?: QBFilterQuery, fields?: string[]): this;
134
+ innerJoinAndSelect(field: string, alias: string, cond?: QBFilterQuery, fields?: string[]): this;
135
+ withSubQuery(subQuery: Knex.QueryBuilder, alias: string): this;
136
+ where(cond: QBFilterQuery<T>, operator?: keyof typeof GroupOperator): this;
137
+ where(cond: string, params?: any[], operator?: keyof typeof GroupOperator): this;
138
+ andWhere(cond: QBFilterQuery<T>): this;
139
+ andWhere(cond: string, params?: any[]): this;
140
+ orWhere(cond: QBFilterQuery<T>): this;
141
+ orWhere(cond: string, params?: any[]): this;
142
+ orderBy(orderBy: QueryOrderMap<T>): this;
143
+ groupBy(fields: (string | keyof T) | (string | keyof T)[]): this;
144
+ having(cond?: QBFilterQuery | string, params?: any[]): this;
145
+ getAliasForJoinPath(path: string, options?: ICriteriaNodeProcessOptions): string | undefined;
146
+ getJoinForPath(path?: string, options?: ICriteriaNodeProcessOptions): JoinOptions | undefined;
147
+ getNextAlias(entityName?: string): string;
148
+ clone(reset?: boolean): IQueryBuilder<T>;
149
+ setFlag(flag: QueryFlag): this;
150
+ unsetFlag(flag: QueryFlag): this;
151
+ hasFlag(flag: QueryFlag): boolean;
152
+ }
153
+ export interface ICriteriaNodeProcessOptions {
154
+ alias?: string;
155
+ matchPopulateJoins?: boolean;
156
+ ignoreBranching?: boolean;
157
+ preferNoBranch?: boolean;
158
+ }
159
+ export interface ICriteriaNode<T extends object> {
160
+ readonly entityName: string;
161
+ readonly parent?: ICriteriaNode<T> | undefined;
162
+ readonly key?: string | undefined;
163
+ payload: any;
164
+ prop?: EntityProperty;
165
+ index?: number;
166
+ process(qb: IQueryBuilder<T>, options?: ICriteriaNodeProcessOptions): any;
167
+ shouldInline(payload: any): boolean;
168
+ willAutoJoin(qb: IQueryBuilder<T>, alias?: string): boolean;
169
+ shouldRename(payload: any): boolean;
170
+ renameFieldToPK<T>(qb: IQueryBuilder<T>): string;
171
+ getPath(addIndex?: boolean): string;
172
+ getPivotPath(path: string): string;
173
+ }
174
+ export {};
package/typings.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });