@stackfactor/client-api 1.1.133 → 1.1.135
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/.eslintrc.json +4 -3
- package/declarations/axios.d.ts +1 -0
- package/declarations/html2plaintext.d.ts +1 -0
- package/dist/actionNotifications.d.ts +7 -0
- package/dist/actionNotifications.d.ts.map +1 -0
- package/dist/actionNotifications.js +9 -10
- package/dist/actionNotifications.js.map +1 -0
- package/dist/address.d.ts +5 -0
- package/dist/address.d.ts.map +1 -0
- package/dist/address.js +5 -6
- package/dist/address.js.map +1 -0
- package/dist/aiAssistant.d.ts +9 -0
- package/dist/aiAssistant.d.ts.map +1 -0
- package/dist/aiAssistant.js +16 -17
- package/dist/aiAssistant.js.map +1 -0
- package/dist/avatar.d.ts +5 -0
- package/dist/avatar.d.ts.map +1 -0
- package/dist/avatar.js +4 -5
- package/dist/avatar.js.map +1 -0
- package/dist/axiosClient.d.ts +32 -0
- package/dist/axiosClient.d.ts.map +1 -0
- package/dist/axiosClient.js +17 -27
- package/dist/axiosClient.js.map +1 -0
- package/dist/config.d.ts +7 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +9 -10
- package/dist/config.js.map +1 -0
- package/dist/constants.d.ts +70 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +2 -7
- package/dist/constants.js.map +1 -0
- package/dist/dashboard.d.ts +7 -0
- package/dist/dashboard.d.ts.map +1 -0
- package/dist/dashboard.js +9 -10
- package/dist/dashboard.js.map +1 -0
- package/dist/departmentTrainingPlans.d.ts +13 -0
- package/dist/departmentTrainingPlans.d.ts.map +1 -0
- package/dist/departmentTrainingPlans.js +16 -17
- package/dist/departmentTrainingPlans.js.map +1 -0
- package/dist/groups.d.ts +16 -0
- package/dist/groups.d.ts.map +1 -0
- package/dist/groups.js +27 -28
- package/dist/groups.js.map +1 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -17
- package/dist/index.js.map +1 -0
- package/dist/integration.d.ts +95 -0
- package/dist/integration.d.ts.map +1 -0
- package/dist/integration.js +62 -69
- package/dist/integration.js.map +1 -0
- package/dist/integrationConfiguration.d.ts +7 -0
- package/dist/integrationConfiguration.d.ts.map +1 -0
- package/dist/integrationConfiguration.js +10 -11
- package/dist/integrationConfiguration.js.map +1 -0
- package/dist/integrations/contentGenerator.d.ts +27 -0
- package/dist/integrations/contentGenerator.d.ts.map +1 -0
- package/dist/integrations/contentGenerator.js +12 -16
- package/dist/integrations/contentGenerator.js.map +1 -0
- package/dist/learningContent.d.ts +19 -0
- package/dist/learningContent.d.ts.map +1 -0
- package/dist/learningContent.js +30 -31
- package/dist/learningContent.js.map +1 -0
- package/dist/learningPath.d.ts +12 -0
- package/dist/learningPath.d.ts.map +1 -0
- package/dist/learningPath.js +19 -20
- package/dist/learningPath.js.map +1 -0
- package/dist/logger.d.ts +6 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +8 -9
- package/dist/logger.js.map +1 -0
- package/dist/microSkillsQuizes.d.ts +6 -0
- package/dist/microSkillsQuizes.d.ts.map +1 -0
- package/dist/microSkillsQuizes.js +8 -9
- package/dist/microSkillsQuizes.js.map +1 -0
- package/dist/quotas.d.ts +6 -0
- package/dist/quotas.d.ts.map +1 -0
- package/dist/quotas.js +7 -8
- package/dist/quotas.js.map +1 -0
- package/dist/role.d.ts +18 -0
- package/dist/role.d.ts.map +1 -0
- package/dist/role.js +32 -33
- package/dist/role.js.map +1 -0
- package/dist/roleTemplate.d.ts +13 -0
- package/dist/roleTemplate.d.ts.map +1 -0
- package/dist/roleTemplate.js +22 -23
- package/dist/roleTemplate.js.map +1 -0
- package/dist/security.d.ts +8 -0
- package/dist/security.d.ts.map +1 -0
- package/dist/security.js +11 -12
- package/dist/security.js.map +1 -0
- package/dist/skill.d.ts +22 -0
- package/dist/skill.d.ts.map +1 -0
- package/dist/skill.js +40 -41
- package/dist/skill.js.map +1 -0
- package/dist/skillAssessmentTestingSession.d.ts +10 -0
- package/dist/skillAssessmentTestingSession.d.ts.map +1 -0
- package/dist/skillAssessmentTestingSession.js +15 -16
- package/dist/skillAssessmentTestingSession.js.map +1 -0
- package/dist/skillAssessments.d.ts +10 -0
- package/dist/skillAssessments.d.ts.map +1 -0
- package/dist/skillAssessments.js +15 -16
- package/dist/skillAssessments.js.map +1 -0
- package/dist/skillTemplate.d.ts +15 -0
- package/dist/skillTemplate.d.ts.map +1 -0
- package/dist/skillTemplate.js +26 -27
- package/dist/skillTemplate.js.map +1 -0
- package/dist/talentTransfromation.d.ts +8 -0
- package/dist/talentTransfromation.d.ts.map +1 -0
- package/dist/talentTransfromation.js +11 -12
- package/dist/talentTransfromation.js.map +1 -0
- package/dist/teams.d.ts +15 -0
- package/dist/teams.d.ts.map +1 -0
- package/dist/teams.js +25 -26
- package/dist/teams.js.map +1 -0
- package/dist/tenants.d.ts +6 -0
- package/dist/tenants.d.ts.map +1 -0
- package/dist/tenants.js +7 -8
- package/dist/tenants.js.map +1 -0
- package/dist/trainingPlans.d.ts +16 -0
- package/dist/trainingPlans.d.ts.map +1 -0
- package/dist/trainingPlans.js +19 -20
- package/dist/trainingPlans.js.map +1 -0
- package/dist/trainingPlansProficiencyLevels.d.ts +8 -0
- package/dist/trainingPlansProficiencyLevels.d.ts.map +1 -0
- package/dist/trainingPlansProficiencyLevels.js +9 -10
- package/dist/trainingPlansProficiencyLevels.js.map +1 -0
- package/dist/userInformation.d.ts +7 -0
- package/dist/userInformation.d.ts.map +1 -0
- package/dist/userInformation.js +9 -10
- package/dist/userInformation.js.map +1 -0
- package/dist/users.d.ts +31 -0
- package/dist/users.d.ts.map +1 -0
- package/dist/users.js +37 -39
- package/dist/users.js.map +1 -0
- package/dist/utils.d.ts +8 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +8 -21
- package/dist/utils.js.map +1 -0
- package/package.json +15 -14
- package/src/lib/actionNotifications.ts +11 -10
- package/src/lib/address.ts +5 -4
- package/src/lib/aiAssistant.ts +25 -24
- package/src/lib/avatar.ts +4 -3
- package/src/lib/axiosClient.ts +22 -9
- package/src/lib/config.ts +11 -10
- package/src/lib/dashboard.ts +11 -10
- package/src/lib/departmentTrainingPlans.ts +29 -32
- package/src/lib/groups.ts +38 -37
- package/src/lib/index.ts +85 -1
- package/src/lib/integration.ts +56 -55
- package/src/lib/integrationConfiguration.ts +15 -14
- package/src/lib/integrations/contentGenerator.ts +10 -9
- package/src/lib/learningContent.ts +56 -55
- package/src/lib/learningPath.ts +32 -31
- package/src/lib/logger.ts +9 -8
- package/src/lib/microSkillsQuizes.ts +11 -10
- package/src/lib/quotas.ts +10 -9
- package/src/lib/role.ts +56 -55
- package/src/lib/roleTemplate.ts +37 -36
- package/src/lib/security.ts +14 -13
- package/src/lib/skill.ts +72 -71
- package/src/lib/skillAssessmentTestingSession.ts +25 -24
- package/src/lib/skillAssessments.ts +25 -24
- package/src/lib/skillTemplate.ts +45 -44
- package/src/lib/talentTransfromation.ts +15 -14
- package/src/lib/teams.ts +35 -34
- package/src/lib/tenants.ts +10 -9
- package/src/lib/trainingPlans.ts +37 -36
- package/src/lib/trainingPlansProficiencyLevels.ts +14 -13
- package/src/lib/userInformation.ts +13 -12
- package/src/lib/users.ts +72 -72
- package/src/lib/utils.ts +7 -16
- package/tsconfig.json +16 -5
- package/dist/exports.js +0 -77
- package/index.d.ts +0 -1
- package/src/lib/exports.ts +0 -85
package/src/lib/groups.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AxiosError, AxiosResponse } from "axios";
|
|
2
|
+
import { client } from "./axiosClient";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Add permissions to group
|
|
5
6
|
* @param {String} groupId The group Id
|
|
6
7
|
* @param {Array<String>} permissions The permissions to be added
|
|
7
8
|
* @param {String} authToken - Authentication token
|
|
8
|
-
* @returns {Promise<
|
|
9
|
+
* @returns {Promise<object>}
|
|
9
10
|
*/
|
|
10
11
|
const addPermissionsToGroup = (
|
|
11
12
|
groupId: string,
|
|
@@ -22,10 +23,10 @@ const addPermissionsToGroup = (
|
|
|
22
23
|
{ headers: { authorization: authToken } }
|
|
23
24
|
);
|
|
24
25
|
request
|
|
25
|
-
.then((response) => {
|
|
26
|
+
.then((response : AxiosResponse) => {
|
|
26
27
|
resolve(response.data);
|
|
27
28
|
})
|
|
28
|
-
.catch((error) => {
|
|
29
|
+
.catch((error : AxiosError) => {
|
|
29
30
|
reject(error);
|
|
30
31
|
});
|
|
31
32
|
});
|
|
@@ -36,7 +37,7 @@ const addPermissionsToGroup = (
|
|
|
36
37
|
* @param {String} groupId The group Id
|
|
37
38
|
* @param {Array<String>} users The users to be added
|
|
38
39
|
* @param {String} authToken - Authentication token
|
|
39
|
-
* @returns {Promise<
|
|
40
|
+
* @returns {Promise<object>}
|
|
40
41
|
*/
|
|
41
42
|
const addUsersToGroup = (
|
|
42
43
|
groupId: string,
|
|
@@ -53,10 +54,10 @@ const addUsersToGroup = (
|
|
|
53
54
|
{ headers: { authorization: authToken } }
|
|
54
55
|
);
|
|
55
56
|
request
|
|
56
|
-
.then((response) => {
|
|
57
|
+
.then((response : AxiosResponse) => {
|
|
57
58
|
resolve(response.data);
|
|
58
59
|
})
|
|
59
|
-
.catch((error) => {
|
|
60
|
+
.catch((error : AxiosError) => {
|
|
60
61
|
reject(error);
|
|
61
62
|
});
|
|
62
63
|
});
|
|
@@ -67,7 +68,7 @@ const addUsersToGroup = (
|
|
|
67
68
|
* @param {String} name The name of the group
|
|
68
69
|
* @param {String} description The description of the group
|
|
69
70
|
* @param {String} authToken The authorization token
|
|
70
|
-
* @returns {Promise<
|
|
71
|
+
* @returns {Promise<object>}
|
|
71
72
|
*/
|
|
72
73
|
const createGroup = (
|
|
73
74
|
name: string,
|
|
@@ -84,10 +85,10 @@ const createGroup = (
|
|
|
84
85
|
{ headers: { authorization: authToken } }
|
|
85
86
|
);
|
|
86
87
|
request
|
|
87
|
-
.then((response) => {
|
|
88
|
+
.then((response : AxiosResponse) => {
|
|
88
89
|
resolve(response.data);
|
|
89
90
|
})
|
|
90
|
-
.catch((error) => {
|
|
91
|
+
.catch((error : AxiosError) => {
|
|
91
92
|
reject(error);
|
|
92
93
|
});
|
|
93
94
|
});
|
|
@@ -98,7 +99,7 @@ const createGroup = (
|
|
|
98
99
|
* @param {String} groupId The group to be deleted
|
|
99
100
|
* @param {String} defaultGroupId The default group all the users will be moved to
|
|
100
101
|
* @param {String} authToken The authentication token
|
|
101
|
-
* @returns {Promise<
|
|
102
|
+
* @returns {Promise<object>}
|
|
102
103
|
*/
|
|
103
104
|
const deleteGroup = (
|
|
104
105
|
groupId: string,
|
|
@@ -114,10 +115,10 @@ const deleteGroup = (
|
|
|
114
115
|
},
|
|
115
116
|
});
|
|
116
117
|
request
|
|
117
|
-
.then((response) => {
|
|
118
|
+
.then((response : AxiosResponse) => {
|
|
118
119
|
resolve(response.data);
|
|
119
120
|
})
|
|
120
|
-
.catch((error) => {
|
|
121
|
+
.catch((error : AxiosError) => {
|
|
121
122
|
reject(error);
|
|
122
123
|
});
|
|
123
124
|
});
|
|
@@ -126,7 +127,7 @@ const deleteGroup = (
|
|
|
126
127
|
/**
|
|
127
128
|
* Get all permissions
|
|
128
129
|
* @param {String} authToken The authentication token
|
|
129
|
-
* @returns {Promise<
|
|
130
|
+
* @returns {Promise<object>}
|
|
130
131
|
*/
|
|
131
132
|
const getAllPermissions = (authToken: string): Promise<object> => {
|
|
132
133
|
return new Promise((resolve, reject) => {
|
|
@@ -134,10 +135,10 @@ const getAllPermissions = (authToken: string): Promise<object> => {
|
|
|
134
135
|
headers: { authorization: authToken },
|
|
135
136
|
});
|
|
136
137
|
request
|
|
137
|
-
.then((response) => {
|
|
138
|
+
.then((response : AxiosResponse) => {
|
|
138
139
|
resolve(response.data);
|
|
139
140
|
})
|
|
140
|
-
.catch((error) => {
|
|
141
|
+
.catch((error : AxiosError) => {
|
|
141
142
|
reject(error);
|
|
142
143
|
});
|
|
143
144
|
});
|
|
@@ -147,7 +148,7 @@ const getAllPermissions = (authToken: string): Promise<object> => {
|
|
|
147
148
|
* Get group by Id
|
|
148
149
|
* @param {String} groupId The group Id
|
|
149
150
|
* @param {String} authToken The authentication token
|
|
150
|
-
* @returns {Promise<
|
|
151
|
+
* @returns {Promise<object>}
|
|
151
152
|
*/
|
|
152
153
|
const getGroupById = (groupId: string, authToken: string): Promise<object> => {
|
|
153
154
|
return new Promise((resolve, reject) => {
|
|
@@ -155,10 +156,10 @@ const getGroupById = (groupId: string, authToken: string): Promise<object> => {
|
|
|
155
156
|
headers: { authorization: authToken },
|
|
156
157
|
});
|
|
157
158
|
request
|
|
158
|
-
.then((response) => {
|
|
159
|
+
.then((response : AxiosResponse) => {
|
|
159
160
|
resolve(response.data);
|
|
160
161
|
})
|
|
161
|
-
.catch((error) => {
|
|
162
|
+
.catch((error : AxiosError) => {
|
|
162
163
|
reject(error);
|
|
163
164
|
});
|
|
164
165
|
});
|
|
@@ -167,7 +168,7 @@ const getGroupById = (groupId: string, authToken: string): Promise<object> => {
|
|
|
167
168
|
/**
|
|
168
169
|
* Get groups for current tenant
|
|
169
170
|
* @param {String} authToken The authentication token
|
|
170
|
-
* @returns {Promise<
|
|
171
|
+
* @returns {Promise<object>}
|
|
171
172
|
*/
|
|
172
173
|
const getGroups = (authToken: string): Promise<object> => {
|
|
173
174
|
return new Promise((resolve, reject) => {
|
|
@@ -175,10 +176,10 @@ const getGroups = (authToken: string): Promise<object> => {
|
|
|
175
176
|
headers: { authorization: authToken },
|
|
176
177
|
});
|
|
177
178
|
request
|
|
178
|
-
.then((response) => {
|
|
179
|
+
.then((response : AxiosResponse) => {
|
|
179
180
|
resolve(response.data);
|
|
180
181
|
})
|
|
181
|
-
.catch((error) => {
|
|
182
|
+
.catch((error : AxiosError) => {
|
|
182
183
|
reject(error);
|
|
183
184
|
});
|
|
184
185
|
});
|
|
@@ -187,7 +188,7 @@ const getGroups = (authToken: string): Promise<object> => {
|
|
|
187
188
|
/**
|
|
188
189
|
* Get current user permissions
|
|
189
190
|
* @param {String} authToken The authentication token
|
|
190
|
-
* @returns {Promise<
|
|
191
|
+
* @returns {Promise<object>}
|
|
191
192
|
*/
|
|
192
193
|
const getUserPermissions = (authToken: string): Promise<object> => {
|
|
193
194
|
return new Promise((resolve, reject) => {
|
|
@@ -195,10 +196,10 @@ const getUserPermissions = (authToken: string): Promise<object> => {
|
|
|
195
196
|
headers: { authorization: authToken },
|
|
196
197
|
});
|
|
197
198
|
request
|
|
198
|
-
.then((response) => {
|
|
199
|
+
.then((response : AxiosResponse) => {
|
|
199
200
|
resolve(response.data);
|
|
200
201
|
})
|
|
201
|
-
.catch((error) => {
|
|
202
|
+
.catch((error : AxiosError) => {
|
|
202
203
|
reject(error);
|
|
203
204
|
});
|
|
204
205
|
});
|
|
@@ -209,7 +210,7 @@ const getUserPermissions = (authToken: string): Promise<object> => {
|
|
|
209
210
|
* @param {String} groupId The group Id
|
|
210
211
|
* @param {Array<String>} permissions The permissions to be removed from the group
|
|
211
212
|
* @param {String} authToken The authentication token
|
|
212
|
-
* @returns {Promise<
|
|
213
|
+
* @returns {Promise<object>}
|
|
213
214
|
*/
|
|
214
215
|
const removePermissionsFromGroup = (
|
|
215
216
|
groupId: string,
|
|
@@ -226,10 +227,10 @@ const removePermissionsFromGroup = (
|
|
|
226
227
|
{ headers: { authorization: authToken } }
|
|
227
228
|
);
|
|
228
229
|
request
|
|
229
|
-
.then((response) => {
|
|
230
|
+
.then((response : AxiosResponse) => {
|
|
230
231
|
resolve(response.data);
|
|
231
232
|
})
|
|
232
|
-
.catch((error) => {
|
|
233
|
+
.catch((error : AxiosError) => {
|
|
233
234
|
reject(error);
|
|
234
235
|
});
|
|
235
236
|
});
|
|
@@ -240,7 +241,7 @@ const removePermissionsFromGroup = (
|
|
|
240
241
|
* @param {String} groupId The group Id
|
|
241
242
|
* @param {Array<String>} users The users to be removed from the group
|
|
242
243
|
* @param {String} authToken The authentication token
|
|
243
|
-
* @returns {Promise<
|
|
244
|
+
* @returns {Promise<object>}
|
|
244
245
|
*/
|
|
245
246
|
const removeUsersFromGroup = (
|
|
246
247
|
groupId: string,
|
|
@@ -257,10 +258,10 @@ const removeUsersFromGroup = (
|
|
|
257
258
|
{ headers: { authorization: authToken } }
|
|
258
259
|
);
|
|
259
260
|
request
|
|
260
|
-
.then((response) => {
|
|
261
|
+
.then((response : AxiosResponse) => {
|
|
261
262
|
resolve(response.data);
|
|
262
263
|
})
|
|
263
|
-
.catch((error) => {
|
|
264
|
+
.catch((error : AxiosError) => {
|
|
264
265
|
reject(error);
|
|
265
266
|
});
|
|
266
267
|
});
|
|
@@ -270,7 +271,7 @@ const removeUsersFromGroup = (
|
|
|
270
271
|
* Set group as default
|
|
271
272
|
* @param {String} groupId The group Id
|
|
272
273
|
* @param {String} authToken The authentication token
|
|
273
|
-
* @returns {Promise<
|
|
274
|
+
* @returns {Promise<object>}
|
|
274
275
|
*/
|
|
275
276
|
const setDefault = (groupId: string, authToken: string): Promise<object> => {
|
|
276
277
|
return new Promise((resolve, reject) => {
|
|
@@ -282,10 +283,10 @@ const setDefault = (groupId: string, authToken: string): Promise<object> => {
|
|
|
282
283
|
{ headers: { authorization: authToken } }
|
|
283
284
|
);
|
|
284
285
|
request
|
|
285
|
-
.then((response) => {
|
|
286
|
+
.then((response : AxiosResponse) => {
|
|
286
287
|
resolve(response.data);
|
|
287
288
|
})
|
|
288
|
-
.catch((error) => {
|
|
289
|
+
.catch((error : AxiosError) => {
|
|
289
290
|
reject(error);
|
|
290
291
|
});
|
|
291
292
|
});
|
|
@@ -297,7 +298,7 @@ const setDefault = (groupId: string, authToken: string): Promise<object> => {
|
|
|
297
298
|
* @param {String} name The updated name of the group
|
|
298
299
|
* @param {String} description The updated description of the group
|
|
299
300
|
* @param {String} authToken The authentication token
|
|
300
|
-
* @returns {Promise<
|
|
301
|
+
* @returns {Promise<object>}
|
|
301
302
|
*/
|
|
302
303
|
const updateGroup = (
|
|
303
304
|
groupId: string,
|
|
@@ -316,10 +317,10 @@ const updateGroup = (
|
|
|
316
317
|
{ headers: { authorization: authToken } }
|
|
317
318
|
);
|
|
318
319
|
request
|
|
319
|
-
.then((response) => {
|
|
320
|
+
.then((response : AxiosResponse) => {
|
|
320
321
|
resolve(response.data);
|
|
321
322
|
})
|
|
322
|
-
.catch((error) => {
|
|
323
|
+
.catch((error : AxiosError) => {
|
|
323
324
|
reject(error);
|
|
324
325
|
});
|
|
325
326
|
});
|
package/src/lib/index.ts
CHANGED
|
@@ -1 +1,85 @@
|
|
|
1
|
-
|
|
1
|
+
import actionNotifications from "./actionNotifications";
|
|
2
|
+
import {
|
|
3
|
+
client,
|
|
4
|
+
errorToString,
|
|
5
|
+
getErrorInformation,
|
|
6
|
+
getErrorType,
|
|
7
|
+
shouldReturnError,
|
|
8
|
+
} from "./axiosClient";
|
|
9
|
+
import aiAssistant from "./aiAssistant";
|
|
10
|
+
import avatar from "./avatar";
|
|
11
|
+
import address from "./address";
|
|
12
|
+
import config from "./config";
|
|
13
|
+
import {
|
|
14
|
+
DOCUMENT_VERSION,
|
|
15
|
+
PERMISSIONS,
|
|
16
|
+
PERMISSION_DESCRIPTIONS,
|
|
17
|
+
RESPONSE_TYPE,
|
|
18
|
+
} from "./constants";
|
|
19
|
+
import contentGenerator from "./integrations/contentGenerator";
|
|
20
|
+
import dashboard from "./dashboard";
|
|
21
|
+
import departmentTraingPlans from "./departmentTrainingPlans";
|
|
22
|
+
import integration from "./integration";
|
|
23
|
+
import integrationConfiguration from "./integrationConfiguration";
|
|
24
|
+
import groups from "./groups";
|
|
25
|
+
import learningContent from "./learningContent";
|
|
26
|
+
import learningPath from "./learningPath";
|
|
27
|
+
import logger from "./logger";
|
|
28
|
+
import microSkillsQuizes from "./microSkillsQuizes";
|
|
29
|
+
import quotas from "./quotas";
|
|
30
|
+
import role from "./role";
|
|
31
|
+
import roleTemplate from "./roleTemplate";
|
|
32
|
+
import security from "./security";
|
|
33
|
+
import skill from "./skill";
|
|
34
|
+
import skillAssessment from "./skillAssessments";
|
|
35
|
+
import skillAssessmentTestingSession from "./skillAssessmentTestingSession";
|
|
36
|
+
import skillTemplate from "./skillTemplate";
|
|
37
|
+
import talentTransfromation from "./talentTransfromation";
|
|
38
|
+
import team from "./teams";
|
|
39
|
+
import tenant from "./tenants";
|
|
40
|
+
import trainingPlan from "./trainingPlans";
|
|
41
|
+
import trainingPlanProficiencyLevel from "./trainingPlansProficiencyLevels";
|
|
42
|
+
import userInformation from "./userInformation";
|
|
43
|
+
import users from "./users";
|
|
44
|
+
|
|
45
|
+
export {
|
|
46
|
+
actionNotifications,
|
|
47
|
+
address,
|
|
48
|
+
aiAssistant,
|
|
49
|
+
avatar,
|
|
50
|
+
client,
|
|
51
|
+
config,
|
|
52
|
+
contentGenerator,
|
|
53
|
+
dashboard,
|
|
54
|
+
errorToString,
|
|
55
|
+
getErrorInformation,
|
|
56
|
+
getErrorType,
|
|
57
|
+
DOCUMENT_VERSION,
|
|
58
|
+
integration,
|
|
59
|
+
integrationConfiguration,
|
|
60
|
+
departmentTraingPlans,
|
|
61
|
+
groups,
|
|
62
|
+
learningContent,
|
|
63
|
+
learningPath,
|
|
64
|
+
logger,
|
|
65
|
+
microSkillsQuizes,
|
|
66
|
+
PERMISSIONS,
|
|
67
|
+
PERMISSION_DESCRIPTIONS,
|
|
68
|
+
quotas,
|
|
69
|
+
RESPONSE_TYPE,
|
|
70
|
+
role,
|
|
71
|
+
roleTemplate,
|
|
72
|
+
security,
|
|
73
|
+
shouldReturnError,
|
|
74
|
+
skill,
|
|
75
|
+
skillAssessment,
|
|
76
|
+
skillAssessmentTestingSession,
|
|
77
|
+
skillTemplate,
|
|
78
|
+
talentTransfromation,
|
|
79
|
+
team,
|
|
80
|
+
tenant,
|
|
81
|
+
trainingPlan,
|
|
82
|
+
trainingPlanProficiencyLevel,
|
|
83
|
+
userInformation,
|
|
84
|
+
users,
|
|
85
|
+
};
|
package/src/lib/integration.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AxiosError, AxiosResponse } from "axios";
|
|
2
|
+
import { client, errorToString } from "./axiosClient";
|
|
2
3
|
import axiosLib from "axios";
|
|
3
4
|
import htmlParser from "node-html-parser";
|
|
4
5
|
import htmlToText from "html2plaintext";
|
|
@@ -41,14 +42,14 @@ export const createIntegration = (
|
|
|
41
42
|
const requestData: IntegrationData = {
|
|
42
43
|
data: data,
|
|
43
44
|
};
|
|
44
|
-
|
|
45
|
+
const confirmationRequest = client.put("api/v1/integrations/", requestData, {
|
|
45
46
|
headers: { authorization: token },
|
|
46
47
|
});
|
|
47
48
|
confirmationRequest
|
|
48
|
-
.then((response) => {
|
|
49
|
+
.then((response : AxiosResponse) => {
|
|
49
50
|
resolve(response.data);
|
|
50
51
|
})
|
|
51
|
-
.catch((error) => {
|
|
52
|
+
.catch((error : AxiosError) => {
|
|
52
53
|
reject(error);
|
|
53
54
|
});
|
|
54
55
|
});
|
|
@@ -71,10 +72,10 @@ export const deleteIntegration = (
|
|
|
71
72
|
},
|
|
72
73
|
});
|
|
73
74
|
request
|
|
74
|
-
.then((response) => {
|
|
75
|
+
.then((response : AxiosResponse) => {
|
|
75
76
|
resolve(response.data);
|
|
76
77
|
})
|
|
77
|
-
.catch((error) => {
|
|
78
|
+
.catch((error : AxiosError) => {
|
|
78
79
|
reject(error);
|
|
79
80
|
});
|
|
80
81
|
});
|
|
@@ -96,10 +97,10 @@ export const discardIntegrationChanges = (
|
|
|
96
97
|
data: data,
|
|
97
98
|
});
|
|
98
99
|
request
|
|
99
|
-
.then((response) => {
|
|
100
|
+
.then((response : AxiosResponse) => {
|
|
100
101
|
resolve(response.data);
|
|
101
102
|
})
|
|
102
|
-
.catch((error) => {
|
|
103
|
+
.catch((error : AxiosError) => {
|
|
103
104
|
reject(error);
|
|
104
105
|
});
|
|
105
106
|
});
|
|
@@ -117,17 +118,17 @@ export const getIntegrationInformationById = (
|
|
|
117
118
|
token: string
|
|
118
119
|
): Promise<object> => {
|
|
119
120
|
return new Promise((resolve, reject) => {
|
|
120
|
-
|
|
121
|
+
const confirmationRequest = client.get(
|
|
121
122
|
`api/v1/integrations/${id}/${version}`,
|
|
122
123
|
{
|
|
123
124
|
headers: { authorization: token },
|
|
124
125
|
}
|
|
125
126
|
);
|
|
126
127
|
confirmationRequest
|
|
127
|
-
.then((response) => {
|
|
128
|
+
.then((response : AxiosResponse) => {
|
|
128
129
|
resolve(response.data);
|
|
129
130
|
})
|
|
130
|
-
.catch((error) => {
|
|
131
|
+
.catch((error : AxiosError) => {
|
|
131
132
|
reject(error);
|
|
132
133
|
});
|
|
133
134
|
});
|
|
@@ -155,14 +156,14 @@ export const getIntegrationsList = (
|
|
|
155
156
|
};
|
|
156
157
|
if (filter) requestData.filter = filter;
|
|
157
158
|
if (type) requestData.type = type;
|
|
158
|
-
|
|
159
|
+
const confirmationRequest = client.post(`api/v1/integrations`, requestData, {
|
|
159
160
|
headers: { authorization: token },
|
|
160
161
|
});
|
|
161
162
|
confirmationRequest
|
|
162
|
-
.then((response) => {
|
|
163
|
+
.then((response : AxiosResponse) => {
|
|
163
164
|
resolve(response.data);
|
|
164
165
|
})
|
|
165
|
-
.catch((error) => {
|
|
166
|
+
.catch((error : AxiosError) => {
|
|
166
167
|
reject(error);
|
|
167
168
|
});
|
|
168
169
|
});
|
|
@@ -184,7 +185,7 @@ export const getContentInformationByUrl = (
|
|
|
184
185
|
url: url,
|
|
185
186
|
verb: verb,
|
|
186
187
|
};
|
|
187
|
-
|
|
188
|
+
const confirmationRequest = client.post(
|
|
188
189
|
`api/v1/contentproviders/getcontentinformationbyurl`,
|
|
189
190
|
requestData,
|
|
190
191
|
{
|
|
@@ -192,10 +193,10 @@ export const getContentInformationByUrl = (
|
|
|
192
193
|
}
|
|
193
194
|
);
|
|
194
195
|
confirmationRequest
|
|
195
|
-
.then((response) => {
|
|
196
|
+
.then((response : AxiosResponse) => {
|
|
196
197
|
resolve(response.data);
|
|
197
198
|
})
|
|
198
|
-
.catch((error) => {
|
|
199
|
+
.catch((error : AxiosError) => {
|
|
199
200
|
reject(error);
|
|
200
201
|
});
|
|
201
202
|
});
|
|
@@ -210,11 +211,11 @@ export const getContentInformationByUrlFromBrowser = (
|
|
|
210
211
|
url: string
|
|
211
212
|
): Promise<ContentInformationResponse> => {
|
|
212
213
|
return new Promise((resolve, reject) => {
|
|
213
|
-
|
|
214
|
-
|
|
214
|
+
const domain = new URL(url);
|
|
215
|
+
const instance = axiosLib.create({
|
|
215
216
|
baseURL: domain.origin,
|
|
216
217
|
});
|
|
217
|
-
|
|
218
|
+
const confirmationRequest = instance.get(domain.pathname, {
|
|
218
219
|
headers: {
|
|
219
220
|
"Access-Control-Allow-Origin": "*",
|
|
220
221
|
"Access-Control-Allow-Headers":
|
|
@@ -227,7 +228,7 @@ export const getContentInformationByUrlFromBrowser = (
|
|
|
227
228
|
},
|
|
228
229
|
});
|
|
229
230
|
confirmationRequest
|
|
230
|
-
.then((response) => {
|
|
231
|
+
.then((response : AxiosResponse) => {
|
|
231
232
|
//get the reading time
|
|
232
233
|
const getReadingTime = (text: string): number => {
|
|
233
234
|
const wpm = 225;
|
|
@@ -235,32 +236,32 @@ export const getContentInformationByUrlFromBrowser = (
|
|
|
235
236
|
return Math.ceil(words / wpm);
|
|
236
237
|
};
|
|
237
238
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
239
|
+
const document = htmlParser.parse(response.data);
|
|
240
|
+
const duration = getReadingTime(htmlToText(response.data));
|
|
241
|
+
const titleTag = document.querySelector("title");
|
|
242
|
+
const title = titleTag ? titleTag.rawText : "";
|
|
243
|
+
const description = "";
|
|
243
244
|
const descriptionEl = document.querySelector("meta");
|
|
244
245
|
try {
|
|
245
246
|
if (descriptionEl) {
|
|
246
|
-
|
|
247
|
-
if (
|
|
247
|
+
const descriptionParentNode = descriptionEl.parentNode;
|
|
248
|
+
if (descriptionEl) {
|
|
248
249
|
const descriptionChildNodes = descriptionParentNode.childNodes;
|
|
249
250
|
if (descriptionChildNodes) {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
);
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
}
|
|
251
|
+
//TODO: Code needs fixing
|
|
252
|
+
// const descriptionRawAttr = descriptionChildNodes.find((element) => {
|
|
253
|
+
// return element.rawAttrs && element.rawAttrs.includes("description");
|
|
254
|
+
// });
|
|
255
|
+
// if (descriptionRawAttr) {
|
|
256
|
+
// const element = descriptionRawAttr as any; // Cast to any to access rawAttrs
|
|
257
|
+
// const descriptionContent = element.rawAttrs.substring(
|
|
258
|
+
// element.rawAttrs.indexOf("content=") + 8
|
|
259
|
+
// );
|
|
260
|
+
// description = descriptionContent.substring(
|
|
261
|
+
// 0,
|
|
262
|
+
// descriptionContent.length - 1
|
|
263
|
+
// );
|
|
264
|
+
// }
|
|
264
265
|
}
|
|
265
266
|
}
|
|
266
267
|
}
|
|
@@ -275,7 +276,7 @@ export const getContentInformationByUrlFromBrowser = (
|
|
|
275
276
|
});
|
|
276
277
|
}
|
|
277
278
|
})
|
|
278
|
-
.catch((error) => {
|
|
279
|
+
.catch((error : AxiosError) => {
|
|
279
280
|
reject(new Error(errorToString(error)));
|
|
280
281
|
});
|
|
281
282
|
});
|
|
@@ -291,17 +292,17 @@ export const getEnabledContentProviders = (
|
|
|
291
292
|
token: string
|
|
292
293
|
): Promise<object> => {
|
|
293
294
|
return new Promise((resolve, reject) => {
|
|
294
|
-
|
|
295
|
+
const confirmationRequest = client.get(
|
|
295
296
|
`api/v1/contentproviders/getenabledcontentproviders/${userId}`,
|
|
296
297
|
{
|
|
297
298
|
headers: { authorization: token },
|
|
298
299
|
}
|
|
299
300
|
);
|
|
300
301
|
confirmationRequest
|
|
301
|
-
.then((response) => {
|
|
302
|
+
.then((response : AxiosResponse) => {
|
|
302
303
|
resolve(response.data);
|
|
303
304
|
})
|
|
304
|
-
.catch((error) => {
|
|
305
|
+
.catch((error : AxiosError) => {
|
|
305
306
|
reject(error);
|
|
306
307
|
});
|
|
307
308
|
});
|
|
@@ -317,7 +318,7 @@ export const publishIntegration = (
|
|
|
317
318
|
token: string
|
|
318
319
|
): Promise<object> => {
|
|
319
320
|
return new Promise((resolve, reject) => {
|
|
320
|
-
|
|
321
|
+
const confirmationRequest = client.post(
|
|
321
322
|
`api/v1/integrations/publish/${id}`,
|
|
322
323
|
{},
|
|
323
324
|
{
|
|
@@ -325,10 +326,10 @@ export const publishIntegration = (
|
|
|
325
326
|
}
|
|
326
327
|
);
|
|
327
328
|
confirmationRequest
|
|
328
|
-
.then((response) => {
|
|
329
|
+
.then((response : AxiosResponse) => {
|
|
329
330
|
resolve(response.data);
|
|
330
331
|
})
|
|
331
|
-
.catch((error) => {
|
|
332
|
+
.catch((error : AxiosError) => {
|
|
332
333
|
reject(error);
|
|
333
334
|
});
|
|
334
335
|
});
|
|
@@ -349,7 +350,7 @@ export const setIntegrationInformation = (
|
|
|
349
350
|
const requestData: IntegrationData = {
|
|
350
351
|
data: data,
|
|
351
352
|
};
|
|
352
|
-
|
|
353
|
+
const confirmationRequest = client.post(
|
|
353
354
|
`api/v1/integrations/${id}`,
|
|
354
355
|
requestData,
|
|
355
356
|
{
|
|
@@ -357,10 +358,10 @@ export const setIntegrationInformation = (
|
|
|
357
358
|
}
|
|
358
359
|
);
|
|
359
360
|
confirmationRequest
|
|
360
|
-
.then((response) => {
|
|
361
|
+
.then((response : AxiosResponse) => {
|
|
361
362
|
resolve(response.data);
|
|
362
363
|
})
|
|
363
|
-
.catch((error) => {
|
|
364
|
+
.catch((error : AxiosError) => {
|
|
364
365
|
reject(error);
|
|
365
366
|
});
|
|
366
367
|
});
|
|
@@ -376,7 +377,7 @@ export const setDefaultIntegration = (
|
|
|
376
377
|
token: string
|
|
377
378
|
): Promise<object> => {
|
|
378
379
|
return new Promise((resolve, reject) => {
|
|
379
|
-
|
|
380
|
+
const confirmationRequest = client.post(
|
|
380
381
|
`api/v1/integrations/${id}/default`,
|
|
381
382
|
"",
|
|
382
383
|
{
|
|
@@ -384,10 +385,10 @@ export const setDefaultIntegration = (
|
|
|
384
385
|
}
|
|
385
386
|
);
|
|
386
387
|
confirmationRequest
|
|
387
|
-
.then((response) => {
|
|
388
|
+
.then((response : AxiosResponse) => {
|
|
388
389
|
resolve(response.data);
|
|
389
390
|
})
|
|
390
|
-
.catch((error) => {
|
|
391
|
+
.catch((error : AxiosError) => {
|
|
391
392
|
reject(error);
|
|
392
393
|
});
|
|
393
394
|
});
|