rez_core 3.1.43 → 3.1.45
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/entity/{integration-ivr-mapper.entity.d.ts → integration-entity-mapper.entity.d.ts} +2 -2
- package/dist/module/integration/entity/{integration-ivr-mapper.entity.js → integration-entity-mapper.entity.js} +14 -14
- package/dist/module/integration/entity/integration-entity-mapper.entity.js.map +1 -0
- package/dist/module/integration/integration.module.js +4 -0
- package/dist/module/integration/integration.module.js.map +1 -1
- package/dist/module/integration/service/integration-entity-mapper.service.d.ts +7 -0
- package/dist/module/integration/service/integration-entity-mapper.service.js +36 -0
- package/dist/module/integration/service/integration-entity-mapper.service.js.map +1 -0
- package/dist/module/integration/service/integration.service.d.ts +3 -1
- package/dist/module/integration/service/integration.service.js +26 -2
- package/dist/module/integration/service/integration.service.js.map +1 -1
- package/dist/module/mapper/controller/field-mapper.controller.d.ts +4 -2
- package/dist/module/mapper/controller/field-mapper.controller.js +14 -5
- package/dist/module/mapper/controller/field-mapper.controller.js.map +1 -1
- package/dist/module/mapper/entity/field-mapper.entity.d.ts +1 -1
- package/dist/module/mapper/entity/field-mapper.entity.js +2 -2
- package/dist/module/mapper/entity/field-mapper.entity.js.map +1 -1
- package/dist/module/mapper/repository/field-mapper.repository.d.ts +2 -2
- package/dist/module/mapper/repository/field-mapper.repository.js +6 -4
- package/dist/module/mapper/repository/field-mapper.repository.js.map +1 -1
- package/dist/module/mapper/service/field-mapper.service.d.ts +3 -2
- package/dist/module/mapper/service/field-mapper.service.js +9 -8
- package/dist/module/mapper/service/field-mapper.service.js.map +1 -1
- package/dist/module/workflow-automation/entity/workflow-automation.entity.d.ts +1 -1
- package/dist/module/workflow-automation/entity/workflow-automation.entity.js +1 -1
- package/dist/module/workflow-automation/entity/workflow-automation.entity.js.map +1 -1
- package/dist/module/workflow-automation/service/workflow-automation.service.d.ts +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/integration/entity/integration-entity-mapper.entity.ts +14 -0
- package/src/module/integration/integration.module.ts +4 -0
- package/src/module/integration/service/integration-entity-mapper.service.ts +18 -0
- package/src/module/integration/service/integration.service.ts +31 -0
- package/src/module/mapper/controller/field-mapper.controller.ts +10 -6
- package/src/module/mapper/entity/field-mapper.entity.ts +2 -2
- package/src/module/mapper/repository/field-mapper.repository.ts +7 -4
- package/src/module/mapper/service/field-mapper.service.ts +12 -12
- package/src/module/workflow-automation/entity/workflow-automation.entity.ts +1 -1
- package/dist/module/integration/entity/integration-ivr-mapper.entity.js.map +0 -1
- package/src/module/integration/entity/integration-ivr-mapper.entity.ts +0 -14
package/package.json
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseEntity } from 'src/module/meta/entity/base-entity.entity';
|
|
2
|
+
import { Column, Entity } from 'typeorm';
|
|
3
|
+
|
|
4
|
+
@Entity({ name: 'cr_integration_entity_mapper' })
|
|
5
|
+
export class IntegrationEntityMapper extends BaseEntity {
|
|
6
|
+
@Column({ name: 'integration_config_id', type: 'bigint', nullable: true })
|
|
7
|
+
integration_config_id: number;
|
|
8
|
+
|
|
9
|
+
@Column({ name: 'did', type: 'varchar', length: 100 })
|
|
10
|
+
did: string;
|
|
11
|
+
|
|
12
|
+
@Column({ name: 'campaign_name', type: 'varchar', length: 100, nullable: true })
|
|
13
|
+
campaign_name: string;
|
|
14
|
+
}
|
|
@@ -43,6 +43,8 @@ import { WrapperController } from './controller/wrapper.controller';
|
|
|
43
43
|
import { IcsMeetingModule } from '../ics/ics.module';
|
|
44
44
|
import { IntegrationSource } from './entity/integration-source.entity';
|
|
45
45
|
import { UserIntegration } from './entity/user-integration.entity';
|
|
46
|
+
import { IntegrationEntityMapper } from './entity/integration-entity-mapper.entity';
|
|
47
|
+
import { IntegrationEntityMapperService } from './service/integration-entity-mapper.service';
|
|
46
48
|
|
|
47
49
|
@Module({
|
|
48
50
|
imports: [
|
|
@@ -50,6 +52,7 @@ import { UserIntegration } from './entity/user-integration.entity';
|
|
|
50
52
|
IntegrationConfig,
|
|
51
53
|
IntegrationSource,
|
|
52
54
|
UserIntegration,
|
|
55
|
+
IntegrationEntityMapper,
|
|
53
56
|
]),
|
|
54
57
|
IcsMeetingModule,
|
|
55
58
|
],
|
|
@@ -58,6 +61,7 @@ import { UserIntegration } from './entity/user-integration.entity';
|
|
|
58
61
|
// Main Services
|
|
59
62
|
IntegrationService,
|
|
60
63
|
IntegrationQueueService,
|
|
64
|
+
IntegrationEntityMapperService,
|
|
61
65
|
OAuthService,
|
|
62
66
|
|
|
63
67
|
// Email Strategies (API only)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
import { InjectRepository } from '@nestjs/typeorm';
|
|
3
|
+
import { IntegrationEntityMapper } from '../entity/integration-entity-mapper.entity';
|
|
4
|
+
import { Repository } from 'typeorm';
|
|
5
|
+
|
|
6
|
+
@Injectable()
|
|
7
|
+
export class IntegrationEntityMapperService {
|
|
8
|
+
constructor(
|
|
9
|
+
@InjectRepository(IntegrationEntityMapper) private readonly integrationEntityMapperRepo: Repository<IntegrationEntityMapper>,
|
|
10
|
+
) {
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
async findByDid(did: string) {
|
|
14
|
+
return this.integrationEntityMapperRepo.findOne({
|
|
15
|
+
where: { did },
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -5,6 +5,7 @@ import { ConfigService } from '@nestjs/config';
|
|
|
5
5
|
import { google } from 'googleapis';
|
|
6
6
|
import { IntegrationConfig } from '../entity/integration-config.entity';
|
|
7
7
|
import { UserIntegration } from '../entity/user-integration.entity';
|
|
8
|
+
import { IntegrationEntityMapper } from '../entity/integration-entity-mapper.entity';
|
|
8
9
|
import { IntegrationFactory } from '../factories/integration.factory';
|
|
9
10
|
import { IntegrationResult } from '../strategies/integration.strategy';
|
|
10
11
|
import { GmailApiStrategy } from '../strategies/email/gmail-api.strategy';
|
|
@@ -73,6 +74,8 @@ export class IntegrationService {
|
|
|
73
74
|
private readonly configRepository: Repository<IntegrationConfig>,
|
|
74
75
|
@InjectRepository(UserIntegration)
|
|
75
76
|
private readonly userIntegrationRepository: Repository<UserIntegration>,
|
|
77
|
+
@InjectRepository(IntegrationEntityMapper)
|
|
78
|
+
private readonly entityMapperRepository: Repository<IntegrationEntityMapper>,
|
|
76
79
|
|
|
77
80
|
private readonly dataSource: DataSource,
|
|
78
81
|
private readonly integrationFactory: IntegrationFactory,
|
|
@@ -1693,6 +1696,34 @@ export class IntegrationService {
|
|
|
1693
1696
|
`Communication config created: ${configType}/${provider} for ${levelType} ${levelId}`,
|
|
1694
1697
|
);
|
|
1695
1698
|
|
|
1699
|
+
// Store DID mapping for TELEPHONE integration
|
|
1700
|
+
if (configType === 'TELEPHONE') {
|
|
1701
|
+
try {
|
|
1702
|
+
// Extract DID from config (could be did, callerNumber, or fromNumber)
|
|
1703
|
+
const did = config.did || config.callerNumber || config.fromNumber;
|
|
1704
|
+
|
|
1705
|
+
if (did) {
|
|
1706
|
+
const entityMapper = this.entityMapperRepository.create({
|
|
1707
|
+
integration_config_id: savedConfig.id,
|
|
1708
|
+
level_id: String(levelId),
|
|
1709
|
+
level_type: levelType,
|
|
1710
|
+
appcode: app_code,
|
|
1711
|
+
did: did,
|
|
1712
|
+
campaign_name: config.campaignName || null,
|
|
1713
|
+
});
|
|
1714
|
+
|
|
1715
|
+
await this.entityMapperRepository.save(entityMapper);
|
|
1716
|
+
this.logger.log(
|
|
1717
|
+
`DID mapping created for TELEPHONE integration: ${did} for ${levelType} ${levelId}`,
|
|
1718
|
+
);
|
|
1719
|
+
}
|
|
1720
|
+
} catch (error) {
|
|
1721
|
+
this.logger.warn(
|
|
1722
|
+
`Failed to create DID mapping for TELEPHONE integration: ${error.message}`,
|
|
1723
|
+
);
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1696
1727
|
return Array.isArray(savedConfig) ? savedConfig[0] : savedConfig;
|
|
1697
1728
|
}
|
|
1698
1729
|
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { Body, Controller, Inject, Post, Query, Req, UseGuards } from '@nestjs/common';
|
|
1
|
+
import { Body, Controller, Get, Inject, Param, Post, Query, Req, UseGuards } from '@nestjs/common';
|
|
2
2
|
import { FieldMapperService } from '../service/field-mapper.service';
|
|
3
3
|
import { JwtAuthGuard } from '../../auth/guards/jwt.guard';
|
|
4
|
+
import { FieldMapperDto } from '../dto/field-mapper.dto';
|
|
4
5
|
|
|
5
6
|
@Controller('field-mapper')
|
|
7
|
+
@UseGuards(JwtAuthGuard)
|
|
6
8
|
export class FieldMapperController {
|
|
7
9
|
constructor(@Inject('FieldMapperService') private readonly fieldMapperService: FieldMapperService) {
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
@Post('resolve')
|
|
11
|
-
@
|
|
12
|
-
async resolve(@Req() req: any, @Query('integration_component') integration_component: string,
|
|
13
|
+
async resolve(@Req() req: any, @Query('integration_component') integration_component: number,
|
|
13
14
|
@Query('entity_type') entity_type: string,
|
|
14
15
|
@Query('entity_id') entity_id: number) {
|
|
15
16
|
const loggedInUser = req.user.userData;
|
|
@@ -18,10 +19,13 @@ export class FieldMapperController {
|
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
@Post('bulk')
|
|
21
|
-
@
|
|
22
|
-
async createBulk(@Req() req: any, @Body() dtos: string) {
|
|
22
|
+
async createBulk(@Req() req: any, @Body() dtos: FieldMapperDto[]) {
|
|
23
23
|
const loggedInUser = req.user.userData;
|
|
24
|
-
return this.fieldMapperService.createFieldMappers(dtos);
|
|
24
|
+
return this.fieldMapperService.createFieldMappers(dtos, loggedInUser);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
@Get('getFields/:mapperId')
|
|
28
|
+
async getFieldsByMapper(@Param('mapperId') mapperId: number) {
|
|
29
|
+
return this.fieldMapperService.getMapperFields(mapperId);
|
|
30
|
+
}
|
|
27
31
|
}
|
|
@@ -9,8 +9,8 @@ export class FieldMapper extends BaseEntity {
|
|
|
9
9
|
this.entity_type = 'FMAP';
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
@Column({ name: 'mapper_id', type: '
|
|
13
|
-
mapper_id:
|
|
12
|
+
@Column({ name: 'mapper_id', type: 'bigint' })
|
|
13
|
+
mapper_id: number;
|
|
14
14
|
|
|
15
15
|
@Column({ name: 'action', type: 'varchar', length: 30 })
|
|
16
16
|
action: string;
|
|
@@ -11,9 +11,9 @@ export class FieldMapperRepository {
|
|
|
11
11
|
) {
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
async
|
|
14
|
+
async findByMapperIdAndMappedEntityType(mapper_id: number, mapped_entity_type: string) {
|
|
15
15
|
return await this.fieldMapperRepository.find({
|
|
16
|
-
where: { mapper_id
|
|
16
|
+
where: { mapper_id, mapped_entity_type },
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -21,7 +21,10 @@ export class FieldMapperRepository {
|
|
|
21
21
|
return await this.fieldMapperRepository.save(dto);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
async
|
|
25
|
-
return await this.fieldMapperRepository.
|
|
24
|
+
async findByMapperId(mapper_id: number) {
|
|
25
|
+
return await this.fieldMapperRepository.find({
|
|
26
|
+
where: {mapper_id},
|
|
27
|
+
},
|
|
28
|
+
);
|
|
26
29
|
}
|
|
27
30
|
}
|
|
@@ -22,13 +22,6 @@ export class FieldMapperService extends EntityServiceImpl {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
async createEntity(dto: FieldMapperDto, loggedInUser: UserData) {
|
|
25
|
-
if (dto.filter_json) {
|
|
26
|
-
const savedFilter = await this.savedFilterService.createEntity(
|
|
27
|
-
dto.filter_json,
|
|
28
|
-
loggedInUser,
|
|
29
|
-
);
|
|
30
|
-
dto.filter_code = savedFilter.code;
|
|
31
|
-
}
|
|
32
25
|
return super.createEntity(dto, loggedInUser);
|
|
33
26
|
}
|
|
34
27
|
|
|
@@ -43,19 +36,26 @@ export class FieldMapperService extends EntityServiceImpl {
|
|
|
43
36
|
return super.updateEntity(dto, loggedInUser);
|
|
44
37
|
}
|
|
45
38
|
|
|
46
|
-
async createFieldMappers(dtos) {
|
|
47
|
-
|
|
39
|
+
async createFieldMappers(dtos: FieldMapperDto[], loggedInUser: UserData) {
|
|
40
|
+
for (const dto of dtos) {
|
|
41
|
+
await super.createEntity(dto, loggedInUser);
|
|
42
|
+
}
|
|
48
43
|
}
|
|
49
44
|
|
|
45
|
+
async getMapperFields(mapperId: number) {
|
|
46
|
+
return await this.fieldMapperRepository.findByMapperId(mapperId);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
50
50
|
async resolveData(
|
|
51
|
-
|
|
51
|
+
mapper_id: number,
|
|
52
52
|
parent_type: string,
|
|
53
53
|
parent_id: number,
|
|
54
54
|
userData: UserData,
|
|
55
55
|
) {
|
|
56
56
|
const fieldMappers =
|
|
57
|
-
await this.fieldMapperRepository.
|
|
58
|
-
|
|
57
|
+
await this.fieldMapperRepository.findByMapperIdAndMappedEntityType(
|
|
58
|
+
mapper_id,
|
|
59
59
|
parent_type,
|
|
60
60
|
);
|
|
61
61
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"integration-ivr-mapper.entity.js","sourceRoot":"","sources":["../../../../src/module/integration/entity/integration-ivr-mapper.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6EAAuE;AACvE,qCAAyC;AAGlC,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,+BAAU;CAShD,CAAA;AATY,8CAAiB;AAE5B;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;;8CAC1C;AAGZ;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;;wDAC1C;AAGtB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,oBAAoB,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;;6DACzC;4BARhB,iBAAiB;IAD7B,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,iCAAiC,EAAE,CAAC;GACvC,iBAAiB,CAS7B"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { BaseEntity } from 'src/module/meta/entity/base-entity.entity';
|
|
2
|
-
import { Column, Entity } from 'typeorm';
|
|
3
|
-
|
|
4
|
-
@Entity({ name: 'cr_integration_telephone_mapper' })
|
|
5
|
-
export class IntegrationSource extends BaseEntity {
|
|
6
|
-
@Column({ name: 'did', type: 'varchar', length: 100 })
|
|
7
|
-
did: string;
|
|
8
|
-
|
|
9
|
-
@Column({ name: 'campaign_name', type: 'varchar', length: 100 })
|
|
10
|
-
campaign_name: string;
|
|
11
|
-
|
|
12
|
-
@Column({ name: 'mapped_entity_type', type: 'varchar', length: 20 })
|
|
13
|
-
mapped_entity_type: string;
|
|
14
|
-
}
|