enterprise-logging-system 1.0.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 +16 -0
- package/dist/__tests__/exports.test.d.ts +2 -0
- package/dist/__tests__/exports.test.d.ts.map +1 -0
- package/dist/__tests__/exports.test.js +48 -0
- package/dist/__tests__/exports.test.js.map +1 -0
- package/dist/backend/config/database.d.ts +11 -0
- package/dist/backend/config/database.d.ts.map +1 -0
- package/dist/backend/config/database.js +65 -0
- package/dist/backend/config/database.js.map +1 -0
- package/dist/backend/config/logging.config.d.ts +28 -0
- package/dist/backend/config/logging.config.d.ts.map +1 -0
- package/dist/backend/config/logging.config.js +36 -0
- package/dist/backend/config/logging.config.js.map +1 -0
- package/dist/backend/controllers/LogController.d.ts +18 -0
- package/dist/backend/controllers/LogController.d.ts.map +1 -0
- package/dist/backend/controllers/LogController.js +159 -0
- package/dist/backend/controllers/LogController.js.map +1 -0
- package/dist/backend/index.d.ts +8 -0
- package/dist/backend/index.d.ts.map +1 -0
- package/dist/backend/index.js +24 -0
- package/dist/backend/index.js.map +1 -0
- package/dist/backend/middleware/loggingMiddleware.d.ts +8 -0
- package/dist/backend/middleware/loggingMiddleware.d.ts.map +1 -0
- package/dist/backend/middleware/loggingMiddleware.js +112 -0
- package/dist/backend/middleware/loggingMiddleware.js.map +1 -0
- package/dist/backend/models/AccessLog.d.ts +73 -0
- package/dist/backend/models/AccessLog.d.ts.map +1 -0
- package/dist/backend/models/AccessLog.js +10 -0
- package/dist/backend/models/AccessLog.js.map +1 -0
- package/dist/backend/models/ChangeLog.d.ts +81 -0
- package/dist/backend/models/ChangeLog.d.ts.map +1 -0
- package/dist/backend/models/ChangeLog.js +11 -0
- package/dist/backend/models/ChangeLog.js.map +1 -0
- package/dist/backend/models/ExportLog.d.ts +64 -0
- package/dist/backend/models/ExportLog.d.ts.map +1 -0
- package/dist/backend/models/ExportLog.js +10 -0
- package/dist/backend/models/ExportLog.js.map +1 -0
- package/dist/backend/models/SessionLog.d.ts +94 -0
- package/dist/backend/models/SessionLog.d.ts.map +1 -0
- package/dist/backend/models/SessionLog.js +11 -0
- package/dist/backend/models/SessionLog.js.map +1 -0
- package/dist/backend/models/index.d.ts +5 -0
- package/dist/backend/models/index.d.ts.map +1 -0
- package/dist/backend/models/index.js +21 -0
- package/dist/backend/models/index.js.map +1 -0
- package/dist/backend/repositories/AccessLogRepository.d.ts +14 -0
- package/dist/backend/repositories/AccessLogRepository.d.ts.map +1 -0
- package/dist/backend/repositories/AccessLogRepository.js +60 -0
- package/dist/backend/repositories/AccessLogRepository.js.map +1 -0
- package/dist/backend/repositories/BaseRepository.d.ts +28 -0
- package/dist/backend/repositories/BaseRepository.d.ts.map +1 -0
- package/dist/backend/repositories/BaseRepository.js +112 -0
- package/dist/backend/repositories/BaseRepository.js.map +1 -0
- package/dist/backend/repositories/ChangeLogRepository.d.ts +12 -0
- package/dist/backend/repositories/ChangeLogRepository.d.ts.map +1 -0
- package/dist/backend/repositories/ChangeLogRepository.js +47 -0
- package/dist/backend/repositories/ChangeLogRepository.js.map +1 -0
- package/dist/backend/repositories/ExportLogRepository.d.ts +11 -0
- package/dist/backend/repositories/ExportLogRepository.d.ts.map +1 -0
- package/dist/backend/repositories/ExportLogRepository.js +45 -0
- package/dist/backend/repositories/ExportLogRepository.js.map +1 -0
- package/dist/backend/repositories/SessionLogRepository.d.ts +20 -0
- package/dist/backend/repositories/SessionLogRepository.d.ts.map +1 -0
- package/dist/backend/repositories/SessionLogRepository.js +171 -0
- package/dist/backend/repositories/SessionLogRepository.js.map +1 -0
- package/dist/backend/repositories/index.d.ts +6 -0
- package/dist/backend/repositories/index.d.ts.map +1 -0
- package/dist/backend/repositories/index.js +22 -0
- package/dist/backend/repositories/index.js.map +1 -0
- package/dist/backend/services/LoggingService.d.ts +110 -0
- package/dist/backend/services/LoggingService.d.ts.map +1 -0
- package/dist/backend/services/LoggingService.js +97 -0
- package/dist/backend/services/LoggingService.js.map +1 -0
- package/dist/backend/utils/Logger.d.ts +8 -0
- package/dist/backend/utils/Logger.d.ts.map +1 -0
- package/dist/backend/utils/Logger.js +23 -0
- package/dist/backend/utils/Logger.js.map +1 -0
- package/dist/examples/queries.d.ts +29 -0
- package/dist/examples/queries.d.ts.map +1 -0
- package/dist/examples/queries.js +151 -0
- package/dist/examples/queries.js.map +1 -0
- package/dist/frontend/activity-monitor/ActivityMonitor.d.ts +45 -0
- package/dist/frontend/activity-monitor/ActivityMonitor.d.ts.map +1 -0
- package/dist/frontend/activity-monitor/ActivityMonitor.js +159 -0
- package/dist/frontend/activity-monitor/ActivityMonitor.js.map +1 -0
- package/dist/frontend/idle-tracker/IdleTracker.d.ts +34 -0
- package/dist/frontend/idle-tracker/IdleTracker.d.ts.map +1 -0
- package/dist/frontend/idle-tracker/IdleTracker.js +56 -0
- package/dist/frontend/idle-tracker/IdleTracker.js.map +1 -0
- package/dist/frontend/index.d.ts +3 -0
- package/dist/frontend/index.d.ts.map +1 -0
- package/dist/frontend/index.js +19 -0
- package/dist/frontend/index.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +72 -0
- package/dist/index.js.map +1 -0
- package/dist/shared/types/index.d.ts +41 -0
- package/dist/shared/types/index.d.ts.map +1 -0
- package/dist/shared/types/index.js +3 -0
- package/dist/shared/types/index.js.map +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { BaseLogEntry, GeoLocation, NetworkInfo, BrowserInfo } from '../../shared/types';
|
|
2
|
+
export interface AccessLog extends BaseLogEntry {
|
|
3
|
+
type: 'PAGE_OPEN' | 'ACTION_PERFORMED';
|
|
4
|
+
activityType: string;
|
|
5
|
+
activityName: string;
|
|
6
|
+
pageId?: string;
|
|
7
|
+
pageTitle?: string;
|
|
8
|
+
pageUrl?: string;
|
|
9
|
+
pageRoute?: string;
|
|
10
|
+
previousPage?: string;
|
|
11
|
+
actionType?: string;
|
|
12
|
+
actionTarget?: string;
|
|
13
|
+
actionData?: Record<string, any>;
|
|
14
|
+
startTime: Date;
|
|
15
|
+
endTime?: Date;
|
|
16
|
+
activeDuration?: number;
|
|
17
|
+
browser: BrowserInfo;
|
|
18
|
+
geoLocation?: GeoLocation;
|
|
19
|
+
network?: NetworkInfo;
|
|
20
|
+
loadTime?: number;
|
|
21
|
+
domReadyTime?: number;
|
|
22
|
+
indexes: {
|
|
23
|
+
tenant_user_date: string;
|
|
24
|
+
session_activity: string;
|
|
25
|
+
page_tracking: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export declare const ACCESS_LOG_INDEXES: ({
|
|
29
|
+
keys: {
|
|
30
|
+
tenantId: number;
|
|
31
|
+
userId: number;
|
|
32
|
+
timestamp: number;
|
|
33
|
+
sessionId?: undefined;
|
|
34
|
+
activityType?: undefined;
|
|
35
|
+
pageId?: undefined;
|
|
36
|
+
};
|
|
37
|
+
name: string;
|
|
38
|
+
expireAfterSeconds?: undefined;
|
|
39
|
+
} | {
|
|
40
|
+
keys: {
|
|
41
|
+
sessionId: number;
|
|
42
|
+
activityType: number;
|
|
43
|
+
timestamp: number;
|
|
44
|
+
tenantId?: undefined;
|
|
45
|
+
userId?: undefined;
|
|
46
|
+
pageId?: undefined;
|
|
47
|
+
};
|
|
48
|
+
name: string;
|
|
49
|
+
expireAfterSeconds?: undefined;
|
|
50
|
+
} | {
|
|
51
|
+
keys: {
|
|
52
|
+
pageId: number;
|
|
53
|
+
timestamp: number;
|
|
54
|
+
tenantId?: undefined;
|
|
55
|
+
userId?: undefined;
|
|
56
|
+
sessionId?: undefined;
|
|
57
|
+
activityType?: undefined;
|
|
58
|
+
};
|
|
59
|
+
name: string;
|
|
60
|
+
expireAfterSeconds?: undefined;
|
|
61
|
+
} | {
|
|
62
|
+
keys: {
|
|
63
|
+
timestamp: number;
|
|
64
|
+
tenantId?: undefined;
|
|
65
|
+
userId?: undefined;
|
|
66
|
+
sessionId?: undefined;
|
|
67
|
+
activityType?: undefined;
|
|
68
|
+
pageId?: undefined;
|
|
69
|
+
};
|
|
70
|
+
name: string;
|
|
71
|
+
expireAfterSeconds: number;
|
|
72
|
+
})[];
|
|
73
|
+
//# sourceMappingURL=AccessLog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccessLog.d.ts","sourceRoot":"","sources":["../../../src/backend/models/AccessLog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEzF,MAAM,WAAW,SAAU,SAAQ,YAAY;IAC7C,IAAI,EAAE,WAAW,GAAG,kBAAkB,CAAC;IACvC,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IAGrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAGjC,SAAS,EAAE,IAAI,CAAC;IAChB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IAGxB,OAAO,EAAE,WAAW,CAAC;IACrB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,OAAO,CAAC,EAAE,WAAW,CAAC;IAGtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,OAAO,EAAE;QACP,gBAAgB,EAAE,MAAM,CAAC;QACzB,gBAAgB,EAAE,MAAM,CAAC;QACzB,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;CACH;AAED,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAK9B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ACCESS_LOG_INDEXES = void 0;
|
|
4
|
+
exports.ACCESS_LOG_INDEXES = [
|
|
5
|
+
{ keys: { tenantId: 1, userId: 1, timestamp: -1 }, name: 'tenant_user_date_idx' },
|
|
6
|
+
{ keys: { sessionId: 1, activityType: 1, timestamp: -1 }, name: 'session_activity_idx' },
|
|
7
|
+
{ keys: { pageId: 1, timestamp: -1 }, name: 'page_tracking_idx' },
|
|
8
|
+
{ keys: { timestamp: 1 }, name: 'timestamp_idx', expireAfterSeconds: 2592000 } // 30 days TTL
|
|
9
|
+
];
|
|
10
|
+
//# sourceMappingURL=AccessLog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccessLog.js","sourceRoot":"","sources":["../../../src/backend/models/AccessLog.ts"],"names":[],"mappings":";;;AAyCa,QAAA,kBAAkB,GAAG;IAChC,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,sBAAsB,EAAE;IACjF,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,sBAAsB,EAAE;IACxF,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,mBAAmB,EAAE;IACjE,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,kBAAkB,EAAE,OAAO,EAAE,CAAC,cAAc;CAC9F,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { BaseLogEntry } from '../../shared/types';
|
|
2
|
+
export interface FieldChange {
|
|
3
|
+
field: string;
|
|
4
|
+
oldValue: any;
|
|
5
|
+
newValue: any;
|
|
6
|
+
type: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ChangeLog extends BaseLogEntry {
|
|
9
|
+
type: 'CREATE' | 'UPDATE' | 'DELETE' | 'RESTORE';
|
|
10
|
+
entityType: string;
|
|
11
|
+
entityId: string;
|
|
12
|
+
changes: FieldChange[];
|
|
13
|
+
changedBy: {
|
|
14
|
+
userId: string;
|
|
15
|
+
role: string;
|
|
16
|
+
ipAddress: string;
|
|
17
|
+
};
|
|
18
|
+
reason?: string;
|
|
19
|
+
comment?: string;
|
|
20
|
+
status: 'SUCCESS' | 'FAILURE';
|
|
21
|
+
errorMessage?: string;
|
|
22
|
+
parentEntityType?: string;
|
|
23
|
+
parentEntityId?: string;
|
|
24
|
+
indexes: {
|
|
25
|
+
entity_lookup: string;
|
|
26
|
+
user_changes: string;
|
|
27
|
+
date_entity: string;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export declare const CHANGE_LOG_INDEXES: ({
|
|
31
|
+
keys: {
|
|
32
|
+
entityType: number;
|
|
33
|
+
entityId: number;
|
|
34
|
+
timestamp: number;
|
|
35
|
+
userId?: undefined;
|
|
36
|
+
'changes.field'?: undefined;
|
|
37
|
+
};
|
|
38
|
+
name: string;
|
|
39
|
+
expireAfterSeconds?: undefined;
|
|
40
|
+
} | {
|
|
41
|
+
keys: {
|
|
42
|
+
userId: number;
|
|
43
|
+
entityType: number;
|
|
44
|
+
timestamp: number;
|
|
45
|
+
entityId?: undefined;
|
|
46
|
+
'changes.field'?: undefined;
|
|
47
|
+
};
|
|
48
|
+
name: string;
|
|
49
|
+
expireAfterSeconds?: undefined;
|
|
50
|
+
} | {
|
|
51
|
+
keys: {
|
|
52
|
+
timestamp: number;
|
|
53
|
+
entityType: number;
|
|
54
|
+
entityId?: undefined;
|
|
55
|
+
userId?: undefined;
|
|
56
|
+
'changes.field'?: undefined;
|
|
57
|
+
};
|
|
58
|
+
name: string;
|
|
59
|
+
expireAfterSeconds?: undefined;
|
|
60
|
+
} | {
|
|
61
|
+
keys: {
|
|
62
|
+
'changes.field': number;
|
|
63
|
+
entityType?: undefined;
|
|
64
|
+
entityId?: undefined;
|
|
65
|
+
timestamp?: undefined;
|
|
66
|
+
userId?: undefined;
|
|
67
|
+
};
|
|
68
|
+
name: string;
|
|
69
|
+
expireAfterSeconds?: undefined;
|
|
70
|
+
} | {
|
|
71
|
+
keys: {
|
|
72
|
+
timestamp: number;
|
|
73
|
+
entityType?: undefined;
|
|
74
|
+
entityId?: undefined;
|
|
75
|
+
userId?: undefined;
|
|
76
|
+
'changes.field'?: undefined;
|
|
77
|
+
};
|
|
78
|
+
name: string;
|
|
79
|
+
expireAfterSeconds: number;
|
|
80
|
+
})[];
|
|
81
|
+
//# sourceMappingURL=ChangeLog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChangeLog.d.ts","sourceRoot":"","sources":["../../../src/backend/models/ChangeLog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,GAAG,CAAC;IACd,QAAQ,EAAE,GAAG,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,SAAU,SAAQ,YAAY;IAC7C,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IAGjB,OAAO,EAAE,WAAW,EAAE,CAAC;IAGvB,SAAS,EAAE;QACT,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IAGF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,SAAS,GAAG,SAAS,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IAGxB,OAAO,EAAE;QACP,aAAa,EAAE,MAAM,CAAC;QACtB,YAAY,EAAE,MAAM,CAAC;QACrB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AAED,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAM9B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CHANGE_LOG_INDEXES = void 0;
|
|
4
|
+
exports.CHANGE_LOG_INDEXES = [
|
|
5
|
+
{ keys: { entityType: 1, entityId: 1, timestamp: -1 }, name: 'entity_lookup_idx' },
|
|
6
|
+
{ keys: { userId: 1, entityType: 1, timestamp: -1 }, name: 'user_changes_idx' },
|
|
7
|
+
{ keys: { timestamp: -1, entityType: 1 }, name: 'date_entity_idx' },
|
|
8
|
+
{ keys: { 'changes.field': 1 }, name: 'field_changes_idx' },
|
|
9
|
+
{ keys: { timestamp: 1 }, name: 'timestamp_idx', expireAfterSeconds: 7776000 } // 90 days TTL
|
|
10
|
+
];
|
|
11
|
+
//# sourceMappingURL=ChangeLog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChangeLog.js","sourceRoot":"","sources":["../../../src/backend/models/ChangeLog.ts"],"names":[],"mappings":";;;AA0Ca,QAAA,kBAAkB,GAAG;IAChC,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,mBAAmB,EAAE;IAClF,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE;IAC/E,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE;IACnE,EAAE,IAAI,EAAE,EAAE,eAAe,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,mBAAmB,EAAE;IAC3D,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,kBAAkB,EAAE,OAAO,EAAE,CAAC,cAAc;CAC9F,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { BaseLogEntry } from '../../shared/types';
|
|
2
|
+
export interface ExportLog extends BaseLogEntry {
|
|
3
|
+
type: 'DATA_EXPORT';
|
|
4
|
+
exportType: 'CSV' | 'EXCEL' | 'PDF' | 'JSON';
|
|
5
|
+
fileName: string;
|
|
6
|
+
fileSize?: number;
|
|
7
|
+
recordCount: number;
|
|
8
|
+
filters?: Record<string, any>;
|
|
9
|
+
columns?: string[];
|
|
10
|
+
entityType?: string;
|
|
11
|
+
entityIds?: string[];
|
|
12
|
+
status: 'SUCCESS' | 'FAILED' | 'IN_PROGRESS';
|
|
13
|
+
errorMessage?: string;
|
|
14
|
+
downloadUrl?: string;
|
|
15
|
+
generationTime?: number;
|
|
16
|
+
fileHash?: string;
|
|
17
|
+
indexes: {
|
|
18
|
+
user_exports: string;
|
|
19
|
+
date_status: string;
|
|
20
|
+
file_tracking: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export declare const EXPORT_LOG_INDEXES: ({
|
|
24
|
+
keys: {
|
|
25
|
+
userId: number;
|
|
26
|
+
exportType: number;
|
|
27
|
+
timestamp: number;
|
|
28
|
+
status?: undefined;
|
|
29
|
+
fileName?: undefined;
|
|
30
|
+
};
|
|
31
|
+
name: string;
|
|
32
|
+
expireAfterSeconds?: undefined;
|
|
33
|
+
} | {
|
|
34
|
+
keys: {
|
|
35
|
+
timestamp: number;
|
|
36
|
+
status: number;
|
|
37
|
+
userId?: undefined;
|
|
38
|
+
exportType?: undefined;
|
|
39
|
+
fileName?: undefined;
|
|
40
|
+
};
|
|
41
|
+
name: string;
|
|
42
|
+
expireAfterSeconds?: undefined;
|
|
43
|
+
} | {
|
|
44
|
+
keys: {
|
|
45
|
+
fileName: number;
|
|
46
|
+
userId?: undefined;
|
|
47
|
+
exportType?: undefined;
|
|
48
|
+
timestamp?: undefined;
|
|
49
|
+
status?: undefined;
|
|
50
|
+
};
|
|
51
|
+
name: string;
|
|
52
|
+
expireAfterSeconds?: undefined;
|
|
53
|
+
} | {
|
|
54
|
+
keys: {
|
|
55
|
+
timestamp: number;
|
|
56
|
+
userId?: undefined;
|
|
57
|
+
exportType?: undefined;
|
|
58
|
+
status?: undefined;
|
|
59
|
+
fileName?: undefined;
|
|
60
|
+
};
|
|
61
|
+
name: string;
|
|
62
|
+
expireAfterSeconds: number;
|
|
63
|
+
})[];
|
|
64
|
+
//# sourceMappingURL=ExportLog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExportLog.d.ts","sourceRoot":"","sources":["../../../src/backend/models/ExportLog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,WAAW,SAAU,SAAQ,YAAY;IAC7C,IAAI,EAAE,aAAa,CAAC;IACpB,UAAU,EAAE,KAAK,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAGnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IAGrB,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,aAAa,CAAC;IAC7C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IAGrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,OAAO,EAAE;QACP,YAAY,EAAE,MAAM,CAAC;QACrB,WAAW,EAAE,MAAM,CAAC;QACpB,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;CACH;AAED,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAK9B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EXPORT_LOG_INDEXES = void 0;
|
|
4
|
+
exports.EXPORT_LOG_INDEXES = [
|
|
5
|
+
{ keys: { userId: 1, exportType: 1, timestamp: -1 }, name: 'user_exports_idx' },
|
|
6
|
+
{ keys: { timestamp: -1, status: 1 }, name: 'date_status_idx' },
|
|
7
|
+
{ keys: { fileName: 1 }, name: 'file_tracking_idx' },
|
|
8
|
+
{ keys: { timestamp: 1 }, name: 'timestamp_idx', expireAfterSeconds: 7776000 } // 90 days TTL
|
|
9
|
+
];
|
|
10
|
+
//# sourceMappingURL=ExportLog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExportLog.js","sourceRoot":"","sources":["../../../src/backend/models/ExportLog.ts"],"names":[],"mappings":";;;AAkCa,QAAA,kBAAkB,GAAG;IAChC,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE;IAC/E,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE;IAC/D,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,mBAAmB,EAAE;IACpD,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,kBAAkB,EAAE,OAAO,EAAE,CAAC,cAAc;CAC9F,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { BaseLogEntry } from '../../shared/types';
|
|
2
|
+
export interface ActivityPeriod {
|
|
3
|
+
startTime: Date;
|
|
4
|
+
endTime: Date;
|
|
5
|
+
duration: number;
|
|
6
|
+
type: 'ACTIVE' | 'IDLE';
|
|
7
|
+
lastActivityTime: Date;
|
|
8
|
+
}
|
|
9
|
+
export interface SessionLog extends BaseLogEntry {
|
|
10
|
+
type: 'LOGIN' | 'LOGOUT' | 'AUTO_LOGOUT' | 'SESSION_RESUME';
|
|
11
|
+
loginTime: Date;
|
|
12
|
+
logoutTime?: Date;
|
|
13
|
+
logoutReason?: 'USER' | 'TIMEOUT' | 'ERROR';
|
|
14
|
+
idleThreshold: number;
|
|
15
|
+
totalActiveDuration: number;
|
|
16
|
+
totalIdleDuration: number;
|
|
17
|
+
sessionDuration: number;
|
|
18
|
+
activityPeriods: ActivityPeriod[];
|
|
19
|
+
lastActivityTime: Date;
|
|
20
|
+
heartbeatCount: number;
|
|
21
|
+
lastHeartbeatTime: Date;
|
|
22
|
+
visibilityChanges: Array<{
|
|
23
|
+
timestamp: Date;
|
|
24
|
+
state: 'visible' | 'hidden';
|
|
25
|
+
duration?: number;
|
|
26
|
+
}>;
|
|
27
|
+
indexes: {
|
|
28
|
+
tenant_user_session: string;
|
|
29
|
+
login_date: string;
|
|
30
|
+
session_duration: string;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export declare const SESSION_LOG_INDEXES: ({
|
|
34
|
+
keys: {
|
|
35
|
+
tenantId: number;
|
|
36
|
+
userId: number;
|
|
37
|
+
sessionId: number;
|
|
38
|
+
loginTime?: undefined;
|
|
39
|
+
sessionDuration?: undefined;
|
|
40
|
+
'activityPeriods.startTime'?: undefined;
|
|
41
|
+
timestamp?: undefined;
|
|
42
|
+
};
|
|
43
|
+
name: string;
|
|
44
|
+
expireAfterSeconds?: undefined;
|
|
45
|
+
} | {
|
|
46
|
+
keys: {
|
|
47
|
+
loginTime: number;
|
|
48
|
+
tenantId?: undefined;
|
|
49
|
+
userId?: undefined;
|
|
50
|
+
sessionId?: undefined;
|
|
51
|
+
sessionDuration?: undefined;
|
|
52
|
+
'activityPeriods.startTime'?: undefined;
|
|
53
|
+
timestamp?: undefined;
|
|
54
|
+
};
|
|
55
|
+
name: string;
|
|
56
|
+
expireAfterSeconds?: undefined;
|
|
57
|
+
} | {
|
|
58
|
+
keys: {
|
|
59
|
+
sessionDuration: number;
|
|
60
|
+
tenantId?: undefined;
|
|
61
|
+
userId?: undefined;
|
|
62
|
+
sessionId?: undefined;
|
|
63
|
+
loginTime?: undefined;
|
|
64
|
+
'activityPeriods.startTime'?: undefined;
|
|
65
|
+
timestamp?: undefined;
|
|
66
|
+
};
|
|
67
|
+
name: string;
|
|
68
|
+
expireAfterSeconds?: undefined;
|
|
69
|
+
} | {
|
|
70
|
+
keys: {
|
|
71
|
+
'activityPeriods.startTime': number;
|
|
72
|
+
tenantId?: undefined;
|
|
73
|
+
userId?: undefined;
|
|
74
|
+
sessionId?: undefined;
|
|
75
|
+
loginTime?: undefined;
|
|
76
|
+
sessionDuration?: undefined;
|
|
77
|
+
timestamp?: undefined;
|
|
78
|
+
};
|
|
79
|
+
name: string;
|
|
80
|
+
expireAfterSeconds?: undefined;
|
|
81
|
+
} | {
|
|
82
|
+
keys: {
|
|
83
|
+
timestamp: number;
|
|
84
|
+
tenantId?: undefined;
|
|
85
|
+
userId?: undefined;
|
|
86
|
+
sessionId?: undefined;
|
|
87
|
+
loginTime?: undefined;
|
|
88
|
+
sessionDuration?: undefined;
|
|
89
|
+
'activityPeriods.startTime'?: undefined;
|
|
90
|
+
};
|
|
91
|
+
name: string;
|
|
92
|
+
expireAfterSeconds: number;
|
|
93
|
+
})[];
|
|
94
|
+
//# sourceMappingURL=SessionLog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SessionLog.d.ts","sourceRoot":"","sources":["../../../src/backend/models/SessionLog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA4B,MAAM,oBAAoB,CAAC;AAE5E,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,IAAI,CAAC;IAChB,OAAO,EAAE,IAAI,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC;IACxB,gBAAgB,EAAE,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,UAAW,SAAQ,YAAY;IAC9C,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,aAAa,GAAG,gBAAgB,CAAC;IAC5D,SAAS,EAAE,IAAI,CAAC;IAChB,UAAU,CAAC,EAAE,IAAI,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IAG5C,aAAa,EAAE,MAAM,CAAC;IACtB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IAGxB,eAAe,EAAE,cAAc,EAAE,CAAC;IAClC,gBAAgB,EAAE,IAAI,CAAC;IAGvB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,IAAI,CAAC;IAGxB,iBAAiB,EAAE,KAAK,CAAC;QACvB,SAAS,EAAE,IAAI,CAAC;QAChB,KAAK,EAAE,SAAS,GAAG,QAAQ,CAAC;QAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC,CAAC;IAGH,OAAO,EAAE;QACP,mBAAmB,EAAE,MAAM,CAAC;QAC5B,UAAU,EAAE,MAAM,CAAC;QACnB,gBAAgB,EAAE,MAAM,CAAC;KAC1B,CAAC;CACH;AAED,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAM/B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SESSION_LOG_INDEXES = void 0;
|
|
4
|
+
exports.SESSION_LOG_INDEXES = [
|
|
5
|
+
{ keys: { tenantId: 1, userId: 1, sessionId: 1 }, name: 'tenant_user_session_idx' },
|
|
6
|
+
{ keys: { loginTime: -1 }, name: 'login_time_idx' },
|
|
7
|
+
{ keys: { sessionDuration: -1 }, name: 'session_duration_idx' },
|
|
8
|
+
{ keys: { 'activityPeriods.startTime': 1 }, name: 'activity_periods_idx' },
|
|
9
|
+
{ keys: { timestamp: 1 }, name: 'timestamp_idx', expireAfterSeconds: 2592000 } // 30 days TTL
|
|
10
|
+
];
|
|
11
|
+
//# sourceMappingURL=SessionLog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SessionLog.js","sourceRoot":"","sources":["../../../src/backend/models/SessionLog.ts"],"names":[],"mappings":";;;AA6Ca,QAAA,mBAAmB,GAAG;IACjC,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,yBAAyB,EAAE;IACnF,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE;IACnD,EAAE,IAAI,EAAE,EAAE,eAAe,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,sBAAsB,EAAE;IAC/D,EAAE,IAAI,EAAE,EAAE,2BAA2B,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,sBAAsB,EAAE;IAC1E,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,kBAAkB,EAAE,OAAO,EAAE,CAAC,cAAc;CAC9F,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/backend/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
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("./AccessLog"), exports);
|
|
18
|
+
__exportStar(require("./SessionLog"), exports);
|
|
19
|
+
__exportStar(require("./ChangeLog"), exports);
|
|
20
|
+
__exportStar(require("./ExportLog"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/backend/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,+CAA6B;AAC7B,8CAA4B;AAC5B,8CAA4B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Db } from 'mongodb';
|
|
2
|
+
import { BaseRepository } from './BaseRepository';
|
|
3
|
+
import { AccessLog } from '../models/AccessLog';
|
|
4
|
+
import { DateRange } from '../../shared/types';
|
|
5
|
+
export declare class AccessLogRepository extends BaseRepository<AccessLog> {
|
|
6
|
+
constructor(db: Db);
|
|
7
|
+
logPageView(log: Omit<AccessLog, '_id' | 'type' | 'indexes'>): Promise<AccessLog>;
|
|
8
|
+
logAction(log: Omit<AccessLog, '_id' | 'type' | 'indexes'>): Promise<AccessLog>;
|
|
9
|
+
getUserTimeline(userId: string, dateRange: DateRange): Promise<AccessLog[]>;
|
|
10
|
+
getSessionActivities(sessionId: string): Promise<AccessLog[]>;
|
|
11
|
+
updateActivityDuration(logId: string, endTime: Date): Promise<AccessLog | null>;
|
|
12
|
+
private generateId;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=AccessLogRepository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccessLogRepository.d.ts","sourceRoot":"","sources":["../../../src/backend/repositories/AccessLogRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAsB,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAoB,MAAM,oBAAoB,CAAC;AAEjE,qBAAa,mBAAoB,SAAQ,cAAc,CAAC,SAAS,CAAC;gBACpD,EAAE,EAAE,EAAE;IAIZ,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;IAejF,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;IAe/E,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAO3E,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAI7D,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;IAYrF,OAAO,CAAC,UAAU;CAGnB"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AccessLogRepository = void 0;
|
|
4
|
+
const BaseRepository_1 = require("./BaseRepository");
|
|
5
|
+
const AccessLog_1 = require("../models/AccessLog");
|
|
6
|
+
class AccessLogRepository extends BaseRepository_1.BaseRepository {
|
|
7
|
+
constructor(db) {
|
|
8
|
+
super(db, 'access_logs', AccessLog_1.ACCESS_LOG_INDEXES);
|
|
9
|
+
}
|
|
10
|
+
async logPageView(log) {
|
|
11
|
+
const accessLog = {
|
|
12
|
+
...log,
|
|
13
|
+
_id: this.generateId(),
|
|
14
|
+
type: 'PAGE_OPEN',
|
|
15
|
+
indexes: {
|
|
16
|
+
tenant_user_date: `${log.tenantId}_${log.userId}_${log.timestamp.getTime()}`,
|
|
17
|
+
session_activity: `${log.sessionId}_${log.activityType}`,
|
|
18
|
+
page_tracking: `${log.pageId}_${log.timestamp.getTime()}`
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
return this.create(accessLog);
|
|
22
|
+
}
|
|
23
|
+
async logAction(log) {
|
|
24
|
+
const accessLog = {
|
|
25
|
+
...log,
|
|
26
|
+
_id: this.generateId(),
|
|
27
|
+
type: 'ACTION_PERFORMED',
|
|
28
|
+
indexes: {
|
|
29
|
+
tenant_user_date: `${log.tenantId}_${log.userId}_${log.timestamp.getTime()}`,
|
|
30
|
+
session_activity: `${log.sessionId}_${log.activityType}`,
|
|
31
|
+
page_tracking: `${log.pageId}_${log.timestamp.getTime()}`
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
return this.create(accessLog);
|
|
35
|
+
}
|
|
36
|
+
async getUserTimeline(userId, dateRange) {
|
|
37
|
+
return this.find({
|
|
38
|
+
userId,
|
|
39
|
+
timestamp: { $gte: dateRange.startDate, $lte: dateRange.endDate }
|
|
40
|
+
}, { sort: { timestamp: -1 } });
|
|
41
|
+
}
|
|
42
|
+
async getSessionActivities(sessionId) {
|
|
43
|
+
return this.find({ sessionId }, { sort: { timestamp: 1 } });
|
|
44
|
+
}
|
|
45
|
+
async updateActivityDuration(logId, endTime) {
|
|
46
|
+
const log = await this.findById(logId);
|
|
47
|
+
if (!log)
|
|
48
|
+
return null;
|
|
49
|
+
const duration = endTime.getTime() - new Date(log.startTime).getTime();
|
|
50
|
+
return this.update(logId, {
|
|
51
|
+
endTime,
|
|
52
|
+
activeDuration: duration
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
generateId() {
|
|
56
|
+
return `acc_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.AccessLogRepository = AccessLogRepository;
|
|
60
|
+
//# sourceMappingURL=AccessLogRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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'mongodb';
|
|
2
|
+
import { Logger } from '../utils/Logger';
|
|
3
|
+
export declare abstract class BaseRepository<T extends Document> {
|
|
4
|
+
protected db: Db;
|
|
5
|
+
protected collectionName: string;
|
|
6
|
+
protected indexes: any[];
|
|
7
|
+
protected collection: Collection<T>;
|
|
8
|
+
protected logger: Logger;
|
|
9
|
+
constructor(db: Db, collectionName: string, indexes: any[]);
|
|
10
|
+
initialize(): Promise<void>;
|
|
11
|
+
create(document: T): Promise<T>;
|
|
12
|
+
findById(id: string): Promise<T | null>;
|
|
13
|
+
find(filter: Filter<T>, options?: FindOptions): Promise<T[]>;
|
|
14
|
+
findOne(filter: Filter<T>): Promise<T | null>;
|
|
15
|
+
update(id: string, update: Partial<T>): Promise<T | null>;
|
|
16
|
+
delete(id: string): Promise<boolean>;
|
|
17
|
+
aggregate(pipeline: Document[]): Promise<any[]>;
|
|
18
|
+
private validateAggregationPipeline;
|
|
19
|
+
paginate(filter: Filter<T>, page: number, limit: number, sort?: {
|
|
20
|
+
[key: string]: 1 | -1;
|
|
21
|
+
}): Promise<{
|
|
22
|
+
data: T[];
|
|
23
|
+
total: number;
|
|
24
|
+
page: number;
|
|
25
|
+
totalPages: number;
|
|
26
|
+
}>;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=BaseRepository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseRepository.d.ts","sourceRoot":"","sources":["../../../src/backend/repositories/BaseRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,WAAW,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAClF,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,8BAAsB,cAAc,CAAC,CAAC,SAAS,QAAQ;IAKnD,SAAS,CAAC,EAAE,EAAE,EAAE;IAChB,SAAS,CAAC,cAAc,EAAE,MAAM;IAChC,SAAS,CAAC,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