rez_core 3.1.160 → 3.1.162

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.160",
3
+ "version": "3.1.162",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -50,6 +50,32 @@ export class ListMasterController {
50
50
  );
51
51
  }
52
52
 
53
+ // Public/internal endpoint (no JWT required)
54
+ @Get('/getDropdownDataPublic/:type')
55
+ @HttpCode(HttpStatus.OK)
56
+ async getDropdownDataPublic(
57
+ @Param('type') type: string,
58
+ @Query() queryParams: Record<string, string>,
59
+ ) {
60
+ const { inactiveIds,loggedInUser, ...params } = queryParams;
61
+
62
+ const inactiveIdsArray = inactiveIds
63
+ ? inactiveIds.split(',').map((id) => parseInt(id, 10))
64
+ : [];
65
+
66
+ // Default user object (if organization_id or appcode is needed in service)
67
+
68
+
69
+ return await this.service.getDropdownOptions(
70
+ type,
71
+ params,
72
+ inactiveIdsArray,
73
+ loggedInUser,
74
+ );
75
+ }
76
+
77
+
78
+
53
79
  @Get('/getDataSourceList/:source')
54
80
  @UseGuards(JwtAuthGuard)
55
81
  @HttpCode(HttpStatus.OK)
@@ -17,6 +17,9 @@ import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.s
17
17
  import { STATUS_ACTIVE, STATUS_INACTIVE } from 'src/constant/global.constant';
18
18
  import { ListMasterExtension } from './list-master-extension.interface';
19
19
  import { ListMasterEngine } from './list-master-engine';
20
+ import { Action } from '../../workflow-automation/interface/action.interface';
21
+ import axios from 'axios';
22
+ import { ConfigService } from '@nestjs/config';
20
23
 
21
24
  @Injectable()
22
25
  export class ListMasterService {
@@ -31,9 +34,18 @@ export class ListMasterService {
31
34
  private readonly apiRegistryService: ApiRegistryService,
32
35
  private readonly httpService: HttpService,
33
36
  private readonly listMasterEngine: ListMasterEngine,
37
+ private readonly configService: ConfigService,
34
38
  ) {}
35
39
 
36
40
  private readonly skipLevelFilterEntities = ['BRN'];
41
+ private readonly actions = new Map<string, Action>();
42
+
43
+ registerAction(actionName: string, actionInstance: Action) {
44
+ this.actions.set(actionName, actionInstance);
45
+ console.log(
46
+ `⚙️ [WorkflowAutomationEngine] Registered action: ${actionName}`,
47
+ );
48
+ }
37
49
 
38
50
  async getResolvedListCode(
39
51
  code: string,
@@ -61,31 +73,43 @@ export class ListMasterService {
61
73
  type,
62
74
  loggedInUser?.organization_id,
63
75
  );
64
-
76
+
65
77
  if (!config) throw new NotFoundException(`Type ${type} not found`);
66
-
67
- if (config.appcode!=loggedInUser?.appcode) {
68
78
 
79
+ if (config.appcode != loggedInUser?.appcode) {
80
+ // Call internal API for appcode mismatch
69
81
  try {
70
- const extensionResult = await this.listMasterEngine.execute(type, {
71
- params,
72
- inactiveIdsArray,
73
- loggedInUser,
74
- config,
75
- });
76
-
77
- if (extensionResult !== undefined) return extensionResult;
78
- } catch (err) {
79
- console.warn(`No extension found for type ${type}, falling back to default logic`);
82
+ const response = await axios.post(
83
+ `${this.configService.get('REDIRECT_BE_URL')}/api/list-master/getDropdownData/${type}`,
84
+ {},
85
+ {
86
+ headers: {
87
+ Authorization: `Bearer ${loggedInUser?.token || ''}`,
88
+ 'Content-Type': 'application/json',
89
+ },
90
+ },
91
+ );
92
+
93
+ console.log('✅ Internal API response:', response.data);
94
+ return response.data;
95
+ } catch (error) {
96
+ console.error('⚠️ Internal API call failed:', error.message);
97
+ throw new BadRequestException(
98
+ `Failed to fetch dropdown for type ${type} from internal API`,
99
+ );
80
100
  }
81
101
  }
82
- // Check if a dynamic extension exists for this type
83
-
102
+
84
103
  // Fallback to old logic if no extension exists
85
104
  switch (config.source) {
86
105
  case 'entity':
87
- return this.fetchFromEntity(type, params, inactiveIdsArray, loggedInUser);
88
-
106
+ return this.fetchFromEntity(
107
+ type,
108
+ params,
109
+ inactiveIdsArray,
110
+ loggedInUser,
111
+ );
112
+
89
113
  case 'master':
90
114
  return this.listItemsRepo.findItemsByType(
91
115
  type,
@@ -94,21 +118,30 @@ export class ListMasterService {
94
118
  loggedInUser?.organization_id,
95
119
  params,
96
120
  );
97
-
121
+
98
122
  case 'operator':
99
123
  return this.listItemsRepo.findOperatorsByType(
100
124
  type,
101
125
  loggedInUser?.organization_id,
102
126
  );
103
-
127
+
104
128
  case 'custom':
105
- return this.fetchFromExternalSource(config.custom_source_id, params);
106
-
129
+ // If you want Axios call here too:
130
+ try {
131
+ const response = await axios.get(
132
+ `https://external-source.com/${config.custom_source_id}`,
133
+ { params },
134
+ );
135
+ return response.data;
136
+ } catch (error) {
137
+ console.error('⚠️ Custom source fetch failed:', error.message);
138
+ throw new BadRequestException('Failed to fetch custom source');
139
+ }
140
+
107
141
  default:
108
142
  throw new BadRequestException(`Unknown source: ${config.source}`);
109
143
  }
110
144
  }
111
-
112
145
 
113
146
  private async fetchFromEntity(
114
147
  sourceList: string,
@@ -99,7 +99,11 @@ export class OtpService {
99
99
  }
100
100
 
101
101
  if (!verifyOTPResponse.isValid) {
102
- throw new BadRequestException('Invalid OTP!');
102
+ // throw new BadRequestException('Invalid OTP!');
103
+ return {
104
+ sucess: false,
105
+ message: 'Invalid OTP!',
106
+ };
103
107
  }
104
108
 
105
109
  // Proceed to login