typeorm-extensions 1.3.0 → 1.3.2
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/dist/extensions/get-many-with-totals.extension.d.ts +7 -1
- package/dist/extensions/get-many-with-totals.extension.js +1 -2
- package/dist/extensions/order.extension.d.ts +8 -1
- package/dist/extensions/order.extension.js +0 -1
- package/dist/extensions/pagination.extension.d.ts +10 -1
- package/dist/extensions/pagination.extension.js +6 -3
- package/dist/extensions/typed/typed-distinct/typed-distinct.extension.d.ts +14 -1
- package/dist/extensions/typed/typed-distinct/typed-distinct.extension.js +0 -1
- package/dist/extensions/typed/typed-joins/typed-joins.extension.d.ts +10 -1
- package/dist/extensions/typed/typed-joins/typed-joins.extension.js +0 -1
- package/dist/extensions/typed/typed-order-by/typed-order-by.extension.d.ts +17 -1
- package/dist/extensions/typed/typed-order-by/typed-order-by.extension.js +0 -1
- package/dist/extensions/typed/typed-select/typed-select.extension.d.ts +34 -1
- package/dist/extensions/typed/typed-select/typed-select.extension.js +0 -1
- package/dist/extensions/typed/typed-where/typed-where-is-in.extension.d.ts +132 -1
- package/dist/extensions/typed/typed-where/typed-where-is-in.extension.js +0 -1
- package/dist/extensions/typed/typed-where/typed-where.extension.d.ts +87 -1
- package/dist/extensions/typed/typed-where/typed-where.extension.js +0 -1
- package/dist/extensions/where-is-in.extension.d.ts +130 -1
- package/dist/extensions/where-is-in.extension.js +0 -1
- package/dist/utils/prototype.utils.js +1 -1
- package/package.json +4 -3
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
import './declarations/get-many-with-totals.declaration';
|
|
2
1
|
import './pagination.extension';
|
|
2
|
+
import { PaginationFilter } from '../types/interfaces/pagination.interface';
|
|
3
|
+
import type { GetManyWithTotalsOptions, ListWithTotals } from '../types/extensions';
|
|
4
|
+
declare module 'typeorm/query-builder/SelectQueryBuilder' {
|
|
5
|
+
interface SelectQueryBuilder<Entity> {
|
|
6
|
+
getManyWithTotals(paginationFilter: PaginationFilter, options?: GetManyWithTotalsOptions): Promise<ListWithTotals<Entity>>;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
require("./
|
|
3
|
+
require("./pagination.extension");
|
|
4
4
|
const SelectQueryBuilder_1 = require("typeorm/query-builder/SelectQueryBuilder");
|
|
5
5
|
const pagination_utils_1 = require("../utils/pagination.utils");
|
|
6
|
-
require("./pagination.extension");
|
|
7
6
|
const prototype_utils_1 = require("../utils/prototype.utils");
|
|
8
7
|
// patching
|
|
9
8
|
const extension = {
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
import '
|
|
1
|
+
import type { OrderParam, OrderFilter } from '../types/interfaces/ordering.interface';
|
|
2
|
+
import type { ApplyOrderOptions } from '../types/extensions/order.types';
|
|
3
|
+
declare module 'typeorm/query-builder/SelectQueryBuilder' {
|
|
4
|
+
interface SelectQueryBuilder<Entity> {
|
|
5
|
+
applyOrder<OrderEntity>(orderBy: OrderParam<OrderEntity>, options?: ApplyOrderOptions): SelectQueryBuilder<Entity>;
|
|
6
|
+
applyOrderFilter<OrderEntity>(orderFilter: OrderFilter<OrderEntity>, options?: ApplyOrderOptions): SelectQueryBuilder<Entity>;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
4
|
-
require("./declarations/order.declaration");
|
|
5
4
|
const SelectQueryBuilder_1 = require("typeorm/query-builder/SelectQueryBuilder");
|
|
6
5
|
const constants_1 = require("../constants");
|
|
7
6
|
const common_utils_1 = require("../utils/common.utils");
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
import '
|
|
1
|
+
import { SelectQueryBuilder } from 'typeorm';
|
|
2
|
+
import { PaginationFilter } from '../types/interfaces/pagination.interface';
|
|
3
|
+
import { ObjectLiteral } from 'typeorm';
|
|
4
|
+
import { ApplyPaginationOptions } from '../types/extensions/pagination.types';
|
|
5
|
+
declare module 'typeorm/query-builder/SelectQueryBuilder' {
|
|
6
|
+
interface SelectQueryBuilder<Entity extends ObjectLiteral> {
|
|
7
|
+
applyPaginationFilter(paginationFilter: PaginationFilter, options?: ApplyPaginationOptions): SelectQueryBuilder<Entity>;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare const SelectQB: typeof SelectQueryBuilder;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var _a;
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.SelectQB = void 0;
|
|
3
5
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
4
|
-
require("
|
|
5
|
-
const SelectQueryBuilder_1 = require("typeorm/query-builder/SelectQueryBuilder");
|
|
6
|
+
const typeorm_1 = require("typeorm");
|
|
6
7
|
const constants_1 = require("../constants");
|
|
7
8
|
const pagination_utils_1 = require("../utils/pagination.utils");
|
|
8
9
|
const prototype_utils_1 = require("../utils/prototype.utils");
|
|
@@ -14,7 +15,9 @@ const extension = {
|
|
|
14
15
|
},
|
|
15
16
|
},
|
|
16
17
|
};
|
|
17
|
-
(0, prototype_utils_1.patchPrototype)(
|
|
18
|
+
(0, prototype_utils_1.patchPrototype)(typeorm_1.SelectQueryBuilder, extension);
|
|
19
|
+
console.log('After patching:', ((_a = typeorm_1.SelectQueryBuilder.prototype.applyPaginationFilter) === null || _a === void 0 ? void 0 : _a.name) || 'not patched');
|
|
20
|
+
exports.SelectQB = typeorm_1.SelectQueryBuilder;
|
|
18
21
|
// implementation
|
|
19
22
|
function applyPaginationFilter(builder, paginationFilter, options) {
|
|
20
23
|
const { useTakeAndSkip = constants_1.defaultUseTakeAndSkip } = options || {};
|
|
@@ -1 +1,14 @@
|
|
|
1
|
-
import '
|
|
1
|
+
import { ObjectLiteral } from 'typeorm';
|
|
2
|
+
import { KeyProxyCallback } from '../../../types/modules/proxy-callback.types';
|
|
3
|
+
declare module 'typeorm/query-builder/SelectQueryBuilder' {
|
|
4
|
+
interface SelectQueryBuilder<Entity extends ObjectLiteral> {
|
|
5
|
+
/**
|
|
6
|
+
* Sets the distinct on clause for Postgres.
|
|
7
|
+
*/
|
|
8
|
+
distinctOnTyped<Type extends ObjectLiteral = Entity>(this: SelectQueryBuilder<Entity>, ...distinctOn: Array<KeyProxyCallback<Type>>): SelectQueryBuilder<Entity>;
|
|
9
|
+
/**
|
|
10
|
+
* Sets the distinct on clause for Postgres.
|
|
11
|
+
*/
|
|
12
|
+
distinctOnTyped<Type extends ObjectLiteral = Entity>(this: SelectQueryBuilder<Entity>, distinctOn: KeyProxyCallback<Type>): SelectQueryBuilder<Entity>;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
require("../../declarations/typed/typed-distinct.declaration");
|
|
4
3
|
const typeorm_1 = require("typeorm");
|
|
5
4
|
const proxy_key_utils_1 = require("../../../utils/proxy-key.utils");
|
|
6
5
|
// patching and implementation
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
import '
|
|
1
|
+
import { ObjectLiteral } from 'typeorm';
|
|
2
|
+
import { RelationalKeyProxyCallback } from '../../../types/modules/proxy-callback.types';
|
|
3
|
+
declare module 'typeorm/query-builder/SelectQueryBuilder' {
|
|
4
|
+
interface SelectQueryBuilder<Entity extends ObjectLiteral> {
|
|
5
|
+
leftJoinTyped<Type extends ObjectLiteral = Entity>(this: SelectQueryBuilder<Entity>, selection: RelationalKeyProxyCallback<Type>, alias: string, condition?: string, parameters?: ObjectLiteral): SelectQueryBuilder<Entity>;
|
|
6
|
+
innerJoinTyped<Type extends ObjectLiteral = Entity>(this: SelectQueryBuilder<Entity>, selection: RelationalKeyProxyCallback<Type>, alias: string, condition?: string, parameters?: ObjectLiteral): SelectQueryBuilder<Entity>;
|
|
7
|
+
leftJoinAndSelectTyped<Type extends ObjectLiteral = Entity>(this: SelectQueryBuilder<Entity>, selection: RelationalKeyProxyCallback<Type>, alias: string, condition?: string, parameters?: ObjectLiteral): SelectQueryBuilder<Entity>;
|
|
8
|
+
innerJoinAndSelectTyped<Type extends ObjectLiteral = Entity>(this: SelectQueryBuilder<Entity>, selection: RelationalKeyProxyCallback<Type>, alias: string, condition?: string, parameters?: ObjectLiteral): SelectQueryBuilder<Entity>;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -1 +1,17 @@
|
|
|
1
|
-
import '
|
|
1
|
+
import { ObjectLiteral } from 'typeorm';
|
|
2
|
+
import { ProxyColumnValueType } from '../../../types/modules/proxy-callback.types';
|
|
3
|
+
import { KeyHolder } from '../../../utils/proxy-key.utils';
|
|
4
|
+
declare module 'typeorm/query-builder/SelectQueryBuilder' {
|
|
5
|
+
interface SelectQueryBuilder<Entity extends ObjectLiteral> {
|
|
6
|
+
/**
|
|
7
|
+
* Sets ORDER BY condition in the query builder.
|
|
8
|
+
* If you had previously ORDER BY expression defined,
|
|
9
|
+
* calling this function will override previously set ORDER BY conditions.
|
|
10
|
+
*/
|
|
11
|
+
orderByTyped<Type extends ObjectLiteral = Entity>(this: SelectQueryBuilder<Entity>, selection: (proxy: Type) => ProxyColumnValueType | KeyHolder, order?: 'ASC' | 'DESC', nulls?: 'NULLS FIRST' | 'NULLS LAST'): SelectQueryBuilder<Entity>;
|
|
12
|
+
/**
|
|
13
|
+
* Adds ORDER BY condition in the query builder.
|
|
14
|
+
*/
|
|
15
|
+
addOrderByTyped<Type extends ObjectLiteral = Entity>(this: SelectQueryBuilder<Entity>, selection: (proxy: Type) => ProxyColumnValueType | KeyHolder, order?: 'ASC' | 'DESC', nulls?: 'NULLS FIRST' | 'NULLS LAST'): SelectQueryBuilder<Entity>;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
require("../../declarations/typed/typed-order-by.declaration");
|
|
4
3
|
const typeorm_1 = require("typeorm");
|
|
5
4
|
const proxy_key_utils_1 = require("../../../utils/proxy-key.utils");
|
|
6
5
|
// patching and implementation
|
|
@@ -1 +1,34 @@
|
|
|
1
|
-
import '
|
|
1
|
+
import { ObjectLiteral } from 'typeorm';
|
|
2
|
+
import { KeyProxyCallback } from '../../../types/modules/proxy-callback.types';
|
|
3
|
+
import { KeyHolder } from '../../../utils/proxy-key.utils';
|
|
4
|
+
declare module 'typeorm/query-builder/SelectQueryBuilder' {
|
|
5
|
+
interface SelectQueryBuilder<Entity> {
|
|
6
|
+
/**
|
|
7
|
+
* Creates SELECT query.
|
|
8
|
+
* Replaces all previous selections if they exist.
|
|
9
|
+
*/
|
|
10
|
+
selectTyped<Type extends ObjectLiteral = Entity>(this: SelectQueryBuilder<Entity>, selection: KeyProxyCallback<Type>, selectionAliasName?: string): SelectQueryBuilder<Entity>;
|
|
11
|
+
/**
|
|
12
|
+
* Creates SELECT query and selects given data.
|
|
13
|
+
* Replaces all previous selections if they exist.
|
|
14
|
+
*/
|
|
15
|
+
selectTyped(this: SelectQueryBuilder<Entity>, selection: string | KeyHolder, selectionAliasName?: string): SelectQueryBuilder<Entity>;
|
|
16
|
+
/**
|
|
17
|
+
* Creates SELECT query and selects given data.
|
|
18
|
+
* Replaces all previous selections if they exist.
|
|
19
|
+
*/
|
|
20
|
+
selectTyped<Type extends ObjectLiteral = Entity>(this: SelectQueryBuilder<Entity>, selection: string[] | KeyHolder[] | Array<KeyProxyCallback<Type>>): SelectQueryBuilder<Entity>;
|
|
21
|
+
/**
|
|
22
|
+
* Adds new selection to the SELECT query.
|
|
23
|
+
*/
|
|
24
|
+
addSelectTyped<Type extends ObjectLiteral = Entity>(this: SelectQueryBuilder<Entity>, selection: KeyProxyCallback<Type>, selectionAliasName?: string): SelectQueryBuilder<Entity>;
|
|
25
|
+
/**
|
|
26
|
+
* Adds new selection to the SELECT query.
|
|
27
|
+
*/
|
|
28
|
+
addSelectTyped(this: SelectQueryBuilder<Entity>, selection: string | KeyHolder, selectionAliasName?: string): SelectQueryBuilder<Entity>;
|
|
29
|
+
/**
|
|
30
|
+
* Adds new selection to the SELECT query.
|
|
31
|
+
*/
|
|
32
|
+
addSelectTyped<Type extends ObjectLiteral = Entity>(this: SelectQueryBuilder<Entity>, selection: string[] | KeyHolder[] | Array<KeyProxyCallback<Type>>): SelectQueryBuilder<Entity>;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
require("../../declarations/typed/typed-select.declaration");
|
|
4
3
|
const typeorm_1 = require("typeorm");
|
|
5
4
|
const proxy_key_utils_1 = require("../../../utils/proxy-key.utils");
|
|
6
5
|
const prototype_utils_1 = require("../../../utils/prototype.utils");
|
|
@@ -1,2 +1,133 @@
|
|
|
1
|
-
import '../../declarations/typed/typed-where-is-in.declaration';
|
|
2
1
|
import '../../where-is-in.extension';
|
|
2
|
+
import { ObjectLiteral } from 'typeorm';
|
|
3
|
+
import { ProxyColumnValueType } from '../../../types/modules/proxy-callback.types';
|
|
4
|
+
import { ArgsType } from '../../../types/util-types';
|
|
5
|
+
import { TypedWhereIsInOptions } from '../../../types/extensions/typed-where.types';
|
|
6
|
+
declare module 'typeorm/query-builder/WhereExpressionBuilder' {
|
|
7
|
+
interface WhereExpressionBuilder {
|
|
8
|
+
/**
|
|
9
|
+
* Sets WHERE IN condition in the query builder.
|
|
10
|
+
* If you had previously WHERE expression defined,
|
|
11
|
+
* calling this function will override previously set WHERE conditions.
|
|
12
|
+
*/
|
|
13
|
+
whereIsInTyped<Type extends ObjectLiteral>(subQuery: (proxy: Type) => ProxyColumnValueType, array?: ArgsType, options?: TypedWhereIsInOptions): this;
|
|
14
|
+
/**
|
|
15
|
+
* Adds new AND WHERE IN condition in the query builder.
|
|
16
|
+
*/
|
|
17
|
+
andWhereIsInTyped<Type extends ObjectLiteral>(subQuery: (proxy: Type) => ProxyColumnValueType, array?: ArgsType, options?: TypedWhereIsInOptions): this;
|
|
18
|
+
/**
|
|
19
|
+
* Adds new OR WHERE IN condition in the query builder.
|
|
20
|
+
*/
|
|
21
|
+
orWhereIsInTyped<Type extends ObjectLiteral>(subQuery: (proxy: Type) => ProxyColumnValueType, array?: ArgsType, options?: TypedWhereIsInOptions): this;
|
|
22
|
+
/**
|
|
23
|
+
* Sets WHERE NOT IN condition in the query builder.
|
|
24
|
+
* If you had previously WHERE expression defined,
|
|
25
|
+
* calling this function will override previously set WHERE conditions.
|
|
26
|
+
*/
|
|
27
|
+
whereIsNotInTyped<Type extends ObjectLiteral>(subQuery: (proxy: Type) => ProxyColumnValueType, array?: ArgsType, options?: TypedWhereIsInOptions): this;
|
|
28
|
+
/**
|
|
29
|
+
* Adds new AND WHERE NOT IN condition in the query builder.
|
|
30
|
+
*/
|
|
31
|
+
andWhereIsNotInTyped<Type extends ObjectLiteral>(subQuery: (proxy: Type) => ProxyColumnValueType, array?: ArgsType, options?: TypedWhereIsInOptions): this;
|
|
32
|
+
/**
|
|
33
|
+
* Adds new OR WHERE NOT IN condition in the query builder.
|
|
34
|
+
*/
|
|
35
|
+
orWhereIsNotInTyped<Type extends ObjectLiteral>(subQuery: (proxy: Type) => ProxyColumnValueType, array?: ArgsType, options?: TypedWhereIsInOptions): this;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
declare module 'typeorm/query-builder/SelectQueryBuilder' {
|
|
39
|
+
interface SelectQueryBuilder<Entity extends ObjectLiteral> {
|
|
40
|
+
/**
|
|
41
|
+
* Sets WHERE IN condition in the query builder.
|
|
42
|
+
* If you had previously WHERE expression defined,
|
|
43
|
+
* calling this function will override previously set WHERE conditions.
|
|
44
|
+
*/
|
|
45
|
+
whereIsInTyped<Type extends ObjectLiteral = Entity>(where: (proxy: Type) => ProxyColumnValueType, array?: ArgsType, options?: TypedWhereIsInOptions): this;
|
|
46
|
+
/**
|
|
47
|
+
* Adds new AND WHERE IN condition in the query builder.
|
|
48
|
+
*/
|
|
49
|
+
andWhereIsInTyped<Type extends ObjectLiteral = Entity>(where: (proxy: Type) => ProxyColumnValueType, array?: ArgsType, options?: TypedWhereIsInOptions): this;
|
|
50
|
+
/**
|
|
51
|
+
* Adds new OR WHERE IN condition in the query builder.
|
|
52
|
+
*/
|
|
53
|
+
orWhereIsInTyped<Type extends ObjectLiteral = Entity>(where: (proxy: Type) => ProxyColumnValueType, array?: ArgsType, options?: TypedWhereIsInOptions): this;
|
|
54
|
+
/**
|
|
55
|
+
* Sets WHERE NOT IN condition in the query builder.
|
|
56
|
+
* If you had previously WHERE expression defined,
|
|
57
|
+
* calling this function will override previously set WHERE conditions.
|
|
58
|
+
*/
|
|
59
|
+
whereIsNotInTyped<Type extends ObjectLiteral>(subQuery: (proxy: Type) => ProxyColumnValueType, array?: ArgsType, options?: TypedWhereIsInOptions): this;
|
|
60
|
+
/**
|
|
61
|
+
* Adds new AND WHERE NOT IN condition in the query builder.
|
|
62
|
+
*/
|
|
63
|
+
andWhereIsNotInTyped<Type extends ObjectLiteral>(subQuery: (proxy: Type) => ProxyColumnValueType, array?: ArgsType, options?: TypedWhereIsInOptions): this;
|
|
64
|
+
/**
|
|
65
|
+
* Adds new OR WHERE NOT IN condition in the query builder.
|
|
66
|
+
*/
|
|
67
|
+
orWhereIsNotInTyped<Type extends ObjectLiteral>(subQuery: (proxy: Type) => ProxyColumnValueType, array?: ArgsType, options?: TypedWhereIsInOptions): this;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
declare module 'typeorm/query-builder/UpdateQueryBuilder' {
|
|
71
|
+
interface UpdateQueryBuilder<Entity extends ObjectLiteral> {
|
|
72
|
+
/**
|
|
73
|
+
* Sets WHERE IN condition in the query builder.
|
|
74
|
+
* If you had previously WHERE expression defined,
|
|
75
|
+
* calling this function will override previously set WHERE conditions.
|
|
76
|
+
*/
|
|
77
|
+
whereIsInTyped<Type extends ObjectLiteral = Entity>(where: (proxy: Type) => ProxyColumnValueType, array?: ArgsType, options?: TypedWhereIsInOptions): this;
|
|
78
|
+
/**
|
|
79
|
+
* Adds new AND WHERE IN condition in the query builder.
|
|
80
|
+
*/
|
|
81
|
+
andWhereIsInTyped<Type extends ObjectLiteral = Entity>(where: (proxy: Type) => ProxyColumnValueType, array?: ArgsType, options?: TypedWhereIsInOptions): this;
|
|
82
|
+
/**
|
|
83
|
+
* Adds new OR WHERE IN condition in the query builder.
|
|
84
|
+
*/
|
|
85
|
+
orWhereIsInTyped<Type extends ObjectLiteral = Entity>(where: (proxy: Type) => ProxyColumnValueType, array?: ArgsType, options?: TypedWhereIsInOptions): this;
|
|
86
|
+
/**
|
|
87
|
+
* Sets WHERE NOT IN condition in the query builder.
|
|
88
|
+
* If you had previously WHERE expression defined,
|
|
89
|
+
* calling this function will override previously set WHERE conditions.
|
|
90
|
+
*/
|
|
91
|
+
whereIsNotInTyped<Type extends ObjectLiteral>(subQuery: (proxy: Type) => ProxyColumnValueType, array?: ArgsType, options?: TypedWhereIsInOptions): this;
|
|
92
|
+
/**
|
|
93
|
+
* Adds new AND WHERE NOT IN condition in the query builder.
|
|
94
|
+
*/
|
|
95
|
+
andWhereIsNotInTyped<Type extends ObjectLiteral>(subQuery: (proxy: Type) => ProxyColumnValueType, array?: ArgsType, options?: TypedWhereIsInOptions): this;
|
|
96
|
+
/**
|
|
97
|
+
* Adds new OR WHERE NOT IN condition in the query builder.
|
|
98
|
+
*/
|
|
99
|
+
orWhereIsNotInTyped<Type extends ObjectLiteral>(subQuery: (proxy: Type) => ProxyColumnValueType, array?: ArgsType, options?: TypedWhereIsInOptions): this;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
declare module 'typeorm/query-builder/DeleteQueryBuilder' {
|
|
103
|
+
interface DeleteQueryBuilder<Entity extends ObjectLiteral> {
|
|
104
|
+
/**
|
|
105
|
+
* Sets WHERE IN condition in the query builder.
|
|
106
|
+
* If you had previously WHERE expression defined,
|
|
107
|
+
* calling this function will override previously set WHERE conditions.
|
|
108
|
+
*/
|
|
109
|
+
whereIsInTyped<Type extends ObjectLiteral = Entity>(where: (proxy: Type) => ProxyColumnValueType, array?: ArgsType, options?: TypedWhereIsInOptions): this;
|
|
110
|
+
/**
|
|
111
|
+
* Adds new AND WHERE IN condition in the query builder.
|
|
112
|
+
*/
|
|
113
|
+
andWhereIsInTyped<Type extends ObjectLiteral = Entity>(where: (proxy: Type) => ProxyColumnValueType, array?: ArgsType, options?: TypedWhereIsInOptions): this;
|
|
114
|
+
/**
|
|
115
|
+
* Adds new OR WHERE IN condition in the query builder.
|
|
116
|
+
*/
|
|
117
|
+
orWhereIsInTyped<Type extends ObjectLiteral = Entity>(where: (proxy: Type) => ProxyColumnValueType, array?: ArgsType, options?: TypedWhereIsInOptions): this;
|
|
118
|
+
/**
|
|
119
|
+
* Sets WHERE NOT IN condition in the query builder.
|
|
120
|
+
* If you had previously WHERE expression defined,
|
|
121
|
+
* calling this function will override previously set WHERE conditions.
|
|
122
|
+
*/
|
|
123
|
+
whereIsNotInTyped<Type extends ObjectLiteral>(subQuery: (proxy: Type) => ProxyColumnValueType, array?: ArgsType, options?: TypedWhereIsInOptions): this;
|
|
124
|
+
/**
|
|
125
|
+
* Adds new AND WHERE NOT IN condition in the query builder.
|
|
126
|
+
*/
|
|
127
|
+
andWhereIsNotInTyped<Type extends ObjectLiteral>(subQuery: (proxy: Type) => ProxyColumnValueType, array?: ArgsType, options?: TypedWhereIsInOptions): this;
|
|
128
|
+
/**
|
|
129
|
+
* Adds new OR WHERE NOT IN condition in the query builder.
|
|
130
|
+
*/
|
|
131
|
+
orWhereIsNotInTyped<Type extends ObjectLiteral>(subQuery: (proxy: Type) => ProxyColumnValueType, array?: ArgsType, options?: TypedWhereIsInOptions): this;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
require("../../declarations/typed/typed-where-is-in.declaration");
|
|
4
3
|
require("../../where-is-in.extension");
|
|
5
4
|
const typeorm_1 = require("typeorm");
|
|
6
5
|
const proxy_key_utils_1 = require("../../../utils/proxy-key.utils");
|
|
@@ -1 +1,87 @@
|
|
|
1
|
-
import '
|
|
1
|
+
import { ObjectLiteral } from 'typeorm';
|
|
2
|
+
import { ProxyColumnValueType } from '../../../types/modules/proxy-callback.types';
|
|
3
|
+
import { TypedWhereOptions } from '../../../types/extensions/typed-where.types';
|
|
4
|
+
declare module 'typeorm/query-builder/WhereExpressionBuilder' {
|
|
5
|
+
interface WhereExpressionBuilder {
|
|
6
|
+
/**
|
|
7
|
+
* Sets WHERE condition in the query builder.
|
|
8
|
+
* If you had previously WHERE expression defined,
|
|
9
|
+
* calling this function will override previously set WHERE conditions.
|
|
10
|
+
* Additionally you can add parameters used in where expression.
|
|
11
|
+
*/
|
|
12
|
+
whereTyped<Type extends ObjectLiteral>(subQuery: (proxy: Type) => ProxyColumnValueType, conditions: string, parameters?: ObjectLiteral, options?: TypedWhereOptions): this;
|
|
13
|
+
/**
|
|
14
|
+
* Adds new AND WHERE condition in the query builder.
|
|
15
|
+
* Additionally you can add parameters used in where expression.
|
|
16
|
+
*/
|
|
17
|
+
andWhereTyped<Type extends ObjectLiteral>(subQuery: (proxy: Type) => ProxyColumnValueType, conditions: string, parameters?: ObjectLiteral, options?: TypedWhereOptions): this;
|
|
18
|
+
/**
|
|
19
|
+
* Adds new OR WHERE condition in the query builder.
|
|
20
|
+
* Additionally you can add parameters used in where expression.
|
|
21
|
+
*/
|
|
22
|
+
orWhereTyped<Type extends ObjectLiteral>(subQuery: (proxy: Type) => ProxyColumnValueType, conditions: string, parameters?: ObjectLiteral, options?: TypedWhereOptions): this;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
declare module 'typeorm/query-builder/SelectQueryBuilder' {
|
|
26
|
+
interface SelectQueryBuilder<Entity> {
|
|
27
|
+
/**
|
|
28
|
+
* Sets WHERE condition in the query builder.
|
|
29
|
+
* If you had previously WHERE expression defined,
|
|
30
|
+
* calling this function will override previously set WHERE conditions.
|
|
31
|
+
* Additionally you can add parameters used in where expression.
|
|
32
|
+
*/
|
|
33
|
+
whereTyped<Type extends ObjectLiteral = Entity>(where: (proxy: Type) => ProxyColumnValueType, conditions: string, parameters?: ObjectLiteral, options?: TypedWhereOptions): this;
|
|
34
|
+
/**
|
|
35
|
+
* Adds new AND WHERE condition in the query builder.
|
|
36
|
+
* Additionally you can add parameters used in where expression.
|
|
37
|
+
*/
|
|
38
|
+
andWhereTyped<Type extends ObjectLiteral = Entity>(where: (proxy: Type) => ProxyColumnValueType, conditions: string, parameters?: ObjectLiteral, options?: TypedWhereOptions): this;
|
|
39
|
+
/**
|
|
40
|
+
* Adds new OR WHERE condition in the query builder.
|
|
41
|
+
* Additionally you can add parameters used in where expression.
|
|
42
|
+
*/
|
|
43
|
+
orWhereTyped<Type extends ObjectLiteral = Entity>(where: (proxy: Type) => ProxyColumnValueType, conditions: string, parameters?: ObjectLiteral, options?: TypedWhereOptions): this;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
declare module 'typeorm/query-builder/UpdateQueryBuilder' {
|
|
47
|
+
interface UpdateQueryBuilder<Entity> {
|
|
48
|
+
/**
|
|
49
|
+
* Sets WHERE condition in the query builder.
|
|
50
|
+
* If you had previously WHERE expression defined,
|
|
51
|
+
* calling this function will override previously set WHERE conditions.
|
|
52
|
+
* Additionally you can add parameters used in where expression.
|
|
53
|
+
*/
|
|
54
|
+
whereTyped<Type extends ObjectLiteral = Entity>(where: (proxy: Type) => ProxyColumnValueType, conditions: string, parameters?: ObjectLiteral, options?: TypedWhereOptions): this;
|
|
55
|
+
/**
|
|
56
|
+
* Adds new AND WHERE condition in the query builder.
|
|
57
|
+
* Additionally you can add parameters used in where expression.
|
|
58
|
+
*/
|
|
59
|
+
andWhereTyped<Type extends ObjectLiteral = Entity>(where: (proxy: Type) => ProxyColumnValueType, conditions: string, parameters?: ObjectLiteral, options?: TypedWhereOptions): this;
|
|
60
|
+
/**
|
|
61
|
+
* Adds new OR WHERE condition in the query builder.
|
|
62
|
+
* Additionally you can add parameters used in where expression.
|
|
63
|
+
*/
|
|
64
|
+
orWhereTyped<Type extends ObjectLiteral = Entity>(where: (proxy: Type) => ProxyColumnValueType, conditions: string, parameters?: ObjectLiteral, options?: TypedWhereOptions): this;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
declare module 'typeorm/query-builder/DeleteQueryBuilder' {
|
|
68
|
+
interface DeleteQueryBuilder<Entity> {
|
|
69
|
+
/**
|
|
70
|
+
* Sets WHERE condition in the query builder.
|
|
71
|
+
* If you had previously WHERE expression defined,
|
|
72
|
+
* calling this function will override previously set WHERE conditions.
|
|
73
|
+
* Additionally you can add parameters used in where expression.
|
|
74
|
+
*/
|
|
75
|
+
whereTyped<Type extends ObjectLiteral = Entity>(where: (proxy: Type) => ProxyColumnValueType, conditions: string, parameters?: ObjectLiteral, options?: TypedWhereOptions): this;
|
|
76
|
+
/**
|
|
77
|
+
* Adds new AND WHERE condition in the query builder.
|
|
78
|
+
* Additionally you can add parameters used in where expression.
|
|
79
|
+
*/
|
|
80
|
+
andWhereTyped<Type extends ObjectLiteral = Entity>(where: (proxy: Type) => ProxyColumnValueType, conditions: string, parameters?: ObjectLiteral, options?: TypedWhereOptions): this;
|
|
81
|
+
/**
|
|
82
|
+
* Adds new OR WHERE condition in the query builder.
|
|
83
|
+
* Additionally you can add parameters used in where expression.
|
|
84
|
+
*/
|
|
85
|
+
orWhereTyped<Type extends ObjectLiteral = Entity>(where: (proxy: Type) => ProxyColumnValueType, conditions: string, parameters?: ObjectLiteral, options?: TypedWhereOptions): this;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
require("../../declarations/typed/typed-where.declaration");
|
|
4
3
|
const typeorm_1 = require("typeorm");
|
|
5
4
|
const proxy_key_utils_1 = require("../../../utils/proxy-key.utils");
|
|
6
5
|
const prototype_utils_1 = require("../../../utils/prototype.utils");
|
|
@@ -1 +1,130 @@
|
|
|
1
|
-
import '
|
|
1
|
+
import { ObjectLiteral } from 'typeorm';
|
|
2
|
+
import { ArgsType } from '../types/util-types';
|
|
3
|
+
declare module 'typeorm/query-builder/WhereExpressionBuilder' {
|
|
4
|
+
interface WhereExpressionBuilder {
|
|
5
|
+
/**
|
|
6
|
+
* Sets WHERE IN condition in the query builder.
|
|
7
|
+
* If you had previously WHERE expression defined,
|
|
8
|
+
* calling this function will override previously set WHERE conditions.
|
|
9
|
+
*/
|
|
10
|
+
whereIsIn(field: string, array?: ArgsType): this;
|
|
11
|
+
/**
|
|
12
|
+
* Adds new AND WHERE IN condition in the query builder.
|
|
13
|
+
*/
|
|
14
|
+
andWhereIsIn(field: string, array?: ArgsType): this;
|
|
15
|
+
/**
|
|
16
|
+
* Adds new OR WHERE IN condition in the query builder.
|
|
17
|
+
*/
|
|
18
|
+
orWhereIsIn(field: string, array?: ArgsType): this;
|
|
19
|
+
/**
|
|
20
|
+
* Sets WHERE NOT IN condition in the query builder.
|
|
21
|
+
* If you had previously WHERE expression defined,
|
|
22
|
+
* calling this function will override previously set WHERE conditions.
|
|
23
|
+
*/
|
|
24
|
+
whereIsNotIn(field: string, array?: ArgsType): this;
|
|
25
|
+
/**
|
|
26
|
+
* Adds new AND WHERE NOT IN condition in the query builder.
|
|
27
|
+
*/
|
|
28
|
+
andWhereIsNotIn(field: string, array?: ArgsType): this;
|
|
29
|
+
/**
|
|
30
|
+
* Adds new OR WHERE NOT IN condition in the query builder.
|
|
31
|
+
*/
|
|
32
|
+
orWhereIsNotIn(field: string, array?: ArgsType): this;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
declare module 'typeorm/query-builder/SelectQueryBuilder' {
|
|
36
|
+
interface SelectQueryBuilder<Entity extends ObjectLiteral> {
|
|
37
|
+
/**
|
|
38
|
+
* Sets WHERE IN condition in the query builder.
|
|
39
|
+
* If you had previously WHERE expression defined,
|
|
40
|
+
* calling this function will override previously set WHERE conditions.
|
|
41
|
+
*/
|
|
42
|
+
whereIsIn(field: string, array?: ArgsType): SelectQueryBuilder<Entity>;
|
|
43
|
+
/**
|
|
44
|
+
* Adds new AND WHERE IN condition in the query builder.
|
|
45
|
+
*/
|
|
46
|
+
andWhereIsIn(field: string, array?: ArgsType): SelectQueryBuilder<Entity>;
|
|
47
|
+
/**
|
|
48
|
+
* Adds new OR WHERE IN condition in the query builder.
|
|
49
|
+
*/
|
|
50
|
+
orWhereIsIn(field: string, array?: ArgsType): SelectQueryBuilder<Entity>;
|
|
51
|
+
/**
|
|
52
|
+
* Sets WHERE NOT IN condition in the query builder.
|
|
53
|
+
* If you had previously WHERE expression defined,
|
|
54
|
+
* calling this function will override previously set WHERE conditions.
|
|
55
|
+
*/
|
|
56
|
+
whereIsNotIn(field: string, array?: ArgsType): SelectQueryBuilder<Entity>;
|
|
57
|
+
/**
|
|
58
|
+
* Adds new AND WHERE NOT IN condition in the query builder.
|
|
59
|
+
*/
|
|
60
|
+
andWhereIsNotIn(field: string, array?: ArgsType): SelectQueryBuilder<Entity>;
|
|
61
|
+
/**
|
|
62
|
+
* Adds new OR WHERE NOT IN condition in the query builder.
|
|
63
|
+
*/
|
|
64
|
+
orWhereIsNotIn(field: string, array?: ArgsType): SelectQueryBuilder<Entity>;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
declare module 'typeorm/query-builder/UpdateQueryBuilder' {
|
|
68
|
+
interface UpdateQueryBuilder<Entity extends ObjectLiteral> {
|
|
69
|
+
/**
|
|
70
|
+
* Sets WHERE IN condition in the query builder.
|
|
71
|
+
* If you had previously WHERE expression defined,
|
|
72
|
+
* calling this function will override previously set WHERE conditions.
|
|
73
|
+
*/
|
|
74
|
+
whereIsIn(field: string, array?: ArgsType): UpdateQueryBuilder<Entity>;
|
|
75
|
+
/**
|
|
76
|
+
* Adds new AND WHERE IN condition in the query builder.
|
|
77
|
+
*/
|
|
78
|
+
andWhereIsIn(field: string, array?: ArgsType): UpdateQueryBuilder<Entity>;
|
|
79
|
+
/**
|
|
80
|
+
* Adds new OR WHERE IN condition in the query builder.
|
|
81
|
+
*/
|
|
82
|
+
orWhereIsIn(field: string, array?: ArgsType): UpdateQueryBuilder<Entity>;
|
|
83
|
+
/**
|
|
84
|
+
* Sets WHERE NOT IN condition in the query builder.
|
|
85
|
+
* If you had previously WHERE expression defined,
|
|
86
|
+
* calling this function will override previously set WHERE conditions.
|
|
87
|
+
*/
|
|
88
|
+
whereIsNotIn(field: string, array?: ArgsType): UpdateQueryBuilder<Entity>;
|
|
89
|
+
/**
|
|
90
|
+
* Adds new AND WHERE NOT IN condition in the query builder.
|
|
91
|
+
*/
|
|
92
|
+
andWhereIsNotIn(field: string, array?: ArgsType): UpdateQueryBuilder<Entity>;
|
|
93
|
+
/**
|
|
94
|
+
* Adds new OR WHERE NOT IN condition in the query builder.
|
|
95
|
+
*/
|
|
96
|
+
orWhereIsNotIn(field: string, array?: ArgsType): UpdateQueryBuilder<Entity>;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
declare module 'typeorm/query-builder/DeleteQueryBuilder' {
|
|
100
|
+
interface DeleteQueryBuilder<Entity extends ObjectLiteral> {
|
|
101
|
+
/**
|
|
102
|
+
* Sets WHERE IN condition in the query builder.
|
|
103
|
+
* If you had previously WHERE expression defined,
|
|
104
|
+
* calling this function will override previously set WHERE conditions.
|
|
105
|
+
*/
|
|
106
|
+
whereIsIn(field: string, array?: ArgsType): DeleteQueryBuilder<Entity>;
|
|
107
|
+
/**
|
|
108
|
+
* Adds new AND WHERE IN condition in the query builder.
|
|
109
|
+
*/
|
|
110
|
+
andWhereIsIn(field: string, array?: ArgsType): DeleteQueryBuilder<Entity>;
|
|
111
|
+
/**
|
|
112
|
+
* Adds new OR WHERE IN condition in the query builder.
|
|
113
|
+
*/
|
|
114
|
+
orWhereIsIn(field: string, array?: ArgsType): DeleteQueryBuilder<Entity>;
|
|
115
|
+
/**
|
|
116
|
+
* Sets WHERE NOT IN condition in the query builder.
|
|
117
|
+
* If you had previously WHERE expression defined,
|
|
118
|
+
* calling this function will override previously set WHERE conditions.
|
|
119
|
+
*/
|
|
120
|
+
whereIsNotIn(field: string, array?: ArgsType): DeleteQueryBuilder<Entity>;
|
|
121
|
+
/**
|
|
122
|
+
* Adds new AND WHERE NOT IN condition in the query builder.
|
|
123
|
+
*/
|
|
124
|
+
andWhereIsNotIn(field: string, array?: ArgsType): DeleteQueryBuilder<Entity>;
|
|
125
|
+
/**
|
|
126
|
+
* Adds new OR WHERE NOT IN condition in the query builder.
|
|
127
|
+
*/
|
|
128
|
+
orWhereIsNotIn(field: string, array?: ArgsType): DeleteQueryBuilder<Entity>;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
require("./declarations/where-is-in.daclaration");
|
|
4
3
|
const typeorm_1 = require("typeorm");
|
|
5
4
|
const prototype_utils_1 = require("../utils/prototype.utils");
|
|
6
5
|
const where_utils_1 = require("../utils/where.utils");
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.patchPrototype = void 0;
|
|
5
5
|
function patchPrototype(target, source) {
|
|
6
|
-
for (const method
|
|
6
|
+
for (const method of Object.keys(source.prototype)) {
|
|
7
7
|
target.prototype[method] = source.prototype[method];
|
|
8
8
|
}
|
|
9
9
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typeorm-extensions",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "typeorm commonly used extensions",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -25,13 +25,14 @@
|
|
|
25
25
|
],
|
|
26
26
|
"author": "koenigstag",
|
|
27
27
|
"license": "ISC",
|
|
28
|
-
"
|
|
29
|
-
"typeorm": "^0.3.
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"typeorm": "^0.3.12"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@typescript-eslint/eslint-plugin": "^7.1.1",
|
|
33
33
|
"@typescript-eslint/parser": "^7.1.1",
|
|
34
34
|
"eslint": "^8.57.0",
|
|
35
|
+
"typeorm": "^0.3.12",
|
|
35
36
|
"typescript": "5.3"
|
|
36
37
|
}
|
|
37
38
|
}
|