@hichchi/nest-crud 0.0.1-beta.4 → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -56
- package/base/base-entity-extension.js +6 -10
- package/base/base-entity-extension.js.map +1 -1
- package/base/base-entity.d.ts +1 -1
- package/base/base-entity.js +43 -47
- package/base/base-entity.js.map +1 -1
- package/base/base-repository.d.ts +6 -6
- package/base/base-repository.js +31 -31
- package/base/base-repository.js.map +1 -1
- package/base/base-user.entity.d.ts +7 -1
- package/base/base-user.entity.js +91 -67
- package/base/base-user.entity.js.map +1 -1
- package/base/index.js +4 -7
- package/base/index.js.map +1 -1
- package/constants.d.ts +2 -0
- package/constants.js +7 -8
- package/constants.js.map +1 -1
- package/crud.module.js +26 -27
- package/crud.module.js.map +1 -1
- package/decorators/entity-extension.decorator.js +17 -20
- package/decorators/entity-extension.decorator.js.map +1 -1
- package/decorators/entity.decorator.js +27 -30
- package/decorators/entity.decorator.js.map +1 -1
- package/decorators/filter.decorator.js +5 -8
- package/decorators/filter.decorator.js.map +1 -1
- package/decorators/index.js +8 -11
- package/decorators/index.js.map +1 -1
- package/decorators/join-column.decorator.js +8 -11
- package/decorators/join-column.decorator.js.map +1 -1
- package/decorators/page.decorator.d.ts +14 -8
- package/decorators/page.decorator.js +9 -111
- package/decorators/page.decorator.js.map +1 -1
- package/decorators/repository.decorator.js +11 -14
- package/decorators/repository.decorator.js.map +1 -1
- package/decorators/search.decorator.js +5 -8
- package/decorators/search.decorator.js.map +1 -1
- package/decorators/sort.decorator.js +5 -8
- package/decorators/sort.decorator.js.map +1 -1
- package/dtos/bulk-delete.dto.js +12 -15
- package/dtos/bulk-delete.dto.js.map +1 -1
- package/dtos/bulk-update.dto.d.ts +6 -0
- package/dtos/bulk-update.dto.js +24 -0
- package/dtos/bulk-update.dto.js.map +1 -0
- package/dtos/ids.dto.d.ts +5 -0
- package/dtos/ids.dto.js +19 -0
- package/dtos/ids.dto.js.map +1 -0
- package/dtos/index.d.ts +1 -0
- package/dtos/index.js +2 -4
- package/dtos/index.js.map +1 -1
- package/enums/crud.enums.js +4 -7
- package/enums/crud.enums.js.map +1 -1
- package/enums/index.js +1 -4
- package/enums/index.js.map +1 -1
- package/enums/metadata-keys.enum.js +2 -5
- package/enums/metadata-keys.enum.js.map +1 -1
- package/exceptions/index.js +1 -4
- package/exceptions/index.js.map +1 -1
- package/exceptions/typeorm.exception.js +4 -9
- package/exceptions/typeorm.exception.js.map +1 -1
- package/index.d.ts +0 -1
- package/index.js +12 -20
- package/index.js.map +1 -1
- package/interfaces/connection-options.interface.js +1 -2
- package/interfaces/crud-options.interfaces.d.ts +49 -46
- package/interfaces/crud-options.interfaces.js +1 -2
- package/interfaces/index.js +2 -5
- package/interfaces/index.js.map +1 -1
- package/package.json +15 -9
- package/readme-top.md +3 -0
- package/responses/crud.error.responses.js +28 -31
- package/responses/crud.error.responses.js.map +1 -1
- package/responses/crud.success.responses.js +21 -24
- package/responses/crud.success.responses.js.map +1 -1
- package/responses/index.js +2 -5
- package/responses/index.js.map +1 -1
- package/services/crud.service.d.ts +13 -13
- package/services/crud.service.js +39 -44
- package/services/crud.service.js.map +1 -1
- package/services/index.js +1 -4
- package/services/index.js.map +1 -1
- package/tokens.js +2 -5
- package/tokens.js.map +1 -1
- package/types/database.types.js +1 -2
- package/types/decorator.types.js +1 -2
- package/types/decorator.types.js.map +1 -1
- package/types/entity-option-unique.js +1 -2
- package/types/error-handler.type.js +1 -2
- package/types/filter-options.type.js +1 -2
- package/types/find-conditions.type.js +1 -2
- package/types/index.js +8 -11
- package/types/index.js.map +1 -1
- package/types/repository-decorator.type.js +1 -2
- package/types/sort-options.type.js +1 -2
- package/utils/entity.utils.js +42 -46
- package/utils/entity.utils.js.map +1 -1
- package/utils/http.utils.d.ts +2 -2
- package/utils/http.utils.js +8 -13
- package/utils/http.utils.js.map +1 -1
- package/utils/index.js +2 -5
- package/utils/index.js.map +1 -1
- package/utils/repository.utils.d.ts +4 -2
- package/utils/repository.utils.js +10 -12
- package/utils/repository.utils.js.map +1 -1
- package/base/base-controller.d.ts +0 -13
- package/base/base-controller.js +0 -80
- package/base/base-controller.js.map +0 -1
- package/classes/index.d.ts +0 -1
- package/classes/index.js +0 -5
- package/classes/index.js.map +0 -1
- package/classes/paginated-response.d.ts +0 -95
- package/classes/paginated-response.js +0 -106
- package/classes/paginated-response.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
## 0.0.1-beta.4 (2025-07-18)
|
|
2
|
-
|
|
3
|
-
### 🚀 Features
|
|
4
|
-
|
|
5
|
-
- Updated EntityDecorator type to support both BaseEntity and HichchiUserEntity types
|
|
6
|
-
|
|
7
|
-
### 🧱 Updated Dependencies
|
|
8
|
-
|
|
9
|
-
- Updated nest-connector to 0.0.1-beta.3
|
|
10
|
-
- Updated nest-core to 0.0.1-beta.4
|
|
11
|
-
- Updated utils to 0.0.1-beta.2
|
|
12
|
-
-
|
|
13
|
-
## 0.0.1-beta.3 (2025-07-17)
|
|
14
|
-
|
|
15
|
-
### 🧱 Updated Dependencies
|
|
16
|
-
|
|
17
|
-
- Updated nest-connector to 0.0.1-beta.2
|
|
18
|
-
- Updated nest-core to 0.0.1-beta.3
|
|
19
|
-
|
|
20
|
-
## 0.0.1-beta.2 (2025-07-16)
|
|
21
|
-
|
|
22
|
-
### 🧱 Updated Dependencies
|
|
23
|
-
|
|
24
|
-
- Updated nest-core to 0.0.1-beta.2
|
|
25
|
-
|
|
26
|
-
## 0.0.1-beta.1 (2025-07-16)
|
|
27
|
-
|
|
28
|
-
### 🧱 Updated Dependencies
|
|
29
|
-
|
|
30
|
-
- Updated nest-connector to 0.0.1-beta.1
|
|
31
|
-
- Updated nest-core to 0.0.1-beta.1
|
|
32
|
-
- Updated utils to 0.0.1-beta.1
|
|
33
|
-
|
|
34
|
-
## 0.0.1-beta.0 (2025-07-15)
|
|
35
|
-
|
|
36
|
-
### 🧱 Updated Dependencies
|
|
37
|
-
|
|
38
|
-
- Updated nest-connector to 0.0.1-beta.0
|
|
39
|
-
- Updated nest-core to 0.0.1-beta.0
|
|
40
|
-
- Updated utils to 0.0.1-beta.0
|
|
41
|
-
|
|
42
|
-
## 0.0.1-alpha.1 (2025-06-23)
|
|
43
|
-
|
|
44
|
-
### 🧱 Updated Dependencies
|
|
45
|
-
|
|
46
|
-
- Updated nest-connector to 0.0.1-alpha.1
|
|
47
|
-
- Updated nest-core to 0.0.1-alpha.1
|
|
48
|
-
- Updated utils to 0.0.1-alpha.1
|
|
49
|
-
|
|
50
|
-
## 0.0.1-alpha.0 (2025-06-23)
|
|
51
|
-
|
|
52
|
-
### 🧱 Updated Dependencies
|
|
53
|
-
|
|
54
|
-
- Updated nest-connector to 0.0.1-alpha.0
|
|
55
|
-
- Updated nest-core to 0.0.1-alpha.0
|
|
56
|
-
- Updated utils to 0.0.1-alpha.0
|
|
1
|
+
## 0.0.1-beta.4 (2025-07-18)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- Updated EntityDecorator type to support both BaseEntity and HichchiUserEntity types
|
|
6
|
+
|
|
7
|
+
### 🧱 Updated Dependencies
|
|
8
|
+
|
|
9
|
+
- Updated nest-connector to 0.0.1-beta.3
|
|
10
|
+
- Updated nest-core to 0.0.1-beta.4
|
|
11
|
+
- Updated utils to 0.0.1-beta.2
|
|
12
|
+
-
|
|
13
|
+
## 0.0.1-beta.3 (2025-07-17)
|
|
14
|
+
|
|
15
|
+
### 🧱 Updated Dependencies
|
|
16
|
+
|
|
17
|
+
- Updated nest-connector to 0.0.1-beta.2
|
|
18
|
+
- Updated nest-core to 0.0.1-beta.3
|
|
19
|
+
|
|
20
|
+
## 0.0.1-beta.2 (2025-07-16)
|
|
21
|
+
|
|
22
|
+
### 🧱 Updated Dependencies
|
|
23
|
+
|
|
24
|
+
- Updated nest-core to 0.0.1-beta.2
|
|
25
|
+
|
|
26
|
+
## 0.0.1-beta.1 (2025-07-16)
|
|
27
|
+
|
|
28
|
+
### 🧱 Updated Dependencies
|
|
29
|
+
|
|
30
|
+
- Updated nest-connector to 0.0.1-beta.1
|
|
31
|
+
- Updated nest-core to 0.0.1-beta.1
|
|
32
|
+
- Updated utils to 0.0.1-beta.1
|
|
33
|
+
|
|
34
|
+
## 0.0.1-beta.0 (2025-07-15)
|
|
35
|
+
|
|
36
|
+
### 🧱 Updated Dependencies
|
|
37
|
+
|
|
38
|
+
- Updated nest-connector to 0.0.1-beta.0
|
|
39
|
+
- Updated nest-core to 0.0.1-beta.0
|
|
40
|
+
- Updated utils to 0.0.1-beta.0
|
|
41
|
+
|
|
42
|
+
## 0.0.1-alpha.1 (2025-06-23)
|
|
43
|
+
|
|
44
|
+
### 🧱 Updated Dependencies
|
|
45
|
+
|
|
46
|
+
- Updated nest-connector to 0.0.1-alpha.1
|
|
47
|
+
- Updated nest-core to 0.0.1-alpha.1
|
|
48
|
+
- Updated utils to 0.0.1-alpha.1
|
|
49
|
+
|
|
50
|
+
## 0.0.1-alpha.0 (2025-06-23)
|
|
51
|
+
|
|
52
|
+
### 🧱 Updated Dependencies
|
|
53
|
+
|
|
54
|
+
- Updated nest-connector to 0.0.1-alpha.0
|
|
55
|
+
- Updated nest-core to 0.0.1-alpha.0
|
|
56
|
+
- Updated utils to 0.0.1-alpha.0
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// noinspection JSUnusedGlobalSymbols
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const tslib_1 = require("tslib");
|
|
6
|
-
const typeorm_1 = require("typeorm");
|
|
2
|
+
import { __decorate, __metadata } from "tslib";
|
|
3
|
+
import { PrimaryGeneratedColumn } from "typeorm";
|
|
7
4
|
/**
|
|
8
5
|
* Base entity extension class that provides a minimal entity structure
|
|
9
6
|
*
|
|
@@ -41,7 +38,7 @@ const typeorm_1 = require("typeorm");
|
|
|
41
38
|
* @see {@link HichchiEntityExtension} The decorator required for entity extensions
|
|
42
39
|
* @see {@link HichchiJoinColumn} The decorator required for entity relationships
|
|
43
40
|
*/
|
|
44
|
-
class BaseEntityExtension {
|
|
41
|
+
export class BaseEntityExtension {
|
|
45
42
|
/**
|
|
46
43
|
* Unique identifier for the entity extension
|
|
47
44
|
*
|
|
@@ -50,9 +47,8 @@ class BaseEntityExtension {
|
|
|
50
47
|
*/
|
|
51
48
|
id;
|
|
52
49
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
(
|
|
56
|
-
tslib_1.__metadata("design:type", String)
|
|
50
|
+
__decorate([
|
|
51
|
+
PrimaryGeneratedColumn("uuid"),
|
|
52
|
+
__metadata("design:type", String)
|
|
57
53
|
], BaseEntityExtension.prototype, "id", void 0);
|
|
58
54
|
//# sourceMappingURL=base-entity-extension.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-entity-extension.js","sourceRoot":"","sources":["../../../../libs/nest-crud/src/base/base-entity-extension.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"base-entity-extension.js","sourceRoot":"","sources":["../../../../libs/nest-crud/src/base/base-entity-extension.ts"],"names":[],"mappings":"AAAA,qCAAqC;;AAErC,OAAO,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAGjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,OAAO,mBAAmB;IAC5B;;;;;OAKG;IAEH,EAAE,CAAW;CAChB;AADG;IADC,sBAAsB,CAAC,MAAM,CAAC;;+CAClB"}
|
package/base/base-entity.d.ts
CHANGED
package/base/base-entity.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const typeorm_1 = require("typeorm");
|
|
6
|
-
const tokens_1 = require("../tokens");
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { AfterLoad, Column, DeleteDateColumn, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
|
|
3
|
+
import { USER_ENTITY_TABLE_NAME } from "../tokens";
|
|
7
4
|
/**
|
|
8
5
|
* List of standard relation properties in the BaseEntity
|
|
9
6
|
*
|
|
@@ -17,7 +14,7 @@ const tokens_1 = require("../tokens");
|
|
|
17
14
|
* @see {@link BaseEntity} The base entity class that uses these relations
|
|
18
15
|
* @see {@link HichchiEntity} The entity decorator that uses this constant
|
|
19
16
|
*/
|
|
20
|
-
|
|
17
|
+
export const BaseEntityTemplateRelations = ["createdBy", "updatedBy", "deletedBy"];
|
|
21
18
|
/**
|
|
22
19
|
* Base entity class that provides common fields and functionality for all entities
|
|
23
20
|
*
|
|
@@ -48,7 +45,7 @@ exports.BaseEntityTemplateRelations = ["createdBy", "updatedBy", "deletedBy"];
|
|
|
48
45
|
* @implements {Model} Interface from @hichchi/nest-connector/crud
|
|
49
46
|
* @see {@link HichchiEntity} Decorator used to define entities
|
|
50
47
|
*/
|
|
51
|
-
class BaseEntity {
|
|
48
|
+
export class BaseEntity {
|
|
52
49
|
/**
|
|
53
50
|
* Unique identifier for the entity
|
|
54
51
|
*
|
|
@@ -160,54 +157,53 @@ class BaseEntity {
|
|
|
160
157
|
};
|
|
161
158
|
}
|
|
162
159
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
(
|
|
166
|
-
tslib_1.__metadata("design:type", String)
|
|
160
|
+
__decorate([
|
|
161
|
+
PrimaryGeneratedColumn("uuid"),
|
|
162
|
+
__metadata("design:type", String)
|
|
167
163
|
], BaseEntity.prototype, "id", void 0);
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
164
|
+
__decorate([
|
|
165
|
+
Column({ nullable: false, default: () => "CURRENT_TIMESTAMP" }),
|
|
166
|
+
__metadata("design:type", Date)
|
|
171
167
|
], BaseEntity.prototype, "createdAt", void 0);
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
168
|
+
__decorate([
|
|
169
|
+
Column({ nullable: false, default: () => "CURRENT_TIMESTAMP" }),
|
|
170
|
+
__metadata("design:type", Date)
|
|
175
171
|
], BaseEntity.prototype, "updatedAt", void 0);
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
172
|
+
__decorate([
|
|
173
|
+
DeleteDateColumn({ type: "timestamp", nullable: true }),
|
|
174
|
+
__metadata("design:type", Object)
|
|
179
175
|
], BaseEntity.prototype, "deletedAt", void 0);
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
176
|
+
__decorate([
|
|
177
|
+
Column({ nullable: true }),
|
|
178
|
+
__metadata("design:type", Object)
|
|
183
179
|
], BaseEntity.prototype, "createdById", void 0);
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
180
|
+
__decorate([
|
|
181
|
+
ManyToOne(USER_ENTITY_TABLE_NAME, { nullable: true, eager: true }),
|
|
182
|
+
JoinColumn(),
|
|
183
|
+
__metadata("design:type", Object)
|
|
188
184
|
], BaseEntity.prototype, "createdBy", void 0);
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
185
|
+
__decorate([
|
|
186
|
+
Column({ nullable: true }),
|
|
187
|
+
__metadata("design:type", Object)
|
|
192
188
|
], BaseEntity.prototype, "updatedById", void 0);
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
189
|
+
__decorate([
|
|
190
|
+
ManyToOne(USER_ENTITY_TABLE_NAME, { nullable: true, eager: true }),
|
|
191
|
+
JoinColumn(),
|
|
192
|
+
__metadata("design:type", Object)
|
|
197
193
|
], BaseEntity.prototype, "updatedBy", void 0);
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
194
|
+
__decorate([
|
|
195
|
+
Column({ nullable: true }),
|
|
196
|
+
__metadata("design:type", Object)
|
|
201
197
|
], BaseEntity.prototype, "deletedById", void 0);
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
198
|
+
__decorate([
|
|
199
|
+
ManyToOne(USER_ENTITY_TABLE_NAME, { nullable: true, eager: true }),
|
|
200
|
+
JoinColumn(),
|
|
201
|
+
__metadata("design:type", Object)
|
|
206
202
|
], BaseEntity.prototype, "deletedBy", void 0);
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
203
|
+
__decorate([
|
|
204
|
+
AfterLoad(),
|
|
205
|
+
__metadata("design:type", Function),
|
|
206
|
+
__metadata("design:paramtypes", []),
|
|
207
|
+
__metadata("design:returntype", void 0)
|
|
212
208
|
], BaseEntity.prototype, "afterLoad", null);
|
|
213
209
|
//# sourceMappingURL=base-entity.js.map
|
package/base/base-entity.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-entity.js","sourceRoot":"","sources":["../../../../libs/nest-crud/src/base/base-entity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"base-entity.js","sourceRoot":"","sources":["../../../../libs/nest-crud/src/base/base-entity.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,SAAS,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAG7G,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAEnD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,WAAW,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;AAEnF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,OAAO,UAAU;IACnB;;;;;OAKG;IAEH,EAAE,CAAW;IAEb;;;;;OAKG;IAEH,SAAS,CAAO;IAEhB;;;;;OAKG;IAEH,SAAS,CAAO;IAEhB;;;;;OAKG;IAEH,SAAS,CAAc;IAEvB;;;;;OAKG;IAEH,WAAW,CAAkB;IAE7B;;;;;OAKG;IAGH,SAAS,CAAkB;IAE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W,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACjC;AASvB;IADC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACE;AAU7B;IAFC,SAAS,CAAC,sBAAsB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAClE,UAAU,EAAE;;6CACc;AAS3B;IADC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACE;AAU7B;IAFC,SAAS,CAAC,sBAAsB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAClE,UAAU,EAAE;;6CACc;AAS3B;IADC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACE;AAU7B;IAFC,SAAS,CAAC,sBAAsB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAClE,UAAU,EAAE;;6CACc;AAajB;IADT,SAAS,EAAE;;;;2CAWX"}
|
|
@@ -694,18 +694,18 @@ export declare class BaseRepository<Entity extends Model | ModelExtension> exten
|
|
|
694
694
|
*
|
|
695
695
|
* @template Entity - The entity type this repository manages
|
|
696
696
|
* @param {FindOptionsWhere<Entity>} where - The base where condition
|
|
697
|
-
* @param {FindOptionsWhere<Entity>}
|
|
697
|
+
* @param {FindOptionsWhere<Entity>} or - The search or negation criteria
|
|
698
698
|
* @param {<T>(value: FindOperator<T> | T) => FindOperator<T>} operator - The operator to apply (ILike or Not)
|
|
699
699
|
* @returns {FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[]} The resulting where condition(s)
|
|
700
700
|
*
|
|
701
|
-
* @see {@link
|
|
701
|
+
* @see {@link mapAndWhere} The helper method used to apply operators to conditions
|
|
702
702
|
* @see {@link generateOptions} Method that uses this to process search and negation conditions
|
|
703
703
|
* @see {@link FindOptionsWhere} TypeORM's type for where conditions
|
|
704
704
|
* @see {@link ILike} TypeORM's case-insensitive LIKE operator
|
|
705
705
|
* @see {@link Not} TypeORM's negation operator
|
|
706
706
|
* @see {@link FindOperator} TypeORM's operator class for query building
|
|
707
707
|
*/
|
|
708
|
-
orWhere(where: FindOptionsWhere<Entity>,
|
|
708
|
+
orWhere(where: FindOptionsWhere<Entity>, or: QueryDeepPartial<Entity>, operator: <T>(value: FindOperator<T> | T) => FindOperator<T>): FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[];
|
|
709
709
|
/**
|
|
710
710
|
* Type guard to check if a value is a TypeORM FindOperator
|
|
711
711
|
*
|
|
@@ -717,7 +717,7 @@ export declare class BaseRepository<Entity extends Model | ModelExtension> exten
|
|
|
717
717
|
* @returns {boolean} True if the value is a FindOperator instance
|
|
718
718
|
*
|
|
719
719
|
* @see {@link FindOperator} TypeORM's operator class for query building
|
|
720
|
-
* @see {@link
|
|
720
|
+
* @see {@link mapAndWhere} Method that uses this to safely handle values
|
|
721
721
|
* @see {@link ILike} Example of a FindOperator
|
|
722
722
|
* @see {@link Not} Example of a FindOperator
|
|
723
723
|
*/
|
|
@@ -739,7 +739,7 @@ export declare class BaseRepository<Entity extends Model | ModelExtension> exten
|
|
|
739
739
|
*
|
|
740
740
|
* @template T - The entity type for the where conditions
|
|
741
741
|
* @param {FindOptionsWhere<T>} where - The base where conditions to extend
|
|
742
|
-
* @param {FindOptionsWhere<T>}
|
|
742
|
+
* @param {FindOptionsWhere<T>} and - The new conditions to apply
|
|
743
743
|
* @param {<V>(value: V | FindOperator<V>) => FindOperator<V>} [operator] - Optional operator to apply to values
|
|
744
744
|
* @param {`${string}{}${string}`} [wrap] - Optional template for wrapping string values
|
|
745
745
|
* @returns {FindOptionsWhere<T>} The resulting where conditions
|
|
@@ -752,5 +752,5 @@ export declare class BaseRepository<Entity extends Model | ModelExtension> exten
|
|
|
752
752
|
* @see {@link ILike} Example of an operator that can be applied
|
|
753
753
|
* @see {@link Not} Example of an operator that can be applied
|
|
754
754
|
*/
|
|
755
|
-
|
|
755
|
+
mapAndWhere<T = Entity>(where: FindOptionsWhere<T>, and: QueryDeepPartial<T>, operator?: <V>(value: V | FindOperator<V>) => FindOperator<V>, wrap?: `${string}{}${string}`): FindOptionsWhere<T>;
|
|
756
756
|
}
|
package/base/base-repository.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// noinspection JSUnusedGlobalSymbols
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const typeorm_1 = require("typeorm");
|
|
6
|
-
const repository_utils_1 = require("../utils/repository.utils");
|
|
7
|
-
const bson_typings_1 = require("typeorm/driver/mongodb/bson.typings");
|
|
2
|
+
import { FindOperator, ILike, Not, ObjectId, Repository, } from "typeorm";
|
|
3
|
+
import { toDeepPartial, toFindOptionsWhere } from "../utils/repository.utils";
|
|
8
4
|
/**
|
|
9
5
|
* Base Repository Class that extends TypeORM's Repository with enhanced functionality
|
|
10
6
|
*
|
|
@@ -71,7 +67,7 @@ const bson_typings_1 = require("typeorm/driver/mongodb/bson.typings");
|
|
|
71
67
|
* @see {@link BaseEntity} The base class for entities with full audit tracking
|
|
72
68
|
* @see {@link BaseEntityExtension} The base class for lightweight entity extensions
|
|
73
69
|
*/
|
|
74
|
-
class BaseRepository extends
|
|
70
|
+
export class BaseRepository extends Repository {
|
|
75
71
|
/**
|
|
76
72
|
* Static property to store the current transaction manager
|
|
77
73
|
* Used to ensure all operations within a transaction use the same manager
|
|
@@ -113,8 +109,8 @@ class BaseRepository extends typeorm_1.Repository {
|
|
|
113
109
|
*/
|
|
114
110
|
create(entityLike) {
|
|
115
111
|
return super.create((Array.isArray(entityLike)
|
|
116
|
-
? entityLike.map(e =>
|
|
117
|
-
:
|
|
112
|
+
? entityLike.map(e => toDeepPartial(e))
|
|
113
|
+
: toDeepPartial(entityLike)));
|
|
118
114
|
}
|
|
119
115
|
/**
|
|
120
116
|
* Save an entity to the database
|
|
@@ -330,7 +326,7 @@ class BaseRepository extends typeorm_1.Repository {
|
|
|
330
326
|
* @see {@link UpdateResult} TypeORM's result type for update operations
|
|
331
327
|
*/
|
|
332
328
|
updateOne(where, partialEntity) {
|
|
333
|
-
return this.entityRepository.update(
|
|
329
|
+
return this.entityRepository.update(toFindOptionsWhere(where), partialEntity);
|
|
334
330
|
}
|
|
335
331
|
/**
|
|
336
332
|
* Update multiple entities matching the specified criteria
|
|
@@ -359,11 +355,11 @@ class BaseRepository extends typeorm_1.Repository {
|
|
|
359
355
|
* @see {@link UpdateResult} TypeORM's result type for update operations
|
|
360
356
|
*/
|
|
361
357
|
updateMany(where, partialEntity) {
|
|
362
|
-
return this.entityRepository.update(!(where instanceof
|
|
358
|
+
return this.entityRepository.update(!(where instanceof ObjectId) &&
|
|
363
359
|
!(where instanceof Date) &&
|
|
364
360
|
typeof where === "object" &&
|
|
365
361
|
!Array.isArray(where)
|
|
366
|
-
?
|
|
362
|
+
? toFindOptionsWhere(where)
|
|
367
363
|
: where, partialEntity);
|
|
368
364
|
}
|
|
369
365
|
/**
|
|
@@ -709,13 +705,18 @@ class BaseRepository extends typeorm_1.Repository {
|
|
|
709
705
|
generateOptions(getOptions) {
|
|
710
706
|
const { options, relations, pagination, sort } = getOptions ?? {};
|
|
711
707
|
const opt = { ...(options || {}) };
|
|
712
|
-
opt.where =
|
|
708
|
+
opt.where = toFindOptionsWhere(getOptions.where || getOptions.filters);
|
|
713
709
|
const { search, not } = getOptions;
|
|
710
|
+
// if (not) {
|
|
711
|
+
// opt.where = this.orWhere(opt.where as FindOptionsWhere<Entity>, not, Not);
|
|
712
|
+
// } else if (search) {
|
|
713
|
+
// opt.where = this.orWhere(opt.where as FindOptionsWhere<Entity>, search, ILike);
|
|
714
|
+
// }
|
|
714
715
|
if (not) {
|
|
715
|
-
opt.where = this.
|
|
716
|
+
opt.where = this.mapAndWhere(opt.where, not, Not);
|
|
716
717
|
}
|
|
717
|
-
|
|
718
|
-
opt.where = this.
|
|
718
|
+
if (search) {
|
|
719
|
+
opt.where = this.mapAndWhere(opt.where, search, ILike);
|
|
719
720
|
}
|
|
720
721
|
if (relations) {
|
|
721
722
|
opt.relations = relations;
|
|
@@ -741,25 +742,25 @@ class BaseRepository extends typeorm_1.Repository {
|
|
|
741
742
|
*
|
|
742
743
|
* @template Entity - The entity type this repository manages
|
|
743
744
|
* @param {FindOptionsWhere<Entity>} where - The base where condition
|
|
744
|
-
* @param {FindOptionsWhere<Entity>}
|
|
745
|
+
* @param {FindOptionsWhere<Entity>} or - The search or negation criteria
|
|
745
746
|
* @param {<T>(value: FindOperator<T> | T) => FindOperator<T>} operator - The operator to apply (ILike or Not)
|
|
746
747
|
* @returns {FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[]} The resulting where condition(s)
|
|
747
748
|
*
|
|
748
|
-
* @see {@link
|
|
749
|
+
* @see {@link mapAndWhere} The helper method used to apply operators to conditions
|
|
749
750
|
* @see {@link generateOptions} Method that uses this to process search and negation conditions
|
|
750
751
|
* @see {@link FindOptionsWhere} TypeORM's type for where conditions
|
|
751
752
|
* @see {@link ILike} TypeORM's case-insensitive LIKE operator
|
|
752
753
|
* @see {@link Not} TypeORM's negation operator
|
|
753
754
|
* @see {@link FindOperator} TypeORM's operator class for query building
|
|
754
755
|
*/
|
|
755
|
-
orWhere(where,
|
|
756
|
-
const entries = Object.entries(
|
|
756
|
+
orWhere(where, or, operator) {
|
|
757
|
+
const entries = Object.entries(or);
|
|
757
758
|
if (entries.length > 1) {
|
|
758
759
|
const whr = [];
|
|
759
|
-
entries.forEach(([key, value]) => whr.push(this.
|
|
760
|
+
entries.forEach(([key, value]) => whr.push(this.mapAndWhere(where, { [key]: value }, operator, "%{}%")));
|
|
760
761
|
return whr;
|
|
761
762
|
}
|
|
762
|
-
return this.
|
|
763
|
+
return this.mapAndWhere(where, or, operator, "%{}%");
|
|
763
764
|
}
|
|
764
765
|
/**
|
|
765
766
|
* Type guard to check if a value is a TypeORM FindOperator
|
|
@@ -772,12 +773,12 @@ class BaseRepository extends typeorm_1.Repository {
|
|
|
772
773
|
* @returns {boolean} True if the value is a FindOperator instance
|
|
773
774
|
*
|
|
774
775
|
* @see {@link FindOperator} TypeORM's operator class for query building
|
|
775
|
-
* @see {@link
|
|
776
|
+
* @see {@link mapAndWhere} Method that uses this to safely handle values
|
|
776
777
|
* @see {@link ILike} Example of a FindOperator
|
|
777
778
|
* @see {@link Not} Example of a FindOperator
|
|
778
779
|
*/
|
|
779
780
|
isFindOperator(value) {
|
|
780
|
-
return value instanceof
|
|
781
|
+
return value instanceof FindOperator;
|
|
781
782
|
}
|
|
782
783
|
/**
|
|
783
784
|
* Map and transform where conditions with operators
|
|
@@ -796,7 +797,7 @@ class BaseRepository extends typeorm_1.Repository {
|
|
|
796
797
|
*
|
|
797
798
|
* @template T - The entity type for the where conditions
|
|
798
799
|
* @param {FindOptionsWhere<T>} where - The base where conditions to extend
|
|
799
|
-
* @param {FindOptionsWhere<T>}
|
|
800
|
+
* @param {FindOptionsWhere<T>} and - The new conditions to apply
|
|
800
801
|
* @param {<V>(value: V | FindOperator<V>) => FindOperator<V>} [operator] - Optional operator to apply to values
|
|
801
802
|
* @param {`${string}{}${string}`} [wrap] - Optional template for wrapping string values
|
|
802
803
|
* @returns {FindOptionsWhere<T>} The resulting where conditions
|
|
@@ -809,14 +810,14 @@ class BaseRepository extends typeorm_1.Repository {
|
|
|
809
810
|
* @see {@link ILike} Example of an operator that can be applied
|
|
810
811
|
* @see {@link Not} Example of an operator that can be applied
|
|
811
812
|
*/
|
|
812
|
-
|
|
813
|
+
mapAndWhere(where, and, operator, wrap) {
|
|
813
814
|
// Start with a copy of the base where conditions
|
|
814
815
|
const whr = where ? { ...where } : {};
|
|
815
816
|
// Process each key-value pair in the data
|
|
816
|
-
for (const key in
|
|
817
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
817
|
+
for (const key in and) {
|
|
818
|
+
if (!Object.prototype.hasOwnProperty.call(and, key))
|
|
818
819
|
continue;
|
|
819
|
-
const value =
|
|
820
|
+
const value = and[key];
|
|
820
821
|
if (value === undefined)
|
|
821
822
|
continue;
|
|
822
823
|
const existing = whr[key];
|
|
@@ -825,7 +826,7 @@ class BaseRepository extends typeorm_1.Repository {
|
|
|
825
826
|
// For nested objects, recursively apply mapWhere
|
|
826
827
|
const nestedExisting = existing && typeof existing === "object" && !this.isFindOperator(existing) ? existing : {};
|
|
827
828
|
// Type-safe recursive call for nested objects
|
|
828
|
-
const nestedResult = this.
|
|
829
|
+
const nestedResult = this.mapAndWhere(nestedExisting, value, operator, wrap);
|
|
829
830
|
whr[key] = nestedResult;
|
|
830
831
|
}
|
|
831
832
|
else {
|
|
@@ -849,5 +850,4 @@ class BaseRepository extends typeorm_1.Repository {
|
|
|
849
850
|
return whr;
|
|
850
851
|
}
|
|
851
852
|
}
|
|
852
|
-
exports.BaseRepository = BaseRepository;
|
|
853
853
|
//# sourceMappingURL=base-repository.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-repository.js","sourceRoot":"","sources":["../../../../libs/nest-crud/src/base/base-repository.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"base-repository.js","sourceRoot":"","sources":["../../../../libs/nest-crud/src/base/base-repository.ts"],"names":[],"mappings":"AAAA,qCAAqC;AAWrC,OAAO,EAMH,YAAY,EAEZ,KAAK,EACL,GAAG,EACH,QAAQ,EAER,UAAU,GAEb,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AACH,MAAM,OAAO,cAAsD,SAAQ,UAAkB;IACzF;;;;OAIG;IACK,MAAM,CAAC,qBAAqB,CAAiB;IAErD;;;;OAIG;IACH,YAAY,UAA8B;QACtC,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE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B,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;gBAE/F,8CAA8C;gBAC9C,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CACjC,cAA2D,EAC3D,KAAK,EACL,QAAQ,EACR,IAAI,CACP,CAAC;gBACF,GAAG,CAAC,GAAc,CAAC,GAAG,YAA4C,CAAC;YACvE,CAAC;iBAAM,CAAC;gBACJ,4CAA4C;gBAC5C,IAAI,cAAc,GAA0B,KAAK,CAAC;gBAElD,qCAAqC;gBACrC,qCAAqC;gBACrC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,IAAI,EAAE,CAAC;oBACpC,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;gBAC/C,CAAC;gBAED,qEAAqE;gBACrE,IAAI,QAAQ,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,CAAC;oBACnD,MAAM,cAAc,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC;oBAChD,GAAG,CAAC,GAAc,CAAC,GAAG,cAA8C,CAAC;gBACzE,CAAC;qBAAM,CAAC;oBACJ,GAAG,CAAC,GAAc,CAAC,GAAG,cAA8C,CAAC;gBACzE,CAAC;YACL,CAAC;QACL,CAAC;QAED,OAAO,GAAG,CAAC;IACf,CAAC;CACJ"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { UserInfo } from "@hichchi/nest-connector";
|
|
2
2
|
import { EntityId, Model } from "@hichchi/nest-connector/crud";
|
|
3
|
+
import { AuthProvider, GoogleProfile } from "@hichchi/nest-connector/auth";
|
|
3
4
|
/**
|
|
4
5
|
* Base user entity class that provides common user fields and functionality
|
|
5
6
|
*
|
|
@@ -144,6 +145,11 @@ export declare class HichchiUserEntity implements UserInfo, Model {
|
|
|
144
145
|
* alternative authentication methods like email-only authentication.
|
|
145
146
|
*/
|
|
146
147
|
username: string | null;
|
|
148
|
+
password: string | null;
|
|
149
|
+
emailVerified: boolean;
|
|
150
|
+
avatar: string | null;
|
|
151
|
+
profileData: GoogleProfile | null;
|
|
152
|
+
signUpType: AuthProvider;
|
|
147
153
|
/**
|
|
148
154
|
* Lifecycle hooks that run before an entity is inserted or updated
|
|
149
155
|
*
|
|
@@ -174,5 +180,5 @@ export declare class HichchiUserEntity implements UserInfo, Model {
|
|
|
174
180
|
* @returns {UserInfo} A simplified user object with only essential information
|
|
175
181
|
* @private
|
|
176
182
|
*/
|
|
177
|
-
|
|
183
|
+
protected _mapUserEntity?(user: UserInfo): UserInfo;
|
|
178
184
|
}
|