rez_core 3.1.54 → 3.1.56

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.54",
3
+ "version": "3.1.56",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -99,6 +99,7 @@ import { IntegrationEntityMapperService } from './service/integration-entity-map
99
99
  IntegrationFactory,
100
100
  IntegrationQueueService,
101
101
  WrapperService,
102
+ IntegrationEntityMapperService,
102
103
  ],
103
104
  })
104
105
  export class IntegrationModule {}
@@ -118,39 +118,47 @@ export class TubelightWhatsAppStrategy implements IntegrationStrategy {
118
118
  config: TubelightWhatsAppConfig,
119
119
  ): Promise<string | null> {
120
120
  try {
121
- const baseUrl = config.baseUrl || this.defaultBaseUrl;
122
- const authUrl = baseUrl.replace('/whatsapp/api/v1', '/auth/api/v1');
121
+ const authUrl = 'https://portal.tubelightcommunications.com/api/authentication/login';
123
122
 
124
123
  const response = await axios.post(
125
- `${authUrl}/login`,
124
+ authUrl,
126
125
  {
127
- user_name: config.userName,
126
+ username: config.userName,
128
127
  password: config.password,
128
+ validityTime: 3600,
129
129
  },
130
130
  {
131
131
  headers: {
132
132
  'Content-Type': 'application/json',
133
- 'X-TENANT-ID': config.tenantId,
134
133
  },
135
134
  },
136
135
  );
137
136
 
138
137
  const data = response.data as {
139
138
  bearer_token?: string;
140
- access_token?: string;
139
+ accessToken?: string;
141
140
  token?: string;
141
+ authToken?: string;
142
142
  success?: boolean;
143
143
  };
144
144
 
145
- if (data.success !== false) {
146
- return data?.bearer_token || data?.access_token || data?.token || null;
145
+ // Return token in various possible formats
146
+ const token = data?.bearer_token || data?.accessToken || data?.token || data?.authToken || null;
147
+
148
+ if (token) {
149
+ this.logger.log('Successfully authenticated with Tubelight');
150
+ return token;
147
151
  }
148
152
 
153
+ this.logger.warn('No token found in Tubelight auth response');
149
154
  return null;
150
155
  } catch (error) {
156
+ const errorMessage = error.response?.data
157
+ ? JSON.stringify(error.response.data)
158
+ : error.message;
151
159
  this.logger.error(
152
160
  'Failed to authenticate with Tubelight:',
153
- error.response?.data || error.message,
161
+ errorMessage,
154
162
  );
155
163
  return null;
156
164
  }
@@ -24,6 +24,7 @@ export class ViewMasterController {
24
24
  async getEntityJsonByType(
25
25
  @Query('entity_type') entityType: string,
26
26
  @Query('type') type: string,
27
+ @Query('code') code: string,
27
28
  @Res() res: Response,
28
29
  @Req() req: Request & { user: any },
29
30
  ) {
@@ -37,7 +38,12 @@ export class ViewMasterController {
37
38
  });
38
39
  }
39
40
 
40
- const result = await this.viewMaster.getEntityJson(entityType, type);
41
+ const result = await this.viewMaster.getEntityJson(
42
+ entityType,
43
+ type,
44
+ loggedInUser,
45
+ code,
46
+ );
41
47
 
42
48
  return res.status(HttpStatus.OK).json({
43
49
  success: true,
@@ -13,10 +13,14 @@ export class ViewMaterRespository {
13
13
  async getEntityJson(
14
14
  entityType: string,
15
15
  type: string,
16
+ loggedInUser: any,
17
+ code?: string,
16
18
  ): Promise<ViewMaster | null> {
17
19
  const viewMaster = await this.viewMasterRepository.findOneBy({
18
20
  mapped_entity_type: entityType,
19
21
  type: type,
22
+ organization_id: loggedInUser.organization_id,
23
+ code: code,
20
24
  });
21
25
 
22
26
  return viewMaster;
@@ -48,10 +48,17 @@ export class ViewMasterService extends EntityServiceImpl {
48
48
  return res;
49
49
  }
50
50
 
51
- async getEntityJson(entityType: string, type: string) {
51
+ async getEntityJson(
52
+ entityType: string,
53
+ type: string,
54
+ loggedInUser: UserData,
55
+ code?: string,
56
+ ) {
52
57
  const res = await this.viewMasterRepoService.getEntityJson(
53
58
  entityType,
54
59
  type,
60
+ loggedInUser,
61
+ code,
55
62
  );
56
63
 
57
64
  if (type == 'form') {
@@ -74,6 +81,7 @@ export class ViewMasterService extends EntityServiceImpl {
74
81
  return await super.getEntityData(entityType, id, loggedInUserData);
75
82
  }
76
83
 
84
+ // DROPDOWN
77
85
  async getViewMasterByEntityType(entityType: string, loggedInUser: UserData) {
78
86
  return await this.viewMasterRepoService.findByEntityType(
79
87
  entityType,