@gennext/lb-infra 0.1.0 → 0.1.3
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 +0 -6
- package/dist/base/index.d.ts +2 -0
- package/dist/base/index.d.ts.map +1 -1
- package/dist/base/index.js +2 -0
- package/dist/base/index.js.map +1 -1
- package/dist/base/migration/index.d.ts +3 -0
- package/dist/base/migration/index.d.ts.map +1 -0
- package/dist/base/migration/index.js +19 -0
- package/dist/base/migration/index.js.map +1 -0
- package/dist/base/migration/migration.interface.d.ts +5 -0
- package/dist/base/migration/migration.interface.d.ts.map +1 -0
- package/dist/base/migration/migration.interface.js +3 -0
- package/dist/base/migration/migration.interface.js.map +1 -0
- package/dist/base/migration/migration.service.d.ts +9 -0
- package/dist/base/migration/migration.service.d.ts.map +1 -0
- package/dist/base/migration/migration.service.js +146 -0
- package/dist/base/migration/migration.service.js.map +1 -0
- package/dist/base/models/base.model.d.ts +12 -6
- package/dist/base/models/base.model.d.ts.map +1 -1
- package/dist/base/models/base.model.js +10 -6
- package/dist/base/models/base.model.js.map +1 -1
- package/dist/base/models/index.d.ts +1 -0
- package/dist/base/models/index.d.ts.map +1 -1
- package/dist/base/models/index.js +1 -0
- package/dist/base/models/index.js.map +1 -1
- package/dist/base/models/migration.model.d.ts +12 -0
- package/dist/base/models/migration.model.d.ts.map +1 -0
- package/dist/base/models/migration.model.js +46 -0
- package/dist/base/models/migration.model.js.map +1 -0
- package/dist/base/repository/index.d.ts +3 -0
- package/dist/base/repository/index.d.ts.map +1 -0
- package/dist/base/repository/index.js +19 -0
- package/dist/base/repository/index.js.map +1 -0
- package/dist/base/repository/migration.repository.d.ts +6 -0
- package/dist/base/repository/migration.repository.d.ts.map +1 -0
- package/dist/base/repository/migration.repository.js +29 -0
- package/dist/base/repository/migration.repository.js.map +1 -0
- package/dist/base/repository/soft-delete.repository.d.ts +40 -0
- package/dist/base/repository/soft-delete.repository.d.ts.map +1 -0
- package/dist/base/repository/soft-delete.repository.js +74 -0
- package/dist/base/repository/soft-delete.repository.js.map +1 -0
- package/dist/helpers/migrate/type.d.ts +10 -0
- package/dist/helpers/migrate/type.d.ts.map +1 -0
- package/dist/helpers/migrate/type.js +3 -0
- package/dist/helpers/migrate/type.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/utilities/axios.utility.d.ts +14 -0
- package/dist/utilities/axios.utility.d.ts.map +1 -0
- package/dist/utilities/axios.utility.js +122 -0
- package/dist/utilities/axios.utility.js.map +1 -0
- package/dist/utilities/index.d.ts +5 -0
- package/dist/utilities/index.d.ts.map +1 -1
- package/dist/utilities/index.js +28 -0
- package/dist/utilities/index.js.map +1 -1
- package/dist/utilities/lb-filter.utility.d.ts +5 -0
- package/dist/utilities/lb-filter.utility.d.ts.map +1 -0
- package/dist/utilities/lb-filter.utility.js +9 -0
- package/dist/utilities/lb-filter.utility.js.map +1 -0
- package/dist/utilities/migrate-helper.d.ts +10 -0
- package/dist/utilities/migrate-helper.d.ts.map +1 -0
- package/dist/utilities/migrate-helper.js +45 -0
- package/dist/utilities/migrate-helper.js.map +1 -0
- package/dist/utilities/migration-engine.d.ts +16 -0
- package/dist/utilities/migration-engine.d.ts.map +1 -0
- package/dist/utilities/migration-engine.js +40 -0
- package/dist/utilities/migration-engine.js.map +1 -0
- package/dist/utilities/migration.utility.d.ts +7 -0
- package/dist/utilities/migration.utility.d.ts.map +1 -0
- package/dist/utilities/migration.utility.js +23 -0
- package/dist/utilities/migration.utility.js.map +1 -0
- package/dist/utilities/model.utility.d.ts +44 -23
- package/dist/utilities/model.utility.d.ts.map +1 -1
- package/dist/utilities/model.utility.js +56 -37
- package/dist/utilities/model.utility.js.map +1 -1
- package/dist/validators/base.schema.d.ts +56 -0
- package/dist/validators/base.schema.d.ts.map +1 -0
- package/dist/validators/base.schema.js +84 -0
- package/dist/validators/base.schema.js.map +1 -0
- package/dist/validators/common.schema.d.ts +50 -0
- package/dist/validators/common.schema.d.ts.map +1 -0
- package/dist/validators/common.schema.js +51 -0
- package/dist/validators/common.schema.js.map +1 -0
- package/dist/validators/index.d.ts +15 -0
- package/dist/validators/index.d.ts.map +1 -0
- package/dist/validators/index.js +36 -0
- package/dist/validators/index.js.map +1 -0
- package/dist/validators/with-zod.d.ts +66 -0
- package/dist/validators/with-zod.d.ts.map +1 -0
- package/dist/validators/with-zod.js +117 -0
- package/dist/validators/with-zod.js.map +1 -0
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -95,12 +95,6 @@ await executePromiseWithLimit({
|
|
|
95
95
|
- `src/helpers`: Các module bổ trợ quan trọng (Logger, Redis).
|
|
96
96
|
- `src/utilities`: Các hàm tiện ích dùng chung.
|
|
97
97
|
|
|
98
|
-
## 📖 Tài liệu chi tiết
|
|
99
|
-
|
|
100
|
-
- [Tài liệu cấu hình Logger](docs/ENHANCED_LOGGER_USAGE.md)
|
|
101
|
-
- [Hướng dẫn cấu hình chung](docs/CONFIG_USAGE.md)
|
|
102
|
-
- [Chi tiết hệ thống xử lý lỗi](docs/ERROR_HANDLING.md)
|
|
103
|
-
|
|
104
98
|
## 🛠️ Scripts hỗ trợ (Maintainer)
|
|
105
99
|
|
|
106
100
|
- `bun run build`: Biên dịch mã nguồn sang thư mục `dist`.
|
package/dist/base/index.d.ts
CHANGED
package/dist/base/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/base/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/base/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
|
package/dist/base/index.js
CHANGED
|
@@ -16,5 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./datasources"), exports);
|
|
18
18
|
__exportStar(require("./models"), exports);
|
|
19
|
+
__exportStar(require("./repository"), exports);
|
|
20
|
+
__exportStar(require("./migration"), exports);
|
|
19
21
|
__exportStar(require("./base.helper"), exports);
|
|
20
22
|
//# sourceMappingURL=index.js.map
|
package/dist/base/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/base/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,2CAAyB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/base/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,2CAAyB;AACzB,+CAA6B;AAC7B,8CAA4B;AAC5B,gDAA8B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/base/migration/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./migration.interface"), exports);
|
|
18
|
+
__exportStar(require("./migration.service"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/base/migration/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,sDAAoC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration.interface.d.ts","sourceRoot":"","sources":["../../../src/base/migration/migration.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACpB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration.interface.js","sourceRoot":"","sources":["../../../src/base/migration/migration.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MigrationsRepository } from '../repository/migration.repository';
|
|
2
|
+
export declare class MigrationService {
|
|
3
|
+
migrationsRepository: MigrationsRepository;
|
|
4
|
+
private logger;
|
|
5
|
+
constructor(migrationsRepository: MigrationsRepository);
|
|
6
|
+
migrate(migrationsDir: string): Promise<void>;
|
|
7
|
+
rollback(migrationsDir: string, steps?: number): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=migration.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration.service.d.ts","sourceRoot":"","sources":["../../../src/base/migration/migration.service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAI1E,qBACa,gBAAgB;IAKlB,oBAAoB,EAAE,oBAAoB;IAJnD,OAAO,CAAC,MAAM,CAAS;gBAId,oBAAoB,EAAE,oBAAoB;IAK7C,OAAO,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgD7C,QAAQ,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,GAAE,MAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CAwCxE"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
42
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
43
|
+
};
|
|
44
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
45
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
exports.MigrationService = void 0;
|
|
49
|
+
const core_1 = require("@loopback/core");
|
|
50
|
+
const repository_1 = require("@loopback/repository");
|
|
51
|
+
const fs = __importStar(require("node:fs"));
|
|
52
|
+
const path = __importStar(require("node:path"));
|
|
53
|
+
const migration_repository_1 = require("../repository/migration.repository");
|
|
54
|
+
const helpers_1 = require("../../helpers");
|
|
55
|
+
let MigrationService = class MigrationService {
|
|
56
|
+
constructor(migrationsRepository) {
|
|
57
|
+
this.migrationsRepository = migrationsRepository;
|
|
58
|
+
this.logger = helpers_1.LoggerFactory.getLogger(['MigrationService']);
|
|
59
|
+
}
|
|
60
|
+
async migrate(migrationsDir) {
|
|
61
|
+
if (!fs.existsSync(migrationsDir)) {
|
|
62
|
+
this.logger.warn(`Migration directory ${migrationsDir} does not exist. Skipping migrations.`);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const files = fs.readdirSync(migrationsDir).filter(f => f.endsWith('.js') || f.endsWith('.ts'));
|
|
66
|
+
files.sort(); // Ensure migrations run in alphabetical order
|
|
67
|
+
for (const file of files) {
|
|
68
|
+
const migrationId = file;
|
|
69
|
+
// Check if migration has already run
|
|
70
|
+
const exists = await this.migrationsRepository.findOne({ where: { name: migrationId } });
|
|
71
|
+
if (exists) {
|
|
72
|
+
continue; // Skip applied migration
|
|
73
|
+
}
|
|
74
|
+
this.logger.info(`Running migration: ${migrationId}`);
|
|
75
|
+
try {
|
|
76
|
+
const migrationModule = require(path.join(migrationsDir, file));
|
|
77
|
+
// Supports exporting a default class or a class named 'Migration'
|
|
78
|
+
const MigrationClass = migrationModule.default || migrationModule.Migration;
|
|
79
|
+
if (MigrationClass) {
|
|
80
|
+
const migrationInstance = new MigrationClass();
|
|
81
|
+
await migrationInstance.up();
|
|
82
|
+
// Save to database
|
|
83
|
+
await this.migrationsRepository.create({
|
|
84
|
+
name: migrationId,
|
|
85
|
+
appliedAt: new Date().toISOString(),
|
|
86
|
+
});
|
|
87
|
+
this.logger.info(`Migration ${migrationId} applied successfully.`);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
this.logger.warn(`Migration file ${file} does not export a default class or 'Migration' class.`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
this.logger.error(`Error running migration ${migrationId}: ${error.message}`);
|
|
95
|
+
throw error; // Stop migrations if one fails
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
this.logger.info('All migrations applied successfully.');
|
|
99
|
+
}
|
|
100
|
+
async rollback(migrationsDir, steps = 1) {
|
|
101
|
+
const appliedMigrations = await this.migrationsRepository.find({
|
|
102
|
+
order: ['appliedAt DESC', 'id DESC'],
|
|
103
|
+
limit: steps,
|
|
104
|
+
});
|
|
105
|
+
if (appliedMigrations.length === 0) {
|
|
106
|
+
this.logger.info('No migrations to rollback.');
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
for (const migration of appliedMigrations) {
|
|
110
|
+
this.logger.info(`Rolling back migration: ${migration.name}`);
|
|
111
|
+
try {
|
|
112
|
+
const filePath = path.join(migrationsDir, migration.name);
|
|
113
|
+
if (fs.existsSync(filePath)) {
|
|
114
|
+
const migrationModule = require(filePath);
|
|
115
|
+
const MigrationClass = migrationModule.default || migrationModule.Migration;
|
|
116
|
+
if (MigrationClass) {
|
|
117
|
+
const migrationInstance = new MigrationClass();
|
|
118
|
+
if (migrationInstance.down) {
|
|
119
|
+
await migrationInstance.down();
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
this.logger.warn(`Migration ${migration.name} does not have a down() method.`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
this.logger.warn(`Migration file ${migration.name} not found in ${migrationsDir}.`);
|
|
128
|
+
}
|
|
129
|
+
// Remove from database
|
|
130
|
+
await this.migrationsRepository.deleteById(migration.id);
|
|
131
|
+
this.logger.info(`Migration ${migration.name} rolled back successfully.`);
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
this.logger.error(`Error rolling back migration ${migration.name}: ${error.message}`);
|
|
135
|
+
throw error;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
exports.MigrationService = MigrationService;
|
|
141
|
+
exports.MigrationService = MigrationService = __decorate([
|
|
142
|
+
(0, core_1.injectable)({ scope: core_1.BindingScope.TRANSIENT }),
|
|
143
|
+
__param(0, (0, repository_1.repository)(migration_repository_1.MigrationsRepository)),
|
|
144
|
+
__metadata("design:paramtypes", [migration_repository_1.MigrationsRepository])
|
|
145
|
+
], MigrationService);
|
|
146
|
+
//# sourceMappingURL=migration.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration.service.js","sourceRoot":"","sources":["../../../src/base/migration/migration.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA0D;AAC1D,qDAAkD;AAClD,4CAA8B;AAC9B,gDAAkC;AAClC,6EAA0E;AAE1E,2CAAsD;AAG/C,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAG3B,YAES,oBAA0C;QAA1C,yBAAoB,GAApB,oBAAoB,CAAsB;QAEjD,IAAI,CAAC,MAAM,GAAG,uBAAa,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAC9D,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,aAAqB;QACjC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;YAClC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,uBAAuB,aAAa,uCAAuC,CAAC,CAAC;YAC9F,OAAO;QACT,CAAC;QAED,MAAM,KAAK,GAAG,EAAE,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;QAChG,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,8CAA8C;QAE5D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,WAAW,GAAG,IAAI,CAAC;YAEzB,qCAAqC;YACrC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC;YACzF,IAAI,MAAM,EAA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AAI,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,SAAS,CAAC,IAAI,4BAA4B,CAAC,CAAC;YAC5E,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gCAAgC,SAAS,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;gBACtF,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAlGY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,iBAAU,EAAC,EAAE,KAAK,EAAE,mBAAY,CAAC,SAAS,EAAE,CAAC;IAKzC,WAAA,IAAA,uBAAU,EAAC,2CAAoB,CAAC,CAAA;qCACJ,2CAAoB;GALxC,gBAAgB,CAkG5B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Entity } from '@loopback/repository';
|
|
2
|
+
import { IdType, NumberIdType, StringIdType } from '../../common/types';
|
|
2
3
|
export declare class BaseEntity extends Entity {
|
|
3
4
|
}
|
|
4
5
|
/**
|
|
@@ -8,19 +9,24 @@ export declare class BaseEntity extends Entity {
|
|
|
8
9
|
export declare class BaseKVEntity<T = any> extends BaseEntity {
|
|
9
10
|
payload: T;
|
|
10
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Base entity with generic ID
|
|
14
|
+
* @template T - Type of ID (string or number)
|
|
15
|
+
*/
|
|
16
|
+
export declare abstract class BaseIdEntity<T extends IdType = NumberIdType> extends BaseEntity {
|
|
17
|
+
abstract id: T;
|
|
18
|
+
}
|
|
11
19
|
/**
|
|
12
20
|
* Base entity with auto-generated numeric ID
|
|
13
21
|
*/
|
|
14
|
-
export declare class BaseNumberIdEntity extends
|
|
15
|
-
id:
|
|
22
|
+
export declare class BaseNumberIdEntity extends BaseIdEntity<NumberIdType> {
|
|
23
|
+
id: NumberIdType;
|
|
16
24
|
}
|
|
17
25
|
/**
|
|
18
26
|
* Base entity with string-based (manual) ID
|
|
19
27
|
*/
|
|
20
|
-
export declare class BaseStringIdEntity extends
|
|
21
|
-
id:
|
|
22
|
-
}
|
|
23
|
-
export declare class BaseIdEntity extends BaseNumberIdEntity {
|
|
28
|
+
export declare class BaseStringIdEntity extends BaseIdEntity<StringIdType> {
|
|
29
|
+
id: StringIdType;
|
|
24
30
|
}
|
|
25
31
|
export type TBaseIdEntity = BaseNumberIdEntity | BaseStringIdEntity;
|
|
26
32
|
//# sourceMappingURL=base.model.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.model.d.ts","sourceRoot":"","sources":["../../../src/base/models/base.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAY,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"base.model.d.ts","sourceRoot":"","sources":["../../../src/base/models/base.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAY,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAExE,qBAAa,UAAW,SAAQ,MAAM;CAAG;AAEzC;;;GAGG;AACH,qBAAa,YAAY,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,UAAU;IAEnD,OAAO,EAAG,CAAC,CAAC;CACb;AAED;;;GAGG;AACH,8BAAsB,YAAY,CAAC,CAAC,SAAS,MAAM,GAAG,YAAY,CAAE,SAAQ,UAAU;IACpF,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC;CAChB;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,YAAY,CAAC,YAAY,CAAC;IAEhE,EAAE,EAAG,YAAY,CAAC;CACnB;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,YAAY,CAAC,YAAY,CAAC;IAEhE,EAAE,EAAG,YAAY,CAAC;CACnB;AAED,MAAM,MAAM,aAAa,GAAG,kBAAkB,GAAG,kBAAkB,CAAC"}
|
|
@@ -9,7 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.BaseStringIdEntity = exports.BaseNumberIdEntity = exports.BaseIdEntity = exports.BaseKVEntity = exports.BaseEntity = void 0;
|
|
13
13
|
const repository_1 = require("@loopback/repository");
|
|
14
14
|
class BaseEntity extends repository_1.Entity {
|
|
15
15
|
}
|
|
@@ -25,10 +25,17 @@ __decorate([
|
|
|
25
25
|
(0, repository_1.property)({ type: 'object' }),
|
|
26
26
|
__metadata("design:type", Object)
|
|
27
27
|
], BaseKVEntity.prototype, "payload", void 0);
|
|
28
|
+
/**
|
|
29
|
+
* Base entity with generic ID
|
|
30
|
+
* @template T - Type of ID (string or number)
|
|
31
|
+
*/
|
|
32
|
+
class BaseIdEntity extends BaseEntity {
|
|
33
|
+
}
|
|
34
|
+
exports.BaseIdEntity = BaseIdEntity;
|
|
28
35
|
/**
|
|
29
36
|
* Base entity with auto-generated numeric ID
|
|
30
37
|
*/
|
|
31
|
-
class BaseNumberIdEntity extends
|
|
38
|
+
class BaseNumberIdEntity extends BaseIdEntity {
|
|
32
39
|
}
|
|
33
40
|
exports.BaseNumberIdEntity = BaseNumberIdEntity;
|
|
34
41
|
__decorate([
|
|
@@ -38,14 +45,11 @@ __decorate([
|
|
|
38
45
|
/**
|
|
39
46
|
* Base entity with string-based (manual) ID
|
|
40
47
|
*/
|
|
41
|
-
class BaseStringIdEntity extends
|
|
48
|
+
class BaseStringIdEntity extends BaseIdEntity {
|
|
42
49
|
}
|
|
43
50
|
exports.BaseStringIdEntity = BaseStringIdEntity;
|
|
44
51
|
__decorate([
|
|
45
52
|
(0, repository_1.property)({ type: 'string', id: true }),
|
|
46
53
|
__metadata("design:type", String)
|
|
47
54
|
], BaseStringIdEntity.prototype, "id", void 0);
|
|
48
|
-
class BaseIdEntity extends BaseNumberIdEntity {
|
|
49
|
-
}
|
|
50
|
-
exports.BaseIdEntity = BaseIdEntity;
|
|
51
55
|
//# sourceMappingURL=base.model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.model.js","sourceRoot":"","sources":["../../../src/base/models/base.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAwD;
|
|
1
|
+
{"version":3,"file":"base.model.js","sourceRoot":"","sources":["../../../src/base/models/base.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAwD;AAGxD,MAAa,UAAW,SAAQ,mBAAM;CAAG;AAAzC,gCAAyC;AAEzC;;;GAGG;AACH,MAAa,YAAsB,SAAQ,UAAU;CAGpD;AAHD,oCAGC;AADC;IADC,IAAA,qBAAQ,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;;6CACjB;AAGd;;;GAGG;AACH,MAAsB,YAA8C,SAAQ,UAAU;CAErF;AAFD,oCAEC;AAED;;GAEG;AACH,MAAa,kBAAmB,SAAQ,YAA0B;CAGjE;AAHD,gDAGC;AADC;IADC,IAAA,qBAAQ,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;;8CACtC;AAGpB;;GAEG;AACH,MAAa,kBAAmB,SAAQ,YAA0B;CAGjE;AAHD,gDAGC;AADC;IADC,IAAA,qBAAQ,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;;8CACrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/base/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/base/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC"}
|
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./base.model"), exports);
|
|
18
|
+
__exportStar(require("./migration.model"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/base/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/base/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,oDAAkC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseEntity } from './base.model';
|
|
2
|
+
export declare class Migrations extends BaseEntity {
|
|
3
|
+
id?: number;
|
|
4
|
+
name: string;
|
|
5
|
+
appliedAt?: string;
|
|
6
|
+
[prop: string]: any;
|
|
7
|
+
constructor(data?: Partial<Migrations>);
|
|
8
|
+
}
|
|
9
|
+
export interface IMigrationsRelations {
|
|
10
|
+
}
|
|
11
|
+
export type TMigrationsWithRelations = Migrations & IMigrationsRelations;
|
|
12
|
+
//# sourceMappingURL=migration.model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration.model.d.ts","sourceRoot":"","sources":["../../../src/base/models/migration.model.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,qBACa,UAAW,SAAQ,UAAU;IAMxC,EAAE,CAAC,EAAE,MAAM,CAAC;IAMZ,IAAI,EAAG,MAAM,CAAC;IAKd,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC;gBAER,IAAI,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC;CAGvC;AAED,MAAM,WAAW,oBAAoB;CAAG;AAExC,MAAM,MAAM,wBAAwB,GAAG,UAAU,GAAG,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Migrations = void 0;
|
|
13
|
+
const repository_1 = require("@loopback/repository");
|
|
14
|
+
const base_model_1 = require("./base.model");
|
|
15
|
+
let Migrations = class Migrations extends base_model_1.BaseEntity {
|
|
16
|
+
constructor(data) {
|
|
17
|
+
super(data);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
exports.Migrations = Migrations;
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, repository_1.property)({
|
|
23
|
+
type: 'number',
|
|
24
|
+
id: true,
|
|
25
|
+
generated: true,
|
|
26
|
+
}),
|
|
27
|
+
__metadata("design:type", Number)
|
|
28
|
+
], Migrations.prototype, "id", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, repository_1.property)({
|
|
31
|
+
type: 'string',
|
|
32
|
+
required: true,
|
|
33
|
+
}),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], Migrations.prototype, "name", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, repository_1.property)({
|
|
38
|
+
type: 'string',
|
|
39
|
+
}),
|
|
40
|
+
__metadata("design:type", String)
|
|
41
|
+
], Migrations.prototype, "appliedAt", void 0);
|
|
42
|
+
exports.Migrations = Migrations = __decorate([
|
|
43
|
+
(0, repository_1.model)({ settings: { strict: true } }),
|
|
44
|
+
__metadata("design:paramtypes", [Object])
|
|
45
|
+
], Migrations);
|
|
46
|
+
//# sourceMappingURL=migration.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration.model.js","sourceRoot":"","sources":["../../../src/base/models/migration.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAuD;AACvD,6CAA0C;AAGnC,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,uBAAU;IAqBxC,YAAY,IAA0B;QACpC,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;CACF,CAAA;AAxBY,gCAAU;AAMrB;IALC,IAAA,qBAAQ,EAAC;QACR,IAAI,EAAE,QAAQ;QACd,EAAE,EAAE,IAAI;QACR,SAAS,EAAE,IAAI;KAChB,CAAC;;sCACU;AAMZ;IAJC,IAAA,qBAAQ,EAAC;QACR,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;KACf,CAAC;;wCACY;AAKd;IAHC,IAAA,qBAAQ,EAAC;QACR,IAAI,EAAE,QAAQ;KACf,CAAC;;6CACiB;qBAjBR,UAAU;IADtB,IAAA,kBAAK,EAAC,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC;;GACzB,UAAU,CAwBtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/base/repository/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./migration.repository"), exports);
|
|
18
|
+
__exportStar(require("./soft-delete.repository"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/base/repository/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,2DAAyC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DefaultCrudRepository, juggler } from '@loopback/repository';
|
|
2
|
+
import { Migrations, IMigrationsRelations } from '../models/migration.model';
|
|
3
|
+
export declare class MigrationsRepository extends DefaultCrudRepository<Migrations, typeof Migrations.prototype.id, IMigrationsRelations> {
|
|
4
|
+
constructor(dataSource: juggler.DataSource);
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=migration.repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration.repository.d.ts","sourceRoot":"","sources":["../../../src/base/repository/migration.repository.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAE7E,qBAAa,oBAAqB,SAAQ,qBAAqB,CAC7D,UAAU,EACV,OAAO,UAAU,CAAC,SAAS,CAAC,EAAE,EAC9B,oBAAoB,CACrB;gBAC6C,UAAU,EAAE,OAAO,CAAC,UAAU;CAG3E"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.MigrationsRepository = void 0;
|
|
16
|
+
const core_1 = require("@loopback/core");
|
|
17
|
+
const repository_1 = require("@loopback/repository");
|
|
18
|
+
const migration_model_1 = require("../models/migration.model");
|
|
19
|
+
let MigrationsRepository = class MigrationsRepository extends repository_1.DefaultCrudRepository {
|
|
20
|
+
constructor(dataSource) {
|
|
21
|
+
super(migration_model_1.Migrations, dataSource);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
exports.MigrationsRepository = MigrationsRepository;
|
|
25
|
+
exports.MigrationsRepository = MigrationsRepository = __decorate([
|
|
26
|
+
__param(0, (0, core_1.inject)('datasources.postgres')),
|
|
27
|
+
__metadata("design:paramtypes", [repository_1.juggler.DataSource])
|
|
28
|
+
], MigrationsRepository);
|
|
29
|
+
//# sourceMappingURL=migration.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration.repository.js","sourceRoot":"","sources":["../../../src/base/repository/migration.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yCAAwC;AACxC,qDAAsE;AAEtE,+DAA6E;AAE7E,IAAa,oBAAoB,GAAjC,MAAa,oBAAqB,SAAQ,kCAIzC;IACC,YAA4C,UAA8B;QACxE,KAAK,CAAC,4BAAU,EAAE,UAAU,CAAC,CAAC;IAChC,CAAC;CACF,CAAA;AARY,oDAAoB;+BAApB,oBAAoB;IAKlB,WAAA,IAAA,aAAM,EAAC,sBAAsB,CAAC,CAAA;qCAAa,oBAAO,CAAC,UAAU;GAL/D,oBAAoB,CAQhC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { DefaultCrudRepository, Entity, Filter, Where, Options, Count, juggler } from '@loopback/repository';
|
|
2
|
+
/**
|
|
3
|
+
* A base repository that handles soft delete by default.
|
|
4
|
+
*/
|
|
5
|
+
export declare class SoftDeleteRepository<T extends Entity & {
|
|
6
|
+
deletedAt?: Date | null;
|
|
7
|
+
}, ID, Relations extends object = {}> extends DefaultCrudRepository<T, ID, Relations> {
|
|
8
|
+
constructor(entityClass: typeof Entity & {
|
|
9
|
+
prototype: T;
|
|
10
|
+
}, dataSource: juggler.DataSource);
|
|
11
|
+
/**
|
|
12
|
+
* Override find to filter out soft-deleted records by default.
|
|
13
|
+
*/
|
|
14
|
+
find(filter?: Filter<T>, options?: Options): Promise<(T & Relations)[]>;
|
|
15
|
+
/**
|
|
16
|
+
* Override findOne to filter out soft-deleted records.
|
|
17
|
+
*/
|
|
18
|
+
findOne(filter?: Filter<T>, options?: Options): Promise<(T & Relations) | null>;
|
|
19
|
+
/**
|
|
20
|
+
* Override count to filter out soft-deleted records.
|
|
21
|
+
*/
|
|
22
|
+
count(where?: Where<T>, options?: Options): Promise<Count>;
|
|
23
|
+
/**
|
|
24
|
+
* Override deleteById to perform soft delete.
|
|
25
|
+
*/
|
|
26
|
+
deleteById(id: ID, options?: Options): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Perform hard delete if needed.
|
|
29
|
+
*/
|
|
30
|
+
hardDeleteById(id: ID, options?: Options): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Helper to exclude deleted records from filter.
|
|
33
|
+
*/
|
|
34
|
+
private excludeDeleted;
|
|
35
|
+
/**
|
|
36
|
+
* Helper to exclude deleted records from where clause.
|
|
37
|
+
*/
|
|
38
|
+
private excludeDeletedFromWhere;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=soft-delete.repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"soft-delete.repository.d.ts","sourceRoot":"","sources":["../../../src/base/repository/soft-delete.repository.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,MAAM,EACN,MAAM,EACN,KAAK,EACL,OAAO,EAEP,KAAK,EACL,OAAO,EACR,MAAM,sBAAsB,CAAC;AAE9B;;GAEG;AACH,qBAAa,oBAAoB,CAC/B,CAAC,SAAS,MAAM,GAAG;IAAE,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;CAAE,EAC9C,EAAE,EACF,SAAS,SAAS,MAAM,GAAG,EAAE,CAC7B,SAAQ,qBAAqB,CAAC,CAAC,EAAE,EAAE,EAAE,SAAS,CAAC;gBACnC,WAAW,EAAE,OAAO,MAAM,GAAG;QAAE,SAAS,EAAE,CAAC,CAA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