typeorm-extensions 2.2.0-rc.6 → 2.2.0-rc.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.
Files changed (66) hide show
  1. package/dist/extensions/cursor-pagination.extension.d.ts +2 -1
  2. package/dist/extensions/order.extension.d.ts +2 -2
  3. package/dist/extensions/pagination.extension.d.ts +1 -1
  4. package/dist/extensions/period-filter.extension.d.ts +4 -0
  5. package/dist/extensions/period-filter.extension.js +2 -0
  6. package/dist/extensions/typed/index.d.ts +1 -0
  7. package/dist/extensions/typed/index.js +1 -0
  8. package/dist/extensions/typed/typed-distinct/typed-distinct.extension.d.ts +2 -2
  9. package/dist/extensions/typed/typed-group-by/typed-group-by.extension.d.ts +2 -2
  10. package/dist/extensions/typed/typed-having/typed-having.extension.d.ts +4 -4
  11. package/dist/extensions/typed/typed-joins/typed-join-and-map.extension.d.ts +19 -0
  12. package/dist/extensions/typed/typed-joins/typed-join-and-map.extension.js +22 -0
  13. package/dist/extensions/typed/typed-joins/typed-joins.extension.d.ts +4 -4
  14. package/dist/extensions/typed/typed-order-by/typed-order-by-array-position.extension.d.ts +2 -2
  15. package/dist/extensions/typed/typed-order-by/typed-order-by.extension.d.ts +2 -2
  16. package/dist/extensions/typed/typed-root.extension.d.ts +26 -4
  17. package/dist/extensions/typed/typed-select/typed-select.extension.d.ts +6 -6
  18. package/dist/extensions/typed/typed-where/typed-period-filter.extension.d.ts +5 -1
  19. package/dist/extensions/typed/typed-where/typed-period-filter.extension.js +2 -0
  20. package/dist/extensions/typed/typed-where/typed-where-array.extension.d.ts +13 -9
  21. package/dist/extensions/typed/typed-where/typed-where-array.extension.js +2 -0
  22. package/dist/extensions/typed/typed-where/typed-where-ilike.extension.d.ts +10 -6
  23. package/dist/extensions/typed/typed-where/typed-where-ilike.extension.js +2 -0
  24. package/dist/extensions/typed/typed-where/typed-where-is-any.extension.d.ts +10 -6
  25. package/dist/extensions/typed/typed-where/typed-where-is-any.extension.js +2 -0
  26. package/dist/extensions/typed/typed-where/typed-where-is-distinct-from.extension.d.ts +10 -6
  27. package/dist/extensions/typed/typed-where/typed-where-is-distinct-from.extension.js +2 -0
  28. package/dist/extensions/typed/typed-where/typed-where-is-in.extension.d.ts +10 -6
  29. package/dist/extensions/typed/typed-where/typed-where-is-in.extension.js +2 -0
  30. package/dist/extensions/typed/typed-where/typed-where-json.extension.d.ts +10 -6
  31. package/dist/extensions/typed/typed-where/typed-where-json.extension.js +2 -0
  32. package/dist/extensions/typed/typed-where/typed-where-lower.extension.d.ts +10 -6
  33. package/dist/extensions/typed/typed-where/typed-where-lower.extension.js +2 -0
  34. package/dist/extensions/typed/typed-where/typed-where-similar.extension.d.ts +8 -4
  35. package/dist/extensions/typed/typed-where/typed-where-similar.extension.js +2 -0
  36. package/dist/extensions/typed/typed-where/typed-where.extension.d.ts +7 -3
  37. package/dist/extensions/typed/typed-where/typed-where.extension.js +2 -0
  38. package/dist/extensions/where-array.extension.d.ts +4 -0
  39. package/dist/extensions/where-array.extension.js +2 -0
  40. package/dist/extensions/where-is-any.extension.d.ts +41 -6
  41. package/dist/extensions/where-is-any.extension.js +2 -0
  42. package/dist/extensions/where-is-distinct-from.extension.d.ts +4 -0
  43. package/dist/extensions/where-is-distinct-from.extension.js +2 -0
  44. package/dist/extensions/where-is-in.extension.d.ts +38 -6
  45. package/dist/extensions/where-is-in.extension.js +2 -0
  46. package/dist/extensions/where-json.extension.d.ts +4 -0
  47. package/dist/extensions/where-json.extension.js +2 -0
  48. package/dist/extensions/where-relation-exists.extension.d.ts +6 -6
  49. package/dist/helpers.d.ts +4 -0
  50. package/dist/helpers.js +11 -3
  51. package/dist/index.d.ts +4 -0
  52. package/dist/index.js +9 -1
  53. package/dist/types/extensions/index.d.ts +1 -0
  54. package/dist/types/extensions/index.js +1 -0
  55. package/dist/types/extensions/typed-join-and-map.types.d.ts +6 -0
  56. package/dist/types/extensions/typed-join-and-map.types.js +2 -0
  57. package/dist/types/modules/typed-root.types.d.ts +11 -9
  58. package/dist/utils/query-builder.utils.d.ts +3 -2
  59. package/dist/utils/query-builder.utils.js +6 -4
  60. package/dist/utils/reserved-qualifier-guard.utils.d.ts +36 -0
  61. package/dist/utils/reserved-qualifier-guard.utils.js +98 -0
  62. package/dist/utils/reserved-qualifier.utils.d.ts +33 -0
  63. package/dist/utils/reserved-qualifier.utils.js +252 -0
  64. package/dist/utils/table.utils.d.ts +27 -11
  65. package/dist/utils/table.utils.js +49 -12
  66. package/package.json +2 -2
@@ -1,3 +1,4 @@
1
+ import { ObjectLiteral } from 'typeorm';
1
2
  import type { CursorPaginationFilter } from '../types/interfaces/cursor-pagination.interface';
2
3
  import type { GetManyWithCursorOptions, ListWithCursor } from '../types/extensions/cursor-pagination.types';
3
4
  export { InvalidCursorError } from '../utils/cursor.utils';
@@ -14,6 +15,6 @@ declare module 'typeorm/query-builder/SelectQueryBuilder' {
14
15
  * The query builder itself is not changed. Throws `InvalidCursorError` for a cursor that can't
15
16
  * be decoded or was made for another order.
16
17
  */
17
- getManyWithCursor(cursorFilter: CursorPaginationFilter | null | undefined, options: GetManyWithCursorOptions<Entity>): Promise<ListWithCursor<Entity>>;
18
+ getManyWithCursor<CursorEntity extends ObjectLiteral = Entity>(this: SelectQueryBuilder<CursorEntity>, cursorFilter: CursorPaginationFilter | null | undefined, options: GetManyWithCursorOptions<CursorEntity>): Promise<ListWithCursor<CursorEntity>>;
18
19
  }
19
20
  }
@@ -3,7 +3,7 @@ import { ObjectLiteral } from 'typeorm';
3
3
  import type { ApplyOrderOptions } from '../types/extensions/order.types';
4
4
  declare module 'typeorm/query-builder/SelectQueryBuilder' {
5
5
  interface SelectQueryBuilder<Entity> {
6
- applyOrder<OrderEntity extends ObjectLiteral>(orderBy: OrderParam<OrderEntity>, options?: ApplyOrderOptions): SelectQueryBuilder<Entity>;
7
- applyOrderFilter<OrderEntity extends ObjectLiteral>(orderFilter: OrderFilter<OrderEntity>, options?: ApplyOrderOptions): SelectQueryBuilder<Entity>;
6
+ applyOrder<OrderEntity extends ObjectLiteral>(orderBy: OrderParam<OrderEntity>, options?: ApplyOrderOptions): this;
7
+ applyOrderFilter<OrderEntity extends ObjectLiteral>(orderFilter: OrderFilter<OrderEntity>, options?: ApplyOrderOptions): this;
8
8
  }
9
9
  }
@@ -3,6 +3,6 @@ import { ObjectLiteral } from 'typeorm';
3
3
  import { ApplyPaginationOptions } from '../types/extensions/pagination.types';
4
4
  declare module 'typeorm/query-builder/SelectQueryBuilder' {
5
5
  interface SelectQueryBuilder<Entity extends ObjectLiteral> {
6
- applyPaginationFilter(paginationFilter: PaginationFilter, options?: ApplyPaginationOptions): SelectQueryBuilder<Entity>;
6
+ applyPaginationFilter(paginationFilter: PaginationFilter, options?: ApplyPaginationOptions): this;
7
7
  }
8
8
  }
@@ -27,3 +27,7 @@ declare module 'typeorm/query-builder/DeleteQueryBuilder' {
27
27
  interface DeleteQueryBuilder<Entity extends ObjectLiteral> extends PeriodFilterMethods {
28
28
  }
29
29
  }
30
+ declare module 'typeorm/query-builder/SoftDeleteQueryBuilder' {
31
+ interface SoftDeleteQueryBuilder<Entity extends ObjectLiteral> extends PeriodFilterMethods {
32
+ }
33
+ }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const typeorm_1 = require("typeorm");
4
+ const SoftDeleteQueryBuilder_1 = require("typeorm/query-builder/SoftDeleteQueryBuilder");
4
5
  const prototype_utils_1 = require("../utils/prototype.utils");
5
6
  const query_builder_utils_1 = require("../utils/query-builder.utils");
6
7
  const period_utils_1 = require("../utils/period.utils");
@@ -17,6 +18,7 @@ const queryBuilders = [
17
18
  typeorm_1.SelectQueryBuilder,
18
19
  typeorm_1.UpdateQueryBuilder,
19
20
  typeorm_1.DeleteQueryBuilder,
21
+ SoftDeleteQueryBuilder_1.SoftDeleteQueryBuilder,
20
22
  ];
21
23
  queryBuilders.forEach((builder) => {
22
24
  (0, prototype_utils_1.patchPrototype)(builder, extension);
@@ -2,6 +2,7 @@ export * from './typed-distinct/typed-distinct.extension';
2
2
  export * from './typed-group-by/typed-group-by.extension';
3
3
  export * from './typed-having/typed-having.extension';
4
4
  export * from './typed-joins/typed-joins.extension';
5
+ export * from './typed-joins/typed-join-and-map.extension';
5
6
  export * from './typed-order-by/typed-order-by.extension';
6
7
  export * from './typed-select/typed-select.extension';
7
8
  export * from './typed-where/typed-where.extension';
@@ -19,6 +19,7 @@ __exportStar(require("./typed-distinct/typed-distinct.extension"), exports);
19
19
  __exportStar(require("./typed-group-by/typed-group-by.extension"), exports);
20
20
  __exportStar(require("./typed-having/typed-having.extension"), exports);
21
21
  __exportStar(require("./typed-joins/typed-joins.extension"), exports);
22
+ __exportStar(require("./typed-joins/typed-join-and-map.extension"), exports);
22
23
  __exportStar(require("./typed-order-by/typed-order-by.extension"), exports);
23
24
  __exportStar(require("./typed-select/typed-select.extension"), exports);
24
25
  __exportStar(require("./typed-where/typed-where.extension"), exports);
@@ -6,10 +6,10 @@ declare module 'typeorm/query-builder/SelectQueryBuilder' {
6
6
  /**
7
7
  * Sets the distinct on clause for Postgres.
8
8
  */
9
- distinctOnTyped<Type extends ObjectLiteral = TypedRoot<Entity>>(this: SelectQueryBuilder<Entity>, ...distinctOn: Array<KeyProxyCallback<Type>>): SelectQueryBuilder<Entity>;
9
+ distinctOnTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(this: SelectQueryBuilder<Entity>, ...distinctOn: Array<KeyProxyCallback<Type>>): this;
10
10
  /**
11
11
  * Sets the distinct on clause for Postgres.
12
12
  */
13
- distinctOnTyped<Type extends ObjectLiteral = TypedRoot<Entity>>(this: SelectQueryBuilder<Entity>, distinctOn: KeyProxyCallback<Type>): SelectQueryBuilder<Entity>;
13
+ distinctOnTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(this: SelectQueryBuilder<Entity>, distinctOn: KeyProxyCallback<Type>): this;
14
14
  }
15
15
  }
@@ -12,11 +12,11 @@ export interface TypedGroupByMethods<Entity extends ObjectLiteral> {
12
12
  * Sets GROUP BY to the columns the callback selects: `user => user.id`, or several at once,
13
13
  * `user => [user.id, user.email]`. Replaces previously set GROUP BY.
14
14
  */
15
- groupByTyped<Type extends ObjectLiteral = TypedRoot<Entity>>(selection: GroupBySelection<Type>, options?: TypedGroupByOptions): this;
15
+ groupByTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(selection: GroupBySelection<Type>, options?: TypedGroupByOptions): this;
16
16
  /**
17
17
  * Adds the columns the callback selects to GROUP BY.
18
18
  */
19
- addGroupByTyped<Type extends ObjectLiteral = TypedRoot<Entity>>(selection: GroupBySelection<Type>, options?: TypedGroupByOptions): this;
19
+ addGroupByTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(selection: GroupBySelection<Type>, options?: TypedGroupByOptions): this;
20
20
  }
21
21
  declare module 'typeorm/query-builder/SelectQueryBuilder' {
22
22
  interface SelectQueryBuilder<Entity extends ObjectLiteral> extends TypedGroupByMethods<Entity> {
@@ -3,7 +3,7 @@ import { DeepUnwrapArray, ProxyColumnValueType } from '../../../types/modules/pr
3
3
  import { TypedWhereArgs, TypeOrDefault, UnsetType } from '../../../types/modules/typed-params.types';
4
4
  import type { TypedAggregate } from '../../../types/extensions/typed-having.types';
5
5
  import type { TypedRoot } from '../../../types/modules/typed-root.types';
6
- type Selection<Entity extends ObjectLiteral, Type, Value> = (proxy: DeepUnwrapArray<TypeOrDefault<Type, TypedRoot<Entity>>>) => Value;
6
+ type Selection<Root extends ObjectLiteral, Type, Value> = (proxy: DeepUnwrapArray<TypeOrDefault<Type, Root>>) => Value;
7
7
  /**
8
8
  * A value a column holds. A relation (`u => u.images`), the end of a key path or a JSON object is no column:
9
9
  * `COUNT("user"."images")` would fail in the database.
@@ -23,11 +23,11 @@ type AggregateValue<Aggregate, Value> = Aggregate extends 'MIN' | 'MAX' ? Value
23
23
  */
24
24
  export interface TypedHavingMethods<Entity extends ObjectLiteral> {
25
25
  /** Sets HAVING `aggregate(column) condition`, replacing the previous HAVING. */
26
- havingTyped<Type extends ObjectLiteral = UnsetType, Aggregate extends TypedAggregate = TypedAggregate, Value extends ProxyColumnValueType = ProxyColumnValueType, Operator extends string = string>(aggregate: Aggregate, selection: Selection<Entity, Type, Value & AggregatedColumn> | CountAll<Aggregate>, conditions: Operator, ...args: TypedWhereArgs<Type, Operator, AggregateValue<Aggregate, Value>>): this;
26
+ havingTyped<Type extends ObjectLiteral = UnsetType, Aggregate extends TypedAggregate = TypedAggregate, Value extends ProxyColumnValueType = ProxyColumnValueType, Operator extends string = string>(aggregate: Aggregate, selection: Selection<TypedRoot<Entity, this>, Type, Value & AggregatedColumn> | CountAll<Aggregate>, conditions: Operator, ...args: TypedWhereArgs<Type, Operator, AggregateValue<Aggregate, Value>>): this;
27
27
  /** Adds AND HAVING `aggregate(column) condition`. */
28
- andHavingTyped<Type extends ObjectLiteral = UnsetType, Aggregate extends TypedAggregate = TypedAggregate, Value extends ProxyColumnValueType = ProxyColumnValueType, Operator extends string = string>(aggregate: Aggregate, selection: Selection<Entity, Type, Value & AggregatedColumn> | CountAll<Aggregate>, conditions: Operator, ...args: TypedWhereArgs<Type, Operator, AggregateValue<Aggregate, Value>>): this;
28
+ andHavingTyped<Type extends ObjectLiteral = UnsetType, Aggregate extends TypedAggregate = TypedAggregate, Value extends ProxyColumnValueType = ProxyColumnValueType, Operator extends string = string>(aggregate: Aggregate, selection: Selection<TypedRoot<Entity, this>, Type, Value & AggregatedColumn> | CountAll<Aggregate>, conditions: Operator, ...args: TypedWhereArgs<Type, Operator, AggregateValue<Aggregate, Value>>): this;
29
29
  /** Adds OR HAVING `aggregate(column) condition`. */
30
- orHavingTyped<Type extends ObjectLiteral = UnsetType, Aggregate extends TypedAggregate = TypedAggregate, Value extends ProxyColumnValueType = ProxyColumnValueType, Operator extends string = string>(aggregate: Aggregate, selection: Selection<Entity, Type, Value & AggregatedColumn> | CountAll<Aggregate>, conditions: Operator, ...args: TypedWhereArgs<Type, Operator, AggregateValue<Aggregate, Value>>): this;
30
+ orHavingTyped<Type extends ObjectLiteral = UnsetType, Aggregate extends TypedAggregate = TypedAggregate, Value extends ProxyColumnValueType = ProxyColumnValueType, Operator extends string = string>(aggregate: Aggregate, selection: Selection<TypedRoot<Entity, this>, Type, Value & AggregatedColumn> | CountAll<Aggregate>, conditions: Operator, ...args: TypedWhereArgs<Type, Operator, AggregateValue<Aggregate, Value>>): this;
31
31
  }
32
32
  declare module 'typeorm/query-builder/SelectQueryBuilder' {
33
33
  interface SelectQueryBuilder<Entity extends ObjectLiteral> extends TypedHavingMethods<Entity> {
@@ -0,0 +1,19 @@
1
+ import { ObjectLiteral } from 'typeorm';
2
+ import { KeyProxyCallback } from '../../../types/modules/proxy-callback.types';
3
+ import type { JoinAndMapTarget } from '../../../types/extensions/typed-join-and-map.types';
4
+ import type { TypedRoot } from '../../../types/modules/typed-root.types';
5
+ declare module 'typeorm/query-builder/SelectQueryBuilder' {
6
+ interface SelectQueryBuilder<Entity extends ObjectLiteral> {
7
+ /**
8
+ * TypeORM's `leftJoinAndMapOne` with the property to map to picked by a typed callback: `(u) => u.profile` is
9
+ * `'user.profile'` on the main alias, `(q) => q.photo.owner` is `'photo.owner'` with an alias-keyed root.
10
+ */
11
+ leftJoinAndMapOneTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(this: SelectQueryBuilder<Entity>, mapToProperty: KeyProxyCallback<Type>, entity: JoinAndMapTarget, alias: string, condition?: string, parameters?: ObjectLiteral): this;
12
+ /** TypeORM's `innerJoinAndMapOne` with the property to map to picked by a typed callback. */
13
+ innerJoinAndMapOneTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(this: SelectQueryBuilder<Entity>, mapToProperty: KeyProxyCallback<Type>, entity: JoinAndMapTarget, alias: string, condition?: string, parameters?: ObjectLiteral): this;
14
+ /** TypeORM's `leftJoinAndMapMany` with the property to map to picked by a typed callback. */
15
+ leftJoinAndMapManyTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(this: SelectQueryBuilder<Entity>, mapToProperty: KeyProxyCallback<Type>, entity: JoinAndMapTarget, alias: string, condition?: string, parameters?: ObjectLiteral): this;
16
+ /** TypeORM's `innerJoinAndMapMany` with the property to map to picked by a typed callback. */
17
+ innerJoinAndMapManyTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(this: SelectQueryBuilder<Entity>, mapToProperty: KeyProxyCallback<Type>, entity: JoinAndMapTarget, alias: string, condition?: string, parameters?: ObjectLiteral): this;
18
+ }
19
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const typeorm_1 = require("typeorm");
4
+ const proxy_key_utils_1 = require("../../../utils/proxy-key.utils");
5
+ // patching
6
+ typeorm_1.SelectQueryBuilder.prototype.leftJoinAndMapOneTyped = function (mapToProperty, entity, alias, condition, parameters) {
7
+ return addJoinAndMap(this, 'leftJoinAndMapOne', mapToProperty, entity, alias, condition, parameters);
8
+ };
9
+ typeorm_1.SelectQueryBuilder.prototype.innerJoinAndMapOneTyped = function (mapToProperty, entity, alias, condition, parameters) {
10
+ return addJoinAndMap(this, 'innerJoinAndMapOne', mapToProperty, entity, alias, condition, parameters);
11
+ };
12
+ typeorm_1.SelectQueryBuilder.prototype.leftJoinAndMapManyTyped = function (mapToProperty, entity, alias, condition, parameters) {
13
+ return addJoinAndMap(this, 'leftJoinAndMapMany', mapToProperty, entity, alias, condition, parameters);
14
+ };
15
+ typeorm_1.SelectQueryBuilder.prototype.innerJoinAndMapManyTyped = function (mapToProperty, entity, alias, condition, parameters) {
16
+ return addJoinAndMap(this, 'innerJoinAndMapMany', mapToProperty, entity, alias, condition, parameters);
17
+ };
18
+ function addJoinAndMap(query, method, mapToProperty, entity, alias, condition, parameters) {
19
+ // `() => query.alias`: `(q) => q.photo.owner` needs no main alias, only `(u) => u.profile` does
20
+ const key = (0, proxy_key_utils_1.getSqlKeyFromProxyCallback)(mapToProperty, () => query.alias, false);
21
+ return query[method](key, entity, alias, condition, parameters);
22
+ }
@@ -3,9 +3,9 @@ import { RelationalKeyProxyCallback } from '../../../types/modules/proxy-callbac
3
3
  import type { TypedRoot } from '../../../types/modules/typed-root.types';
4
4
  declare module 'typeorm/query-builder/SelectQueryBuilder' {
5
5
  interface SelectQueryBuilder<Entity extends ObjectLiteral> {
6
- leftJoinTyped<Type extends ObjectLiteral = TypedRoot<Entity>>(this: SelectQueryBuilder<Entity>, selection: RelationalKeyProxyCallback<Type>, alias: string, condition?: string, parameters?: ObjectLiteral): SelectQueryBuilder<Entity>;
7
- innerJoinTyped<Type extends ObjectLiteral = TypedRoot<Entity>>(this: SelectQueryBuilder<Entity>, selection: RelationalKeyProxyCallback<Type>, alias: string, condition?: string, parameters?: ObjectLiteral): SelectQueryBuilder<Entity>;
8
- leftJoinAndSelectTyped<Type extends ObjectLiteral = TypedRoot<Entity>>(this: SelectQueryBuilder<Entity>, selection: RelationalKeyProxyCallback<Type>, alias: string, condition?: string, parameters?: ObjectLiteral): SelectQueryBuilder<Entity>;
9
- innerJoinAndSelectTyped<Type extends ObjectLiteral = TypedRoot<Entity>>(this: SelectQueryBuilder<Entity>, selection: RelationalKeyProxyCallback<Type>, alias: string, condition?: string, parameters?: ObjectLiteral): SelectQueryBuilder<Entity>;
6
+ leftJoinTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(this: SelectQueryBuilder<Entity>, selection: RelationalKeyProxyCallback<Type>, alias: string, condition?: string, parameters?: ObjectLiteral): this;
7
+ innerJoinTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(this: SelectQueryBuilder<Entity>, selection: RelationalKeyProxyCallback<Type>, alias: string, condition?: string, parameters?: ObjectLiteral): this;
8
+ leftJoinAndSelectTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(this: SelectQueryBuilder<Entity>, selection: RelationalKeyProxyCallback<Type>, alias: string, condition?: string, parameters?: ObjectLiteral): this;
9
+ innerJoinAndSelectTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(this: SelectQueryBuilder<Entity>, selection: RelationalKeyProxyCallback<Type>, alias: string, condition?: string, parameters?: ObjectLiteral): this;
10
10
  }
11
11
  }
@@ -9,11 +9,11 @@ export interface TypedOrderByArrayPositionMethods<Entity extends ObjectLiteral>
9
9
  * `array_position(:values, column)`. Rows whose value isn't in `values` come last.
10
10
  * Like `orderBy`, it replaces the previous ORDER BY. See `orderByArrayPosition`.
11
11
  */
12
- orderByArrayPositionTyped<Type extends ObjectLiteral = TypedRoot<Entity>>(selection: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType, values: ArgsType, arrayType?: string): this;
12
+ orderByArrayPositionTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(selection: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType, values: ArgsType, arrayType?: string): this;
13
13
  /**
14
14
  * Adds ORDER BY the position of the property's column value in `values` (PostgreSQL), like `addOrderBy`.
15
15
  */
16
- addOrderByArrayPositionTyped<Type extends ObjectLiteral = TypedRoot<Entity>>(selection: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType, values: ArgsType, arrayType?: string): this;
16
+ addOrderByArrayPositionTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(selection: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType, values: ArgsType, arrayType?: string): this;
17
17
  }
18
18
  declare module 'typeorm/query-builder/SelectQueryBuilder' {
19
19
  interface SelectQueryBuilder<Entity extends ObjectLiteral> extends TypedOrderByArrayPositionMethods<Entity> {
@@ -10,10 +10,10 @@ declare module 'typeorm/query-builder/SelectQueryBuilder' {
10
10
  * If you had previously ORDER BY expression defined,
11
11
  * calling this function will override previously set ORDER BY conditions.
12
12
  */
13
- orderByTyped<Type extends ObjectLiteral = TypedRoot<Entity>>(this: SelectQueryBuilder<Entity>, selection: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType | KeyHolder, order?: 'ASC' | 'DESC', nulls?: 'NULLS FIRST' | 'NULLS LAST', options?: TypedOrderByOptions): SelectQueryBuilder<Entity>;
13
+ orderByTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(this: SelectQueryBuilder<Entity>, selection: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType | KeyHolder, order?: 'ASC' | 'DESC', nulls?: 'NULLS FIRST' | 'NULLS LAST', options?: TypedOrderByOptions): this;
14
14
  /**
15
15
  * Adds ORDER BY condition in the query builder.
16
16
  */
17
- addOrderByTyped<Type extends ObjectLiteral = TypedRoot<Entity>>(this: SelectQueryBuilder<Entity>, selection: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType | KeyHolder, order?: 'ASC' | 'DESC', nulls?: 'NULLS FIRST' | 'NULLS LAST', options?: TypedOrderByOptions): SelectQueryBuilder<Entity>;
17
+ addOrderByTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(this: SelectQueryBuilder<Entity>, selection: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType | KeyHolder, order?: 'ASC' | 'DESC', nulls?: 'NULLS FIRST' | 'NULLS LAST', options?: TypedOrderByOptions): this;
18
18
  }
19
19
  }
@@ -1,13 +1,14 @@
1
1
  import { ObjectLiteral } from 'typeorm';
2
+ import type { EntityTarget } from 'typeorm';
2
3
  import type { WithTypedRoot } from '../../types/modules/typed-root.types';
3
- type KnownEntity<Entity> = 0 extends 1 & Entity ? ObjectLiteral : Entity;
4
4
  declare module 'typeorm/query-builder/SelectQueryBuilder' {
5
5
  interface SelectQueryBuilder<Entity extends ObjectLiteral> {
6
6
  /**
7
7
  * Sets the root of the typed callbacks of the calls that follow, instead of passing it to each of them:
8
8
  * the aliases of the query and their entities.
9
9
  *
10
- * Type-only: returns the builder itself. Call it once; a second call merges the roots.
10
+ * Type-only: returns the builder itself, marked with the root; its entity type stays. `from()` and `addFrom()`
11
+ * keep the root, so it may go before them; a second call replaces it.
11
12
  *
12
13
  * @example
13
14
  * type Joins = { checkin: CheckIn; event: Event };
@@ -19,7 +20,28 @@ declare module 'typeorm/query-builder/SelectQueryBuilder' {
19
20
  * .selectTyped((q) => q.checkin.customerId, 'customerId')
20
21
  * .whereTyped((q) => q.event.eventType, '=', type) // instead of whereTyped<Joins>(…)
21
22
  */
22
- typed<Root extends ObjectLiteral>(): SelectQueryBuilder<WithTypedRoot<KnownEntity<Entity>, Root>>;
23
+ typed<Root extends ObjectLiteral>(): WithTypedRoot<SelectQueryBuilder<Entity>, Root>;
24
+ /**
25
+ * Specifies FROM which entity's table select/update/delete will be executed.
26
+ * Also sets a main string alias of the selection data.
27
+ * Removes all previously set from-s. Keeps the root set with `typed()`.
28
+ */
29
+ from<T extends ObjectLiteral, Root extends ObjectLiteral>(this: WithTypedRoot<unknown, Root>, entityTarget: (qb: SelectQueryBuilder<any>) => SelectQueryBuilder<any>, aliasName: string): WithTypedRoot<SelectQueryBuilder<T>, Root>;
30
+ /**
31
+ * Specifies FROM which entity's table select/update/delete will be executed.
32
+ * Also sets a main string alias of the selection data.
33
+ * Removes all previously set from-s. Keeps the root set with `typed()`.
34
+ */
35
+ from<T extends ObjectLiteral, Root extends ObjectLiteral>(this: WithTypedRoot<unknown, Root>, entityTarget: EntityTarget<T>, aliasName: string): WithTypedRoot<SelectQueryBuilder<T>, Root>;
36
+ /**
37
+ * Specifies FROM which entity's table select/update/delete will be executed.
38
+ * Also sets a main string alias of the selection data. Keeps the root set with `typed()`.
39
+ */
40
+ addFrom<T extends ObjectLiteral, Root extends ObjectLiteral>(this: WithTypedRoot<unknown, Root>, entityTarget: (qb: SelectQueryBuilder<any>) => SelectQueryBuilder<any>, aliasName: string): WithTypedRoot<SelectQueryBuilder<T>, Root>;
41
+ /**
42
+ * Specifies FROM which entity's table select/update/delete will be executed.
43
+ * Also sets a main string alias of the selection data. Keeps the root set with `typed()`.
44
+ */
45
+ addFrom<T extends ObjectLiteral, Root extends ObjectLiteral>(this: WithTypedRoot<unknown, Root>, entityTarget: EntityTarget<T>, aliasName: string): WithTypedRoot<SelectQueryBuilder<T>, Root>;
23
46
  }
24
47
  }
25
- export {};
@@ -8,28 +8,28 @@ declare module 'typeorm/query-builder/SelectQueryBuilder' {
8
8
  * Creates SELECT query.
9
9
  * Replaces all previous selections if they exist.
10
10
  */
11
- selectTyped<Type extends ObjectLiteral = TypedRoot<Entity>>(this: SelectQueryBuilder<Entity>, selection: KeyProxyCallback<Type>, selectionAliasName?: string, useQuotes?: boolean): SelectQueryBuilder<Entity>;
11
+ selectTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(this: SelectQueryBuilder<Entity>, selection: KeyProxyCallback<Type>, selectionAliasName?: string, useQuotes?: boolean): this;
12
12
  /**
13
13
  * Creates SELECT query and selects given data.
14
14
  * Replaces all previous selections if they exist.
15
15
  */
16
- selectTyped(this: SelectQueryBuilder<Entity>, selection: string | KeyHolder, selectionAliasName?: string, useQuotes?: boolean): SelectQueryBuilder<Entity>;
16
+ selectTyped(this: SelectQueryBuilder<Entity>, selection: string | KeyHolder, selectionAliasName?: string, useQuotes?: boolean): this;
17
17
  /**
18
18
  * Creates SELECT query and selects given data.
19
19
  * Replaces all previous selections if they exist.
20
20
  */
21
- selectTyped<Type extends ObjectLiteral = TypedRoot<Entity>>(this: SelectQueryBuilder<Entity>, selection: string[] | KeyHolder[] | Array<KeyProxyCallback<Type>>, useQuotes?: boolean): SelectQueryBuilder<Entity>;
21
+ selectTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(this: SelectQueryBuilder<Entity>, selection: string[] | KeyHolder[] | Array<KeyProxyCallback<Type>>, useQuotes?: boolean): this;
22
22
  /**
23
23
  * Adds new selection to the SELECT query.
24
24
  */
25
- addSelectTyped<Type extends ObjectLiteral = TypedRoot<Entity>>(this: SelectQueryBuilder<Entity>, selection: KeyProxyCallback<Type>, selectionAliasName?: string, useQuotes?: boolean): SelectQueryBuilder<Entity>;
25
+ addSelectTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(this: SelectQueryBuilder<Entity>, selection: KeyProxyCallback<Type>, selectionAliasName?: string, useQuotes?: boolean): this;
26
26
  /**
27
27
  * Adds new selection to the SELECT query.
28
28
  */
29
- addSelectTyped(this: SelectQueryBuilder<Entity>, selection: string | KeyHolder, selectionAliasName?: string, useQuotes?: boolean): SelectQueryBuilder<Entity>;
29
+ addSelectTyped(this: SelectQueryBuilder<Entity>, selection: string | KeyHolder, selectionAliasName?: string, useQuotes?: boolean): this;
30
30
  /**
31
31
  * Adds new selection to the SELECT query.
32
32
  */
33
- addSelectTyped<Type extends ObjectLiteral = TypedRoot<Entity>>(this: SelectQueryBuilder<Entity>, selection: string[] | KeyHolder[] | Array<KeyProxyCallback<Type>>, useQuotes?: boolean): SelectQueryBuilder<Entity>;
33
+ addSelectTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(this: SelectQueryBuilder<Entity>, selection: string[] | KeyHolder[] | Array<KeyProxyCallback<Type>>, useQuotes?: boolean): this;
34
34
  }
35
35
  }
@@ -12,7 +12,7 @@ export interface TypedPeriodFilterMethods<Entity extends ObjectLiteral> {
12
12
  * Both ends are inclusive unless `options.includeFrom` / `options.includeTo` is `false`.
13
13
  * A date-only string (`'2024-01-31'`) stands for the whole day: `periodTo: '2024-01-31'` → `column < '2024-02-01'`.
14
14
  */
15
- applyPeriodFilterTyped<Type extends ObjectLiteral = TypedRoot<Entity>>(selection: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType, periodFilter: PeriodFilter | null | undefined, options?: ApplyPeriodOptions): this;
15
+ applyPeriodFilterTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(selection: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType, periodFilter: PeriodFilter | null | undefined, options?: ApplyPeriodOptions): this;
16
16
  }
17
17
  declare module 'typeorm/query-builder/WhereExpressionBuilder' {
18
18
  interface WhereExpressionBuilder extends TypedPeriodFilterMethods<ObjectLiteral> {
@@ -30,3 +30,7 @@ declare module 'typeorm/query-builder/DeleteQueryBuilder' {
30
30
  interface DeleteQueryBuilder<Entity extends ObjectLiteral> extends TypedPeriodFilterMethods<Entity> {
31
31
  }
32
32
  }
33
+ declare module 'typeorm/query-builder/SoftDeleteQueryBuilder' {
34
+ interface SoftDeleteQueryBuilder<Entity extends ObjectLiteral> extends TypedPeriodFilterMethods<Entity> {
35
+ }
36
+ }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  require("../../period-filter.extension");
4
4
  const typeorm_1 = require("typeorm");
5
+ const SoftDeleteQueryBuilder_1 = require("typeorm/query-builder/SoftDeleteQueryBuilder");
5
6
  const query_builder_utils_1 = require("../../../utils/query-builder.utils");
6
7
  const prototype_utils_1 = require("../../../utils/prototype.utils");
7
8
  const period_utils_1 = require("../../../utils/period.utils");
@@ -19,6 +20,7 @@ const queryBuilders = [
19
20
  typeorm_1.SelectQueryBuilder,
20
21
  typeorm_1.UpdateQueryBuilder,
21
22
  typeorm_1.DeleteQueryBuilder,
23
+ SoftDeleteQueryBuilder_1.SoftDeleteQueryBuilder,
22
24
  ];
23
25
  queryBuilders.forEach((builder) => {
24
26
  (0, prototype_utils_1.patchPrototype)(builder, extension);
@@ -13,43 +13,43 @@ export interface TypedWhereArrayMethods<Entity extends ObjectLiteral> {
13
13
  * If you had previously WHERE expression defined,
14
14
  * calling this function will override previously set WHERE conditions.
15
15
  */
16
- whereArrayContainsTyped<Type extends ObjectLiteral = TypedRoot<Entity>>(where: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType, values: ArgsType, arrayType?: string): this;
16
+ whereArrayContainsTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(where: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType, values: ArgsType, arrayType?: string): this;
17
17
  /**
18
18
  * Adds new AND WHERE `column @> :values` condition (PostgreSQL): the array column contains every value.
19
19
  */
20
- andWhereArrayContainsTyped<Type extends ObjectLiteral = TypedRoot<Entity>>(where: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType, values: ArgsType, arrayType?: string): this;
20
+ andWhereArrayContainsTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(where: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType, values: ArgsType, arrayType?: string): this;
21
21
  /**
22
22
  * Adds new OR WHERE `column @> :values` condition (PostgreSQL): the array column contains every value.
23
23
  */
24
- orWhereArrayContainsTyped<Type extends ObjectLiteral = TypedRoot<Entity>>(where: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType, values: ArgsType, arrayType?: string): this;
24
+ orWhereArrayContainsTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(where: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType, values: ArgsType, arrayType?: string): this;
25
25
  /**
26
26
  * Sets WHERE `column <@ :values` condition (PostgreSQL): every element of the array column is one of the values.
27
27
  * If you had previously WHERE expression defined,
28
28
  * calling this function will override previously set WHERE conditions.
29
29
  */
30
- whereArrayContainedByTyped<Type extends ObjectLiteral = TypedRoot<Entity>>(where: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType, values: ArgsType, arrayType?: string): this;
30
+ whereArrayContainedByTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(where: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType, values: ArgsType, arrayType?: string): this;
31
31
  /**
32
32
  * Adds new AND WHERE `column <@ :values` condition (PostgreSQL): every element of the array column is one of the values.
33
33
  */
34
- andWhereArrayContainedByTyped<Type extends ObjectLiteral = TypedRoot<Entity>>(where: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType, values: ArgsType, arrayType?: string): this;
34
+ andWhereArrayContainedByTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(where: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType, values: ArgsType, arrayType?: string): this;
35
35
  /**
36
36
  * Adds new OR WHERE `column <@ :values` condition (PostgreSQL): every element of the array column is one of the values.
37
37
  */
38
- orWhereArrayContainedByTyped<Type extends ObjectLiteral = TypedRoot<Entity>>(where: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType, values: ArgsType, arrayType?: string): this;
38
+ orWhereArrayContainedByTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(where: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType, values: ArgsType, arrayType?: string): this;
39
39
  /**
40
40
  * Sets WHERE `column && :values` condition (PostgreSQL): the array column has at least one of the values.
41
41
  * If you had previously WHERE expression defined,
42
42
  * calling this function will override previously set WHERE conditions.
43
43
  */
44
- whereArrayOverlapsTyped<Type extends ObjectLiteral = TypedRoot<Entity>>(where: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType, values: ArgsType, arrayType?: string): this;
44
+ whereArrayOverlapsTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(where: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType, values: ArgsType, arrayType?: string): this;
45
45
  /**
46
46
  * Adds new AND WHERE `column && :values` condition (PostgreSQL): the array column has at least one of the values.
47
47
  */
48
- andWhereArrayOverlapsTyped<Type extends ObjectLiteral = TypedRoot<Entity>>(where: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType, values: ArgsType, arrayType?: string): this;
48
+ andWhereArrayOverlapsTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(where: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType, values: ArgsType, arrayType?: string): this;
49
49
  /**
50
50
  * Adds new OR WHERE `column && :values` condition (PostgreSQL): the array column has at least one of the values.
51
51
  */
52
- orWhereArrayOverlapsTyped<Type extends ObjectLiteral = TypedRoot<Entity>>(where: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType, values: ArgsType, arrayType?: string): this;
52
+ orWhereArrayOverlapsTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(where: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType, values: ArgsType, arrayType?: string): this;
53
53
  }
54
54
  declare module 'typeorm/query-builder/WhereExpressionBuilder' {
55
55
  interface WhereExpressionBuilder extends TypedWhereArrayMethods<ObjectLiteral> {
@@ -67,3 +67,7 @@ declare module 'typeorm/query-builder/DeleteQueryBuilder' {
67
67
  interface DeleteQueryBuilder<Entity extends ObjectLiteral> extends TypedWhereArrayMethods<Entity> {
68
68
  }
69
69
  }
70
+ declare module 'typeorm/query-builder/SoftDeleteQueryBuilder' {
71
+ interface SoftDeleteQueryBuilder<Entity extends ObjectLiteral> extends TypedWhereArrayMethods<Entity> {
72
+ }
73
+ }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  require("../../where-array.extension");
4
4
  const typeorm_1 = require("typeorm");
5
+ const SoftDeleteQueryBuilder_1 = require("typeorm/query-builder/SoftDeleteQueryBuilder");
5
6
  const query_builder_utils_1 = require("../../../utils/query-builder.utils");
6
7
  const sql_utils_1 = require("../../../utils/sql.utils");
7
8
  const prototype_utils_1 = require("../../../utils/prototype.utils");
@@ -27,6 +28,7 @@ const queryBuilders = [
27
28
  typeorm_1.SelectQueryBuilder,
28
29
  typeorm_1.UpdateQueryBuilder,
29
30
  typeorm_1.DeleteQueryBuilder,
31
+ SoftDeleteQueryBuilder_1.SoftDeleteQueryBuilder,
30
32
  ];
31
33
  queryBuilders.forEach((builder) => {
32
34
  (0, prototype_utils_1.patchPrototype)(builder, extension);
@@ -14,17 +14,17 @@ export interface TypedWhereILikeMethods<Entity extends ObjectLiteral> {
14
14
  * If you had previously WHERE expression defined,
15
15
  * calling this function will override previously set WHERE conditions.
16
16
  */
17
- whereILikeTyped<Type extends ObjectLiteral = TypedRoot<Entity>>(where: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType, value: string | null | undefined, options?: TypedILikeOptions): this;
17
+ whereILikeTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(where: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType, value: string | null | undefined, options?: TypedILikeOptions): this;
18
18
  /**
19
19
  * Adds new AND WHERE `column ILIKE :pattern` condition in the query builder.
20
20
  * `null`, `undefined` or a blank value adds no condition.
21
21
  */
22
- andWhereILikeTyped<Type extends ObjectLiteral = TypedRoot<Entity>>(where: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType, value: string | null | undefined, options?: TypedILikeOptions): this;
22
+ andWhereILikeTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(where: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType, value: string | null | undefined, options?: TypedILikeOptions): this;
23
23
  /**
24
24
  * Adds new OR WHERE `column ILIKE :pattern` condition in the query builder.
25
25
  * `null`, `undefined` or a blank value adds no condition.
26
26
  */
27
- orWhereILikeTyped<Type extends ObjectLiteral = TypedRoot<Entity>>(where: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType, value: string | null | undefined, options?: TypedILikeOptions): this;
27
+ orWhereILikeTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(where: (proxy: DeepUnwrapArray<Type>) => ProxyColumnValueType, value: string | null | undefined, options?: TypedILikeOptions): this;
28
28
  /**
29
29
  * Sets WHERE `(col1 ILIKE :pattern OR col2 ILIKE :pattern …)` condition in the query builder:
30
30
  * one group, one parameter for every column. A selector is a typed callback (it may select
@@ -33,17 +33,17 @@ export interface TypedWhereILikeMethods<Entity extends ObjectLiteral> {
33
33
  * If you had previously WHERE expression defined,
34
34
  * calling this function will override previously set WHERE conditions.
35
35
  */
36
- whereSearchTyped<Type extends ObjectLiteral = TypedRoot<Entity>>(selectors: ReadonlyArray<SearchSelector<Type>>, value: string | null | undefined, options?: TypedSearchOptions): this;
36
+ whereSearchTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(selectors: ReadonlyArray<SearchSelector<Type>>, value: string | null | undefined, options?: TypedSearchOptions): this;
37
37
  /**
38
38
  * Adds new AND WHERE `(col1 ILIKE :pattern OR col2 ILIKE :pattern …)` condition in the query builder.
39
39
  * A value shorter than `options.minLength` (default 1, after trimming) adds no condition.
40
40
  */
41
- andWhereSearchTyped<Type extends ObjectLiteral = TypedRoot<Entity>>(selectors: ReadonlyArray<SearchSelector<Type>>, value: string | null | undefined, options?: TypedSearchOptions): this;
41
+ andWhereSearchTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(selectors: ReadonlyArray<SearchSelector<Type>>, value: string | null | undefined, options?: TypedSearchOptions): this;
42
42
  /**
43
43
  * Adds new OR WHERE `(col1 ILIKE :pattern OR col2 ILIKE :pattern …)` condition in the query builder.
44
44
  * A value shorter than `options.minLength` (default 1, after trimming) adds no condition.
45
45
  */
46
- orWhereSearchTyped<Type extends ObjectLiteral = TypedRoot<Entity>>(selectors: ReadonlyArray<SearchSelector<Type>>, value: string | null | undefined, options?: TypedSearchOptions): this;
46
+ orWhereSearchTyped<Type extends ObjectLiteral = TypedRoot<Entity, this>>(selectors: ReadonlyArray<SearchSelector<Type>>, value: string | null | undefined, options?: TypedSearchOptions): this;
47
47
  }
48
48
  declare module 'typeorm/query-builder/WhereExpressionBuilder' {
49
49
  interface WhereExpressionBuilder extends TypedWhereILikeMethods<ObjectLiteral> {
@@ -61,3 +61,7 @@ declare module 'typeorm/query-builder/DeleteQueryBuilder' {
61
61
  interface DeleteQueryBuilder<Entity extends ObjectLiteral> extends TypedWhereILikeMethods<Entity> {
62
62
  }
63
63
  }
64
+ declare module 'typeorm/query-builder/SoftDeleteQueryBuilder' {
65
+ interface SoftDeleteQueryBuilder<Entity extends ObjectLiteral> extends TypedWhereILikeMethods<Entity> {
66
+ }
67
+ }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const typeorm_1 = require("typeorm");
4
+ const SoftDeleteQueryBuilder_1 = require("typeorm/query-builder/SoftDeleteQueryBuilder");
4
5
  const query_builder_utils_1 = require("../../../utils/query-builder.utils");
5
6
  const prototype_utils_1 = require("../../../utils/prototype.utils");
6
7
  const sql_utils_1 = require("../../../utils/sql.utils");
@@ -46,6 +47,7 @@ const queryBuilders = [
46
47
  typeorm_1.SelectQueryBuilder,
47
48
  typeorm_1.UpdateQueryBuilder,
48
49
  typeorm_1.DeleteQueryBuilder,
50
+ SoftDeleteQueryBuilder_1.SoftDeleteQueryBuilder,
49
51
  ];
50
52
  queryBuilders.forEach((builder) => {
51
53
  (0, prototype_utils_1.patchPrototype)(builder, extension);
@@ -11,30 +11,30 @@ export interface TypedWhereIsAnyMethods<Entity extends ObjectLiteral> {
11
11
  * If you had previously WHERE expression defined,
12
12
  * calling this function will override previously set WHERE conditions.
13
13
  */
14
- whereIsAnyTyped<Type extends ObjectLiteral = UnsetType, Value extends ProxyColumnValueType = ProxyColumnValueType>(where: (proxy: DeepUnwrapArray<TypeOrDefault<Type, TypedRoot<Entity>>>) => Value, array?: TypedArrayArg<Type, Value>, arrayType?: string): this;
14
+ whereIsAnyTyped<Type extends ObjectLiteral = UnsetType, Value extends ProxyColumnValueType = ProxyColumnValueType>(where: (proxy: DeepUnwrapArray<TypeOrDefault<Type, TypedRoot<Entity, this>>>) => Value, array?: TypedArrayArg<Type, Value>, arrayType?: string): this;
15
15
  /**
16
16
  * Adds new AND WHERE `column = ANY(:array)` condition in the query builder (PostgreSQL).
17
17
  */
18
- andWhereIsAnyTyped<Type extends ObjectLiteral = UnsetType, Value extends ProxyColumnValueType = ProxyColumnValueType>(where: (proxy: DeepUnwrapArray<TypeOrDefault<Type, TypedRoot<Entity>>>) => Value, array?: TypedArrayArg<Type, Value>, arrayType?: string): this;
18
+ andWhereIsAnyTyped<Type extends ObjectLiteral = UnsetType, Value extends ProxyColumnValueType = ProxyColumnValueType>(where: (proxy: DeepUnwrapArray<TypeOrDefault<Type, TypedRoot<Entity, this>>>) => Value, array?: TypedArrayArg<Type, Value>, arrayType?: string): this;
19
19
  /**
20
20
  * Adds new OR WHERE `column = ANY(:array)` condition in the query builder (PostgreSQL).
21
21
  */
22
- orWhereIsAnyTyped<Type extends ObjectLiteral = UnsetType, Value extends ProxyColumnValueType = ProxyColumnValueType>(where: (proxy: DeepUnwrapArray<TypeOrDefault<Type, TypedRoot<Entity>>>) => Value, array?: TypedArrayArg<Type, Value>, arrayType?: string): this;
22
+ orWhereIsAnyTyped<Type extends ObjectLiteral = UnsetType, Value extends ProxyColumnValueType = ProxyColumnValueType>(where: (proxy: DeepUnwrapArray<TypeOrDefault<Type, TypedRoot<Entity, this>>>) => Value, array?: TypedArrayArg<Type, Value>, arrayType?: string): this;
23
23
  /**
24
24
  * Sets WHERE `column <> ALL(:array)` condition in the query builder (PostgreSQL):
25
25
  * the column differs from every value of the array.
26
26
  * If you had previously WHERE expression defined,
27
27
  * calling this function will override previously set WHERE conditions.
28
28
  */
29
- whereIsNotAnyTyped<Type extends ObjectLiteral = UnsetType, Value extends ProxyColumnValueType = ProxyColumnValueType>(where: (proxy: DeepUnwrapArray<TypeOrDefault<Type, TypedRoot<Entity>>>) => Value, array?: TypedArrayArg<Type, Value>, arrayType?: string): this;
29
+ whereIsNotAnyTyped<Type extends ObjectLiteral = UnsetType, Value extends ProxyColumnValueType = ProxyColumnValueType>(where: (proxy: DeepUnwrapArray<TypeOrDefault<Type, TypedRoot<Entity, this>>>) => Value, array?: TypedArrayArg<Type, Value>, arrayType?: string): this;
30
30
  /**
31
31
  * Adds new AND WHERE `column <> ALL(:array)` condition in the query builder (PostgreSQL).
32
32
  */
33
- andWhereIsNotAnyTyped<Type extends ObjectLiteral = UnsetType, Value extends ProxyColumnValueType = ProxyColumnValueType>(where: (proxy: DeepUnwrapArray<TypeOrDefault<Type, TypedRoot<Entity>>>) => Value, array?: TypedArrayArg<Type, Value>, arrayType?: string): this;
33
+ andWhereIsNotAnyTyped<Type extends ObjectLiteral = UnsetType, Value extends ProxyColumnValueType = ProxyColumnValueType>(where: (proxy: DeepUnwrapArray<TypeOrDefault<Type, TypedRoot<Entity, this>>>) => Value, array?: TypedArrayArg<Type, Value>, arrayType?: string): this;
34
34
  /**
35
35
  * Adds new OR WHERE `column <> ALL(:array)` condition in the query builder (PostgreSQL).
36
36
  */
37
- orWhereIsNotAnyTyped<Type extends ObjectLiteral = UnsetType, Value extends ProxyColumnValueType = ProxyColumnValueType>(where: (proxy: DeepUnwrapArray<TypeOrDefault<Type, TypedRoot<Entity>>>) => Value, array?: TypedArrayArg<Type, Value>, arrayType?: string): this;
37
+ orWhereIsNotAnyTyped<Type extends ObjectLiteral = UnsetType, Value extends ProxyColumnValueType = ProxyColumnValueType>(where: (proxy: DeepUnwrapArray<TypeOrDefault<Type, TypedRoot<Entity, this>>>) => Value, array?: TypedArrayArg<Type, Value>, arrayType?: string): this;
38
38
  }
39
39
  declare module 'typeorm/query-builder/WhereExpressionBuilder' {
40
40
  interface WhereExpressionBuilder extends TypedWhereIsAnyMethods<ObjectLiteral> {
@@ -52,3 +52,7 @@ declare module 'typeorm/query-builder/DeleteQueryBuilder' {
52
52
  interface DeleteQueryBuilder<Entity extends ObjectLiteral> extends TypedWhereIsAnyMethods<Entity> {
53
53
  }
54
54
  }
55
+ declare module 'typeorm/query-builder/SoftDeleteQueryBuilder' {
56
+ interface SoftDeleteQueryBuilder<Entity extends ObjectLiteral> extends TypedWhereIsAnyMethods<Entity> {
57
+ }
58
+ }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  require("../../where-is-any.extension");
4
4
  const typeorm_1 = require("typeorm");
5
+ const SoftDeleteQueryBuilder_1 = require("typeorm/query-builder/SoftDeleteQueryBuilder");
5
6
  const query_builder_utils_1 = require("../../../utils/query-builder.utils");
6
7
  const prototype_utils_1 = require("../../../utils/prototype.utils");
7
8
  /* eslint-enable @typescript-eslint/no-empty-interface */
@@ -23,6 +24,7 @@ const queryBuilders = [
23
24
  typeorm_1.SelectQueryBuilder,
24
25
  typeorm_1.UpdateQueryBuilder,
25
26
  typeorm_1.DeleteQueryBuilder,
27
+ SoftDeleteQueryBuilder_1.SoftDeleteQueryBuilder,
26
28
  ];
27
29
  queryBuilders.forEach((builder) => {
28
30
  (0, prototype_utils_1.patchPrototype)(builder, extension);