rez_core 3.1.22 → 3.1.24

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 (105) hide show
  1. package/dist/app.module.js +2 -0
  2. package/dist/app.module.js.map +1 -1
  3. package/dist/module/filter/service/filter.service.js +22 -18
  4. package/dist/module/filter/service/filter.service.js.map +1 -1
  5. package/dist/module/integration/controller/integration.controller.d.ts +17 -1
  6. package/dist/module/integration/controller/integration.controller.js +56 -0
  7. package/dist/module/integration/controller/integration.controller.js.map +1 -1
  8. package/dist/module/integration/dto/create-config.dto.d.ts +7 -0
  9. package/dist/module/integration/dto/create-config.dto.js +29 -1
  10. package/dist/module/integration/dto/create-config.dto.js.map +1 -1
  11. package/dist/module/integration/factories/sms.factory.d.ts +9 -1
  12. package/dist/module/integration/factories/sms.factory.js +36 -4
  13. package/dist/module/integration/factories/sms.factory.js.map +1 -1
  14. package/dist/module/integration/factories/whatsapp.factory.d.ts +5 -1
  15. package/dist/module/integration/factories/whatsapp.factory.js +14 -2
  16. package/dist/module/integration/factories/whatsapp.factory.js.map +1 -1
  17. package/dist/module/integration/integration.module.js +10 -0
  18. package/dist/module/integration/integration.module.js.map +1 -1
  19. package/dist/module/integration/service/integration.service.d.ts +8 -0
  20. package/dist/module/integration/service/integration.service.js +65 -0
  21. package/dist/module/integration/service/integration.service.js.map +1 -1
  22. package/dist/module/integration/strategies/sms/gupshup-sms.strategy.d.ts +9 -0
  23. package/dist/module/integration/strategies/sms/gupshup-sms.strategy.js +104 -0
  24. package/dist/module/integration/strategies/sms/gupshup-sms.strategy.js.map +1 -0
  25. package/dist/module/integration/strategies/sms/msg91-sms.strategy.d.ts +9 -0
  26. package/dist/module/integration/strategies/sms/msg91-sms.strategy.js +113 -0
  27. package/dist/module/integration/strategies/sms/msg91-sms.strategy.js.map +1 -0
  28. package/dist/module/integration/strategies/sms/tubelight-sms.strategy.d.ts +9 -0
  29. package/dist/module/integration/strategies/sms/tubelight-sms.strategy.js +109 -0
  30. package/dist/module/integration/strategies/sms/tubelight-sms.strategy.js.map +1 -0
  31. package/dist/module/integration/strategies/telephone/ozonetel-voice.strategy.d.ts +7 -2
  32. package/dist/module/integration/strategies/telephone/ozonetel-voice.strategy.js +52 -5
  33. package/dist/module/integration/strategies/telephone/ozonetel-voice.strategy.js.map +1 -1
  34. package/dist/module/integration/strategies/whatsapp/gupshup-whatsapp.strategy.d.ts +19 -0
  35. package/dist/module/integration/strategies/whatsapp/gupshup-whatsapp.strategy.js +257 -0
  36. package/dist/module/integration/strategies/whatsapp/gupshup-whatsapp.strategy.js.map +1 -0
  37. package/dist/module/integration/strategies/whatsapp/tubelight-whatsapp.strategy.d.ts +22 -0
  38. package/dist/module/integration/strategies/whatsapp/tubelight-whatsapp.strategy.js +295 -0
  39. package/dist/module/integration/strategies/whatsapp/tubelight-whatsapp.strategy.js.map +1 -0
  40. package/dist/module/mapper/controller/field-mapper.controller.d.ts +6 -0
  41. package/dist/module/mapper/controller/field-mapper.controller.js +45 -0
  42. package/dist/module/mapper/controller/field-mapper.controller.js.map +1 -0
  43. package/dist/module/mapper/dto/field-mapper.dto.d.ts +11 -0
  44. package/dist/module/mapper/dto/field-mapper.dto.js +8 -0
  45. package/dist/module/mapper/dto/field-mapper.dto.js.map +1 -0
  46. package/dist/module/mapper/entity/field-lovs.entity.d.ts +7 -0
  47. package/dist/module/mapper/entity/field-lovs.entity.js +38 -0
  48. package/dist/module/mapper/entity/field-lovs.entity.js.map +1 -0
  49. package/dist/module/mapper/entity/field-mapper.entity.d.ts +12 -0
  50. package/dist/module/mapper/entity/field-mapper.entity.js +58 -0
  51. package/dist/module/mapper/entity/field-mapper.entity.js.map +1 -0
  52. package/dist/module/mapper/mapper.module.d.ts +2 -0
  53. package/dist/module/mapper/mapper.module.js +38 -0
  54. package/dist/module/mapper/mapper.module.js.map +1 -0
  55. package/dist/module/mapper/repository/field-lovs.repository.d.ts +8 -0
  56. package/dist/module/mapper/repository/field-lovs.repository.js +41 -0
  57. package/dist/module/mapper/repository/field-lovs.repository.js.map +1 -0
  58. package/dist/module/mapper/repository/field-mapper.repository.d.ts +9 -0
  59. package/dist/module/mapper/repository/field-mapper.repository.js +42 -0
  60. package/dist/module/mapper/repository/field-mapper.repository.js.map +1 -0
  61. package/dist/module/mapper/service/field-mapper.service.d.ts +16 -0
  62. package/dist/module/mapper/service/field-mapper.service.js +92 -0
  63. package/dist/module/mapper/service/field-mapper.service.js.map +1 -0
  64. package/dist/module/meta/service/resolver.service.d.ts +1 -0
  65. package/dist/module/meta/service/resolver.service.js +30 -0
  66. package/dist/module/meta/service/resolver.service.js.map +1 -1
  67. package/dist/module/notification/controller/notification.controller.d.ts +1 -0
  68. package/dist/module/notification/controller/notification.controller.js +1 -1
  69. package/dist/module/notification/controller/notification.controller.js.map +1 -1
  70. package/dist/module/notification/service/notification.service.d.ts +1 -1
  71. package/dist/module/notification/service/notification.service.js +11 -2
  72. package/dist/module/notification/service/notification.service.js.map +1 -1
  73. package/dist/module/workflow/entity/action.entity.d.ts +2 -0
  74. package/dist/module/workflow/entity/action.entity.js +8 -0
  75. package/dist/module/workflow/entity/action.entity.js.map +1 -1
  76. package/dist/tsconfig.build.tsbuildinfo +1 -1
  77. package/docs/modules/integration.md +55 -1
  78. package/package.json +1 -1
  79. package/src/app.module.ts +2 -0
  80. package/src/module/filter/service/filter.service.ts +39 -25
  81. package/src/module/integration/controller/integration.controller.ts +61 -0
  82. package/src/module/integration/dto/create-config.dto.ts +22 -0
  83. package/src/module/integration/factories/sms.factory.ts +39 -6
  84. package/src/module/integration/factories/whatsapp.factory.ts +10 -0
  85. package/src/module/integration/integration.module.ts +14 -0
  86. package/src/module/integration/service/integration.service.ts +128 -0
  87. package/src/module/integration/strategies/sms/gupshup-sms.strategy.ts +146 -0
  88. package/src/module/integration/strategies/sms/msg91-sms.strategy.ts +164 -0
  89. package/src/module/integration/strategies/sms/tubelight-sms.strategy.ts +163 -0
  90. package/src/module/integration/strategies/telephone/ozonetel-voice.strategy.ts +80 -7
  91. package/src/module/integration/strategies/whatsapp/gupshup-whatsapp.strategy.ts +360 -0
  92. package/src/module/integration/strategies/whatsapp/tubelight-whatsapp.strategy.ts +419 -0
  93. package/src/module/mapper/controller/field-mapper.controller.ts +19 -0
  94. package/src/module/mapper/dto/field-mapper.dto.ts +14 -0
  95. package/src/module/mapper/entity/field-lovs.entity.ts +21 -0
  96. package/src/module/mapper/entity/field-mapper.entity.ts +36 -0
  97. package/src/module/mapper/mapper.module.ts +26 -0
  98. package/src/module/mapper/repository/field-lovs.repository.ts +22 -0
  99. package/src/module/mapper/repository/field-mapper.repository.ts +27 -0
  100. package/src/module/mapper/service/field-mapper.service.ts +91 -0
  101. package/src/module/meta/service/resolver.service.ts +58 -0
  102. package/src/module/notification/controller/notification.controller.ts +8 -1
  103. package/src/module/notification/service/notification.service.ts +19 -4
  104. package/src/module/workflow/entity/action.entity.ts +6 -0
  105. package/src/resources/dev.properties.yaml +1 -1
@@ -195,4 +195,62 @@ export class ResolverService {
195
195
  return rawValue;
196
196
  }
197
197
 
198
+ async getResolvedId(
199
+ loggedInUser: UserData,
200
+ attrKey: string,
201
+ displayValue: any,
202
+ entityType: string,
203
+ ): Promise<any> {
204
+ if (displayValue === null || displayValue === undefined || displayValue === '') {
205
+ return displayValue;
206
+ }
207
+
208
+ // fetch attribute meta
209
+ const [attr] = await this.dataSource.query(
210
+ `SELECT * FROM cr_attribute_master
211
+ WHERE mapped_entity_type = ? AND organization_id = ? AND attribute_key = ?`,
212
+ [entityType, loggedInUser.organization_id, attrKey],
213
+ );
214
+
215
+ if (!attr) return displayValue;
216
+
217
+ // -------- ENTITY data_source_type --------
218
+ if (attr.data_source_type === 'entity') {
219
+ const [entityDef] = await this.dataSource.query(
220
+ `SELECT * FROM cr_entity_master
221
+ WHERE mapped_entity_type = ? AND organization_id = ?`,
222
+ [attr.datasource_list, loggedInUser.organization_id],
223
+ );
224
+
225
+ if (!entityDef) return displayValue;
226
+
227
+ const tableName = entityDef.db_table_name;
228
+
229
+ const query =
230
+ tableName === 'cr_organization'
231
+ ? `SELECT id FROM ${tableName} WHERE ${attr.data_source_attribute} = ?`
232
+ : `SELECT id FROM ${tableName} WHERE ${attr.data_source_attribute} = ? AND organization_id = ?`;
233
+
234
+ const params =
235
+ tableName === 'cr_organization'
236
+ ? [displayValue]
237
+ : [displayValue, loggedInUser.organization_id];
238
+
239
+ const [item] = await this.dataSource.query(query, params);
240
+ return item?.id ?? displayValue;
241
+ }
242
+
243
+ // -------- MASTER data_source_type --------
244
+ else if (attr.data_source_type === 'master') {
245
+ const [item] = await this.dataSource.query(
246
+ `SELECT id FROM cr_list_master_items
247
+ WHERE ${attr.data_source_attribute} = ? AND organization_id = ?`,
248
+ [displayValue, loggedInUser.organization_id],
249
+ );
250
+ return item?.id ?? displayValue;
251
+ }
252
+
253
+ return displayValue;
254
+ }
255
+
198
256
  }
@@ -23,12 +23,19 @@ export class NotificationsController {
23
23
 
24
24
  @Post('send')
25
25
  async sendNotification(
26
- @Body() body: { token: string; title: string; message: string },
26
+ @Body()
27
+ body: {
28
+ token: string;
29
+ title: string;
30
+ message: string;
31
+ data?: Record<string, any>;
32
+ },
27
33
  ) {
28
34
  return this.notificationsService.sendToDevice(
29
35
  body.token,
30
36
  body.title,
31
37
  body.message,
38
+ body.data,
32
39
  );
33
40
  }
34
41
 
@@ -20,13 +20,28 @@ export class NotificationsService {
20
20
  return { success: true, token };
21
21
  }
22
22
 
23
- async sendToDevice(token: string, title: string, body: string) {
24
- const message = {
23
+ async sendToDevice(
24
+ token: string,
25
+ title: string,
26
+ body: string,
27
+ data?: Record<string, any>,
28
+ ) {
29
+ const message: admin.messaging.Message = {
25
30
  token,
26
- notification: { title, body },
31
+ notification: { title, body }, // system notification
32
+ data: data
33
+ ? Object.fromEntries(
34
+ Object.entries(data).map(([k, v]) => [k, v.toString()]),
35
+ )
36
+ : undefined, // FCM requires all values to be strings
27
37
  };
28
38
 
29
- return this.firebaseAdmin.messaging().send(message);
39
+ try {
40
+ return await this.firebaseAdmin.messaging().send(message);
41
+ } catch (error) {
42
+ console.error(error);
43
+ throw error;
44
+ }
30
45
  }
31
46
 
32
47
  // Helper: send to a registered user by userId
@@ -41,4 +41,10 @@ export class ActionEntity extends BaseEntity {
41
41
 
42
42
  @Column({ type: 'int', nullable: true })
43
43
  dependent_action_id: number;
44
+
45
+ @Column({ type: 'varchar', nullable: true })
46
+ mode: string;
47
+
48
+ @Column({ type: 'varchar', nullable: true })
49
+ template: string;
44
50
  }
@@ -1,6 +1,6 @@
1
1
  DB_HOST: '13.234.25.234'
2
2
  # PROFILE: 'dev'
3
- DB_HOST: 'localhost'
3
+ #DB_HOST: 'localhost'
4
4
  DB_PORT: '3306'
5
5
  DB_USER: 'root'
6
6
  DB_PASS: 'Rezolut@123'