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/.vscode/extensions.json +5 -0
- package/dist/module/integration/integration.module.js +1 -0
- package/dist/module/integration/integration.module.js.map +1 -1
- package/dist/module/integration/strategies/whatsapp/tubelight-whatsapp.strategy.js +13 -8
- package/dist/module/integration/strategies/whatsapp/tubelight-whatsapp.strategy.js.map +1 -1
- package/dist/module/meta/controller/view-master.controller.d.ts +1 -1
- package/dist/module/meta/controller/view-master.controller.js +6 -5
- package/dist/module/meta/controller/view-master.controller.js.map +1 -1
- package/dist/module/meta/repository/view-master.repository.d.ts +1 -1
- package/dist/module/meta/repository/view-master.repository.js +3 -1
- package/dist/module/meta/repository/view-master.repository.js.map +1 -1
- package/dist/module/meta/service/view-master.service.d.ts +1 -1
- package/dist/module/meta/service/view-master.service.js +2 -2
- package/dist/module/meta/service/view-master.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/integration/integration.module.ts +1 -0
- package/src/module/integration/strategies/whatsapp/tubelight-whatsapp.strategy.ts +17 -9
- package/src/module/meta/controller/view-master.controller.ts +7 -1
- package/src/module/meta/repository/view-master.repository.ts +4 -0
- package/src/module/meta/service/view-master.service.ts +9 -1
package/package.json
CHANGED
|
@@ -118,39 +118,47 @@ export class TubelightWhatsAppStrategy implements IntegrationStrategy {
|
|
|
118
118
|
config: TubelightWhatsAppConfig,
|
|
119
119
|
): Promise<string | null> {
|
|
120
120
|
try {
|
|
121
|
-
const
|
|
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
|
-
|
|
124
|
+
authUrl,
|
|
126
125
|
{
|
|
127
|
-
|
|
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
|
-
|
|
139
|
+
accessToken?: string;
|
|
141
140
|
token?: string;
|
|
141
|
+
authToken?: string;
|
|
142
142
|
success?: boolean;
|
|
143
143
|
};
|
|
144
144
|
|
|
145
|
-
|
|
146
|
-
|
|
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
|
-
|
|
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(
|
|
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(
|
|
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,
|