@campxdev/server-shared 2.1.12 → 2.1.13

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.
Files changed (30) hide show
  1. package/dist/activity-logs/activity-logs.module.d.ts +7 -0
  2. package/dist/activity-logs/activity-logs.module.d.ts.map +1 -0
  3. package/dist/activity-logs/activity-logs.module.js +27 -0
  4. package/dist/activity-logs/activity-logs.module.js.map +1 -0
  5. package/dist/activity-logs/activity-logs.service.d.ts +115 -0
  6. package/dist/activity-logs/activity-logs.service.d.ts.map +1 -0
  7. package/dist/activity-logs/activity-logs.service.js +301 -0
  8. package/dist/activity-logs/activity-logs.service.js.map +1 -0
  9. package/dist/activity-logs/dtos/common-log-filter.dto.d.ts +12 -0
  10. package/dist/activity-logs/dtos/common-log-filter.dto.d.ts.map +1 -0
  11. package/dist/activity-logs/dtos/common-log-filter.dto.js +51 -0
  12. package/dist/activity-logs/dtos/common-log-filter.dto.js.map +1 -0
  13. package/dist/activity-logs/index.d.ts +4 -0
  14. package/dist/activity-logs/index.d.ts.map +1 -0
  15. package/dist/activity-logs/index.js +10 -0
  16. package/dist/activity-logs/index.js.map +1 -0
  17. package/dist/cloud-watch-logger/cloud-watch-logger.module.js +3 -3
  18. package/dist/cloud-watch-logger/{cloud-water-logger.service.d.ts → cloud-watch-logger.service.d.ts} +21 -12
  19. package/dist/cloud-watch-logger/cloud-watch-logger.service.d.ts.map +1 -0
  20. package/dist/cloud-watch-logger/{cloud-water-logger.service.js → cloud-watch-logger.service.js} +110 -56
  21. package/dist/cloud-watch-logger/cloud-watch-logger.service.js.map +1 -0
  22. package/dist/cloud-watch-logger/index.d.ts +1 -1
  23. package/dist/cloud-watch-logger/index.js +1 -1
  24. package/dist/index.d.ts +1 -0
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +1 -0
  27. package/dist/index.js.map +1 -1
  28. package/package.json +1 -1
  29. package/dist/cloud-watch-logger/cloud-water-logger.service.d.ts.map +0 -1
  30. package/dist/cloud-watch-logger/cloud-water-logger.service.js.map +0 -1
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Activity Logs Module
3
+ * Provides generic activity logging service for all microservice
4
+ */
5
+ export declare class ActivityLogsModule {
6
+ }
7
+ //# sourceMappingURL=activity-logs.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activity-logs.module.d.ts","sourceRoot":"","sources":["../../src/activity-logs/activity-logs.module.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,qBAKa,kBAAkB;CAAG"}
@@ -0,0 +1,27 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.ActivityLogsModule = void 0;
10
+ const common_1 = require("@nestjs/common");
11
+ const cloud_watch_logger_module_1 = require("../cloud-watch-logger/cloud-watch-logger.module");
12
+ const activity_logs_service_1 = require("./activity-logs.service");
13
+ /**
14
+ * Activity Logs Module
15
+ * Provides generic activity logging service for all microservice
16
+ */
17
+ let ActivityLogsModule = class ActivityLogsModule {
18
+ };
19
+ exports.ActivityLogsModule = ActivityLogsModule;
20
+ exports.ActivityLogsModule = ActivityLogsModule = __decorate([
21
+ (0, common_1.Module)({
22
+ imports: [cloud_watch_logger_module_1.CloudWatchLoggerModule],
23
+ providers: [activity_logs_service_1.ActivityLogsService],
24
+ exports: [activity_logs_service_1.ActivityLogsService],
25
+ })
26
+ ], ActivityLogsModule);
27
+ //# sourceMappingURL=activity-logs.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activity-logs.module.js","sourceRoot":"","sources":["../../src/activity-logs/activity-logs.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,+FAAyF;AACzF,mEAA8D;AAE9D;;;GAGG;AAMI,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;CAAG,CAAA;AAArB,gDAAkB;6BAAlB,kBAAkB;IAL9B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,kDAAsB,CAAC;QACjC,SAAS,EAAE,CAAC,2CAAmB,CAAC;QAChC,OAAO,EAAE,CAAC,2CAAmB,CAAC;KAC/B,CAAC;GACW,kBAAkB,CAAG"}
@@ -0,0 +1,115 @@
1
+ import { CloudWatchLoggerService } from '../cloud-watch-logger/cloud-watch-logger.service';
2
+ import { CommonLogFilterDto } from './dtos/common-log-filter.dto';
3
+ /**
4
+ * Transformed Log Entry (what frontend receives)
5
+ * Contains parsed message data plus metadata
6
+ */
7
+ export interface TransformedLogEntry {
8
+ timestamp: string | number;
9
+ message: string;
10
+ userName?: string;
11
+ action?: string;
12
+ [key: string]: any;
13
+ }
14
+ /**
15
+ * Generic Activity Logs Service
16
+ * Works for ALL microservices without any hardcoded mappings or custom logic
17
+ *
18
+ * Key Features:
19
+ * - Generic fetchLogs<T>() accepting any DTO extending CommonLogFilterDto
20
+ * - Dynamic query building - no hardcoded mappings
21
+ * - Timestamp-based pagination (CloudWatch native, verified against AWS docs)
22
+ * - Input sanitization - prevents CloudWatch query injection
23
+ * - Retry logic - exponential backoff for CloudWatch throttling
24
+ * - Hierarchical log groups - {subDomain}/{institutionCode}/{serviceName}
25
+ *
26
+ * @example
27
+ * // Logging:
28
+ * await activityLogsService.logEvent({
29
+ * streamType: 'd-forms',
30
+ * examId: 123,
31
+ * type: 'external',
32
+ * action: 'mark',
33
+ * message: 'D-Form marked',
34
+ * });
35
+ *
36
+ * // Querying:
37
+ * const result = await activityLogsService.fetchLogs({
38
+ * streamType: 'd-forms',
39
+ * examId: 123,
40
+ * type: 'external',
41
+ * limit: 10,
42
+ * });
43
+ */
44
+ export declare class ActivityLogsService {
45
+ private readonly cloudWatchLogger;
46
+ private readonly logger;
47
+ constructor(cloudWatchLogger: CloudWatchLoggerService);
48
+ /**
49
+ * Fetch activity logs with dynamic filtering and timestamp-based pagination
50
+ * Works with any DTO extending CommonLogFilterDto
51
+ *
52
+ * CloudWatch Logs Insights Query Structure:
53
+ * - Filters by @logStream = streamType
54
+ * - Dynamically adds all other DTO fields as filters
55
+ * - Uses @timestamp < lastTimestamp for pagination (CloudWatch native)
56
+ * - Fetches limit+1 to detect if more results exist
57
+ *
58
+ * @throws Error if CloudWatch query fails after 3 retry attempts
59
+ */
60
+ fetchLogs<T extends CommonLogFilterDto>(query: T | Record<string, any>): Promise<TransformedLogEntry[]>;
61
+ /**
62
+ * Log an event to CloudWatch with automatic context enrichment
63
+ * Works for ANY microservice and log type
64
+ *
65
+ * Features:
66
+ * - Retry logic with exponential backoff (2s, 4s, 8s)
67
+ * - Input sanitization for query injection prevention
68
+ * - Automatic context enrichment (tenantId, institutionId, userId, userName)
69
+ * - Timestamp included in all logs
70
+ *
71
+ * @throws Error if logging fails after all retry attempts
72
+ */
73
+ logEvent(data: Record<string, any>, retries?: number): Promise<void>;
74
+ /**
75
+ * Internal method that performs actual logging with retries
76
+ * This runs in the background and doesn't block the caller
77
+ *
78
+ * @private
79
+ * @param data - Event data to log
80
+ * @param retries - Number of retry attempts
81
+ */
82
+ private logEventInBackground;
83
+ /**
84
+ * Get hierarchical log group name based on tenant and institution
85
+ * Hierarchical structure: {subDomain}/{institutionCode}/{serviceName}
86
+ * Examples: exams.com/mit/exams, stanford.edu/cse/exams
87
+ *
88
+ * Benefits:
89
+ * - Automatic tenant/institution isolation (no filter needed!)
90
+ * - 90-95% CloudWatch scan volume reduction
91
+ * - Log group selection = fast path filtering
92
+ */
93
+ private getLogGroupName;
94
+ /**
95
+ * Transform raw CloudWatch log events into user-friendly format
96
+ * Parses JSON message and extracts key fields
97
+ */
98
+ private transformLogs;
99
+ /**
100
+ * Sanitize filter values to prevent CloudWatch query injection
101
+ * Escapes special characters that could break CloudWatch query syntax
102
+ *
103
+ * Characters escaped:
104
+ * - Backslashes (\)
105
+ * - Double quotes (")
106
+ * - Newlines (\n)
107
+ * - Carriage returns (\r)
108
+ *
109
+ * @private
110
+ * @param value - Raw value to sanitize
111
+ * @returns Sanitized value safe for CloudWatch query
112
+ */
113
+ private sanitizeValue;
114
+ }
115
+ //# sourceMappingURL=activity-logs.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activity-logs.service.d.ts","sourceRoot":"","sources":["../../src/activity-logs/activity-logs.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,kDAAkD,CAAC;AAE3F,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,qBACa,mBAAmB;IAGlB,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAF7C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwC;gBAElC,gBAAgB,EAAE,uBAAuB;IAEtE;;;;;;;;;;;OAWG;IACG,SAAS,CAAC,CAAC,SAAS,kBAAkB,EAC1C,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC7B,OAAO,CAAC,mBAAmB,EAAE,CAAC;IA+EjC;;;;;;;;;;;OAWG;IACG,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,SAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBrE;;;;;;;OAOG;YACW,oBAAoB;IAoDlC;;;;;;;;;OASG;IACH,OAAO,CAAC,eAAe;IAMvB;;;OAGG;IACH,OAAO,CAAC,aAAa;IA+CrB;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,aAAa;CAUtB"}
@@ -0,0 +1,301 @@
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 ActivityLogsService_1;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.ActivityLogsService = void 0;
14
+ const common_1 = require("@nestjs/common");
15
+ const cloud_watch_logger_service_1 = require("../cloud-watch-logger/cloud-watch-logger.service");
16
+ const request_store_1 = require("../request-store");
17
+ /**
18
+ * Generic Activity Logs Service
19
+ * Works for ALL microservices without any hardcoded mappings or custom logic
20
+ *
21
+ * Key Features:
22
+ * - Generic fetchLogs<T>() accepting any DTO extending CommonLogFilterDto
23
+ * - Dynamic query building - no hardcoded mappings
24
+ * - Timestamp-based pagination (CloudWatch native, verified against AWS docs)
25
+ * - Input sanitization - prevents CloudWatch query injection
26
+ * - Retry logic - exponential backoff for CloudWatch throttling
27
+ * - Hierarchical log groups - {subDomain}/{institutionCode}/{serviceName}
28
+ *
29
+ * @example
30
+ * // Logging:
31
+ * await activityLogsService.logEvent({
32
+ * streamType: 'd-forms',
33
+ * examId: 123,
34
+ * type: 'external',
35
+ * action: 'mark',
36
+ * message: 'D-Form marked',
37
+ * });
38
+ *
39
+ * // Querying:
40
+ * const result = await activityLogsService.fetchLogs({
41
+ * streamType: 'd-forms',
42
+ * examId: 123,
43
+ * type: 'external',
44
+ * limit: 10,
45
+ * });
46
+ */
47
+ let ActivityLogsService = ActivityLogsService_1 = class ActivityLogsService {
48
+ cloudWatchLogger;
49
+ logger = new common_1.Logger(ActivityLogsService_1.name);
50
+ constructor(cloudWatchLogger) {
51
+ this.cloudWatchLogger = cloudWatchLogger;
52
+ }
53
+ /**
54
+ * Fetch activity logs with dynamic filtering and timestamp-based pagination
55
+ * Works with any DTO extending CommonLogFilterDto
56
+ *
57
+ * CloudWatch Logs Insights Query Structure:
58
+ * - Filters by @logStream = streamType
59
+ * - Dynamically adds all other DTO fields as filters
60
+ * - Uses @timestamp < lastTimestamp for pagination (CloudWatch native)
61
+ * - Fetches limit+1 to detect if more results exist
62
+ *
63
+ * @throws Error if CloudWatch query fails after 3 retry attempts
64
+ */
65
+ async fetchLogs(query) {
66
+ const { streamType, limit = 10, cursor, ...otherFilters } = query;
67
+ // Validate required streamType
68
+ if (!streamType || typeof streamType !== 'string') {
69
+ throw new Error('streamType is required and must be a string');
70
+ }
71
+ const filterClauses = [`@logStream = "${this.sanitizeValue(streamType)}"`];
72
+ // Pagination: Use cursor (ISO 8601 timestamp) for pagination
73
+ // Fetch logs BEFORE this timestamp for infinite scroll
74
+ let paginationTimestamp;
75
+ if (cursor && typeof cursor === 'string') {
76
+ try {
77
+ const parsedTime = new Date(cursor).getTime();
78
+ if (!isNaN(parsedTime)) {
79
+ paginationTimestamp = parsedTime;
80
+ filterClauses.push(`@timestamp < ${paginationTimestamp}`);
81
+ }
82
+ }
83
+ catch (error) {
84
+ this.logger.warn('Invalid cursor format, ignoring pagination', { cursor });
85
+ }
86
+ }
87
+ // DYNAMIC: Add ALL other filters from DTO (examId, type, classroomId, etc.)
88
+ for (const [key, value] of Object.entries(otherFilters)) {
89
+ if (value !== null && value !== undefined && key !== 'cursor') {
90
+ if (Array.isArray(value)) {
91
+ // Handle array filters (e.g., action: ['create', 'update'])
92
+ const arrayFilters = value
93
+ .filter((v) => v !== null && v !== undefined)
94
+ .map((v) => `${key} = "${this.sanitizeValue(v)}"`)
95
+ .join(' or ');
96
+ if (arrayFilters) {
97
+ filterClauses.push(`(${arrayFilters})`);
98
+ }
99
+ }
100
+ else {
101
+ filterClauses.push(`${key} = "${this.sanitizeValue(value)}"`);
102
+ }
103
+ }
104
+ }
105
+ // PAGINATION: Fetch limit+1 to detect if more results exist
106
+ // If we get more than limit records, we know hasMore=true
107
+ const queryString = `
108
+ fields @timestamp, @message
109
+ | filter ${filterClauses.join(' and ')}
110
+ | sort @timestamp desc
111
+ | limit ${limit + 1}
112
+ `;
113
+ const logGroupName = this.getLogGroupName();
114
+ // Get log events from CloudWatch
115
+ const logEvents = await this.cloudWatchLogger.getLogEvents(logGroupName, queryString);
116
+ // Validate CloudWatch returned data
117
+ if (!logEvents || !Array.isArray(logEvents)) {
118
+ return [];
119
+ }
120
+ const logs = this.transformLogs(logEvents);
121
+ // Pagination: Check if limit+1 was returned
122
+ const hasMore = logs.length > limit;
123
+ const resultLogs = hasMore ? logs.slice(0, limit) : logs;
124
+ // Add cursor field for pagination
125
+ // Frontend will use the timestamp of the last log as cursor for next page
126
+ const logsWithCursor = resultLogs.map((log) => ({
127
+ ...log,
128
+ cursor: log.timestamp, // ISO 8601 timestamp for next page pagination
129
+ }));
130
+ // Return just the array (component expects array, not object with logs property)
131
+ return logsWithCursor;
132
+ }
133
+ /**
134
+ * Log an event to CloudWatch with automatic context enrichment
135
+ * Works for ANY microservice and log type
136
+ *
137
+ * Features:
138
+ * - Retry logic with exponential backoff (2s, 4s, 8s)
139
+ * - Input sanitization for query injection prevention
140
+ * - Automatic context enrichment (tenantId, institutionId, userId, userName)
141
+ * - Timestamp included in all logs
142
+ *
143
+ * @throws Error if logging fails after all retry attempts
144
+ */
145
+ async logEvent(data, retries = 3) {
146
+ const { streamType, ...logData } = data;
147
+ if (!streamType || typeof streamType !== 'string') {
148
+ throw new Error('streamType is required for logging and must be a string');
149
+ }
150
+ // FIRE-AND-FORGET PATTERN:
151
+ // Start logging in background WITHOUT blocking the caller
152
+ this.logEventInBackground(data, retries).catch((err) => {
153
+ // Silent catch - log errors only to logger, never throw to caller
154
+ this.logger.error('Background logging failed (non-blocking)', {
155
+ streamType,
156
+ error: err instanceof Error ? err.message : String(err),
157
+ });
158
+ });
159
+ // Return immediately - caller doesn't wait for logging
160
+ return;
161
+ }
162
+ /**
163
+ * Internal method that performs actual logging with retries
164
+ * This runs in the background and doesn't block the caller
165
+ *
166
+ * @private
167
+ * @param data - Event data to log
168
+ * @param retries - Number of retry attempts
169
+ */
170
+ async logEventInBackground(data, retries) {
171
+ const { streamType, ...logData } = data;
172
+ // RETRY LOGIC: Exponential backoff for CloudWatch rate limits
173
+ for (let attempt = 1; attempt <= retries; attempt++) {
174
+ try {
175
+ const logGroupName = this.getLogGroupName();
176
+ const params = {
177
+ logGroupName,
178
+ logStreamName: streamType, // Stream name = streamType (no entityId in stream name!)
179
+ message: JSON.stringify({
180
+ ...logData,
181
+ tenantId: (0, request_store_1.getTenantDetails)().id,
182
+ institutionId: (0, request_store_1.getInstitution)().id,
183
+ userId: (0, request_store_1.getUserData)()?.userId,
184
+ userName: (0, request_store_1.getUserData)()?.username,
185
+ timestamp: Date.now(),
186
+ }),
187
+ };
188
+ await this.cloudWatchLogger.putLogEvents(params);
189
+ return; // Success - exit retry loop
190
+ }
191
+ catch (err) {
192
+ const errorMessage = err instanceof Error ? err.message : String(err);
193
+ if (attempt === retries) {
194
+ // Final attempt failed - log error but don't throw (fire-and-forget)
195
+ this.logger.error(`Failed to log event to CloudWatch after ${retries} attempts`, {
196
+ streamType,
197
+ logData,
198
+ error: errorMessage,
199
+ });
200
+ return; // Exit without throwing
201
+ }
202
+ // Log retry attempt
203
+ const backoffTime = Math.pow(2, attempt) * 1000;
204
+ this.logger.debug(`CloudWatch logging attempt ${attempt} failed, retrying in ${backoffTime}ms`, {
205
+ streamType,
206
+ error: errorMessage,
207
+ });
208
+ // Exponential backoff: 2s, 4s, 8s
209
+ await new Promise((r) => setTimeout(r, backoffTime));
210
+ }
211
+ }
212
+ }
213
+ /**
214
+ * Get hierarchical log group name based on tenant and institution
215
+ * Hierarchical structure: {subDomain}/{institutionCode}/{serviceName}
216
+ * Examples: exams.com/mit/exams, stanford.edu/cse/exams
217
+ *
218
+ * Benefits:
219
+ * - Automatic tenant/institution isolation (no filter needed!)
220
+ * - 90-95% CloudWatch scan volume reduction
221
+ * - Log group selection = fast path filtering
222
+ */
223
+ getLogGroupName() {
224
+ return `${(0, request_store_1.getTenantDetails)().subDomain}/${(0, request_store_1.getInstitution)().code}/${process.env.CLOUDWATCH_SERVICE_NAME}`;
225
+ }
226
+ /**
227
+ * Transform raw CloudWatch log events into user-friendly format
228
+ * Parses JSON message and extracts key fields
229
+ */
230
+ transformLogs(logEvents) {
231
+ return logEvents.flatMap((logEvent) => {
232
+ const messageEntry = logEvent.find((e) => e.field === '@message');
233
+ if (!messageEntry) {
234
+ return [];
235
+ }
236
+ try {
237
+ const msgObj = JSON.parse(messageEntry.value);
238
+ // Validate timestamp exists and is a valid number
239
+ if (!msgObj?.timestamp || typeof msgObj.timestamp !== 'number') {
240
+ this.logger.warn('Missing or invalid timestamp in log message', {
241
+ value: messageEntry.value,
242
+ });
243
+ return [];
244
+ }
245
+ // Use the timestamp from the logged message (Date.now() when log was created)
246
+ // NOT @timestamp which is when CloudWatch received the log
247
+ const timestampMs = msgObj.timestamp;
248
+ const isoTimestamp = new Date(timestampMs).toISOString();
249
+ // IMPORTANT: Remove timestamp from msgObj to avoid duplicates
250
+ const { timestamp: _, ...msgObjWithoutTimestamp } = msgObj;
251
+ return [
252
+ {
253
+ timestamp: isoTimestamp, // ISO 8601 UTC format for frontend
254
+ message: msgObj?.message || '',
255
+ userName: msgObj?.userName || '',
256
+ action: msgObj?.action || '',
257
+ ...msgObjWithoutTimestamp, // Include all fields from log message EXCEPT the raw timestamp
258
+ },
259
+ ];
260
+ }
261
+ catch (error) {
262
+ const errorMsg = error instanceof Error ? error.message : String(error);
263
+ this.logger.error('Failed to parse CloudWatch message', {
264
+ value: messageEntry.value,
265
+ error: errorMsg,
266
+ });
267
+ return [];
268
+ }
269
+ });
270
+ }
271
+ /**
272
+ * Sanitize filter values to prevent CloudWatch query injection
273
+ * Escapes special characters that could break CloudWatch query syntax
274
+ *
275
+ * Characters escaped:
276
+ * - Backslashes (\)
277
+ * - Double quotes (")
278
+ * - Newlines (\n)
279
+ * - Carriage returns (\r)
280
+ *
281
+ * @private
282
+ * @param value - Raw value to sanitize
283
+ * @returns Sanitized value safe for CloudWatch query
284
+ */
285
+ sanitizeValue(value) {
286
+ if (value === null || value === undefined) {
287
+ return '';
288
+ }
289
+ return String(value)
290
+ .replace(/\\/g, '\\\\') // Escape backslashes first!
291
+ .replace(/"/g, '\\"') // Escape quotes
292
+ .replace(/\n/g, '\\n') // Escape newlines
293
+ .replace(/\r/g, '\\r'); // Escape carriage returns
294
+ }
295
+ };
296
+ exports.ActivityLogsService = ActivityLogsService;
297
+ exports.ActivityLogsService = ActivityLogsService = ActivityLogsService_1 = __decorate([
298
+ (0, common_1.Injectable)(),
299
+ __metadata("design:paramtypes", [cloud_watch_logger_service_1.CloudWatchLoggerService])
300
+ ], ActivityLogsService);
301
+ //# sourceMappingURL=activity-logs.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activity-logs.service.js","sourceRoot":"","sources":["../../src/activity-logs/activity-logs.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,iGAA2F;AAC3F,oDAAiF;AAejF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEI,IAAM,mBAAmB,2BAAzB,MAAM,mBAAmB;IAGD;IA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tD,CAAC;CACF,CAAA;AAzRY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;qCAIoC,oDAAuB;GAH3D,mBAAmB,CAyR/B"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Common Log Filter DTO - Base class for all activity log queries
3
+ * Microservices extend this DTO with their specific entity filters
4
+ */
5
+ export declare class CommonLogFilterDto {
6
+ streamType: string;
7
+ limit?: number;
8
+ fromDate?: string;
9
+ toDate?: string;
10
+ cursor?: string;
11
+ }
12
+ //# sourceMappingURL=common-log-filter.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common-log-filter.dto.d.ts","sourceRoot":"","sources":["../../../src/activity-logs/dtos/common-log-filter.dto.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,qBAAa,kBAAkB;IAG7B,UAAU,EAAE,MAAM,CAAC;IAInB,KAAK,CAAC,EAAE,MAAM,CAAC;IAIf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAIlB,MAAM,CAAC,EAAE,MAAM,CAAC;IAIhB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
@@ -0,0 +1,51 @@
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.CommonLogFilterDto = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ /**
15
+ * Common Log Filter DTO - Base class for all activity log queries
16
+ * Microservices extend this DTO with their specific entity filters
17
+ */
18
+ class CommonLogFilterDto {
19
+ streamType;
20
+ limit;
21
+ fromDate;
22
+ toDate;
23
+ cursor;
24
+ }
25
+ exports.CommonLogFilterDto = CommonLogFilterDto;
26
+ __decorate([
27
+ (0, class_validator_1.IsNotEmpty)(),
28
+ (0, class_validator_1.IsString)(),
29
+ __metadata("design:type", String)
30
+ ], CommonLogFilterDto.prototype, "streamType", void 0);
31
+ __decorate([
32
+ (0, class_validator_1.IsOptional)(),
33
+ (0, class_validator_1.IsNumber)(),
34
+ __metadata("design:type", Number)
35
+ ], CommonLogFilterDto.prototype, "limit", void 0);
36
+ __decorate([
37
+ (0, class_validator_1.IsOptional)(),
38
+ (0, class_validator_1.IsString)(),
39
+ __metadata("design:type", String)
40
+ ], CommonLogFilterDto.prototype, "fromDate", void 0);
41
+ __decorate([
42
+ (0, class_validator_1.IsOptional)(),
43
+ (0, class_validator_1.IsString)(),
44
+ __metadata("design:type", String)
45
+ ], CommonLogFilterDto.prototype, "toDate", void 0);
46
+ __decorate([
47
+ (0, class_validator_1.IsOptional)(),
48
+ (0, class_validator_1.IsString)(),
49
+ __metadata("design:type", String)
50
+ ], CommonLogFilterDto.prototype, "cursor", void 0);
51
+ //# sourceMappingURL=common-log-filter.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common-log-filter.dto.js","sourceRoot":"","sources":["../../../src/activity-logs/dtos/common-log-filter.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA6E;AAE7E;;;GAGG;AACH,MAAa,kBAAkB;IAG7B,UAAU,CAAS;IAInB,KAAK,CAAU;IAIf,QAAQ,CAAU;IAIlB,MAAM,CAAU;IAIhB,MAAM,CAAU;CACjB;AApBD,gDAoBC;AAjBC;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;sDACQ;AAInB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;iDACI;AAIf;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;oDACO;AAIlB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;kDACK;AAIhB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;kDACK"}
@@ -0,0 +1,4 @@
1
+ export { ActivityLogsModule } from './activity-logs.module';
2
+ export { ActivityLogsService } from './activity-logs.service';
3
+ export { CommonLogFilterDto } from './dtos/common-log-filter.dto';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/activity-logs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CommonLogFilterDto = exports.ActivityLogsService = exports.ActivityLogsModule = void 0;
4
+ var activity_logs_module_1 = require("./activity-logs.module");
5
+ Object.defineProperty(exports, "ActivityLogsModule", { enumerable: true, get: function () { return activity_logs_module_1.ActivityLogsModule; } });
6
+ var activity_logs_service_1 = require("./activity-logs.service");
7
+ Object.defineProperty(exports, "ActivityLogsService", { enumerable: true, get: function () { return activity_logs_service_1.ActivityLogsService; } });
8
+ var common_log_filter_dto_1 = require("./dtos/common-log-filter.dto");
9
+ Object.defineProperty(exports, "CommonLogFilterDto", { enumerable: true, get: function () { return common_log_filter_dto_1.CommonLogFilterDto; } });
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/activity-logs/index.ts"],"names":[],"mappings":";;;AAAA,+DAA4D;AAAnD,0HAAA,kBAAkB,OAAA;AAC3B,iEAA8D;AAArD,4HAAA,mBAAmB,OAAA;AAC5B,sEAAkE;AAAzD,2HAAA,kBAAkB,OAAA"}
@@ -8,7 +8,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.CloudWatchLoggerModule = void 0;
10
10
  const common_1 = require("@nestjs/common");
11
- const cloud_water_logger_service_1 = require("./cloud-water-logger.service");
11
+ const cloud_watch_logger_service_1 = require("./cloud-watch-logger.service");
12
12
  /**
13
13
  * Description
14
14
  * This module is responsible for logging using AWS CloudWatch.
@@ -19,8 +19,8 @@ let CloudWatchLoggerModule = class CloudWatchLoggerModule {
19
19
  exports.CloudWatchLoggerModule = CloudWatchLoggerModule;
20
20
  exports.CloudWatchLoggerModule = CloudWatchLoggerModule = __decorate([
21
21
  (0, common_1.Module)({
22
- providers: [cloud_water_logger_service_1.CloudWatchLoggerService],
23
- exports: [cloud_water_logger_service_1.CloudWatchLoggerService],
22
+ providers: [cloud_watch_logger_service_1.CloudWatchLoggerService],
23
+ exports: [cloud_watch_logger_service_1.CloudWatchLoggerService],
24
24
  })
25
25
  ], CloudWatchLoggerModule);
26
26
  //# sourceMappingURL=cloud-watch-logger.module.js.map
@@ -1,3 +1,4 @@
1
+ import { ResultField } from '@aws-sdk/client-cloudwatch-logs';
1
2
  import { PutLogEventDto } from './dtos/put-log-event.dto';
2
3
  /**
3
4
  * @class CloudWatchLoggerService
@@ -6,6 +7,7 @@ import { PutLogEventDto } from './dtos/put-log-event.dto';
6
7
  * @exports CloudWatchLoggerService
7
8
  */
8
9
  export declare class CloudWatchLoggerService {
10
+ private readonly logger;
9
11
  /**
10
12
  * AWS CloudWatch Logs client instance used to interact with CloudWatch services.
11
13
  * @private
@@ -17,29 +19,36 @@ export declare class CloudWatchLoggerService {
17
19
  * Initializes the CloudWatchLogsClient with the AWS credentials.
18
20
  */
19
21
  constructor();
22
+ /**
23
+ * Creates a log group in CloudWatch.
24
+ * @param logGroupName - The name of the log group to create.
25
+ * @returns A promise that resolves to the response from creating the log group.
26
+ */
27
+ private createLogGroup;
28
+ /**
29
+ * Checks if a log stream exists in the specified log group.
30
+ * @param logGroupName - The name of the log group.
31
+ * @param logStreamName - The name of the log stream to check.
32
+ * @returns True if the stream exists, false otherwise.
33
+ */
34
+ private logStreamExists;
20
35
  /**
21
36
  * Creates a log stream in the specified log group.
37
+ * Ensures the log group exists first before creating the stream.
38
+ * Checks if stream already exists to avoid duplicates.
22
39
  * @param logGroupName - The name of the log group to which the stream belongs.
23
40
  * @param logStreamName - The unique name of the log stream to be created.
24
41
  * @returns A promise that resolves to the response from creating the log stream.
25
42
  * @throws UnprocessableEntityException if there is an error creating the log stream.
26
43
  */
27
- createLogStream(logGroupName: string, logStreamName: string): Promise<any>;
44
+ private createLogStream;
28
45
  /**
29
46
  * Writes log events to a CloudWatch log stream.
30
47
  * @param data - The log event data.
31
48
  * @returns A promise that resolves with the response from CloudWatch.
32
49
  * @throws UnprocessableEntityException if there is an error writing the log event.
33
50
  */
34
- putLogEvents(data: PutLogEventDto): Promise<any>;
35
- /**
36
- * Retrieves the sequence token for a given log stream in a log group.
37
- * @param logGroupName - The name of the log group.
38
- * @param logStreamName - The name of the log stream.
39
- * @returns A promise that resolves to the sequence token of the log stream.
40
- * @throws UnprocessableEntityException if there is an error retrieving the sequence token.
41
- */
42
- getSequenceTokenForLogStream(logGroupName: string, logStreamName: string): Promise<string>;
51
+ putLogEvents(data: PutLogEventDto): Promise<void>;
43
52
  /**
44
53
  * Polls CloudWatch Logs to retrieve results for the specified query.
45
54
  * Waits until the query is completed or times out.
@@ -48,6 +57,6 @@ export declare class CloudWatchLoggerService {
48
57
  * @returns A promise that resolves to an array of log event results.
49
58
  * @throws UnprocessableEntityException if there is an error retrieving the logs.
50
59
  */
51
- getLogEvents(logGroupName: string, query: string): Promise<any>;
60
+ getLogEvents(logGroupName: string, query: string): Promise<ResultField[][]>;
52
61
  }
53
- //# sourceMappingURL=cloud-water-logger.service.d.ts.map
62
+ //# sourceMappingURL=cloud-watch-logger.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloud-watch-logger.service.d.ts","sourceRoot":"","sources":["../../src/cloud-watch-logger/cloud-watch-logger.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAWL,WAAW,EAIZ,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D;;;;;GAKG;AACH,qBACa,uBAAuB;IAClC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA4C;IAEnE;;;OAGG;IACH,OAAO,CAAC,gBAAgB,CAAuB;IAE/C;;;;OAIG;;IAWH;;;;OAIG;YACW,cAAc;IAgB5B;;;;;OAKG;YACW,eAAe;IAe7B;;;;;;;;OAQG;YACW,eAAe;IAoB7B;;;;;OAKG;IACG,YAAY,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAwCvD;;;;;;;OAOG;IACG,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;CA2DlF"}
@@ -8,6 +8,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  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
+ var CloudWatchLoggerService_1;
11
12
  Object.defineProperty(exports, "__esModule", { value: true });
12
13
  exports.CloudWatchLoggerService = void 0;
13
14
  const client_cloudwatch_logs_1 = require("@aws-sdk/client-cloudwatch-logs");
@@ -18,7 +19,8 @@ const common_1 = require("@nestjs/common");
18
19
  * This service provides methods to create log streams, write log events, and retrieve log events from CloudWatch Logs.
19
20
  * @exports CloudWatchLoggerService
20
21
  */
21
- let CloudWatchLoggerService = class CloudWatchLoggerService {
22
+ let CloudWatchLoggerService = CloudWatchLoggerService_1 = class CloudWatchLoggerService {
23
+ logger = new common_1.Logger(CloudWatchLoggerService_1.name);
22
24
  /**
23
25
  * AWS CloudWatch Logs client instance used to interact with CloudWatch services.
24
26
  * @private
@@ -39,81 +41,111 @@ let CloudWatchLoggerService = class CloudWatchLoggerService {
39
41
  });
40
42
  }
41
43
  /**
42
- * Creates a log stream in the specified log group.
43
- * @param logGroupName - The name of the log group to which the stream belongs.
44
- * @param logStreamName - The unique name of the log stream to be created.
45
- * @returns A promise that resolves to the response from creating the log stream.
46
- * @throws UnprocessableEntityException if there is an error creating the log stream.
44
+ * Creates a log group in CloudWatch.
45
+ * @param logGroupName - The name of the log group to create.
46
+ * @returns A promise that resolves to the response from creating the log group.
47
47
  */
48
- async createLogStream(logGroupName, logStreamName) {
48
+ async createLogGroup(logGroupName) {
49
49
  const params = {
50
50
  logGroupName,
51
- logStreamName,
52
51
  };
53
52
  try {
54
- const command = new client_cloudwatch_logs_1.CreateLogStreamCommand(params);
53
+ const command = new client_cloudwatch_logs_1.CreateLogGroupCommand(params);
55
54
  const response = await this.cloudWatchClient.send(command);
56
55
  return response;
57
56
  }
58
57
  catch (error) {
59
- throw new common_1.UnprocessableEntityException(`Error creating log stream ${params.logGroupName}-${params.logStreamName}`, error);
58
+ if (error.name === 'ResourceAlreadyExistsException') {
59
+ return;
60
+ }
61
+ throw error;
60
62
  }
61
63
  }
62
64
  /**
63
- * Writes log events to a CloudWatch log stream.
64
- * @param data - The log event data.
65
- * @returns A promise that resolves with the response from CloudWatch.
66
- * @throws UnprocessableEntityException if there is an error writing the log event.
65
+ * Checks if a log stream exists in the specified log group.
66
+ * @param logGroupName - The name of the log group.
67
+ * @param logStreamName - The name of the log stream to check.
68
+ * @returns True if the stream exists, false otherwise.
67
69
  */
68
- async putLogEvents(data) {
69
- const sequenceToken = await this.getSequenceTokenForLogStream(data.logGroupName, data.logStreamName);
70
- const params = {
71
- logGroupName: data.logGroupName,
72
- logStreamName: data.logStreamName,
73
- logEvents: [
74
- {
75
- message: data.message,
76
- timestamp: Date.now(),
77
- },
78
- ],
79
- sequenceToken,
80
- };
70
+ async logStreamExists(logGroupName, logStreamName) {
81
71
  try {
82
- const command = new client_cloudwatch_logs_1.PutLogEventsCommand(params);
72
+ const params = {
73
+ logGroupName,
74
+ logStreamNamePrefix: logStreamName,
75
+ };
76
+ const command = new client_cloudwatch_logs_1.DescribeLogStreamsCommand(params);
83
77
  const response = await this.cloudWatchClient.send(command);
84
- return response;
78
+ const exists = response.logStreams?.some((stream) => stream.logStreamName === logStreamName);
79
+ return exists || false;
85
80
  }
86
81
  catch (error) {
87
- if (error.name === 'ResourceNotFoundException') {
88
- console.log('Log stream not found. Creating log stream...');
89
- await this.createLogStream(data.logGroupName, data.logStreamName);
90
- return this.putLogEvents(data);
91
- }
92
- else {
93
- throw new common_1.UnprocessableEntityException(`Error logging message to ${params.logGroupName} in ${params.logStreamName} stream`, error);
94
- }
82
+ return false;
95
83
  }
96
84
  }
97
85
  /**
98
- * Retrieves the sequence token for a given log stream in a log group.
99
- * @param logGroupName - The name of the log group.
100
- * @param logStreamName - The name of the log stream.
101
- * @returns A promise that resolves to the sequence token of the log stream.
102
- * @throws UnprocessableEntityException if there is an error retrieving the sequence token.
86
+ * Creates a log stream in the specified log group.
87
+ * Ensures the log group exists first before creating the stream.
88
+ * Checks if stream already exists to avoid duplicates.
89
+ * @param logGroupName - The name of the log group to which the stream belongs.
90
+ * @param logStreamName - The unique name of the log stream to be created.
91
+ * @returns A promise that resolves to the response from creating the log stream.
92
+ * @throws UnprocessableEntityException if there is an error creating the log stream.
103
93
  */
104
- async getSequenceTokenForLogStream(logGroupName, logStreamName) {
94
+ async createLogStream(logGroupName, logStreamName) {
95
+ // First ensure log group exists
96
+ await this.createLogGroup(logGroupName);
97
+ // Check if stream already exists
98
+ const exists = await this.logStreamExists(logGroupName, logStreamName);
99
+ if (exists) {
100
+ return;
101
+ }
102
+ // Create the stream
105
103
  const params = {
106
104
  logGroupName,
107
- logStreamNamePrefix: logStreamName,
105
+ logStreamName,
108
106
  };
107
+ const command = new client_cloudwatch_logs_1.CreateLogStreamCommand(params);
108
+ const response = await this.cloudWatchClient.send(command);
109
+ return response;
110
+ }
111
+ /**
112
+ * Writes log events to a CloudWatch log stream.
113
+ * @param data - The log event data.
114
+ * @returns A promise that resolves with the response from CloudWatch.
115
+ * @throws UnprocessableEntityException if there is an error writing the log event.
116
+ */
117
+ async putLogEvents(data) {
118
+ // Validate inputs
119
+ if (!data.logGroupName?.trim() || !data.logStreamName?.trim() || !data.message?.trim()) {
120
+ throw new Error('logGroupName, logStreamName, and message are required');
121
+ }
109
122
  try {
110
- const command = new client_cloudwatch_logs_1.DescribeLogStreamsCommand(params);
111
- const response = await this.cloudWatchClient.send(command);
112
- const logStream = response.logStreams.find((stream) => stream.logStreamName === logStreamName);
113
- return logStream?.uploadSequenceToken || null;
123
+ // Check if stream exists, create if needed
124
+ const exists = await this.logStreamExists(data.logGroupName, data.logStreamName);
125
+ if (!exists) {
126
+ await this.createLogStream(data.logGroupName, data.logStreamName);
127
+ }
128
+ // Send log without sequenceToken (timestamp ensures ordering)
129
+ const params = {
130
+ logGroupName: data.logGroupName,
131
+ logStreamName: data.logStreamName,
132
+ logEvents: [
133
+ {
134
+ message: data.message,
135
+ timestamp: Date.now(), // ← Timestamp ensures proper ordering
136
+ },
137
+ ],
138
+ };
139
+ const command = new client_cloudwatch_logs_1.PutLogEventsCommand(params);
140
+ await this.cloudWatchClient.send(command);
114
141
  }
115
142
  catch (error) {
116
- throw new common_1.UnprocessableEntityException(`Error getting sequence token for log stream ${logGroupName}-${logStreamName}`, error);
143
+ if (error.name === 'ResourceNotFoundException') {
144
+ // Retry if stream was deleted between check and write
145
+ await this.createLogStream(data.logGroupName, data.logStreamName);
146
+ return this.putLogEvents(data);
147
+ }
148
+ throw new common_1.UnprocessableEntityException(`Error logging to ${data.logGroupName}/${data.logStreamName}`, error);
117
149
  }
118
150
  }
119
151
  /**
@@ -125,20 +157,31 @@ let CloudWatchLoggerService = class CloudWatchLoggerService {
125
157
  * @throws UnprocessableEntityException if there is an error retrieving the logs.
126
158
  */
127
159
  async getLogEvents(logGroupName, query) {
160
+ // Validate inputs
161
+ if (!logGroupName || typeof logGroupName !== 'string') {
162
+ throw new Error('logGroupName is required and must be a string');
163
+ }
164
+ if (!query || typeof query !== 'string') {
165
+ throw new Error('query is required and must be a string');
166
+ }
128
167
  const params = {
129
168
  logGroupName,
130
- startTime: 0,
169
+ startTime: Date.now() - 24 * 60 * 60 * 1000, // Last 24 hours only
131
170
  endTime: Date.now(),
132
171
  queryString: query,
133
172
  };
134
173
  try {
135
174
  const command = new client_cloudwatch_logs_1.StartQueryCommand(params);
136
175
  const startQueryResponse = await this.cloudWatchClient.send(command);
137
- // Polling for query results
176
+ // Polling for query results with exponential backoff
138
177
  let queryStatus;
139
178
  let results;
179
+ let pollCount = 0;
180
+ const maxPolls = 30; // Max ~1.8 seconds with exponential backoff
140
181
  do {
141
- await new Promise((resolve) => setTimeout(resolve, 1000)); // Wait for 1 second before checking the query status
182
+ // Exponential backoff: 50ms, 100ms, 150ms, 200ms, 250ms (capped)
183
+ const delay = Math.min(50 + pollCount * 50, 250);
184
+ await new Promise((resolve) => setTimeout(resolve, delay));
142
185
  const getQueryResultsCommand = new client_cloudwatch_logs_1.GetQueryResultsCommand({
143
186
  queryId: startQueryResponse.queryId,
144
187
  });
@@ -148,17 +191,28 @@ let CloudWatchLoggerService = class CloudWatchLoggerService {
148
191
  results = queryResults.results;
149
192
  break;
150
193
  }
151
- } while (queryStatus === 'Running' || queryStatus === 'Scheduled');
194
+ pollCount++;
195
+ } while ((queryStatus === 'Running' || queryStatus === 'Scheduled') && pollCount < maxPolls);
196
+ // Handle query timeout explicitly
197
+ if (!results) {
198
+ this.logger.warn('CloudWatch query timeout or incomplete', {
199
+ logGroupName,
200
+ queryStatus,
201
+ pollCount,
202
+ maxPolls,
203
+ });
204
+ return []; // Return empty array instead of undefined
205
+ }
152
206
  return results;
153
207
  }
154
208
  catch (error) {
155
- throw new common_1.UnprocessableEntityException(`Error getting logs for log stream ${logGroupName}`, error);
209
+ throw new common_1.UnprocessableEntityException(`Error getting logs for group: ${logGroupName}`, error);
156
210
  }
157
211
  }
158
212
  };
159
213
  exports.CloudWatchLoggerService = CloudWatchLoggerService;
160
- exports.CloudWatchLoggerService = CloudWatchLoggerService = __decorate([
214
+ exports.CloudWatchLoggerService = CloudWatchLoggerService = CloudWatchLoggerService_1 = __decorate([
161
215
  (0, common_1.Injectable)(),
162
216
  __metadata("design:paramtypes", [])
163
217
  ], CloudWatchLoggerService);
164
- //# sourceMappingURL=cloud-water-logger.service.js.map
218
+ //# sourceMappingURL=cloud-watch-logger.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloud-watch-logger.service.js","sourceRoot":"","sources":["../../src/cloud-watch-logger/cloud-watch-logger.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,4EAeyC;AACzC,2CAAkF;AAGlF;;;;;GAKG;AAEI,IAAM,uBAAuB,+BAA7B,MAAM,uBAAuB;IACjB,MAAM,GAAG,IAAI,eAAM,CAAC,yBAAuB,CAAC,IAAI,CAAC,CAAC;IAEnE;;;OAGG;IACK,gBAAgB,CAAuB;IAE/C;;;;OAIG;IACH;QACE,IAAI,CAAC,gBAAgB,GAAG,IAAI,6CAAoB,CAAC;YAC/C,MAAM,EAAE,YAAY;YACpB,WAAW,EAAE;gBACX,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB;gBAC1C,eAAe,EAAE,OAAO,CAAC,GAAG,CAAC,qBAAqB;aACnD;SACF,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACK,KAAK,CAAC,cAAc,CAAC,YAAoB;QAC/C,MAAM,MAAM,GAA+B;YACzC,YAAY;SACb,CAAC;QACF,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,IAAI,8CAAqB,CAAC,MAAM,CAAC,C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from './cloud-water-logger.service';
2
+ export * from './cloud-watch-logger.service';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -15,5 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./cloud-watch-logger.module"), exports);
18
- __exportStar(require("./cloud-water-logger.service"), exports);
18
+ __exportStar(require("./cloud-watch-logger.service"), exports);
19
19
  //# sourceMappingURL=index.js.map
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './activity-logs';
1
2
  export * from './cloud-watch-logger';
2
3
  export * from './common';
3
4
  export * from './data-export-fields-manager';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AACzB,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AACzB,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./activity-logs"), exports);
17
18
  __exportStar(require("./cloud-watch-logger"), exports);
18
19
  __exportStar(require("./common"), exports);
19
20
  __exportStar(require("./data-export-fields-manager"), exports);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,2CAAyB;AACzB,+DAA6C;AAC7C,yDAAuC;AACvC,2CAAyB;AACzB,2CAAyB;AACzB,0CAAwB;AACxB,4CAA0B;AAC1B,8CAA4B;AAC5B,oDAAkC;AAClC,kDAAgC;AAChC,gDAA8B;AAC9B,sDAAoC;AACpC,kDAAgC;AAChC,kDAAgC;AAChC,+CAA6B;AAC7B,gDAA8B;AAC9B,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,uDAAqC;AACrC,2CAAyB;AACzB,+DAA6C;AAC7C,yDAAuC;AACvC,2CAAyB;AACzB,2CAAyB;AACzB,0CAAwB;AACxB,4CAA0B;AAC1B,8CAA4B;AAC5B,oDAAkC;AAClC,kDAAgC;AAChC,gDAA8B;AAC9B,sDAAoC;AACpC,kDAAgC;AAChC,kDAAgC;AAChC,+CAA6B;AAC7B,gDAA8B;AAC9B,0CAAwB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@campxdev/server-shared",
3
- "version": "2.1.12",
3
+ "version": "2.1.13",
4
4
  "description": "Campx server shared files",
5
5
  "main": "dist/index.js",
6
6
  "license": "MIT",
@@ -1 +0,0 @@
1
- {"version":3,"file":"cloud-water-logger.service.d.ts","sourceRoot":"","sources":["../../src/cloud-watch-logger/cloud-water-logger.service.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D;;;;;GAKG;AACH,qBACa,uBAAuB;IAClC;;;OAGG;IACH,OAAO,CAAC,gBAAgB,CAAuB;IAE/C;;;;OAIG;;IAWH;;;;;;OAMG;IACG,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAiBhF;;;;;OAKG;IACG,YAAY,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC;IAmCtD;;;;;;OAMG;IACG,4BAA4B,CAAC,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAoBhG;;;;;;;OAOG;IACG,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;CAkCtE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"cloud-water-logger.service.js","sourceRoot":"","sources":["../../src/cloud-watch-logger/cloud-water-logger.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4EAayC;AACzC,2CAA0E;AAG1E;;;;;GAKG;AAEI,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAClC;;;OAGG;IACK,gBAAgB,CAAuB;IAE/C;;;;OAIG;IACH;QACE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