rl-core-api 0.3.0 → 0.4.0
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 +1 -1
- package/dist/core/config/env.schema.d.ts +2 -3
- package/dist/core/config/env.schema.js +2 -3
- package/dist/core/config/env.service.d.ts +1 -0
- package/dist/core/config/env.service.js +3 -0
- package/dist/core/context/requestLog.context.d.ts +10 -0
- package/dist/core/context/requestLog.context.js +26 -0
- package/dist/core/database/migrations/1710000000000-InitialSchema.js +63 -36
- package/dist/core/database/migrations/index.js +1 -9
- package/dist/core/events/appEvent.enum.d.ts +18 -1
- package/dist/core/events/appEvent.enum.js +1 -0
- package/dist/core/filters/allExceptions.filter.d.ts +6 -0
- package/dist/core/filters/allExceptions.filter.js +47 -2
- package/dist/core/query/parseFilter.util.js +6 -4
- package/dist/core/utils/ip.util.d.ts +1 -0
- package/dist/core/utils/ip.util.js +8 -0
- package/dist/coreEntities.d.ts +2 -3
- package/dist/coreEntities.js +2 -4
- package/dist/features/audit/audit.module.js +4 -7
- package/dist/features/audit/domain/audit.service.d.ts +6 -16
- package/dist/features/audit/domain/audit.service.js +9 -39
- package/dist/features/audit/domain/classifyError.util.d.ts +1 -1
- package/dist/features/audit/domain/classifyError.util.js +8 -8
- package/dist/features/audit/domain/enums/errorType.enum.d.ts +9 -0
- package/dist/features/audit/domain/enums/errorType.enum.js +13 -0
- package/dist/features/audit/domain/enums/requestOutcome.enum.d.ts +5 -0
- package/dist/features/audit/domain/enums/requestOutcome.enum.js +9 -0
- package/dist/features/audit/domain/index.d.ts +2 -0
- package/dist/features/audit/domain/index.js +2 -0
- package/dist/features/audit/infra/auditData.subscriber.js +17 -9
- package/dist/features/audit/infra/index.d.ts +2 -4
- package/dist/features/audit/infra/index.js +2 -4
- package/dist/features/audit/infra/repositories/requestLog.repository.d.ts +7 -0
- package/dist/features/audit/infra/repositories/{auditChange.repository.js → requestLog.repository.js} +10 -10
- package/dist/features/audit/infra/schema/auditDataChange.schema.d.ts +3 -3
- package/dist/features/audit/infra/schema/auditDataChange.schema.js +8 -7
- package/dist/features/audit/infra/schema/requestLog.schema.d.ts +20 -0
- package/dist/features/audit/infra/schema/requestLog.schema.js +92 -0
- package/dist/features/audit/presentation/audit.controller.d.ts +4 -8
- package/dist/features/audit/presentation/audit.controller.js +8 -31
- package/dist/features/audit/presentation/audit.interceptor.d.ts +5 -1
- package/dist/features/audit/presentation/audit.interceptor.js +47 -28
- package/dist/features/audit/presentation/decorators/auditable.decorator.d.ts +3 -0
- package/dist/features/audit/presentation/decorators/auditable.decorator.js +7 -0
- package/dist/features/audit/presentation/filters/audit.filters.d.ts +1 -2
- package/dist/features/audit/presentation/filters/audit.filters.js +65 -49
- package/dist/features/audit/presentation/httpError.listener.d.ts +8 -0
- package/dist/features/audit/presentation/httpError.listener.js +61 -0
- package/dist/features/audit/presentation/index.d.ts +2 -0
- package/dist/features/audit/presentation/index.js +2 -0
- package/dist/features/audit/presentation/responses/auditDataChange.response.js +1 -1
- package/dist/features/audit/presentation/responses/log.response.d.ts +12 -27
- package/dist/features/audit/presentation/responses/log.response.js +66 -88
- package/dist/features/auth/infra/schema/authToken.schema.d.ts +5 -5
- package/dist/features/auth/infra/schema/authToken.schema.js +7 -7
- package/dist/features/auth/presentation/auth.controller.js +10 -0
- package/dist/features/maintenance/domain/cleanup.service.d.ts +1 -4
- package/dist/features/maintenance/domain/cleanup.service.js +1 -26
- package/dist/features/maintenance/maintenance.module.js +1 -2
- package/dist/features/notifications/domain/enums/channelType.enum.d.ts +5 -5
- package/dist/features/notifications/domain/enums/channelType.enum.js +5 -5
- package/dist/features/notifications/domain/enums/deliveryStatus.enum.d.ts +6 -6
- package/dist/features/notifications/domain/enums/deliveryStatus.enum.js +6 -6
- package/dist/features/notifications/domain/enums/notificationType.enum.d.ts +4 -4
- package/dist/features/notifications/domain/enums/notificationType.enum.js +4 -4
- package/dist/features/notifications/domain/enums/scopeType.enum.d.ts +3 -3
- package/dist/features/notifications/domain/enums/scopeType.enum.js +3 -3
- package/dist/features/notifications/infra/schema/notification.schema.js +2 -2
- package/dist/features/notifications/infra/schema/notificationScope.schema.js +2 -2
- package/dist/features/notifications/presentation/commands/createNotification.command.js +2 -2
- package/dist/features/notifications/presentation/responses/notification.response.js +1 -1
- package/dist/features/rbac/presentation/rbac.controller.js +5 -0
- package/dist/features/users/presentation/users.controller.js +5 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.js +10 -6
- package/package.json +1 -1
- package/dist/core/database/migrations/1786060800000-FirstAccessTokenType.d.ts +0 -6
- package/dist/core/database/migrations/1786060800000-FirstAccessTokenType.js +0 -19
- package/dist/core/database/migrations/1786147200000-PermanentAccountLock.d.ts +0 -6
- package/dist/core/database/migrations/1786147200000-PermanentAccountLock.js +0 -15
- package/dist/core/database/migrations/1786233600000-Notifications.d.ts +0 -6
- package/dist/core/database/migrations/1786233600000-Notifications.js +0 -59
- package/dist/features/audit/infra/repositories/auditChange.repository.d.ts +0 -7
- package/dist/features/audit/infra/repositories/errorLog.repository.d.ts +0 -7
- package/dist/features/audit/infra/repositories/errorLog.repository.js +0 -35
- package/dist/features/audit/infra/schema/auditChange.schema.d.ts +0 -14
- package/dist/features/audit/infra/schema/auditChange.schema.js +0 -68
- package/dist/features/audit/infra/schema/errorLog.schema.d.ts +0 -21
- package/dist/features/audit/infra/schema/errorLog.schema.js +0 -69
|
@@ -1,68 +0,0 @@
|
|
|
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.AuditChange = void 0;
|
|
13
|
-
const typeorm_1 = require("typeorm");
|
|
14
|
-
const base_schema_1 = require("../../../../core/database/base.schema");
|
|
15
|
-
let AuditChange = class AuditChange extends base_schema_1.BaseEntity {
|
|
16
|
-
};
|
|
17
|
-
exports.AuditChange = AuditChange;
|
|
18
|
-
__decorate([
|
|
19
|
-
(0, typeorm_1.Column)({ name: "user_id", type: "char", length: 36, nullable: true }),
|
|
20
|
-
__metadata("design:type", Object)
|
|
21
|
-
], AuditChange.prototype, "userId", void 0);
|
|
22
|
-
__decorate([
|
|
23
|
-
(0, typeorm_1.Column)({ type: "varchar", length: 100 }),
|
|
24
|
-
__metadata("design:type", String)
|
|
25
|
-
], AuditChange.prototype, "action", void 0);
|
|
26
|
-
__decorate([
|
|
27
|
-
(0, typeorm_1.Column)({ type: "varchar", length: 100, nullable: true }),
|
|
28
|
-
__metadata("design:type", Object)
|
|
29
|
-
], AuditChange.prototype, "entity", void 0);
|
|
30
|
-
__decorate([
|
|
31
|
-
(0, typeorm_1.Column)({ name: "entity_id", type: "varchar", length: 36, nullable: true }),
|
|
32
|
-
__metadata("design:type", Object)
|
|
33
|
-
], AuditChange.prototype, "entityId", void 0);
|
|
34
|
-
__decorate([
|
|
35
|
-
(0, typeorm_1.Column)({ type: "varchar", length: 10, nullable: true }),
|
|
36
|
-
__metadata("design:type", Object)
|
|
37
|
-
], AuditChange.prototype, "method", void 0);
|
|
38
|
-
__decorate([
|
|
39
|
-
(0, typeorm_1.Column)({ type: "varchar", length: 255, nullable: true }),
|
|
40
|
-
__metadata("design:type", Object)
|
|
41
|
-
], AuditChange.prototype, "path", void 0);
|
|
42
|
-
__decorate([
|
|
43
|
-
(0, typeorm_1.Column)({ name: "ip_address", type: "varchar", length: 45, nullable: true }),
|
|
44
|
-
__metadata("design:type", Object)
|
|
45
|
-
], AuditChange.prototype, "ipAddress", void 0);
|
|
46
|
-
__decorate([
|
|
47
|
-
(0, typeorm_1.Column)({ name: "status_code", type: "int", nullable: true }),
|
|
48
|
-
__metadata("design:type", Object)
|
|
49
|
-
], AuditChange.prototype, "statusCode", void 0);
|
|
50
|
-
__decorate([
|
|
51
|
-
(0, typeorm_1.Column)({ name: "duration_ms", type: "int", nullable: true }),
|
|
52
|
-
__metadata("design:type", Object)
|
|
53
|
-
], AuditChange.prototype, "durationMs", void 0);
|
|
54
|
-
__decorate([
|
|
55
|
-
(0, typeorm_1.Column)({ name: "request_id", type: "char", length: 36, nullable: true }),
|
|
56
|
-
__metadata("design:type", Object)
|
|
57
|
-
], AuditChange.prototype, "requestId", void 0);
|
|
58
|
-
__decorate([
|
|
59
|
-
(0, typeorm_1.Column)({ type: "json", nullable: true }),
|
|
60
|
-
__metadata("design:type", Object)
|
|
61
|
-
], AuditChange.prototype, "metadata", void 0);
|
|
62
|
-
exports.AuditChange = AuditChange = __decorate([
|
|
63
|
-
(0, typeorm_1.Entity)("audit_changes"),
|
|
64
|
-
(0, typeorm_1.Index)(["userId"]),
|
|
65
|
-
(0, typeorm_1.Index)(["entity"]),
|
|
66
|
-
(0, typeorm_1.Index)(["requestId"]),
|
|
67
|
-
(0, typeorm_1.Index)(["statusCode"])
|
|
68
|
-
], AuditChange);
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { BaseEntity } from "../../../../core/database/base.schema";
|
|
2
|
-
export declare enum ErrorType {
|
|
3
|
-
VALIDATION = "VALIDATION",
|
|
4
|
-
AUTH = "AUTH",
|
|
5
|
-
NOT_FOUND = "NOT_FOUND",
|
|
6
|
-
RATE_LIMIT = "RATE_LIMIT",
|
|
7
|
-
DATABASE = "DATABASE",
|
|
8
|
-
INTEGRATION = "INTEGRATION",
|
|
9
|
-
INTERNAL = "INTERNAL"
|
|
10
|
-
}
|
|
11
|
-
export declare class ErrorLog extends BaseEntity {
|
|
12
|
-
statusCode?: number | null;
|
|
13
|
-
type: ErrorType;
|
|
14
|
-
message: string;
|
|
15
|
-
stack?: string | null;
|
|
16
|
-
method?: string | null;
|
|
17
|
-
path?: string | null;
|
|
18
|
-
userId?: string | null;
|
|
19
|
-
ipAddress?: string | null;
|
|
20
|
-
requestId?: string | null;
|
|
21
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
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.ErrorLog = exports.ErrorType = void 0;
|
|
13
|
-
const typeorm_1 = require("typeorm");
|
|
14
|
-
const base_schema_1 = require("../../../../core/database/base.schema");
|
|
15
|
-
var ErrorType;
|
|
16
|
-
(function (ErrorType) {
|
|
17
|
-
ErrorType["VALIDATION"] = "VALIDATION";
|
|
18
|
-
ErrorType["AUTH"] = "AUTH";
|
|
19
|
-
ErrorType["NOT_FOUND"] = "NOT_FOUND";
|
|
20
|
-
ErrorType["RATE_LIMIT"] = "RATE_LIMIT";
|
|
21
|
-
ErrorType["DATABASE"] = "DATABASE";
|
|
22
|
-
ErrorType["INTEGRATION"] = "INTEGRATION";
|
|
23
|
-
ErrorType["INTERNAL"] = "INTERNAL";
|
|
24
|
-
})(ErrorType || (exports.ErrorType = ErrorType = {}));
|
|
25
|
-
let ErrorLog = class ErrorLog extends base_schema_1.BaseEntity {
|
|
26
|
-
};
|
|
27
|
-
exports.ErrorLog = ErrorLog;
|
|
28
|
-
__decorate([
|
|
29
|
-
(0, typeorm_1.Column)({ name: "status_code", type: "int", nullable: true }),
|
|
30
|
-
__metadata("design:type", Object)
|
|
31
|
-
], ErrorLog.prototype, "statusCode", void 0);
|
|
32
|
-
__decorate([
|
|
33
|
-
(0, typeorm_1.Column)({ type: "enum", enum: ErrorType, default: ErrorType.INTERNAL }),
|
|
34
|
-
__metadata("design:type", String)
|
|
35
|
-
], ErrorLog.prototype, "type", void 0);
|
|
36
|
-
__decorate([
|
|
37
|
-
(0, typeorm_1.Column)({ type: "varchar", length: 255 }),
|
|
38
|
-
__metadata("design:type", String)
|
|
39
|
-
], ErrorLog.prototype, "message", void 0);
|
|
40
|
-
__decorate([
|
|
41
|
-
(0, typeorm_1.Column)({ type: "text", nullable: true }),
|
|
42
|
-
__metadata("design:type", Object)
|
|
43
|
-
], ErrorLog.prototype, "stack", void 0);
|
|
44
|
-
__decorate([
|
|
45
|
-
(0, typeorm_1.Column)({ type: "varchar", length: 10, nullable: true }),
|
|
46
|
-
__metadata("design:type", Object)
|
|
47
|
-
], ErrorLog.prototype, "method", void 0);
|
|
48
|
-
__decorate([
|
|
49
|
-
(0, typeorm_1.Column)({ type: "varchar", length: 255, nullable: true }),
|
|
50
|
-
__metadata("design:type", Object)
|
|
51
|
-
], ErrorLog.prototype, "path", void 0);
|
|
52
|
-
__decorate([
|
|
53
|
-
(0, typeorm_1.Column)({ name: "user_id", type: "char", length: 36, nullable: true }),
|
|
54
|
-
__metadata("design:type", Object)
|
|
55
|
-
], ErrorLog.prototype, "userId", void 0);
|
|
56
|
-
__decorate([
|
|
57
|
-
(0, typeorm_1.Column)({ name: "ip_address", type: "varchar", length: 45, nullable: true }),
|
|
58
|
-
__metadata("design:type", Object)
|
|
59
|
-
], ErrorLog.prototype, "ipAddress", void 0);
|
|
60
|
-
__decorate([
|
|
61
|
-
(0, typeorm_1.Column)({ name: "request_id", type: "char", length: 36, nullable: true }),
|
|
62
|
-
__metadata("design:type", Object)
|
|
63
|
-
], ErrorLog.prototype, "requestId", void 0);
|
|
64
|
-
exports.ErrorLog = ErrorLog = __decorate([
|
|
65
|
-
(0, typeorm_1.Entity)("error_logs"),
|
|
66
|
-
(0, typeorm_1.Index)(["statusCode"]),
|
|
67
|
-
(0, typeorm_1.Index)(["type"]),
|
|
68
|
-
(0, typeorm_1.Index)(["requestId"])
|
|
69
|
-
], ErrorLog);
|