rez_core 3.1.70 → 3.1.76

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez_core",
3
- "version": "3.1.70",
3
+ "version": "3.1.76",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -38,19 +38,46 @@ export class IntegrationController {
38
38
  @Post('send')
39
39
  @HttpCode(HttpStatus.OK)
40
40
  async sendMessage(@Body() sendMessageDto: GenericSendMessageDto) {
41
- return this.integrationService.sendGenericMessage(sendMessageDto);
41
+ try {
42
+ return await this.integrationService.sendGenericMessage(sendMessageDto);
43
+ } catch (error) {
44
+ throw new BadRequestException({
45
+ success: false,
46
+ error: 'SEND_MESSAGE_ERROR',
47
+ message: error.message || 'Failed to send message',
48
+ code: 'MESSAGE_SEND_ERROR',
49
+ });
50
+ }
42
51
  }
43
52
 
44
53
  @Post('send/bulk')
45
54
  @HttpCode(HttpStatus.OK)
46
55
  async sendBulkMessage(@Body() bulkMessageDto: BulkMessageDto) {
47
- return this.integrationService.sendBulkMessage(bulkMessageDto);
56
+ try {
57
+ return await this.integrationService.sendBulkMessage(bulkMessageDto);
58
+ } catch (error) {
59
+ throw new BadRequestException({
60
+ success: false,
61
+ error: 'SEND_BULK_MESSAGE_ERROR',
62
+ message: error.message || 'Failed to send bulk messages',
63
+ code: 'BULK_MESSAGE_SEND_ERROR',
64
+ });
65
+ }
48
66
  }
49
67
 
50
68
  @Post('send/scheduled')
51
69
  @HttpCode(HttpStatus.OK)
52
70
  async scheduleMessage(@Body() scheduledMessageDto: ScheduledMessageDto) {
53
- return this.integrationService.scheduleMessage(scheduledMessageDto);
71
+ try {
72
+ return await this.integrationService.scheduleMessage(scheduledMessageDto);
73
+ } catch (error) {
74
+ throw new BadRequestException({
75
+ success: false,
76
+ error: 'SCHEDULE_MESSAGE_ERROR',
77
+ message: error.message || 'Failed to schedule message',
78
+ code: 'MESSAGE_SCHEDULE_ERROR',
79
+ });
80
+ }
54
81
  }
55
82
 
56
83
  @Post('send/template')
@@ -67,7 +94,16 @@ export class IntegrationController {
67
94
  type?: 'EMAIL' | 'SMS' | 'WA' | 'TELEPHONE';
68
95
  },
69
96
  ) {
70
- return this.integrationService.sendTemplateMessage(templateMessage);
97
+ try {
98
+ return await this.integrationService.sendTemplateMessage(templateMessage);
99
+ } catch (error) {
100
+ throw new BadRequestException({
101
+ success: false,
102
+ error: 'SEND_TEMPLATE_MESSAGE_ERROR',
103
+ message: error.message || 'Failed to send template message',
104
+ code: 'TEMPLATE_MESSAGE_SEND_ERROR',
105
+ });
106
+ }
71
107
  }
72
108
 
73
109
  @Post('check-agent-status')
@@ -162,7 +198,16 @@ export class IntegrationController {
162
198
 
163
199
  @Get('supported-combinations')
164
200
  async getSupportedCombinations() {
165
- return this.integrationService.getSupportedCombinations();
201
+ try {
202
+ return await this.integrationService.getSupportedCombinations();
203
+ } catch (error) {
204
+ throw new BadRequestException({
205
+ success: false,
206
+ error: 'GET_COMBINATIONS_ERROR',
207
+ message: error.message || 'Failed to get supported combinations',
208
+ code: 'FETCH_ERROR',
209
+ });
210
+ }
166
211
  }
167
212
 
168
213
  @Get('level/:id/:type/configs')
@@ -174,11 +219,20 @@ export class IntegrationController {
174
219
  configType?: 'WA' | 'SMS' | 'EMAIL' | 'TELEPHONE',
175
220
  @Query('provider') provider?: string,
176
221
  ) {
177
- return this.integrationService.getLevelConfigs(levelId, levelType, {
178
- app_code,
179
- integration_type: configType,
180
- integration_provider: provider,
181
- });
222
+ try {
223
+ return await this.integrationService.getLevelConfigs(levelId, levelType, {
224
+ app_code,
225
+ integration_type: configType,
226
+ integration_provider: provider,
227
+ });
228
+ } catch (error) {
229
+ throw new BadRequestException({
230
+ success: false,
231
+ error: 'GET_LEVEL_CONFIGS_ERROR',
232
+ message: error.message || 'Failed to get level configurations',
233
+ code: 'FETCH_ERROR',
234
+ });
235
+ }
182
236
  }
183
237
 
184
238
  @Get('config/:id')
@@ -242,17 +296,35 @@ export class IntegrationController {
242
296
  @Post('sendgrid/verified-senders')
243
297
  @HttpCode(HttpStatus.OK)
244
298
  async getSendGridVerifiedSenders(@Body() dto: SendGridVerifiedSendersDto) {
245
- return this.integrationService.getSendGridVerifiedSenders(dto.apiKey);
299
+ try {
300
+ return await this.integrationService.getSendGridVerifiedSenders(dto.apiKey);
301
+ } catch (error) {
302
+ throw new BadRequestException({
303
+ success: false,
304
+ error: 'GET_SENDGRID_SENDERS_ERROR',
305
+ message: error.message || 'Failed to get SendGrid verified senders',
306
+ code: 'SENDGRID_ERROR',
307
+ });
308
+ }
246
309
  }
247
310
 
248
311
  @Post('sendgrid/templates')
249
312
  @HttpCode(HttpStatus.OK)
250
313
  async getSendGridTemplates(@Body() dto: SendGridTemplatesDto) {
251
- return this.integrationService.getSendGridTemplates(
252
- dto.levelId,
253
- dto.levelType,
254
- dto.app_code,
255
- );
314
+ try {
315
+ return await this.integrationService.getSendGridTemplates(
316
+ dto.levelId,
317
+ dto.levelType,
318
+ dto.app_code,
319
+ );
320
+ } catch (error) {
321
+ throw new BadRequestException({
322
+ success: false,
323
+ error: 'GET_SENDGRID_TEMPLATES_ERROR',
324
+ message: error.message || 'Failed to get SendGrid templates',
325
+ code: 'SENDGRID_ERROR',
326
+ });
327
+ }
256
328
  }
257
329
 
258
330
  @Post('config/delete/:configId')
@@ -464,15 +536,24 @@ export class IntegrationController {
464
536
  @Query('integration_type')
465
537
  integration_type?: 'EMAIL' | 'SMS' | 'WA' | 'TELEPHONE',
466
538
  ) {
467
- const loggedInUser = req.user.userData;
539
+ try {
540
+ const loggedInUser = req.user.userData;
468
541
 
469
- const allIntegrationData =
470
- await this.integrationService.getAllIntegrationData(
471
- loggedInUser,
472
- integration_type,
473
- );
542
+ const allIntegrationData =
543
+ await this.integrationService.getAllIntegrationData(
544
+ loggedInUser,
545
+ integration_type,
546
+ );
474
547
 
475
- return allIntegrationData;
548
+ return allIntegrationData;
549
+ } catch (error) {
550
+ throw new BadRequestException({
551
+ success: false,
552
+ error: 'GET_ALL_INTEGRATIONS_ERROR',
553
+ message: error.message || 'Failed to get all integrations',
554
+ code: 'FETCH_ERROR',
555
+ });
556
+ }
476
557
  }
477
558
 
478
559
  @Get('provider-urls')
@@ -25,6 +25,9 @@ export class SendGridApiStrategy implements IntegrationStrategy {
25
25
 
26
26
  } = config;
27
27
 
28
+ console.log("Rich Text:", richText);
29
+ console.log("Message: ", message);
30
+
28
31
  if (!apiKey || !fromEmail) {
29
32
  throw new Error(
30
33
  'Missing required SendGrid credentials: apiKey and fromEmail are required',
@@ -98,7 +98,7 @@ export class FieldMapperService extends EntityServiceImpl {
98
98
 
99
99
  // Case 1️⃣ direct mapping (no mapped_entity_type or equal)
100
100
  if (
101
- !inMemory[entityType][filterCode] ||
101
+ !inMemory[entityType][filterCode] &&
102
102
  field.mapped_entity_type == field.mapper_entity_type
103
103
  ) {
104
104
  inMemory[entityType][filterCode] = await super.getResolvedEntityData(
@@ -54,7 +54,7 @@ export class WorkflowAutomationService extends EntityServiceImpl {
54
54
  ): Promise<WorkflowAutomation[]> {
55
55
  return this.wfRepo.find({
56
56
  where: {
57
- mapped_entity_type: entityType,
57
+ applicable_entity_type: entityType,
58
58
  trigger_event: event,
59
59
  organization_id: loggedInUser.organization_id,
60
60
  },