@gus-eip/loggers 3.8.6 → 3.8.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -58,6 +58,11 @@ import { LoggerModule } from '@gus-eip/loggers';
58
58
  export class AppModule {}
59
59
  ```
60
60
 
61
+ ```
62
+ This repository requires AWS SSM Parameter Store access to retrieve the SQS URL dynamically. Ensure that the application has permission to read LOGGER_SQS_URL.
63
+
64
+ ```
65
+
61
66
  ## License
62
67
 
63
68
  This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
@@ -5,14 +5,21 @@ export declare class CloudWatchLoggerService implements ILogger {
5
5
  private logGroupName;
6
6
  private teamWebhookUrl?;
7
7
  private isAlertNeeded?;
8
+ private loggerEnum;
8
9
  constructor(region: string, logGroupName: string, teamWebhookUrl?: string, isAlertNeeded?: boolean);
9
10
  private version;
10
11
  createLogStream(logStreamName: string): Promise<any>;
11
12
  logToCloudWatch(type: string, logObject: any, logStreamName: string): Promise<void>;
12
13
  logStreamExists(logStreamName: string): Promise<boolean>;
13
14
  sendAlerttoTeams(errorMessage: any, errorStack: any, handler: any, input: any, logStreamName: any): Promise<any>;
15
+ private processLog;
14
16
  sendNotificationtoTeams(title: any, summary: any, handler: any, logStreamName: any, isFormattingRequired: boolean, type: any): Promise<any>;
15
17
  log(correlationId: string, timestamp: string, component: string, source: string, destination: string, event: string, usecase: string, sourcePayload: any, destinationPayload: any, logMessage: any, brand: any, secondaryKey: string, logStreamName: string, entityKeyField: string, entityKey: string, destinationObjectType?: string, destinationObjectId?: string, sourceObjectType?: string, sourceObjectId?: string, destinationResponse?: any): Promise<any>;
16
18
  error(correlationId: string, timestamp: string, component: string, source: string, destination: string, event: string, usecase: string, sourcePayload: any, destinationPayload: any, errorMessage: any, brand: any, secondaryKey: string, logStreamName: string, entityKeyField: string, entityKey: string, destinationObjectType?: string, destinationObjectId?: string, sourceObjectType?: string, sourceObjectId?: string, destinationResponse?: any): Promise<any>;
19
+ private sendToSQS;
20
+ getSourceAndDestination(brand: string, usecase: string): Promise<{
21
+ source: string;
22
+ destination: string;
23
+ }>;
17
24
  logAlert(correlationId: string, timestamp: string, component: string, source: string, destination: string, event: string, usecase: string, sourcePayload: any, destinationPayload: any, logMessage: any, brand: any, secondaryKey: string, logStreamName: string, isAlertFormattingRequired?: boolean, type?: 'INFO' | 'Error', destinationObjectType?: string, destinationObjectId?: string, sourceObjectType?: string, sourceObjectId?: string, destinationResponse?: any): Promise<any>;
18
25
  }
@@ -14,8 +14,12 @@ const common_1 = require("@nestjs/common");
14
14
  const aws_sdk_1 = require("aws-sdk");
15
15
  const cloudwatch_event_formatter_1 = require("./cloudwatch.event.formatter");
16
16
  const axios_1 = require("axios");
17
+ const source_destination_mapping_1 = require("./mappings/source-destination-mapping");
18
+ const enum_1 = require("./enum");
19
+ const ssm_utils_1 = require("./ssm-utils");
17
20
  let CloudWatchLoggerService = class CloudWatchLoggerService {
18
21
  constructor(region, logGroupName, teamWebhookUrl, isAlertNeeded) {
22
+ this.loggerEnum = new enum_1.LoggerEnum();
19
23
  this.version = 'v1';
20
24
  this.cloudwatch = new aws_sdk_1.CloudWatchLogs({ region: region });
21
25
  this.region = region;
@@ -136,6 +140,29 @@ let CloudWatchLoggerService = class CloudWatchLoggerService {
136
140
  console.error('Error sending message:', error);
137
141
  }
138
142
  }
143
+ async processLog(type, logStreamName, fullLogObject, status) {
144
+ const logEvent = {
145
+ correlationId: fullLogObject.correlationId || '',
146
+ brand: fullLogObject.brand || '',
147
+ usecase: fullLogObject.usecase || '',
148
+ timestamp: fullLogObject.timestamp || '',
149
+ type: fullLogObject.type || '',
150
+ entityKeyField: fullLogObject.entityKeyField || '',
151
+ entityKey: fullLogObject.entityKey || '',
152
+ event: fullLogObject.event || '',
153
+ status,
154
+ };
155
+ const sqsUrl = await ssm_utils_1.ssmUtils.getSqsUrl();
156
+ const results = await Promise.allSettled([
157
+ this.logToCloudWatch(type, fullLogObject, logStreamName),
158
+ this.sendToSQS(logEvent, sqsUrl),
159
+ ]);
160
+ results.forEach((result, index) => {
161
+ if (result.status === 'rejected') {
162
+ console.error(`Error in ${index === 0 ? 'logToCloudWatch' : 'sendToSQS'}:`, result.reason);
163
+ }
164
+ });
165
+ }
139
166
  async sendNotificationtoTeams(title, summary, handler, logStreamName, isFormattingRequired = true, type) {
140
167
  console.log('Notification summary', summary);
141
168
  const webhookUrl = this.teamWebhookUrl;
@@ -228,7 +255,8 @@ let CloudWatchLoggerService = class CloudWatchLoggerService {
228
255
  sourceObjectId,
229
256
  destinationResponse,
230
257
  };
231
- await this.logToCloudWatch('info', logObject, logStreamName);
258
+ const status = event === this.loggerEnum.Event.OPERATION_COMPLETED ? 'COMPLETED' : 'IN_PROGRESS';
259
+ await this.processLog('info', logStreamName, logObject, status);
232
260
  }
233
261
  async error(correlationId, timestamp, component, source, destination, event, usecase, sourcePayload, destinationPayload, errorMessage, brand, secondaryKey, logStreamName, entityKeyField, entityKey, destinationObjectType, destinationObjectId, sourceObjectType, sourceObjectId, destinationResponse) {
234
262
  const logObject = {
@@ -253,11 +281,32 @@ let CloudWatchLoggerService = class CloudWatchLoggerService {
253
281
  sourceObjectId,
254
282
  destinationResponse,
255
283
  };
256
- await this.logToCloudWatch('error', logObject, logStreamName);
284
+ await this.processLog('error', logStreamName, logObject, 'ERROR');
257
285
  if (this.isAlertNeeded) {
258
286
  await this.sendAlerttoTeams(errorMessage.message ? errorMessage.message : errorMessage, errorMessage.stack ? errorMessage.stack : errorMessage, component, logObject, encodeURIComponent(logStreamName));
259
287
  }
260
288
  }
289
+ async sendToSQS(logEvent, queueUrl) {
290
+ const sqs = new aws_sdk_1.SQS({ region: 'eu-west-1' });
291
+ const params = {
292
+ QueueUrl: queueUrl,
293
+ MessageBody: JSON.stringify(logEvent),
294
+ MessageGroupId: logEvent.correlationId,
295
+ };
296
+ try {
297
+ await sqs.sendMessage(params).promise();
298
+ console.log('Log event successfully sent to SQS:', logEvent);
299
+ }
300
+ catch (error) {
301
+ console.error('Failed to send log event to SQS:', error);
302
+ }
303
+ }
304
+ async getSourceAndDestination(brand, usecase) {
305
+ const mapping = source_destination_mapping_1.BRAND_USECASE_MAPPING.find((entry) => entry.usecase === usecase && entry.brands.includes(brand));
306
+ return mapping
307
+ ? { source: mapping.source, destination: mapping.destination }
308
+ : null;
309
+ }
261
310
  async logAlert(correlationId, timestamp, component, source, destination, event, usecase, sourcePayload, destinationPayload, logMessage, brand, secondaryKey, logStreamName, isAlertFormattingRequired, type, destinationObjectType, destinationObjectId, sourceObjectType, sourceObjectId, destinationResponse) {
262
311
  const logObject = {
263
312
  correlationId,
@@ -285,8 +334,8 @@ let CloudWatchLoggerService = class CloudWatchLoggerService {
285
334
  }
286
335
  }
287
336
  };
288
- CloudWatchLoggerService = __decorate([
337
+ exports.CloudWatchLoggerService = CloudWatchLoggerService;
338
+ exports.CloudWatchLoggerService = CloudWatchLoggerService = __decorate([
289
339
  (0, common_1.Injectable)(),
290
340
  __metadata("design:paramtypes", [String, String, String, Boolean])
291
341
  ], CloudWatchLoggerService);
292
- exports.CloudWatchLoggerService = CloudWatchLoggerService;
package/dist/enum.d.ts CHANGED
@@ -354,6 +354,8 @@ export declare class LoggerEnum {
354
354
  GET_OPPORTUNITY_COMPLETED: string;
355
355
  GET_OPPORTUNITY_FAILED: string;
356
356
  UPDATE_OPPORTUNITY: string;
357
+ CONTENT_DOCUMENT_LINK_BY_LINKED_ENTITY_ID_FAILED: string;
358
+ OPPORTUNITY_BY_OPPID_FAILED: string;
357
359
  };
358
360
  UseCase: {
359
361
  PROGRAM_INFO: string;
package/dist/enum.js CHANGED
@@ -364,7 +364,9 @@ let LoggerEnum = class LoggerEnum {
364
364
  GET_OPPORTUNITY_INITIATED: 'GET_OPPORTUNITY_INITIATED',
365
365
  GET_OPPORTUNITY_COMPLETED: 'GET_OPPORTUNITY_COMPLETED',
366
366
  GET_OPPORTUNITY_FAILED: 'GET_OPPORTUNITY_FAILED',
367
- UPDATE_OPPORTUNITY: 'UPDATE_OPPORTUNITY'
367
+ UPDATE_OPPORTUNITY: 'UPDATE_OPPORTUNITY',
368
+ CONTENT_DOCUMENT_LINK_BY_LINKED_ENTITY_ID_FAILED: 'CONTENT_DOCUMENT_LINK_BY_LINKED_ENTITY_ID_FAILED',
369
+ OPPORTUNITY_BY_OPPID_FAILED: 'OPPORTUNITY_BY_OPPID_FAILED'
368
370
  };
369
371
  this.UseCase = {
370
372
  PROGRAM_INFO: 'SAVE_PROGRAMME_DETAILS',
@@ -487,7 +489,7 @@ let LoggerEnum = class LoggerEnum {
487
489
  };
488
490
  }
489
491
  };
490
- LoggerEnum = __decorate([
492
+ exports.LoggerEnum = LoggerEnum;
493
+ exports.LoggerEnum = LoggerEnum = __decorate([
491
494
  (0, common_1.Injectable)()
492
495
  ], LoggerEnum);
493
- exports.LoggerEnum = LoggerEnum;
@@ -0,0 +1,11 @@
1
+ export interface LogEvent {
2
+ correlationId: string;
3
+ brand: string;
4
+ usecase: string;
5
+ timestamp: string;
6
+ type: string;
7
+ entityKeyField: string;
8
+ entityKey: string;
9
+ event: any;
10
+ status: string;
11
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ export declare const BRAND_USECASE_MAPPING: {
2
+ brands: string[];
3
+ usecase: string;
4
+ source: string;
5
+ destination: string;
6
+ }[];
@@ -0,0 +1,389 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BRAND_USECASE_MAPPING = void 0;
4
+ exports.BRAND_USECASE_MAPPING = [
5
+ {
6
+ brands: ['LIM', 'HZU', 'IBAT', 'LSBFMYR'],
7
+ usecase: 'SAVE_BASIC_DETAILS',
8
+ source: 'OAP',
9
+ destination: 'GUS Salesforce',
10
+ },
11
+ {
12
+ brands: ['UCW', 'HZU', 'UNFC'],
13
+ usecase: 'SAVE_PROGRAMME_DETAILS',
14
+ source: 'OAP',
15
+ destination: 'GUS Salesforce',
16
+ },
17
+ {
18
+ brands: ['UCW', 'UNFC'],
19
+ usecase: 'SAVE_APPLICANT_INFO',
20
+ source: 'OAP',
21
+ destination: 'GUS Salesforce',
22
+ },
23
+ {
24
+ brands: ['UCW', 'UNFC'],
25
+ usecase: 'SAVE_EMERGENCY_CONTACT_DETAILS',
26
+ source: 'OAP',
27
+ destination: 'GUS Salesforce',
28
+ },
29
+ {
30
+ brands: ['LIM', 'HZU', 'IBAT'],
31
+ usecase: 'SAVE_ADDITIONAL_INFORMATION',
32
+ source: 'OAP',
33
+ destination: 'GUS Salesforce',
34
+ },
35
+ {
36
+ brands: ['LIM', 'HZU'],
37
+ usecase: 'SAVE_ACADEMIC_INFORMATION',
38
+ source: 'OAP',
39
+ destination: 'GUS Salesforce',
40
+ },
41
+ {
42
+ brands: ['LSBFMYR'],
43
+ usecase: 'SAVE_CONTACT_INFO',
44
+ source: 'OAP',
45
+ destination: 'GUS Salesforce',
46
+ },
47
+ {
48
+ brands: ['LIM', 'HZU', 'IBAT', 'LSBFMYR'],
49
+ usecase: 'SAVE_PERSONAL_DETAILS',
50
+ source: 'OAP',
51
+ destination: 'GUS Salesforce',
52
+ },
53
+ {
54
+ brands: ['HZU', 'LSBFMYR'],
55
+ usecase: 'SAVE_TERMS_AND_CONDITIONS',
56
+ source: 'OAP',
57
+ destination: 'GUS Salesforce',
58
+ },
59
+ {
60
+ brands: ['LIM', 'HZU', 'IBAT', 'LSBFMYR', 'UNFC'],
61
+ usecase: 'SUBMIT_APPLICATION',
62
+ source: 'OAP',
63
+ destination: 'GUS Salesforce',
64
+ },
65
+ {
66
+ brands: ['LIM', 'HZU', 'IBAT', 'LSBFMYR', 'UNFC'],
67
+ usecase: 'UPLOAD_DOCUMENT',
68
+ source: 'OAP',
69
+ destination: 'GUS Salesforce',
70
+ },
71
+ {
72
+ brands: ['LIM', 'HZU', 'IBAT', 'LSBFMYR', 'UNFC'],
73
+ usecase: 'GUS_SALESFORCE_OPERATION',
74
+ source: 'OAP',
75
+ destination: 'GUS Salesforce',
76
+ },
77
+ {
78
+ brands: ['IBAT'],
79
+ usecase: 'SAVE_COURSE_SELECTION_DETAILS',
80
+ source: 'OAP',
81
+ destination: 'GUS Salesforce',
82
+ },
83
+ {
84
+ brands: ['UCW', 'UNFC', 'LSBFMYR'],
85
+ usecase: 'SAVE_EDUCATION_HISTORY_DETAILS',
86
+ source: 'OAP',
87
+ destination: 'GUS Salesforce',
88
+ },
89
+ {
90
+ brands: ['UCW', 'UNFC'],
91
+ usecase: 'SAVE_STANDARDIZED_TESTS_DETAILS',
92
+ source: 'OAP',
93
+ destination: 'GUS Salesforce',
94
+ },
95
+ {
96
+ brands: ['UCW', 'LIM'],
97
+ usecase: 'SAVE_EMPLOYMENT_HISTORY_DETAILS',
98
+ source: 'OAP',
99
+ destination: 'GUS Salesforce',
100
+ },
101
+ {
102
+ brands: ['UCW', 'UNFC'],
103
+ usecase: 'SAVE_ADDITIONAL_DOCUMENTS_DETAILS',
104
+ source: 'OAP',
105
+ destination: 'GUS Salesforce',
106
+ },
107
+ {
108
+ brands: ['UNFC'],
109
+ usecase: 'SAVE_TRANSFER_CREDITS_DETAILS',
110
+ source: 'OAP',
111
+ destination: 'GUS Salesforce',
112
+ },
113
+ {
114
+ brands: ['LIM', 'HZU', 'IBAT', 'LSBFMYR', 'UNFC'],
115
+ usecase: 'SAVE_PROGRAMME_DETAILS',
116
+ source: 'OAP',
117
+ destination: 'GUS Salesforce',
118
+ },
119
+ {
120
+ brands: ['UCW'],
121
+ usecase: 'SAVE_AWARDS_DETAILS',
122
+ source: 'OAP',
123
+ destination: 'GUS Salesforce',
124
+ },
125
+ {
126
+ brands: ['LIM'],
127
+ usecase: 'SAVE_PRIVACY_PROTECTION_POLICY_DETAILS',
128
+ source: 'OAP',
129
+ destination: 'GUS Salesforce',
130
+ },
131
+ {
132
+ brands: ['LIM', 'IBAT', 'LSBFMYR'],
133
+ usecase: 'SAVE_DECLARATION_DETAILS',
134
+ source: 'OAP',
135
+ destination: 'GUS Salesforce',
136
+ },
137
+ {
138
+ brands: ['LIM', 'LSBFMYR'],
139
+ usecase: 'SAVE_TEST_INFORMATION',
140
+ source: 'OAP',
141
+ destination: 'GUS Salesforce',
142
+ },
143
+ {
144
+ brands: ['HZU', 'LIM'],
145
+ usecase: 'SAVE_FINANCIAL_DOCUMENT',
146
+ source: 'OAP',
147
+ destination: 'GUS Salesforce',
148
+ },
149
+ {
150
+ brands: ['IBAT'],
151
+ usecase: 'SAVE_ADDITIONAL_SERVICES_INFORMATION',
152
+ source: 'OAP',
153
+ destination: 'GUS Salesforce',
154
+ },
155
+ {
156
+ brands: ['LIM'],
157
+ usecase: 'SAVE_ADMISSION_RECOMMENDATION_LETTER_DETAILS',
158
+ source: 'OAP',
159
+ destination: 'GUS Salesforce',
160
+ },
161
+ {
162
+ brands: ['LIM'],
163
+ usecase: 'SAVE_REQUIRED_ESSAY_RESUME_DETAILS',
164
+ source: 'OAP',
165
+ destination: 'GUS Salesforce',
166
+ },
167
+ {
168
+ brands: ['UNFC'],
169
+ usecase: 'SAVE_INTERNATIONAL_STUDENT_CONSENT_FORM_DETAILS',
170
+ source: 'OAP',
171
+ destination: 'GUS Salesforce',
172
+ },
173
+ {
174
+ brands: ['LIM'],
175
+ usecase: 'SAVE_HONESTY_STATEMENT_DETAILS',
176
+ source: 'OAP',
177
+ destination: 'GUS Salesforce',
178
+ },
179
+ {
180
+ brands: ['LIM'],
181
+ usecase: 'SAVE_LEGAL_NOTICE_DETAILS',
182
+ source: 'OAP',
183
+ destination: 'GUS Salesforce',
184
+ },
185
+ {
186
+ brands: ['HZU'],
187
+ usecase: 'GUS_NEW_APPLICATION',
188
+ source: 'OAP',
189
+ destination: 'GUS Salesforce',
190
+ },
191
+ {
192
+ brands: ['HZU'],
193
+ usecase: 'GUS_SALESFORCE_OPERATION',
194
+ source: 'GUS Salesforce',
195
+ destination: 'HZU education cloud',
196
+ },
197
+ {
198
+ brands: ['HZU'],
199
+ usecase: 'GUS_WITHDRAW_APPLICATION',
200
+ source: 'GUS Salesforce',
201
+ destination: 'HZU education cloud',
202
+ },
203
+ {
204
+ brands: ['HZU'],
205
+ usecase: 'DOCUMENT_CHECKLIST_CREATED',
206
+ source: 'GUS Salesforce',
207
+ destination: 'HZU education cloud',
208
+ },
209
+ {
210
+ brands: ['HZU'],
211
+ usecase: 'GUS_DOCUMENT_UPDATE',
212
+ source: 'GUS Salesforce',
213
+ destination: 'HZU education cloud',
214
+ },
215
+ {
216
+ brands: ['HZU'],
217
+ usecase: 'SYNC_GUS_TO_HZU',
218
+ source: 'GUS Salesforce',
219
+ destination: 'HZU education cloud',
220
+ },
221
+ {
222
+ brands: ['HZU'],
223
+ usecase: 'GUS_SALESFORCE_OPERATION',
224
+ source: 'HZU education cloud',
225
+ destination: 'GUS Salesforce',
226
+ },
227
+ {
228
+ brands: ['HZU'],
229
+ usecase: 'OPPORTUNITY_VISA_APPROVED',
230
+ source: 'HZU education cloud',
231
+ destination: 'GUS Salesforce',
232
+ },
233
+ {
234
+ brands: ['HZU'],
235
+ usecase: 'CONDITIONAL_OFFER',
236
+ source: 'HZU education cloud',
237
+ destination: 'GUS Salesforce',
238
+ },
239
+ {
240
+ brands: ['HZU'],
241
+ usecase: 'OPPORTUNITY_REVOKED_CLOSED_LOST',
242
+ source: 'HZU education cloud',
243
+ destination: 'GUS Salesforce',
244
+ },
245
+ {
246
+ brands: ['HZU'],
247
+ usecase: 'OPPORTUNITY_CLOSED_LOST',
248
+ source: 'HZU education cloud',
249
+ destination: 'GUS Salesforce',
250
+ },
251
+ {
252
+ brands: ['HZU'],
253
+ usecase: 'OPPORTUNITY_CLOSED_WON',
254
+ source: 'HZU education cloud',
255
+ destination: 'GUS Salesforce',
256
+ },
257
+ {
258
+ brands: ['HZU'],
259
+ usecase: 'Payment',
260
+ source: 'HZU education cloud',
261
+ destination: 'GUS Salesforce',
262
+ },
263
+ {
264
+ brands: ['HZU'],
265
+ usecase: 'DOCUMENT_CHECKLIST_CREATED',
266
+ source: 'HZU education cloud',
267
+ destination: 'GUS Salesforce',
268
+ },
269
+ {
270
+ brands: ['HZU'],
271
+ usecase: 'REJECTED_DOCUMENT_TASK',
272
+ source: 'HZU education cloud',
273
+ destination: 'GUS Salesforce',
274
+ },
275
+ {
276
+ brands: ['HZU'],
277
+ usecase: 'I_20',
278
+ source: 'HZU education cloud',
279
+ destination: 'GUS Salesforce',
280
+ },
281
+ {
282
+ brands: ['UCW'],
283
+ usecase: 'GUS_NEW_APPLICATION',
284
+ source: 'GUS Salesforce',
285
+ destination: 'MYUCW',
286
+ },
287
+ {
288
+ brands: ['UCW'],
289
+ usecase: 'GUS_WITHDRAW_APPLICATION',
290
+ source: 'GUS Salesforce',
291
+ destination: 'MYUCW',
292
+ },
293
+ {
294
+ brands: ['UCW'],
295
+ usecase: 'GUS_NEW_DOCUMENT',
296
+ source: 'GUS Salesforce',
297
+ destination: 'MYUCW',
298
+ },
299
+ {
300
+ brands: ['UCW'],
301
+ usecase: 'GUS_DOCUMENT_UPDATE',
302
+ source: 'GUS Salesforce',
303
+ destination: 'MYUCW',
304
+ },
305
+ {
306
+ brands: ['UCW'],
307
+ usecase: 'GUS_CLARIFICATION_SUBMITTED',
308
+ source: 'GUS Salesforce',
309
+ destination: 'MYUCW',
310
+ },
311
+ {
312
+ brands: ['UCW'],
313
+ usecase: 'GUS_SALESFORCE_OPERATION',
314
+ source: 'GUS Salesforce',
315
+ destination: 'MYUCW',
316
+ },
317
+ {
318
+ brands: ['UCW'],
319
+ usecase: 'GUS_SALESFORCE_OPERATION',
320
+ source: 'MYUCW',
321
+ destination: 'GUS Salesforce',
322
+ },
323
+ {
324
+ brands: ['UCW'],
325
+ usecase: 'UCW_OFFERED',
326
+ source: 'MYUCW',
327
+ destination: 'GUS Salesforce',
328
+ },
329
+ {
330
+ brands: ['UCW'],
331
+ usecase: 'UCW_DOCUMENT_ISSUED',
332
+ source: 'MYUCW',
333
+ destination: 'GUS Salesforce',
334
+ },
335
+ {
336
+ brands: ['UCW'],
337
+ usecase: 'UCW_VISA_APPROVED',
338
+ source: 'MYUCW',
339
+ destination: 'GUS Salesforce',
340
+ },
341
+ {
342
+ brands: ['UCW'],
343
+ usecase: 'UCW_ENROLLED',
344
+ source: 'MYUCW',
345
+ destination: 'GUS Salesforce',
346
+ },
347
+ {
348
+ brands: ['UCW'],
349
+ usecase: 'UCW_FOLLOWUP_TASK',
350
+ source: 'MYUCW',
351
+ destination: 'GUS Salesforce',
352
+ },
353
+ {
354
+ brands: ['UCW'],
355
+ usecase: 'UCW_REJECT_APPLICATION',
356
+ source: 'MYUCW',
357
+ destination: 'GUS Salesforce',
358
+ },
359
+ {
360
+ brands: ['UCW'],
361
+ usecase: 'UCW_WITHDRAW_OFFER',
362
+ source: 'MYUCW',
363
+ destination: 'GUS Salesforce',
364
+ },
365
+ {
366
+ brands: ['UCW'],
367
+ usecase: 'UCW_WITHDRAW_APPLICATION',
368
+ source: 'MYUCW',
369
+ destination: 'GUS Salesforce',
370
+ },
371
+ {
372
+ brands: ['UCW'],
373
+ usecase: 'UCW_REJECT_APPLICATION_VS',
374
+ source: 'MYUCW',
375
+ destination: 'GUS Salesforce',
376
+ },
377
+ {
378
+ brands: ['UCW'],
379
+ usecase: 'UCW_REJECT_DOCUMENT',
380
+ source: 'MYUCW',
381
+ destination: 'GUS Salesforce',
382
+ },
383
+ {
384
+ brands: ['UCW'],
385
+ usecase: 'UCW_APPLICATION_DEFERRED',
386
+ source: 'MYUCW',
387
+ destination: 'GUS Salesforce',
388
+ },
389
+ ];
package/dist/module.js CHANGED
@@ -28,7 +28,7 @@ let LoggerModule = LoggerModule_1 = class LoggerModule {
28
28
  };
29
29
  }
30
30
  };
31
- LoggerModule = LoggerModule_1 = __decorate([
31
+ exports.LoggerModule = LoggerModule;
32
+ exports.LoggerModule = LoggerModule = LoggerModule_1 = __decorate([
32
33
  (0, common_1.Module)({})
33
34
  ], LoggerModule);
34
- exports.LoggerModule = LoggerModule;
@@ -0,0 +1,10 @@
1
+ declare class SsmUtils {
2
+ private static instance;
3
+ private ssmClient;
4
+ private cachedSqsUrl;
5
+ private constructor();
6
+ static getInstance(): SsmUtils;
7
+ getSqsUrl(): Promise<string>;
8
+ }
9
+ export declare const ssmUtils: SsmUtils;
10
+ export {};
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ssmUtils = void 0;
4
+ const client_ssm_1 = require("@aws-sdk/client-ssm");
5
+ class SsmUtils {
6
+ constructor() {
7
+ this.cachedSqsUrl = null;
8
+ this.ssmClient = new client_ssm_1.SSMClient({ region: 'eu-west-1' });
9
+ }
10
+ static getInstance() {
11
+ if (!SsmUtils.instance) {
12
+ SsmUtils.instance = new SsmUtils();
13
+ }
14
+ return SsmUtils.instance;
15
+ }
16
+ async getSqsUrl() {
17
+ var _a, _b;
18
+ if (this.cachedSqsUrl) {
19
+ return this.cachedSqsUrl;
20
+ }
21
+ const parameterName = 'LOGGER_SQS_URL';
22
+ try {
23
+ const command = new client_ssm_1.GetParameterCommand({ Name: parameterName });
24
+ const response = await this.ssmClient.send(command);
25
+ this.cachedSqsUrl = (_b = (_a = response.Parameter) === null || _a === void 0 ? void 0 : _a.Value) !== null && _b !== void 0 ? _b : '';
26
+ return this.cachedSqsUrl;
27
+ }
28
+ catch (error) {
29
+ console.error('Error fetching SQS URL from SSM:', error);
30
+ return "";
31
+ }
32
+ }
33
+ }
34
+ exports.ssmUtils = SsmUtils.getInstance();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gus-eip/loggers",
3
- "version": "3.8.6",
3
+ "version": "3.8.8",
4
4
  "description": "@gus-eip/loggers is a package designed to provide logging functionality for your Node.js applications.",
5
5
  "author": "gus",
6
6
  "readmeFilename": "README.md",
@@ -31,6 +31,7 @@
31
31
  "access": "public"
32
32
  },
33
33
  "dependencies": {
34
+ "@aws-sdk/client-ssm": "^3.759.0",
34
35
  "aws-sdk": "^2.1590.0",
35
36
  "axios": "^1.7.4"
36
37
  },