rez_core 3.1.108 → 3.1.111
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/dist/module/integration/service/integration.service.js +9 -7
- package/dist/module/integration/service/integration.service.js.map +1 -1
- package/dist/module/meta/service/entity-dynamic.service.js +9 -2
- package/dist/module/meta/service/entity-dynamic.service.js.map +1 -1
- package/dist/module/workflow/service/task.service.js +2 -1
- package/dist/module/workflow/service/task.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/integration/service/integration.service.ts +34 -37
- package/src/module/meta/service/entity-dynamic.service.ts +10 -3
- package/src/module/workflow/service/task.service.ts +2 -1
package/package.json
CHANGED
|
@@ -87,12 +87,12 @@ export class IntegrationService {
|
|
|
87
87
|
private readonly gmailApiStrategy: GmailApiStrategy,
|
|
88
88
|
private readonly sendGridApiStrategy: SendGridApiStrategy,
|
|
89
89
|
private readonly configService: ConfigService,
|
|
90
|
-
@Inject('FieldMapperService')
|
|
91
|
-
private readonly fieldMapperService: FieldMapperService,
|
|
90
|
+
@Inject('FieldMapperService') private readonly fieldMapperService: FieldMapperService,
|
|
92
91
|
private readonly entityService: EntityServiceImpl,
|
|
93
92
|
@Inject(forwardRef(() => IntegrationQueueService))
|
|
94
93
|
private readonly queueService?: IntegrationQueueService,
|
|
95
|
-
) {
|
|
94
|
+
) {
|
|
95
|
+
}
|
|
96
96
|
|
|
97
97
|
private deriveServiceType(
|
|
98
98
|
integration_type: string,
|
|
@@ -104,15 +104,15 @@ export class IntegrationService {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
async sendMessage({
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
107
|
+
levelId,
|
|
108
|
+
levelType,
|
|
109
|
+
app_code,
|
|
110
|
+
to,
|
|
111
|
+
message,
|
|
112
|
+
mode,
|
|
113
|
+
priority = 1,
|
|
114
|
+
user_id,
|
|
115
|
+
}: SendMessageDto): Promise<IntegrationResult> {
|
|
116
116
|
try {
|
|
117
117
|
// Get active communication configs for the level
|
|
118
118
|
const configs = await this.getActiveConfigs(
|
|
@@ -192,9 +192,7 @@ export class IntegrationService {
|
|
|
192
192
|
.where('config.level_id = :levelId', { levelId })
|
|
193
193
|
.andWhere('config.level_type = :levelType', { levelType })
|
|
194
194
|
.andWhere('config.app_code = :app_code', { app_code })
|
|
195
|
-
.andWhere('config.integration_type = :integration_type', {
|
|
196
|
-
integration_type,
|
|
197
|
-
})
|
|
195
|
+
.andWhere('config.integration_type = :integration_type', { integration_type })
|
|
198
196
|
.andWhere('config.status = 1')
|
|
199
197
|
.orderBy('config.is_default', 'DESC')
|
|
200
198
|
.addOrderBy('config.priority', 'ASC')
|
|
@@ -705,7 +703,7 @@ export class IntegrationService {
|
|
|
705
703
|
if (configJson?.[field]) {
|
|
706
704
|
safeConfig[
|
|
707
705
|
`has${field.charAt(0).toUpperCase() + field.slice(1)}`
|
|
708
|
-
|
|
706
|
+
] = true;
|
|
709
707
|
}
|
|
710
708
|
});
|
|
711
709
|
|
|
@@ -842,7 +840,6 @@ export class IntegrationService {
|
|
|
842
840
|
message,
|
|
843
841
|
type,
|
|
844
842
|
priority = 'medium',
|
|
845
|
-
subject,
|
|
846
843
|
html,
|
|
847
844
|
cc,
|
|
848
845
|
bcc,
|
|
@@ -854,6 +851,8 @@ export class IntegrationService {
|
|
|
854
851
|
entity_type,
|
|
855
852
|
} = messageDto;
|
|
856
853
|
|
|
854
|
+
let subject = messageDto.subject;
|
|
855
|
+
|
|
857
856
|
// Auto-detect communication type if not specified
|
|
858
857
|
const communicationType = this.detectCommunicationType(to, type);
|
|
859
858
|
|
|
@@ -913,7 +912,7 @@ export class IntegrationService {
|
|
|
913
912
|
let variables;
|
|
914
913
|
let richText;
|
|
915
914
|
let externalTemplateId: string | undefined = undefined;
|
|
916
|
-
if (templateId
|
|
915
|
+
if (templateId) {
|
|
917
916
|
const templateData = await this.processTemplate(
|
|
918
917
|
parseInt(templateId, 10),
|
|
919
918
|
entity_type,
|
|
@@ -922,6 +921,7 @@ export class IntegrationService {
|
|
|
922
921
|
variables = templateData.variables;
|
|
923
922
|
externalTemplateId = templateData.externalTemplateId;
|
|
924
923
|
richText = templateData.rich_text;
|
|
924
|
+
subject = templateData.subject;
|
|
925
925
|
}
|
|
926
926
|
|
|
927
927
|
// Merge config with enhanced parameters
|
|
@@ -1011,6 +1011,7 @@ export class IntegrationService {
|
|
|
1011
1011
|
variables = templateData.variables;
|
|
1012
1012
|
externalTemplateId = templateData.externalTemplateId;
|
|
1013
1013
|
richText = templateData.rich_text;
|
|
1014
|
+
subject = templateData.subject;
|
|
1014
1015
|
}
|
|
1015
1016
|
|
|
1016
1017
|
// Merge config with enhanced parameters
|
|
@@ -1019,7 +1020,7 @@ export class IntegrationService {
|
|
|
1019
1020
|
...enhancedConfig,
|
|
1020
1021
|
templateId: externalTemplateId,
|
|
1021
1022
|
variables,
|
|
1022
|
-
richText
|
|
1023
|
+
richText
|
|
1023
1024
|
};
|
|
1024
1025
|
|
|
1025
1026
|
// Handle user integration if user_id provided
|
|
@@ -1035,7 +1036,11 @@ export class IntegrationService {
|
|
|
1035
1036
|
}
|
|
1036
1037
|
}
|
|
1037
1038
|
|
|
1038
|
-
const result = await strategy.sendMessage(
|
|
1039
|
+
const result = await strategy.sendMessage(
|
|
1040
|
+
to,
|
|
1041
|
+
message,
|
|
1042
|
+
finalConfig,
|
|
1043
|
+
);
|
|
1039
1044
|
|
|
1040
1045
|
if (result.success) {
|
|
1041
1046
|
this.logger.log(
|
|
@@ -1255,16 +1260,8 @@ export class IntegrationService {
|
|
|
1255
1260
|
templateId: number,
|
|
1256
1261
|
entity_type: any,
|
|
1257
1262
|
entity_id: any,
|
|
1258
|
-
): Promise<{
|
|
1259
|
-
|
|
1260
|
-
externalTemplateId?: string;
|
|
1261
|
-
rich_text?: string;
|
|
1262
|
-
}> {
|
|
1263
|
-
const commTemplate: any = await this.entityService.getEntityData(
|
|
1264
|
-
COMM_TEMPLATE,
|
|
1265
|
-
templateId,
|
|
1266
|
-
{} as any,
|
|
1267
|
-
);
|
|
1263
|
+
): Promise<{ variables?: Record<string, any>; externalTemplateId?: string; rich_text?: string; subject?: string }> {
|
|
1264
|
+
const commTemplate: any = await this.entityService.getEntityData(COMM_TEMPLATE, templateId, {} as any);
|
|
1268
1265
|
if (!commTemplate) {
|
|
1269
1266
|
return {
|
|
1270
1267
|
variables: {},
|
|
@@ -1276,7 +1273,7 @@ export class IntegrationService {
|
|
|
1276
1273
|
if (commTemplate.mapper_id) {
|
|
1277
1274
|
variables = await this.fieldMapperService.resolveData(
|
|
1278
1275
|
commTemplate.mapper_id,
|
|
1279
|
-
|
|
1276
|
+
"LOOKUP",
|
|
1280
1277
|
entity_type,
|
|
1281
1278
|
entity_id,
|
|
1282
1279
|
{} as any,
|
|
@@ -1293,6 +1290,7 @@ export class IntegrationService {
|
|
|
1293
1290
|
|
|
1294
1291
|
return {
|
|
1295
1292
|
rich_text: richText,
|
|
1293
|
+
subject: commTemplate.subject
|
|
1296
1294
|
};
|
|
1297
1295
|
}
|
|
1298
1296
|
|
|
@@ -1980,10 +1978,10 @@ export class IntegrationService {
|
|
|
1980
1978
|
|
|
1981
1979
|
async getIntegrationConfigById(hubId: number): Promise<
|
|
1982
1980
|
| (IntegrationConfig & {
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1981
|
+
config: IntegrationConfig;
|
|
1982
|
+
linkedSource?: string;
|
|
1983
|
+
configDetails?: any;
|
|
1984
|
+
})
|
|
1987
1985
|
| null
|
|
1988
1986
|
> {
|
|
1989
1987
|
try {
|
|
@@ -2475,8 +2473,7 @@ export class IntegrationService {
|
|
|
2475
2473
|
if (!userIntegration) {
|
|
2476
2474
|
return {
|
|
2477
2475
|
success: false,
|
|
2478
|
-
error:
|
|
2479
|
-
'User integration mapping not found. Please configure agent details.',
|
|
2476
|
+
error: 'User integration mapping not found. Please configure agent details.',
|
|
2480
2477
|
};
|
|
2481
2478
|
}
|
|
2482
2479
|
|
|
@@ -370,9 +370,16 @@ export class EntityDynamicService {
|
|
|
370
370
|
// Insert relation
|
|
371
371
|
await this.dataSource.query(
|
|
372
372
|
`INSERT INTO cr_entity_relation_data
|
|
373
|
-
(source_entity_id, source_entity_type, target_entity_id, target_entity_type, relation_type)
|
|
374
|
-
VALUES (?, ?, ?, ?,
|
|
375
|
-
[
|
|
373
|
+
(organization_id, source_entity_id, source_entity_type, target_entity_id, target_entity_type, relation_type)
|
|
374
|
+
VALUES (?, ?, ?, ?, ?,?)`,
|
|
375
|
+
[
|
|
376
|
+
organizationId,
|
|
377
|
+
id,
|
|
378
|
+
entityType,
|
|
379
|
+
targetEntityId,
|
|
380
|
+
targetEntityType,
|
|
381
|
+
relationType,
|
|
382
|
+
],
|
|
376
383
|
);
|
|
377
384
|
|
|
378
385
|
if (relationType === 'ONE_TO_MANY') {
|
|
@@ -109,8 +109,9 @@ export class TaskService extends EntityServiceImpl {
|
|
|
109
109
|
|
|
110
110
|
if (relationData) {
|
|
111
111
|
await this.dataSource.query(
|
|
112
|
-
`INSERT INTO cr_entity_relation_data (source_entity_id, source_entity_type, target_entity_id, target_entity_type, relation_type) VALUES (?, ?, ?, ?, ?)`,
|
|
112
|
+
`INSERT INTO cr_entity_relation_data (organization_id, source_entity_id, source_entity_type, target_entity_id, target_entity_type, relation_type) VALUES (?, ?, ?, ?, ?)`,
|
|
113
113
|
[
|
|
114
|
+
loggedInUser.organization_id,
|
|
114
115
|
createdEntity.mapped_entity_id,
|
|
115
116
|
createdEntity.mapped_entity_type,
|
|
116
117
|
createdEntity.id,
|