taon-typeorm 19.0.5 → 19.0.7
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/browser/fesm2022/taon-typeorm.mjs +4 -0
- package/browser/fesm2022/taon-typeorm.mjs.map +1 -1
- package/browser/lib/typeorm/find-options/FindOneOptions.d.ts +2 -1
- package/browser/lib/typeorm/index.d.ts +3 -0
- package/browser/lib/typeorm/query-builder/QueryBuilder.d.ts +2 -0
- package/browser/lib/typeorm/query-builder/SelectQueryBuilder.d.ts +3 -0
- package/browser/lib/typeorm/relation-path.d.ts +7 -0
- package/browser/package.json +1 -1
- package/client/fesm2022/taon-typeorm.mjs +4 -0
- package/client/fesm2022/taon-typeorm.mjs.map +1 -1
- package/client/lib/typeorm/find-options/FindOneOptions.d.ts +2 -1
- package/client/lib/typeorm/index.d.ts +3 -0
- package/client/lib/typeorm/query-builder/QueryBuilder.d.ts +2 -0
- package/client/lib/typeorm/query-builder/SelectQueryBuilder.d.ts +3 -0
- package/client/lib/typeorm/relation-path.d.ts +7 -0
- package/client/package.json +1 -1
- package/lib/build-info._auto-generated_.d.ts +1 -1
- package/lib/build-info._auto-generated_.js +1 -1
- package/lib/typeorm/find-options/FindOneOptions.d.ts +2 -1
- package/lib/typeorm/index.d.ts +3 -0
- package/lib/typeorm/index.js +3 -0
- package/lib/typeorm/index.js.map +1 -1
- package/lib/typeorm/query-builder/QueryBuilder.d.ts +2 -0
- package/lib/typeorm/query-builder/QueryBuilder.js.map +1 -1
- package/lib/typeorm/query-builder/RelationQueryBuilder.js +3 -0
- package/lib/typeorm/query-builder/RelationQueryBuilder.js.map +1 -1
- package/lib/typeorm/query-builder/SelectQueryBuilder.d.ts +3 -0
- package/lib/typeorm/query-builder/SelectQueryBuilder.js +1 -0
- package/lib/typeorm/query-builder/SelectQueryBuilder.js.map +1 -1
- package/lib/typeorm/relation-path.d.ts +6 -0
- package/lib/typeorm/relation-path.js +3 -0
- package/lib/typeorm/relation-path.js.map +1 -0
- package/package.json +1 -1
- package/tmp-environment.json +3 -3
- package/websql/fesm2022/taon-typeorm.mjs +4 -0
- package/websql/fesm2022/taon-typeorm.mjs.map +1 -1
- package/websql/lib/typeorm/find-options/FindOneOptions.d.ts +2 -1
- package/websql/lib/typeorm/index.d.ts +3 -0
- package/websql/lib/typeorm/query-builder/QueryBuilder.d.ts +2 -0
- package/websql/lib/typeorm/query-builder/SelectQueryBuilder.d.ts +3 -0
- package/websql/lib/typeorm/relation-path.d.ts +7 -0
- package/websql/package.json +1 -1
|
@@ -4,6 +4,7 @@ import { FindOptionsWhere } from "./FindOptionsWhere";
|
|
|
4
4
|
import { FindOptionsSelect, FindOptionsSelectByString } from "./FindOptionsSelect";
|
|
5
5
|
import { FindOptionsRelationByString, FindOptionsRelations } from "./FindOptionsRelations";
|
|
6
6
|
import { FindOptionsOrder } from "./FindOptionsOrder";
|
|
7
|
+
import { RelationPath } from "../relation-path";
|
|
7
8
|
/**
|
|
8
9
|
* Defines a special criteria to find specific entity.
|
|
9
10
|
*/
|
|
@@ -25,7 +26,7 @@ export interface FindOneOptions<Entity = any> {
|
|
|
25
26
|
/**
|
|
26
27
|
* Indicates what relations of entity should be loaded (simplified left join form).
|
|
27
28
|
*/
|
|
28
|
-
relations?: FindOptionsRelations<Entity> | FindOptionsRelationByString;
|
|
29
|
+
relations?: RelationPath<Entity>[] | FindOptionsRelations<Entity> | FindOptionsRelationByString;
|
|
29
30
|
/**
|
|
30
31
|
* Specifies how relations must be loaded - using "joins" or separate queries.
|
|
31
32
|
* If you are loading too much data with nested joins it's better to load relations
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
export { OrignalClassKey } from './constants';
|
|
3
3
|
export * from './globals';
|
|
4
|
+
export * from './query-builder/QueryPartialEntity';
|
|
5
|
+
export * from './repository/UpsertOptions';
|
|
6
|
+
export * from './relation-path';
|
|
4
7
|
export * from './common/EntityTarget';
|
|
5
8
|
export * from './common/ObjectType';
|
|
6
9
|
export * from './common/ObjectLiteral';
|
|
@@ -19,6 +19,7 @@ import { ColumnMetadata } from "../metadata/ColumnMetadata";
|
|
|
19
19
|
import { WhereClause, WhereClauseCondition } from "./WhereClause";
|
|
20
20
|
import { NotBrackets } from "./NotBrackets";
|
|
21
21
|
import { ReturningType } from "../driver/Driver";
|
|
22
|
+
import { RelationPath } from "../relation-path";
|
|
22
23
|
/**
|
|
23
24
|
* Allows to build complex sql queries in a fashion way and execute those queries.
|
|
24
25
|
*/
|
|
@@ -105,6 +106,7 @@ export declare abstract class QueryBuilder<Entity extends ObjectLiteral> {
|
|
|
105
106
|
* Sets entity's relation with which this query builder gonna work.
|
|
106
107
|
*/
|
|
107
108
|
relation(propertyPath: string): RelationQueryBuilder<Entity>;
|
|
109
|
+
relation(propertyPath: RelationPath<Entity>): RelationQueryBuilder<Entity>;
|
|
108
110
|
/**
|
|
109
111
|
* Sets entity's relation with which this query builder gonna work.
|
|
110
112
|
*/
|
|
@@ -16,6 +16,7 @@ import { RelationMetadata } from "../metadata/RelationMetadata";
|
|
|
16
16
|
import { FindOptionsOrder } from "../find-options/FindOptionsOrder";
|
|
17
17
|
import { FindOptionsWhere } from "../find-options/FindOptionsWhere";
|
|
18
18
|
import { FindOptionsRelations } from "../find-options/FindOptionsRelations";
|
|
19
|
+
import { RelationPath } from "../relation-path";
|
|
19
20
|
/**
|
|
20
21
|
* Allows to build complex sql queries in a fashion way and execute those queries.
|
|
21
22
|
*/
|
|
@@ -177,6 +178,7 @@ export declare class SelectQueryBuilder<Entity extends ObjectLiteral> extends Qu
|
|
|
177
178
|
* Optionally, you can add condition and parameters used in condition.
|
|
178
179
|
*/
|
|
179
180
|
innerJoinAndSelect(property: string, alias: string, condition?: string, parameters?: ObjectLiteral): this;
|
|
181
|
+
innerJoinAndSelect(property: RelationPath<Entity>, alias: string, condition?: string, parameters?: ObjectLiteral): this;
|
|
180
182
|
/**
|
|
181
183
|
* INNER JOINs entity and adds all selection properties to SELECT.
|
|
182
184
|
* You also need to specify an alias of the joined data.
|
|
@@ -202,6 +204,7 @@ export declare class SelectQueryBuilder<Entity extends ObjectLiteral> extends Qu
|
|
|
202
204
|
* Optionally, you can add condition and parameters used in condition.
|
|
203
205
|
*/
|
|
204
206
|
leftJoinAndSelect(property: string, alias: string, condition?: string, parameters?: ObjectLiteral): this;
|
|
207
|
+
leftJoinAndSelect(property: RelationPath<Entity>, alias: string, condition?: string, parameters?: ObjectLiteral): this;
|
|
205
208
|
/**
|
|
206
209
|
* LEFT JOINs entity and adds all selection properties to SELECT.
|
|
207
210
|
* You also need to specify an alias of the joined data.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
type Join<K, P> = K extends string ? P extends string ? `${K}.${P}` : never : never;
|
|
3
|
+
export type RelationPath<T, Depth extends number = 3> = Depth extends 0 ? never : {
|
|
4
|
+
[K in keyof T]: T[K] extends object ? T[K] extends Array<infer U> ? K | Join<K, RelationPath<U, Prev[Depth]>> : K | Join<K, RelationPath<T[K], Prev[Depth]>> : K;
|
|
5
|
+
}[keyof T];
|
|
6
|
+
type Prev = [never, 0, 1, 2, 3, 4, 5, 6];
|
|
7
|
+
export {};
|