rez_core 5.0.152 → 5.0.154

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 (76) hide show
  1. package/dist/config/bull.config.js +4 -4
  2. package/dist/config/bull.config.js.map +1 -1
  3. package/dist/core.module.js +2 -5
  4. package/dist/core.module.js.map +1 -1
  5. package/dist/module/entity_json/entity_json.module.js +1 -1
  6. package/dist/module/entity_json/entity_json.module.js.map +1 -1
  7. package/dist/module/entity_json/service/entity_json.service.js +1 -1
  8. package/dist/module/entity_json/service/entity_json.service.js.map +1 -1
  9. package/dist/module/filter/controller/filter.controller.d.ts +0 -12
  10. package/dist/module/filter/controller/filter.controller.js +1 -1
  11. package/dist/module/filter/controller/filter.controller.js.map +1 -1
  12. package/dist/module/filter/entity/saved-filter-master.entity.d.ts +2 -1
  13. package/dist/module/filter/entity/saved-filter-master.entity.js +6 -2
  14. package/dist/module/filter/entity/saved-filter-master.entity.js.map +1 -1
  15. package/dist/module/filter/filter.module.js +2 -9
  16. package/dist/module/filter/filter.module.js.map +1 -1
  17. package/dist/module/filter/repository/saved-filter.repository.d.ts +1 -5
  18. package/dist/module/filter/repository/saved-filter.repository.js +1 -5
  19. package/dist/module/filter/repository/saved-filter.repository.js.map +1 -1
  20. package/dist/module/filter/service/filter.service.d.ts +1 -37
  21. package/dist/module/filter/service/filter.service.js +2 -30
  22. package/dist/module/filter/service/filter.service.js.map +1 -1
  23. package/dist/module/integration/service/wrapper.service.d.ts +3 -1
  24. package/dist/module/integration/service/wrapper.service.js +24 -2
  25. package/dist/module/integration/service/wrapper.service.js.map +1 -1
  26. package/dist/module/linked_attributes/controller/linked_attributes.controller.d.ts +0 -19
  27. package/dist/module/linked_attributes/controller/linked_attributes.controller.js +0 -77
  28. package/dist/module/linked_attributes/controller/linked_attributes.controller.js.map +1 -1
  29. package/dist/module/linked_attributes/linked_attributes.module.js +1 -8
  30. package/dist/module/linked_attributes/linked_attributes.module.js.map +1 -1
  31. package/dist/module/linked_attributes/service/linked_attributes.service.d.ts +1 -41
  32. package/dist/module/linked_attributes/service/linked_attributes.service.js +2 -266
  33. package/dist/module/linked_attributes/service/linked_attributes.service.js.map +1 -1
  34. package/dist/module/meta/dto/entity-table.dto.d.ts +1 -4
  35. package/dist/module/meta/dto/entity-table.dto.js.map +1 -1
  36. package/dist/module/meta/service/media-data.service.js +18 -5
  37. package/dist/module/meta/service/media-data.service.js.map +1 -1
  38. package/dist/module/workflow/service/action.service.js +2 -10
  39. package/dist/module/workflow/service/action.service.js.map +1 -1
  40. package/dist/table.config.d.ts +1 -3
  41. package/dist/table.config.js +0 -2
  42. package/dist/table.config.js.map +1 -1
  43. package/dist/tsconfig.build.tsbuildinfo +1 -1
  44. package/package.json +1 -1
  45. package/src/config/bull.config.ts +4 -4
  46. package/src/core.module.ts +2 -5
  47. package/src/module/entity_json/entity_json.module.ts +1 -1
  48. package/src/module/entity_json/service/entity_json.service.ts +1 -1
  49. package/src/module/filter/controller/filter.controller.ts +3 -1
  50. package/src/module/filter/entity/saved-filter-master.entity.ts +5 -2
  51. package/src/module/filter/filter.module.ts +2 -9
  52. package/src/module/filter/repository/saved-filter.repository.ts +9 -5
  53. package/src/module/filter/service/filter.service.ts +0 -49
  54. package/src/module/integration/service/wrapper.service.ts +37 -0
  55. package/src/module/linked_attributes/controller/linked_attributes.controller.ts +0 -86
  56. package/src/module/linked_attributes/linked_attributes.module.ts +2 -9
  57. package/src/module/linked_attributes/service/linked_attributes.service.ts +3 -548
  58. package/src/module/meta/dto/entity-table.dto.ts +3 -1
  59. package/src/module/meta/service/media-data.service.ts +27 -9
  60. package/src/module/workflow/service/action.service.ts +6 -10
  61. package/src/table.config.ts +0 -2
  62. package/dist/migrations/1732612800000-AddEntityJsonGinIndex.d.ts +0 -6
  63. package/dist/migrations/1732612800000-AddEntityJsonGinIndex.js +0 -32
  64. package/dist/migrations/1732612800000-AddEntityJsonGinIndex.js.map +0 -1
  65. package/dist/module/filter/service/flatjson-filter.service.d.ts +0 -30
  66. package/dist/module/filter/service/flatjson-filter.service.js +0 -615
  67. package/dist/module/filter/service/flatjson-filter.service.js.map +0 -1
  68. package/dist/module/linked_attributes/dto/create-linked-attribute-smart.dto.d.ts +0 -13
  69. package/dist/module/linked_attributes/dto/create-linked-attribute-smart.dto.js +0 -64
  70. package/dist/module/linked_attributes/dto/create-linked-attribute-smart.dto.js.map +0 -1
  71. package/src/migrations/1732612800000-AddEntityJsonGinIndex.ts +0 -41
  72. package/src/module/entity_json/docs/FlatJson_Filterin_System.md +0 -2804
  73. package/src/module/filter/service/flatjson-filter.service.ts +0 -888
  74. package/src/module/filter/test/flatjson-filter.service.spec.ts +0 -415
  75. package/src/module/linked_attributes/dto/create-linked-attribute-smart.dto.ts +0 -54
  76. package/src/module/linked_attributes/test/linked-attributes.service.spec.ts +0 -244
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez_core",
3
- "version": "5.0.152",
3
+ "version": "5.0.154",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -13,10 +13,10 @@ export class BullConfigService implements SharedBullConfigurationFactory {
13
13
  createSharedConfiguration(): BullModuleOptions {
14
14
  return {
15
15
  redis: {
16
- host: this.configService.get<string>('REDIS_HOST', '43.205.35.45'),
17
- port: this.configService.get<number>('REDIS_PORT', 6379),
18
- password: this.configService.get<string>('REDIS_PASSWORD','Rezolut123'),
19
- db: this.configService.get<number>('REDIS_DB', 0),
16
+ host: '43.205.35.45',
17
+ port: 6379,
18
+ password: 'Rezolut123',
19
+ db: 0,
20
20
  // Enable offline queue to handle Redis disconnections
21
21
  enableOfflineQueue: true,
22
22
  // Retry strategy for Redis connection
@@ -19,7 +19,6 @@ import { MapperModule } from './module/mapper/mapper.module';
19
19
  import { WorkflowScheduleModule } from './module/workflow-schedule/workflow-schedule.module';
20
20
  import { LinkedAttributesModule } from './module/linked_attributes/linked_attributes.module';
21
21
  import { ExportModule } from './module/export/export.module';
22
- import { EntityJSONModule } from './module/entity_json/entity_json.module';
23
22
 
24
23
  @Global()
25
24
  @Module({})
@@ -49,8 +48,7 @@ export class CoreModule {
49
48
  WorkflowScheduleModule.forRoot({ is_workflow: isWorkflow }),
50
49
  MapperModule,
51
50
  LinkedAttributesModule,
52
- ExportModule,
53
- EntityJSONModule
51
+ ExportModule
54
52
  ];
55
53
 
56
54
  const exportsArray = [
@@ -69,8 +67,7 @@ export class CoreModule {
69
67
  WorkflowAutomationModule,
70
68
  WorkflowScheduleModule.forRoot({ is_workflow: isWorkflow }),
71
69
  LinkedAttributesModule,
72
- ExportModule,
73
- EntityJSONModule
70
+ ExportModule
74
71
  ];
75
72
 
76
73
  if (isSso) {
@@ -13,6 +13,6 @@ import { EntityJSONRepository } from './service/entityJson.repository';
13
13
  imports: [EntityModule, TypeOrmModule.forFeature([EntityJson]),FilterModule,UtilsModule],
14
14
  controllers: [EntityJSONController],
15
15
  providers: [EntityJSONService,EntityJSONRepository],
16
- exports: [EntityJSONService],
16
+ exports: [],
17
17
  })
18
18
  export class EntityJSONModule {}
@@ -107,7 +107,7 @@ export class EntityJSONService extends EntityServiceImpl {
107
107
  dropdown.push(...mainAttributes.map(a => ({ label: a.name, value: a.flat_json_key })));
108
108
  dropdown.push(...relatedAttributes.map(a => ({ label: a.name, value: a.flat_json_key })));
109
109
  if (linkedAttributes.length > 0) {
110
- dropdown.push(...linkedAttributes.map(a => ({ label: a.name, value: a.target_attribute_key })));
110
+ dropdown.push(...linkedAttributes.map(a => ({ label: a.name, value: a.attribute_key })));
111
111
  }
112
112
 
113
113
  return dropdown;
@@ -48,7 +48,9 @@ export class FilterController {
48
48
  sortby,
49
49
  } = body;
50
50
 
51
- return this.filterService.applyFilterWithRouting({
51
+
52
+
53
+ return this.filterService.applyFilterWrapper({
52
54
  entity_type,
53
55
  quickFilter,
54
56
  savedFilterCode,
@@ -24,6 +24,9 @@ export class SavedFilterMaster extends BaseEntity {
24
24
  @Column({ type: 'boolean', default: false, nullable: true })
25
25
  is_shared: boolean;
26
26
 
27
- @Column({ type: 'varchar', length: 100, nullable: true })
28
- is_editable: string;
27
+ @Column({ type: 'boolean', default: false, nullable: true })
28
+ is_editable: boolean;
29
+
30
+ @Column({ type: 'varchar', length: 200, nullable: true })
31
+ description: string;
29
32
  }
@@ -9,16 +9,11 @@ import { FilterService } from './service/filter.service';
9
9
  import { FilterController } from './controller/filter.controller';
10
10
  import { FilterEvaluatorService } from './service/filter-evaluator.service';
11
11
  import { SavedFilterDetailRepository } from './repository/saved.filter-detail.repository';
12
- import { FlatjsonFilterService } from './service/flatjson-filter.service';
13
- import { ConfigModule } from '@nestjs/config';
14
- import { UtilsModule } from 'src/utils/utils.module';
15
12
 
16
13
  @Module({
17
14
  imports: [
18
15
  TypeOrmModule.forFeature([SavedFilterDetail, SavedFilterMaster]),
19
- forwardRef(() => EntityModule),
20
- ConfigModule,
21
- UtilsModule,
16
+ forwardRef(() => EntityModule)
22
17
  ],
23
18
  controllers: [FilterController],
24
19
  providers: [
@@ -26,15 +21,13 @@ import { UtilsModule } from 'src/utils/utils.module';
26
21
  SavedFilterRepositoryService,
27
22
  FilterService,
28
23
  FilterEvaluatorService,
29
- SavedFilterDetailRepository,
30
- FlatjsonFilterService,
24
+ SavedFilterDetailRepository
31
25
  ],
32
26
  exports: [
33
27
  'SavedFilterService',
34
28
  SavedFilterRepositoryService,
35
29
  FilterService,
36
30
  FilterEvaluatorService,
37
- FlatjsonFilterService,
38
31
  ],
39
32
  })
40
33
  export class FilterModule {}
@@ -107,6 +107,7 @@ export class SavedFilterRepositoryService {
107
107
  value: filter.id,
108
108
  code: filter.code,
109
109
  }));
110
+ // return filters;
110
111
  }
111
112
 
112
113
  async getSharedFiltersByLevelTypeAndLevelId(
@@ -127,11 +128,14 @@ export class SavedFilterRepositoryService {
127
128
  },
128
129
  });
129
130
 
130
- return filters.map((filter) => ({
131
- label: filter.name,
132
- value: filter.id,
133
- code: filter.code,
134
- }));
131
+ return filters;
132
+
133
+ // return filters.map((filter) => ({
134
+ // label: filter.name,
135
+ // value: filter.id,
136
+ // code: filter.code,
137
+
138
+ // }));
135
139
  }
136
140
 
137
141
  async getFilterById(id: number): Promise<
@@ -11,7 +11,6 @@ import { LoggingService } from 'src/utils/service/loggingUtil.service';
11
11
  import { ConfigService } from '@nestjs/config';
12
12
  import { ReflectionHelper } from '../../../utils/service/reflection-helper.service';
13
13
  import { EntityManager } from 'typeorm';
14
- import { FlatjsonFilterService } from './flatjson-filter.service';
15
14
 
16
15
  @Injectable()
17
16
  export class FilterService {
@@ -27,7 +26,6 @@ export class FilterService {
27
26
  @Inject() protected readonly loggingService: LoggingService,
28
27
  private readonly configService: ConfigService,
29
28
  private readonly reflectionHelper: ReflectionHelper,
30
- private readonly flatjsonFilterService: FlatjsonFilterService,
31
29
  ) {}
32
30
 
33
31
  private async gettab_value_counts(
@@ -98,53 +96,6 @@ export class FilterService {
98
96
  ];
99
97
  }
100
98
 
101
- /**
102
- * Route to flatjson or traditional filtering based on configuration
103
- */
104
- async applyFilterWithRouting(dto: FilterRequestDto) {
105
- // Check if flatjson filtering is enabled via config or query param
106
- const useFlatjson =
107
- this.configService.get<string>('ENABLE_FLATJSON_FILTER') === 'true' ||
108
- dto.queryParams?.use_flatjson === 'true';
109
-
110
- if (useFlatjson) {
111
- await this.loggingService.log(
112
- 'info',
113
- 'FilterService',
114
- 'applyFilterWithRouting',
115
- `Using FLATJSON filtering for ${dto.entity_type}`,
116
- );
117
-
118
- // Use new flatjson filtering service
119
- const result = await this.flatjsonFilterService.applyFlatjsonFilter(dto);
120
-
121
- // Transform to match existing response format
122
- return {
123
- success: true,
124
- data: {
125
- entity_tabs: result.tabCounts || [],
126
- entity_list: result.data,
127
- pagination: {
128
- total: result.total,
129
- page: result.page,
130
- size: result.size,
131
- totalPages: result.totalPages,
132
- },
133
- },
134
- };
135
- } else {
136
- await this.loggingService.log(
137
- 'info',
138
- 'FilterService',
139
- 'applyFilterWithRouting',
140
- `Using TRADITIONAL filtering for ${dto.entity_type}`,
141
- );
142
-
143
- // Use traditional filtering
144
- return this.applyFilterWrapper(dto);
145
- }
146
- }
147
-
148
99
  async applyFilterWrapper(dto: FilterRequestDto) {
149
100
  const {
150
101
  entity_type,
@@ -3,6 +3,8 @@ import { GenericMessageDto, IntegrationService } from './integration.service';
3
3
  import { IcsMeetingService } from 'src/module/ics/service/ics.service';
4
4
  import { LoggingService } from 'src/utils/service/loggingUtil.service';
5
5
  import { ReflectionHelper } from '../../../utils/service/reflection-helper.service';
6
+ import { MediaDataService } from 'src/module/meta/service/media-data.service';
7
+ import axios from 'axios';
6
8
 
7
9
  @Injectable()
8
10
  export class WrapperService {
@@ -13,6 +15,7 @@ export class WrapperService {
13
15
  private readonly icsService: IcsMeetingService,
14
16
  private readonly loggingService: LoggingService,
15
17
  private readonly reflectionHelper: ReflectionHelper,
18
+ private readonly mediaService: MediaDataService,
16
19
  ) {}
17
20
 
18
21
  /**
@@ -405,6 +408,40 @@ export class WrapperService {
405
408
  [],
406
409
  );
407
410
 
411
+ // attachments: [1, 2, 3, 4]
412
+
413
+ if (entity.attachments && entity.attachments.length > 0) {
414
+ mailPayload.attachments = [];
415
+
416
+ for (const attachmentId of entity.attachments) {
417
+ // Step 1: Download or get media file
418
+ const url = await this.mediaService.getMediaDownloadUrl(
419
+ attachmentId,
420
+ {},
421
+ 60000,
422
+ );
423
+
424
+ if (!url?.signedUrl) continue;
425
+
426
+ // Step 2: Fetch file content
427
+ const response = await axios.get(url.signedUrl, {
428
+ responseType: 'arraybuffer',
429
+ });
430
+
431
+ // Step 3: Convert to base64
432
+ const base64Content = Buffer.from(response.data).toString('base64');
433
+
434
+ // Step 4: Push formatted attachment
435
+ mailPayload.attachments.push({
436
+ content: base64Content,
437
+ type:
438
+ response.headers['content-type'] || 'application/octet-stream',
439
+ filename: `attachment-${attachmentId}`,
440
+ disposition: 'attachment',
441
+ });
442
+ }
443
+ }
444
+
408
445
  // Step 5️⃣ Send via Integration Service
409
446
  const result =
410
447
  await this.integrationService.sendGenericMessage(mailPayload);
@@ -6,15 +6,10 @@ import {
6
6
  Post,
7
7
  Req,
8
8
  UseGuards,
9
- Param,
10
- Query,
11
9
  } from '@nestjs/common';
12
- import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
13
10
  import { LinkedAttributesService } from '../service/linked_attributes.service';
14
11
  import { JwtAuthGuard } from 'src/module/auth/guards/jwt.guard';
15
- import { CreateLinkedAttributeSmartDto } from '../dto/create-linked-attribute-smart.dto';
16
12
 
17
- @ApiTags('Linked Attributes')
18
13
  @Controller('linked-attributes')
19
14
  export class LinkedAttributesController {
20
15
  constructor(
@@ -39,85 +34,4 @@ export class LinkedAttributesController {
39
34
  loggedInUser,
40
35
  );
41
36
  }
42
-
43
- @Post('smart')
44
- @UseGuards(JwtAuthGuard)
45
- @ApiOperation({ summary: 'Create linked attribute with auto-generation' })
46
- @ApiResponse({
47
- status: 201,
48
- description: 'Linked attribute created successfully',
49
- })
50
- @ApiResponse({ status: 400, description: 'Validation failed' })
51
- async createSmart(
52
- @Body() dto: CreateLinkedAttributeSmartDto,
53
- @Req() req: any,
54
- ) {
55
- const loggedInUser = req.user?.userData;
56
- return await this.linkedAttributesService.createLinkedAttributeSmart(
57
- dto,
58
- loggedInUser,
59
- );
60
- }
61
-
62
- @Post(':id/backfill')
63
- @UseGuards(JwtAuthGuard)
64
- @ApiOperation({
65
- summary: 'Backfill existing entities with new linked attribute',
66
- })
67
- @ApiResponse({ status: 200, description: 'Backfill completed' })
68
- @ApiResponse({ status: 404, description: 'Linked attribute not found' })
69
- async backfill(@Param('id') id: number, @Req() req: any) {
70
- const loggedInUser = req.user?.userData;
71
- return await this.linkedAttributesService.backfillLinkedAttribute(
72
- id,
73
- loggedInUser,
74
- );
75
- }
76
-
77
- @Post('backfill-all')
78
- @UseGuards(JwtAuthGuard)
79
- @ApiOperation({ summary: 'Backfill all entities of a given type' })
80
- @ApiResponse({ status: 200, description: 'Backfill completed' })
81
- async backfillAll(
82
- @Query('entity_type') entity_type: string,
83
- @Req() req: any,
84
- ) {
85
- const loggedInUser = req.user?.userData;
86
- return await this.linkedAttributesService.backfillAllForEntity(
87
- entity_type,
88
- loggedInUser,
89
- );
90
- }
91
-
92
- @Get('preview-key')
93
- @UseGuards(JwtAuthGuard)
94
- @ApiOperation({
95
- summary: 'Preview generated attribute key before creation',
96
- })
97
- @ApiResponse({ status: 200, description: 'Preview generated successfully' })
98
- async previewKey(
99
- @Query('mapped_entity_type') mapped_entity_type: string,
100
- @Query('entity_type') entity_type: string,
101
- @Query('attribute_key') attribute_key: string,
102
- @Query('organization_id') organization_id: number,
103
- @Req() req: any,
104
- ) {
105
- const loggedInUser = req.user?.userData;
106
-
107
- const sequence =
108
- await this.linkedAttributesService['generateNextSequence'](
109
- mapped_entity_type,
110
- entity_type,
111
- attribute_key,
112
- organization_id,
113
- );
114
-
115
- const generated_key = this.linkedAttributesService.generateAttributeKey(
116
- entity_type,
117
- attribute_key,
118
- sequence,
119
- );
120
-
121
- return { generated_key, sequence };
122
- }
123
37
  }
@@ -1,19 +1,12 @@
1
- import { Module, forwardRef } from '@nestjs/common';
1
+ import { Module } from '@nestjs/common';
2
2
  import { EntityModule } from '../meta/entity.module';
3
- import { FilterModule } from '../filter/filter.module';
4
- import { EntityJSONModule } from '../entity_json/entity_json.module';
5
3
  import { TypeOrmModule } from '@nestjs/typeorm';
6
4
  import { LinkedAttributes } from './entity/linked_attribute.entity';
7
5
  import { LinkedAttributesController } from './controller/linked_attributes.controller';
8
6
  import { LinkedAttributesService } from './service/linked_attributes.service';
9
7
 
10
8
  @Module({
11
- imports: [
12
- EntityModule,
13
- forwardRef(() => FilterModule),
14
- forwardRef(() => EntityJSONModule),
15
- TypeOrmModule.forFeature([LinkedAttributes]),
16
- ],
9
+ imports: [EntityModule, TypeOrmModule.forFeature([LinkedAttributes])],
17
10
  controllers: [LinkedAttributesController],
18
11
  providers: [
19
12
  { provide: 'LinkedAttributesService', useClass: LinkedAttributesService },