typeorm-extensions 1.2.4 → 1.2.6
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/README.md
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
# TypeORM Extensions
|
|
2
2
|
|
|
3
|
-
[](https://travis-ci.org/koenigstag/typeorm-extensions)
|
|
4
3
|
[](https://badge.fury.io/js/typeorm-extensions)
|
|
4
|
+
[](https://www.npmjs.com/package/typeorm-extensions)
|
|
5
|
+
[](https://github.com/koenigstag/typeorm-extensions/issues)
|
|
6
|
+
[](https://github.com/koenigstag/typeorm-extensions/pulls)
|
|
5
7
|
|
|
6
8
|
## Description
|
|
7
9
|
|
|
@@ -27,13 +29,13 @@ npm install typeorm-extensions
|
|
|
27
29
|
```typescript
|
|
28
30
|
import 'typeorm-extensions'; // Import the library root to extend the QueryBuilder with all extensions
|
|
29
31
|
|
|
30
|
-
// Or init specific extension: import
|
|
32
|
+
// Or init specific extension: import 'typeorm-extensions/dist/extensions/pagination.extension';
|
|
31
33
|
|
|
32
34
|
const query = myDataSource
|
|
33
35
|
.createQueryBuilder()
|
|
34
36
|
.from(UserEntity, 'users')
|
|
35
37
|
// Join relation defined in entity model
|
|
36
|
-
.leftJoinTyped(user =>
|
|
38
|
+
.leftJoinTyped(user => user.profile, 'profile')
|
|
37
39
|
// Select type-safe properties
|
|
38
40
|
.selectTyped(user => ([
|
|
39
41
|
id: user.id,
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const SelectQueryBuilder_1 = require("typeorm/query-builder/SelectQueryBuilder");
|
|
4
4
|
const pagination_utils_1 = require("../utils/pagination.utils");
|
|
5
|
+
require("./pagination.extension");
|
|
5
6
|
SelectQueryBuilder_1.SelectQueryBuilder.prototype.getManyWithTotals = async function (paginationFilter, options) {
|
|
6
|
-
const { disableTotalsCalculation = false, loadAll = false } = options || {};
|
|
7
|
+
const { disableTotalsCalculation = false, loadAll = false, ...paginationOptions } = options || {};
|
|
7
8
|
const { limit, offset } = loadAll
|
|
8
9
|
? { limit: null, offset: null }
|
|
9
10
|
: (0, pagination_utils_1.getLimitAndOffset)(paginationFilter);
|
|
@@ -18,12 +19,12 @@ SelectQueryBuilder_1.SelectQueryBuilder.prototype.getManyWithTotals = async func
|
|
|
18
19
|
requests[1] = this.getMany();
|
|
19
20
|
}
|
|
20
21
|
else {
|
|
21
|
-
requests[1] = this.applyPaginationFilter(paginationFilter).getMany();
|
|
22
|
+
requests[1] = this.applyPaginationFilter(paginationFilter, paginationOptions).getMany();
|
|
22
23
|
}
|
|
23
24
|
const [totalCount, list] = (await Promise.all(requests));
|
|
24
25
|
return {
|
|
25
26
|
list,
|
|
26
|
-
totalCount
|
|
27
|
+
totalCount,
|
|
27
28
|
limit,
|
|
28
29
|
offset,
|
|
29
30
|
};
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typeorm-extensions",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6",
|
|
4
4
|
"description": "typeorm commonly used extensions",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"files": ["dist", "LICENSE", "README.md", "package.json"],
|
|
8
8
|
"type": "module",
|
|
9
|
+
"homepage": "https://koenigstag.github.io/typeorm-extensions/",
|
|
9
10
|
"repository": {
|
|
10
11
|
"type": "git",
|
|
11
12
|
"url": "https://github.com/koenigstag/typeorm-extensions.git"
|