@atlantjs/arch 3.1.6 → 3.1.8
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/arch/modules/application/databases/database.helper.abstract.d.ts +5 -3
- package/arch/modules/application/databases/database.helper.abstract.js +0 -3
- package/arch/modules/domain/entities/entity.abstract.d.ts +1 -2
- package/arch/modules/domain/entities/entity.abstract.js +0 -4
- package/package.json +3 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -4,16 +4,18 @@ import { Return } from "../../../../@tool-box/utils/ducts/return-type";
|
|
|
4
4
|
import { DatabaseConfigAbstract } from "./database.config";
|
|
5
5
|
import { FailureAbstract } from "../failures/failure.abstract";
|
|
6
6
|
import { EntityAbstract } from "../../../../index";
|
|
7
|
+
type SchemaAbstract = EntityTarget<ObjectLiteral>;
|
|
7
8
|
export declare abstract class DatabaseHelperAbstract {
|
|
8
9
|
private database;
|
|
9
10
|
private queryRunner;
|
|
10
11
|
connect(db: DatabaseConfigAbstract): Promise<DataSource>;
|
|
11
12
|
disconnect(): Promise<void>;
|
|
12
|
-
read<T extends
|
|
13
|
-
write<T extends
|
|
14
|
-
delete<T extends
|
|
13
|
+
read<T extends SchemaAbstract, E extends ObjectLiteral>(schema: T, relations: FindOptionsRelations<E>, condition: FindOptionsWhere<T>[] | FindOptionsWhere<T>): Promise<Return<Optional<ObjectLiteral[]>, FailureAbstract>>;
|
|
14
|
+
write<T extends SchemaAbstract>(schema: T, sortedEntities: EntityAbstract[]): Promise<any>;
|
|
15
|
+
delete<T extends SchemaAbstract>(entity: T, condition: FindOptionsWhere<T>[] | FindOptionsWhere<T>): Promise<Return<undefined, undefined>>;
|
|
15
16
|
private getManager;
|
|
16
17
|
private openTransaction;
|
|
17
18
|
private commit;
|
|
18
19
|
private rollback;
|
|
19
20
|
}
|
|
21
|
+
export {};
|
|
@@ -35,9 +35,6 @@ class DatabaseHelperAbstract {
|
|
|
35
35
|
const client = await this.openTransaction();
|
|
36
36
|
const repository = client.getRepository(schema);
|
|
37
37
|
sortedEntities.forEach(async (sortedEntity) => {
|
|
38
|
-
if (sortedEntity.id.hasNothing()) {
|
|
39
|
-
return (0, return_type_1.Failure)();
|
|
40
|
-
}
|
|
41
38
|
const registryPacked = (0, optional_type_1.Optional)(await repository.findOne({
|
|
42
39
|
where: { id: sortedEntity.id.toString() },
|
|
43
40
|
}));
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Optional } from "../../../../@tool-box/utils/ducts/optional-type";
|
|
2
1
|
import { UuidAbstract } from "./uuid.abstract";
|
|
3
2
|
import { SolidAbstract } from "../../../../index";
|
|
4
3
|
export declare abstract class EntityAbstract extends SolidAbstract {
|
|
5
4
|
protected _id?: UuidAbstract | undefined;
|
|
6
5
|
constructor(_id?: UuidAbstract | undefined);
|
|
7
|
-
get id():
|
|
6
|
+
abstract get id(): UuidAbstract;
|
|
8
7
|
private requireToPersist;
|
|
9
8
|
abstract toPersist?(): EntityAbstract;
|
|
10
9
|
}
|
|
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.EntityAbstract = void 0;
|
|
7
|
-
const optional_type_1 = require("../../../../@tool-box/utils/ducts/optional-type");
|
|
8
7
|
const guardian_1 = require("../../../../@tool-box/utils/type-guard/guardian");
|
|
9
8
|
const _atlantjs_json_1 = __importDefault(require("../../../@atlantjs.json"));
|
|
10
9
|
const index_1 = require("../../../../index");
|
|
@@ -16,9 +15,6 @@ class EntityAbstract extends index_1.SolidAbstract {
|
|
|
16
15
|
this.requireToPersist();
|
|
17
16
|
}
|
|
18
17
|
}
|
|
19
|
-
get id() {
|
|
20
|
-
return (0, optional_type_1.Optional)(this._id);
|
|
21
|
-
}
|
|
22
18
|
requireToPersist() {
|
|
23
19
|
throw new Error("toPersist method must be implemented");
|
|
24
20
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlantjs/arch",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.8",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"publishConfig": {
|
|
@@ -53,8 +53,10 @@
|
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@biomejs/biome": "1.8.3",
|
|
56
|
+
"@types/axios": "^0.14.4",
|
|
56
57
|
"@types/cookie-parser": "^1.4.7",
|
|
57
58
|
"@types/cors": "^2.8.17",
|
|
59
|
+
"@types/dotenv": "^8.2.3",
|
|
58
60
|
"@types/express": "^5.0.0",
|
|
59
61
|
"@types/jest": "^29.5.12",
|
|
60
62
|
"@types/jsonwebtoken": "^9.0.7",
|