@stackfactor/client-api 1.1.134 → 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.
Files changed (175) hide show
  1. package/.eslintrc.json +4 -3
  2. package/declarations/axios.d.ts +1 -0
  3. package/declarations/html2plaintext.d.ts +1 -0
  4. package/dist/actionNotifications.d.ts +7 -0
  5. package/dist/actionNotifications.d.ts.map +1 -0
  6. package/dist/actionNotifications.js +9 -10
  7. package/dist/actionNotifications.js.map +1 -0
  8. package/dist/address.d.ts +5 -0
  9. package/dist/address.d.ts.map +1 -0
  10. package/dist/address.js +5 -6
  11. package/dist/address.js.map +1 -0
  12. package/dist/aiAssistant.d.ts +9 -0
  13. package/dist/aiAssistant.d.ts.map +1 -0
  14. package/dist/aiAssistant.js +16 -17
  15. package/dist/aiAssistant.js.map +1 -0
  16. package/dist/avatar.d.ts +5 -0
  17. package/dist/avatar.d.ts.map +1 -0
  18. package/dist/avatar.js +4 -5
  19. package/dist/avatar.js.map +1 -0
  20. package/dist/axiosClient.d.ts +32 -0
  21. package/dist/axiosClient.d.ts.map +1 -0
  22. package/dist/axiosClient.js +17 -27
  23. package/dist/axiosClient.js.map +1 -0
  24. package/dist/config.d.ts +7 -0
  25. package/dist/config.d.ts.map +1 -0
  26. package/dist/config.js +9 -10
  27. package/dist/config.js.map +1 -0
  28. package/dist/constants.d.ts +70 -0
  29. package/dist/constants.d.ts.map +1 -0
  30. package/dist/constants.js +2 -7
  31. package/dist/constants.js.map +1 -0
  32. package/dist/dashboard.d.ts +7 -0
  33. package/dist/dashboard.d.ts.map +1 -0
  34. package/dist/dashboard.js +9 -10
  35. package/dist/dashboard.js.map +1 -0
  36. package/dist/departmentTrainingPlans.d.ts +13 -0
  37. package/dist/departmentTrainingPlans.d.ts.map +1 -0
  38. package/dist/departmentTrainingPlans.js +16 -17
  39. package/dist/departmentTrainingPlans.js.map +1 -0
  40. package/dist/groups.d.ts +16 -0
  41. package/dist/groups.d.ts.map +1 -0
  42. package/dist/groups.js +27 -28
  43. package/dist/groups.js.map +1 -0
  44. package/dist/index.d.ts +34 -0
  45. package/dist/index.d.ts.map +1 -0
  46. package/dist/index.js +34 -77
  47. package/dist/index.js.map +1 -0
  48. package/dist/integration.d.ts +95 -0
  49. package/dist/integration.d.ts.map +1 -0
  50. package/dist/integration.js +62 -69
  51. package/dist/integration.js.map +1 -0
  52. package/dist/integrationConfiguration.d.ts +7 -0
  53. package/dist/integrationConfiguration.d.ts.map +1 -0
  54. package/dist/integrationConfiguration.js +10 -11
  55. package/dist/integrationConfiguration.js.map +1 -0
  56. package/dist/integrations/contentGenerator.d.ts +27 -0
  57. package/dist/integrations/contentGenerator.d.ts.map +1 -0
  58. package/dist/integrations/contentGenerator.js +12 -16
  59. package/dist/integrations/contentGenerator.js.map +1 -0
  60. package/dist/learningContent.d.ts +19 -0
  61. package/dist/learningContent.d.ts.map +1 -0
  62. package/dist/learningContent.js +30 -31
  63. package/dist/learningContent.js.map +1 -0
  64. package/dist/learningPath.d.ts +12 -0
  65. package/dist/learningPath.d.ts.map +1 -0
  66. package/dist/learningPath.js +19 -20
  67. package/dist/learningPath.js.map +1 -0
  68. package/dist/logger.d.ts +6 -0
  69. package/dist/logger.d.ts.map +1 -0
  70. package/dist/logger.js +8 -9
  71. package/dist/logger.js.map +1 -0
  72. package/dist/microSkillsQuizes.d.ts +6 -0
  73. package/dist/microSkillsQuizes.d.ts.map +1 -0
  74. package/dist/microSkillsQuizes.js +8 -9
  75. package/dist/microSkillsQuizes.js.map +1 -0
  76. package/dist/quotas.d.ts +6 -0
  77. package/dist/quotas.d.ts.map +1 -0
  78. package/dist/quotas.js +7 -8
  79. package/dist/quotas.js.map +1 -0
  80. package/dist/role.d.ts +18 -0
  81. package/dist/role.d.ts.map +1 -0
  82. package/dist/role.js +32 -33
  83. package/dist/role.js.map +1 -0
  84. package/dist/roleTemplate.d.ts +13 -0
  85. package/dist/roleTemplate.d.ts.map +1 -0
  86. package/dist/roleTemplate.js +22 -23
  87. package/dist/roleTemplate.js.map +1 -0
  88. package/dist/security.d.ts +8 -0
  89. package/dist/security.d.ts.map +1 -0
  90. package/dist/security.js +11 -12
  91. package/dist/security.js.map +1 -0
  92. package/dist/skill.d.ts +22 -0
  93. package/dist/skill.d.ts.map +1 -0
  94. package/dist/skill.js +40 -41
  95. package/dist/skill.js.map +1 -0
  96. package/dist/skillAssessmentTestingSession.d.ts +10 -0
  97. package/dist/skillAssessmentTestingSession.d.ts.map +1 -0
  98. package/dist/skillAssessmentTestingSession.js +15 -16
  99. package/dist/skillAssessmentTestingSession.js.map +1 -0
  100. package/dist/skillAssessments.d.ts +10 -0
  101. package/dist/skillAssessments.d.ts.map +1 -0
  102. package/dist/skillAssessments.js +15 -16
  103. package/dist/skillAssessments.js.map +1 -0
  104. package/dist/skillTemplate.d.ts +15 -0
  105. package/dist/skillTemplate.d.ts.map +1 -0
  106. package/dist/skillTemplate.js +26 -27
  107. package/dist/skillTemplate.js.map +1 -0
  108. package/dist/talentTransfromation.d.ts +8 -0
  109. package/dist/talentTransfromation.d.ts.map +1 -0
  110. package/dist/talentTransfromation.js +11 -12
  111. package/dist/talentTransfromation.js.map +1 -0
  112. package/dist/teams.d.ts +15 -0
  113. package/dist/teams.d.ts.map +1 -0
  114. package/dist/teams.js +25 -26
  115. package/dist/teams.js.map +1 -0
  116. package/dist/tenants.d.ts +6 -0
  117. package/dist/tenants.d.ts.map +1 -0
  118. package/dist/tenants.js +7 -8
  119. package/dist/tenants.js.map +1 -0
  120. package/dist/trainingPlans.d.ts +16 -0
  121. package/dist/trainingPlans.d.ts.map +1 -0
  122. package/dist/trainingPlans.js +19 -20
  123. package/dist/trainingPlans.js.map +1 -0
  124. package/dist/trainingPlansProficiencyLevels.d.ts +8 -0
  125. package/dist/trainingPlansProficiencyLevels.d.ts.map +1 -0
  126. package/dist/trainingPlansProficiencyLevels.js +9 -10
  127. package/dist/trainingPlansProficiencyLevels.js.map +1 -0
  128. package/dist/userInformation.d.ts +7 -0
  129. package/dist/userInformation.d.ts.map +1 -0
  130. package/dist/userInformation.js +9 -10
  131. package/dist/userInformation.js.map +1 -0
  132. package/dist/users.d.ts +31 -0
  133. package/dist/users.d.ts.map +1 -0
  134. package/dist/users.js +37 -39
  135. package/dist/users.js.map +1 -0
  136. package/dist/utils.d.ts +8 -0
  137. package/dist/utils.d.ts.map +1 -0
  138. package/dist/utils.js +8 -21
  139. package/dist/utils.js.map +1 -0
  140. package/package.json +15 -14
  141. package/src/lib/actionNotifications.ts +10 -9
  142. package/src/lib/address.ts +4 -3
  143. package/src/lib/aiAssistant.ts +24 -23
  144. package/src/lib/avatar.ts +3 -2
  145. package/src/lib/axiosClient.ts +20 -7
  146. package/src/lib/config.ts +10 -9
  147. package/src/lib/dashboard.ts +10 -9
  148. package/src/lib/departmentTrainingPlans.ts +28 -31
  149. package/src/lib/groups.ts +37 -36
  150. package/src/lib/integration.ts +55 -54
  151. package/src/lib/integrationConfiguration.ts +14 -13
  152. package/src/lib/integrations/contentGenerator.ts +9 -8
  153. package/src/lib/learningContent.ts +55 -54
  154. package/src/lib/learningPath.ts +31 -30
  155. package/src/lib/logger.ts +8 -7
  156. package/src/lib/microSkillsQuizes.ts +10 -9
  157. package/src/lib/quotas.ts +9 -8
  158. package/src/lib/role.ts +55 -54
  159. package/src/lib/roleTemplate.ts +36 -35
  160. package/src/lib/security.ts +13 -12
  161. package/src/lib/skill.ts +71 -70
  162. package/src/lib/skillAssessmentTestingSession.ts +24 -23
  163. package/src/lib/skillAssessments.ts +24 -23
  164. package/src/lib/skillTemplate.ts +44 -43
  165. package/src/lib/talentTransfromation.ts +14 -13
  166. package/src/lib/teams.ts +34 -33
  167. package/src/lib/tenants.ts +9 -8
  168. package/src/lib/trainingPlans.ts +36 -35
  169. package/src/lib/trainingPlansProficiencyLevels.ts +13 -12
  170. package/src/lib/userInformation.ts +12 -11
  171. package/src/lib/users.ts +71 -71
  172. package/src/lib/utils.ts +7 -16
  173. package/tsconfig.json +16 -5
  174. package/dist/exports.js +0 -77
  175. package/index.d.ts +0 -1
package/src/lib/groups.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { AxiosError, AxiosResponse } from "axios";
1
2
  import { client } from "./axiosClient";
2
3
 
3
4
  /**
@@ -5,7 +6,7 @@ import { client } from "./axiosClient";
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<Object>}
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<Object>}
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<Object>}
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<Object>}
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<Object>}
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<Object>}
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<Object>}
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<Object>}
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<Object>}
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<Object>}
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<Object>}
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<Object>}
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
  });
@@ -1,3 +1,4 @@
1
+ import { AxiosError, AxiosResponse } from "axios";
1
2
  import { client, errorToString } from "./axiosClient";
2
3
  import axiosLib from "axios";
3
4
  import htmlParser from "node-html-parser";
@@ -41,14 +42,14 @@ export const createIntegration = (
41
42
  const requestData: IntegrationData = {
42
43
  data: data,
43
44
  };
44
- let confirmationRequest = client.put("api/v1/integrations/", requestData, {
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
- let confirmationRequest = client.get(
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
- let confirmationRequest = client.post(`api/v1/integrations`, requestData, {
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
- let confirmationRequest = client.post(
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
- let domain = new URL(url);
214
- let instance = axiosLib.create({
214
+ const domain = new URL(url);
215
+ const instance = axiosLib.create({
215
216
  baseURL: domain.origin,
216
217
  });
217
- let confirmationRequest = instance.get(domain.pathname, {
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
- let document = htmlParser.parse(response.data);
239
- let duration = getReadingTime(htmlToText(response.data));
240
- let titleTag = document.querySelector("title");
241
- let title = titleTag ? titleTag.rawText : "";
242
- let description = "";
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
- const descriptionParentNode = descriptionEl.parentNode;
247
- if (descriptionParentNode) {
247
+ const descriptionParentNode = descriptionEl.parentNode;
248
+ if (descriptionEl) {
248
249
  const descriptionChildNodes = descriptionParentNode.childNodes;
249
250
  if (descriptionChildNodes) {
250
- const descriptionRawAttr = descriptionChildNodes.find((item) =>
251
- (item as any).rawAttrs.includes("description")
252
- );
253
- if (descriptionRawAttr) {
254
- const descriptionContent = (
255
- descriptionRawAttr as any
256
- ).rawAttrs.substring(
257
- (descriptionRawAttr as any).rawAttrs.indexOf("content=") + 9
258
- );
259
- description = descriptionContent.substring(
260
- 0,
261
- descriptionContent.length - 1
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
- let confirmationRequest = client.get(
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
- let confirmationRequest = client.post(
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
- let confirmationRequest = client.post(
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
- let confirmationRequest = client.post(
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
  });
@@ -1,3 +1,4 @@
1
+ import { AxiosError, AxiosResponse } from "axios";
1
2
  import { client } from "./axiosClient";
2
3
 
3
4
  /**
@@ -5,7 +6,7 @@ import { client } from "./axiosClient";
5
6
  * @param {Array<String>} ids
6
7
  * @param {Number} type
7
8
  * @param {String} token Authorization token
8
- * @returns {Promise<Object>}
9
+ * @returns {Promise<object>}
9
10
  */
10
11
  const getIntegrationsConfiguration = (
11
12
  ids: string[],
@@ -13,9 +14,9 @@ const getIntegrationsConfiguration = (
13
14
  token: string
14
15
  ): Promise<object> => {
15
16
  return new Promise((resolve, reject) => {
16
- let requestData: { type: number; ids?: string[] } = { type: type };
17
+ const requestData: { type: number; ids?: string[] } = { type: type };
17
18
  if (ids) requestData.ids = ids;
18
- let confirmationRequest = client.post(
19
+ const confirmationRequest = client.post(
19
20
  "api/v1/integrationsconfiguration",
20
21
  requestData,
21
22
  {
@@ -23,10 +24,10 @@ const getIntegrationsConfiguration = (
23
24
  }
24
25
  );
25
26
  confirmationRequest
26
- .then((response) => {
27
+ .then((response : AxiosResponse) => {
27
28
  resolve(response.data);
28
29
  })
29
- .catch((error) => {
30
+ .catch((error : AxiosError) => {
30
31
  reject(error);
31
32
  });
32
33
  });
@@ -38,7 +39,7 @@ const getIntegrationsConfiguration = (
38
39
  * @param {Number} type The type of configuration
39
40
  * @param {Object} configuration Data used to update the integration configuration
40
41
  * @param {String} token Authorization token
41
- * @returns {Promise<Object>}
42
+ * @returns {Promise<object>}
42
43
  */
43
44
  const saveIntegrationConfiguration = (
44
45
  id: string,
@@ -52,7 +53,7 @@ const saveIntegrationConfiguration = (
52
53
  configuration: configuration,
53
54
  type: type,
54
55
  };
55
- let confirmationRequest = client.put(
56
+ const confirmationRequest = client.put(
56
57
  `api/v1/integrationsconfiguration`,
57
58
  requestData,
58
59
  {
@@ -60,10 +61,10 @@ const saveIntegrationConfiguration = (
60
61
  }
61
62
  );
62
63
  confirmationRequest
63
- .then((response) => {
64
+ .then((response : AxiosResponse) => {
64
65
  resolve(response.data);
65
66
  })
66
- .catch((error) => {
67
+ .catch((error : AxiosError) => {
67
68
  reject(error);
68
69
  });
69
70
  });
@@ -75,7 +76,7 @@ const saveIntegrationConfiguration = (
75
76
  * @param {String} type The type of configuration
76
77
  * @param {Object} configuration Configuration to be tested
77
78
  * @param {String} token Authorization token
78
- * @returns {Promise<Object>}
79
+ * @returns {Promise<object>}
79
80
  */
80
81
  const testIntegrationConfiguration = (
81
82
  id: string,
@@ -89,7 +90,7 @@ const testIntegrationConfiguration = (
89
90
  configuration: configuration,
90
91
  type: type,
91
92
  };
92
- let confirmationRequest = client.post(
93
+ const confirmationRequest = client.post(
93
94
  `api/v1/integrationsconfiguration/testConfiguration`,
94
95
  requestData,
95
96
  {
@@ -97,10 +98,10 @@ const testIntegrationConfiguration = (
97
98
  }
98
99
  );
99
100
  confirmationRequest
100
- .then((response) => {
101
+ .then((response : AxiosResponse) => {
101
102
  resolve(response.data);
102
103
  })
103
- .catch((error) => {
104
+ .catch((error : AxiosError) => {
104
105
  reject(error);
105
106
  });
106
107
  });