@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.
Files changed (177) 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 -17
  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 +11 -10
  142. package/src/lib/address.ts +5 -4
  143. package/src/lib/aiAssistant.ts +25 -24
  144. package/src/lib/avatar.ts +4 -3
  145. package/src/lib/axiosClient.ts +22 -9
  146. package/src/lib/config.ts +11 -10
  147. package/src/lib/dashboard.ts +11 -10
  148. package/src/lib/departmentTrainingPlans.ts +29 -32
  149. package/src/lib/groups.ts +38 -37
  150. package/src/lib/index.ts +85 -1
  151. package/src/lib/integration.ts +56 -55
  152. package/src/lib/integrationConfiguration.ts +15 -14
  153. package/src/lib/integrations/contentGenerator.ts +10 -9
  154. package/src/lib/learningContent.ts +56 -55
  155. package/src/lib/learningPath.ts +32 -31
  156. package/src/lib/logger.ts +9 -8
  157. package/src/lib/microSkillsQuizes.ts +11 -10
  158. package/src/lib/quotas.ts +10 -9
  159. package/src/lib/role.ts +56 -55
  160. package/src/lib/roleTemplate.ts +37 -36
  161. package/src/lib/security.ts +14 -13
  162. package/src/lib/skill.ts +72 -71
  163. package/src/lib/skillAssessmentTestingSession.ts +25 -24
  164. package/src/lib/skillAssessments.ts +25 -24
  165. package/src/lib/skillTemplate.ts +45 -44
  166. package/src/lib/talentTransfromation.ts +15 -14
  167. package/src/lib/teams.ts +35 -34
  168. package/src/lib/tenants.ts +10 -9
  169. package/src/lib/trainingPlans.ts +37 -36
  170. package/src/lib/trainingPlansProficiencyLevels.ts +14 -13
  171. package/src/lib/userInformation.ts +13 -12
  172. package/src/lib/users.ts +72 -72
  173. package/src/lib/utils.ts +7 -16
  174. package/tsconfig.json +16 -5
  175. package/dist/exports.js +0 -77
  176. package/index.d.ts +0 -1
  177. package/src/lib/exports.ts +0 -85
@@ -1,9 +1,10 @@
1
- import { client } from "./axiosClient.js";
1
+ import { AxiosError, AxiosResponse } from "axios";
2
+ import { client } from "./axiosClient";
2
3
 
3
4
  /**
4
5
  * Get talent transformation steps for the current user
5
6
  * @param {String} authToken The authentication token
6
- * @returns {Promise<Object>}
7
+ * @returns {Promise<object>}
7
8
  */
8
9
  const getTalentTransformationStepsForCurrentUser = (
9
10
  authToken: string
@@ -18,10 +19,10 @@ const getTalentTransformationStepsForCurrentUser = (
18
19
  : {}
19
20
  );
20
21
  request
21
- .then((response) => {
22
+ .then((response : AxiosResponse) => {
22
23
  resolve(response.data);
23
24
  })
24
- .catch((error) => {
25
+ .catch((error : AxiosError) => {
25
26
  reject(error);
26
27
  });
27
28
  });
@@ -30,7 +31,7 @@ const getTalentTransformationStepsForCurrentUser = (
30
31
  /**
31
32
  * Get the talent transformation summary for the whole organization
32
33
  * @param {String} authToken
33
- * @returns {Promise<Object>} The talent transformation summary
34
+ * @returns {Promise<object>} The talent transformation summary
34
35
  */
35
36
  const getTalentTransformationSummary = (authToken: string): Promise<object> => {
36
37
  return new Promise((resolve, reject) => {
@@ -43,10 +44,10 @@ const getTalentTransformationSummary = (authToken: string): Promise<object> => {
43
44
  : {}
44
45
  );
45
46
  request
46
- .then((response) => {
47
+ .then((response : AxiosResponse) => {
47
48
  resolve(response.data);
48
49
  })
49
- .catch((error) => {
50
+ .catch((error : AxiosError) => {
50
51
  reject(error);
51
52
  });
52
53
  });
@@ -56,7 +57,7 @@ const getTalentTransformationSummary = (authToken: string): Promise<object> => {
56
57
  * Get the talent transformation summary for the team
57
58
  * @param {String} teamId
58
59
  * @param {String} authToken
59
- * @returns {Promise<Object>} The talent transformation summary
60
+ * @returns {Promise<object>} The talent transformation summary
60
61
  */
61
62
  const getTalentTransformationSummaryForTeam = (
62
63
  teamId: string,
@@ -72,10 +73,10 @@ const getTalentTransformationSummaryForTeam = (
72
73
  : {}
73
74
  );
74
75
  request
75
- .then((response) => {
76
+ .then((response : AxiosResponse) => {
76
77
  resolve(response.data);
77
78
  })
78
- .catch((error) => {
79
+ .catch((error : AxiosError) => {
79
80
  reject(error);
80
81
  });
81
82
  });
@@ -87,7 +88,7 @@ const getTalentTransformationSummaryForTeam = (
87
88
  * @param {Object} data Data used to update the talent transformation step
88
89
  * @param {Boolean} returnAllStepsStatuses If true, return all steps statuses
89
90
  * @param {String} token Authorization token
90
- * @returns {Promise<Object>}
91
+ * @returns {Promise<object>}
91
92
  */
92
93
  const setTalentTransformationStepData = (
93
94
  id: string,
@@ -101,7 +102,7 @@ const setTalentTransformationStepData = (
101
102
  id: id,
102
103
  returnAllStepsStatuses: returnAllStepsStatuses,
103
104
  };
104
- let confirmationRequest = client.post(
105
+ const confirmationRequest = client.post(
105
106
  `api/v1/talenttransformation/setdata/`,
106
107
  requestData,
107
108
  {
@@ -109,10 +110,10 @@ const setTalentTransformationStepData = (
109
110
  }
110
111
  );
111
112
  confirmationRequest
112
- .then((response) => {
113
+ .then((response : AxiosResponse) => {
113
114
  resolve(response.data);
114
115
  })
115
- .catch((error) => {
116
+ .catch((error : AxiosError) => {
116
117
  reject(error);
117
118
  });
118
119
  });
package/src/lib/teams.ts CHANGED
@@ -1,11 +1,12 @@
1
- import { client } from "./axiosClient.js";
1
+ import { AxiosError, AxiosResponse } from "axios";
2
+ import { client } from "./axiosClient";
2
3
 
3
4
  /**
4
5
  * Add users to team
5
6
  * @param {String} teamId The team Id
6
7
  * @param {Array<String>} users The users to be added
7
8
  * @param {String} authToken - Authentication token
8
- * @returns {Promise<Object>}
9
+ * @returns {Promise<object>}
9
10
  */
10
11
  const addUsersToTeam = (
11
12
  teamId: string,
@@ -22,10 +23,10 @@ const addUsersToTeam = (
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
  });
@@ -37,7 +38,7 @@ const addUsersToTeam = (
37
38
  * @param {String} managerId The id of the manager
38
39
  * @param {String} description The description of the team
39
40
  * @param {String} authToken The authorization token
40
- * @returns {Promise<Object>}
41
+ * @returns {Promise<object>}
41
42
  */
42
43
  const createTeam = (
43
44
  name: string,
@@ -56,10 +57,10 @@ const createTeam = (
56
57
  { headers: { authorization: authToken } }
57
58
  );
58
59
  request
59
- .then((response) => {
60
+ .then((response : AxiosResponse) => {
60
61
  resolve(response.data);
61
62
  })
62
- .catch((error) => {
63
+ .catch((error : AxiosError) => {
63
64
  reject(error);
64
65
  });
65
66
  });
@@ -70,7 +71,7 @@ const createTeam = (
70
71
  * @param {String} teamId The team to be deleted
71
72
  * @param {String} defaultTeamId The default team all the users will be moved to
72
73
  * @param {String} authToken The authentication token
73
- * @returns {Promise<Object>}
74
+ * @returns {Promise<object>}
74
75
  */
75
76
  const deleteTeam = (
76
77
  teamId: string,
@@ -86,10 +87,10 @@ const deleteTeam = (
86
87
  },
87
88
  });
88
89
  request
89
- .then((response) => {
90
+ .then((response : AxiosResponse) => {
90
91
  resolve(response.data);
91
92
  })
92
- .catch((error) => {
93
+ .catch((error : AxiosError) => {
93
94
  reject(error);
94
95
  });
95
96
  });
@@ -100,7 +101,7 @@ const deleteTeam = (
100
101
  * @param {String} teamId The team Id
101
102
  * @param {Boolean} includeUserSummaryInformation True if request to load user summary information
102
103
  * @param {String} authToken The authentication token
103
- * @returns {Promise<Object>}
104
+ * @returns {Promise<object>}
104
105
  */
105
106
  const getTeamById = (
106
107
  teamId: string,
@@ -116,10 +117,10 @@ const getTeamById = (
116
117
  { headers: { authorization: authToken } }
117
118
  );
118
119
  request
119
- .then((response) => {
120
+ .then((response : AxiosResponse) => {
120
121
  resolve(response.data);
121
122
  })
122
- .catch((error) => {
123
+ .catch((error : AxiosError) => {
123
124
  reject(error);
124
125
  });
125
126
  });
@@ -129,7 +130,7 @@ const getTeamById = (
129
130
  * Get team roles
130
131
  * @param {String} teamId The team Id
131
132
  * @param {String} authToken The authentication token
132
- * @returns {Promise<Object>}
133
+ * @returns {Promise<object>}
133
134
  */
134
135
  const getTeamByIdRoles = (
135
136
  teamId: string,
@@ -140,10 +141,10 @@ const getTeamByIdRoles = (
140
141
  headers: { authorization: authToken },
141
142
  });
142
143
  request
143
- .then((response) => {
144
+ .then((response : AxiosResponse) => {
144
145
  resolve(response.data);
145
146
  })
146
- .catch((error) => {
147
+ .catch((error : AxiosError) => {
147
148
  reject(error);
148
149
  });
149
150
  });
@@ -152,7 +153,7 @@ const getTeamByIdRoles = (
152
153
  /**
153
154
  * Get teams for current tenant
154
155
  * @param {String} authToken The authentication token
155
- * @returns {Promise<Object>}
156
+ * @returns {Promise<object>}
156
157
  */
157
158
  const getTeams = (authToken: string): Promise<object> => {
158
159
  return new Promise((resolve, reject) => {
@@ -160,10 +161,10 @@ const getTeams = (authToken: string): Promise<object> => {
160
161
  headers: { authorization: authToken },
161
162
  });
162
163
  request
163
- .then((response) => {
164
+ .then((response : AxiosResponse) => {
164
165
  resolve(response.data);
165
166
  })
166
- .catch((error) => {
167
+ .catch((error : AxiosError) => {
167
168
  reject(error);
168
169
  });
169
170
  });
@@ -174,7 +175,7 @@ const getTeams = (authToken: string): Promise<object> => {
174
175
  * @param {String} userId
175
176
  * @param {Boolean} includeUserSummaryInformation True if request to load user summary information
176
177
  * @param {String} authToken The authentication token
177
- * @returns {Promise<Object>}
178
+ * @returns {Promise<object>}
178
179
  */
179
180
  const getTeamByUserId = (
180
181
  userId: string,
@@ -190,10 +191,10 @@ const getTeamByUserId = (
190
191
  { headers: { authorization: authToken } }
191
192
  );
192
193
  request
193
- .then((response) => {
194
+ .then((response : AxiosResponse) => {
194
195
  resolve(response.data);
195
196
  })
196
- .catch((error) => {
197
+ .catch((error : AxiosError) => {
197
198
  reject(error);
198
199
  });
199
200
  });
@@ -203,7 +204,7 @@ const getTeamByUserId = (
203
204
  * Get top team in the organization, usually the executive team
204
205
  * @param {Boolean} includeUserSummaryInformation True if request to load user summary information
205
206
  * @param {String} authToken The authentication token
206
- * @returns {Promise<Object>}
207
+ * @returns {Promise<object>}
207
208
  */
208
209
  const getTopTeam = (
209
210
  includeUserSummaryInformation: boolean,
@@ -218,10 +219,10 @@ const getTopTeam = (
218
219
  { headers: { authorization: authToken } }
219
220
  );
220
221
  request
221
- .then((response) => {
222
+ .then((response : AxiosResponse) => {
222
223
  resolve(response.data);
223
224
  })
224
- .catch((error) => {
225
+ .catch((error : AxiosError) => {
225
226
  reject(error);
226
227
  });
227
228
  });
@@ -232,7 +233,7 @@ const getTopTeam = (
232
233
  * @param {String} teamId The team Id
233
234
  * @param {Array<String>} users The users to be removed from the team
234
235
  * @param {String} authToken The authentication token
235
- * @returns {Promise<Object>}
236
+ * @returns {Promise<object>}
236
237
  */
237
238
  const removeUsersFromTeam = (
238
239
  teamId: string,
@@ -249,10 +250,10 @@ const removeUsersFromTeam = (
249
250
  { headers: { authorization: authToken } }
250
251
  );
251
252
  request
252
- .then((response) => {
253
+ .then((response : AxiosResponse) => {
253
254
  resolve(response.data);
254
255
  })
255
- .catch((error) => {
256
+ .catch((error : AxiosError) => {
256
257
  reject(error);
257
258
  });
258
259
  });
@@ -262,7 +263,7 @@ const removeUsersFromTeam = (
262
263
  * Set team as default
263
264
  * @param {String} teamId The team Id
264
265
  * @param {String} authToken The authentication token
265
- * @returns {Promise<Object>}
266
+ * @returns {Promise<object>}
266
267
  */
267
268
  const setDefault = (teamId: string, authToken: string): Promise<object> => {
268
269
  return new Promise((resolve, reject) => {
@@ -274,10 +275,10 @@ const setDefault = (teamId: string, authToken: string): Promise<object> => {
274
275
  { headers: { authorization: authToken } }
275
276
  );
276
277
  request
277
- .then((response) => {
278
+ .then((response : AxiosResponse) => {
278
279
  resolve(response.data);
279
280
  })
280
- .catch((error) => {
281
+ .catch((error : AxiosError) => {
281
282
  reject(error);
282
283
  });
283
284
  });
@@ -288,7 +289,7 @@ const setDefault = (teamId: string, authToken: string): Promise<object> => {
288
289
  * @param {String} teamId The team Id
289
290
  * @param {Object} data The updated data of the team
290
291
  * @param {String} authToken The authentication token
291
- * @returns {Promise<Object>}
292
+ * @returns {Promise<object>}
292
293
  */
293
294
  const updateTeam = (
294
295
  teamId: string,
@@ -305,10 +306,10 @@ const updateTeam = (
305
306
  { headers: { authorization: authToken } }
306
307
  );
307
308
  request
308
- .then((response) => {
309
+ .then((response : AxiosResponse) => {
309
310
  resolve(response.data);
310
311
  })
311
- .catch((error) => {
312
+ .catch((error : AxiosError) => {
312
313
  reject(error);
313
314
  });
314
315
  });
@@ -1,10 +1,11 @@
1
- import { client } from "./axiosClient.js";
1
+ import { AxiosError, AxiosResponse } from "axios";
2
+ import { client } from "./axiosClient";
2
3
 
3
4
  /**
4
5
  * Get tenant information
5
6
  * @param {String} category Tenant information category
6
7
  * @param {String} token Authorization token
7
- * @returns {Promise<Object>}
8
+ * @returns {Promise<object>}
8
9
  */
9
10
  const getTenantInformation = (
10
11
  category: string,
@@ -14,14 +15,14 @@ const getTenantInformation = (
14
15
  const requestData = {
15
16
  categories: category,
16
17
  };
17
- let request = client.post("api/v1/tenants/tenant/get", requestData, {
18
+ const request = client.post("api/v1/tenants/tenant/get", requestData, {
18
19
  headers: { authorization: token },
19
20
  });
20
21
  request
21
- .then((response) => {
22
+ .then((response : AxiosResponse) => {
22
23
  resolve(response.data ? response.data : null);
23
24
  })
24
- .catch((error) => {
25
+ .catch((error : AxiosError) => {
25
26
  reject(error);
26
27
  });
27
28
  });
@@ -32,7 +33,7 @@ const getTenantInformation = (
32
33
  * @param {String} category Tenant information category
33
34
  * @param {Object} data New or updated tenant data information
34
35
  * @param {String} token Authorization token
35
- * @returns {Promise<Object>}
36
+ * @returns {Promise<object>}
36
37
  */
37
38
  const setTenantInformation = (
38
39
  category: string,
@@ -44,7 +45,7 @@ const setTenantInformation = (
44
45
  category: category,
45
46
  data: data,
46
47
  };
47
- let confirmationRequest = client.post(
48
+ const confirmationRequest = client.post(
48
49
  "api/v1/tenants/tenant/set",
49
50
  requestData,
50
51
  {
@@ -52,10 +53,10 @@ const setTenantInformation = (
52
53
  }
53
54
  );
54
55
  confirmationRequest
55
- .then((response) => {
56
+ .then((response : AxiosResponse) => {
56
57
  resolve(response.data);
57
58
  })
58
- .catch((error) => {
59
+ .catch((error : AxiosError) => {
59
60
  reject(error);
60
61
  });
61
62
  });
@@ -1,4 +1,5 @@
1
- import { client } from "./axiosClient.js";
1
+ import { AxiosError, AxiosResponse } from "axios";
2
+ import { client } from "./axiosClient";
2
3
 
3
4
  /**
4
5
  * Archive the training plan
@@ -11,10 +12,10 @@ const archiveTrainingPlan = (id: string, token: string): Promise<object> => {
11
12
  headers: { authorization: token },
12
13
  });
13
14
  request
14
- .then((response) => {
15
+ .then((response : AxiosResponse) => {
15
16
  resolve(response.data);
16
17
  })
17
- .catch((error) => {
18
+ .catch((error : AxiosError) => {
18
19
  reject(error);
19
20
  });
20
21
  });
@@ -41,14 +42,14 @@ const createTrainingPlan = (
41
42
  returnDefaultIfVersionNotAvailable: true,
42
43
  types: [type],
43
44
  };
44
- let confirmationRequest = client.put("api/v1/trainingplans", requestData, {
45
+ const confirmationRequest = client.put("api/v1/trainingplans", 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
  });
@@ -75,10 +76,10 @@ const deleteTrainingPlan = (
75
76
  data: data,
76
77
  });
77
78
  request
78
- .then((response) => {
79
+ .then((response : AxiosResponse) => {
79
80
  resolve(response.data);
80
81
  })
81
- .catch((error) => {
82
+ .catch((error : AxiosError) => {
82
83
  reject(error);
83
84
  });
84
85
  });
@@ -98,10 +99,10 @@ const discardTrainingPlanChanges = (
98
99
  headers: { authorization: token },
99
100
  });
100
101
  request
101
- .then((response) => {
102
+ .then((response : AxiosResponse) => {
102
103
  resolve(response.data);
103
104
  })
104
- .catch((error) => {
105
+ .catch((error : AxiosError) => {
105
106
  reject(error);
106
107
  });
107
108
  });
@@ -129,7 +130,7 @@ const generateNewBaseline = (
129
130
  saveBaseline: saveBaseline,
130
131
  };
131
132
  if (id) requestData.id = id;
132
- let confirmationRequest = client.post(
133
+ const confirmationRequest = client.post(
133
134
  "api/v1/trainingplans/generatenewbaseline",
134
135
  requestData,
135
136
  {
@@ -137,10 +138,10 @@ const generateNewBaseline = (
137
138
  }
138
139
  );
139
140
  confirmationRequest
140
- .then((response) => {
141
+ .then((response : AxiosResponse) => {
141
142
  resolve(response.data);
142
143
  })
143
- .catch((error) => {
144
+ .catch((error : AxiosError) => {
144
145
  reject(error);
145
146
  });
146
147
  });
@@ -158,17 +159,17 @@ const getTrainingPlanById = (
158
159
  token: string
159
160
  ): Promise<object> => {
160
161
  return new Promise((resolve, reject) => {
161
- let confirmationRequest = client.get(
162
+ const confirmationRequest = client.get(
162
163
  `api/v1/trainingplans/${id}/${version}`,
163
164
  {
164
165
  headers: { authorization: token },
165
166
  }
166
167
  );
167
168
  confirmationRequest
168
- .then((response) => {
169
+ .then((response : AxiosResponse) => {
169
170
  resolve(response.data);
170
171
  })
171
- .catch((error) => {
172
+ .catch((error : AxiosError) => {
172
173
  reject(error);
173
174
  });
174
175
  });
@@ -182,14 +183,14 @@ const getAllTrainingPlansTasksSummary = (
182
183
  token: string | null = null
183
184
  ): Promise<object> => {
184
185
  return new Promise((resolve, reject) => {
185
- let confirmationRequest = client.get(`api/v1/trainingplans/taskssummary`, {
186
+ const confirmationRequest = client.get(`api/v1/trainingplans/taskssummary`, {
186
187
  headers: token ? { authorization: token } : {},
187
188
  });
188
189
  confirmationRequest
189
- .then((response) => {
190
+ .then((response : AxiosResponse) => {
190
191
  resolve(response.data);
191
192
  })
192
- .catch((error) => {
193
+ .catch((error : AxiosError) => {
193
194
  reject(error);
194
195
  });
195
196
  });
@@ -226,14 +227,14 @@ const getListOfTrainingPlans = (
226
227
  if (fields) requestData.fields = fields;
227
228
  if (types) requestData.types = types;
228
229
  if (users) requestData.users = users;
229
- let confirmationRequest = client.post(`api/v1/trainingplans`, requestData, {
230
+ const confirmationRequest = client.post(`api/v1/trainingplans`, requestData, {
230
231
  headers: { authorization: token },
231
232
  });
232
233
  confirmationRequest
233
- .then((response) => {
234
+ .then((response : AxiosResponse) => {
234
235
  resolve(response.data);
235
236
  })
236
- .catch((error) => {
237
+ .catch((error : AxiosError) => {
237
238
  reject(error);
238
239
  });
239
240
  });
@@ -251,9 +252,9 @@ const publishTrainingPlan = (
251
252
  token: string
252
253
  ): Promise<object> => {
253
254
  return new Promise((resolve, reject) => {
254
- let data: { comments?: string } = {};
255
+ const data: { comments?: string } = {};
255
256
  if (comments) data.comments = comments;
256
- let confirmationRequest = client.post(
257
+ const confirmationRequest = client.post(
257
258
  `api/v1/trainingplans/publish/${id}`,
258
259
  data,
259
260
  {
@@ -261,10 +262,10 @@ const publishTrainingPlan = (
261
262
  }
262
263
  );
263
264
  confirmationRequest
264
- .then((response) => {
265
+ .then((response : AxiosResponse) => {
265
266
  resolve(response.data);
266
267
  })
267
- .catch((error) => {
268
+ .catch((error : AxiosError) => {
268
269
  reject(error);
269
270
  });
270
271
  });
@@ -289,7 +290,7 @@ const updateTrainingPlan = (
289
290
  id: planId,
290
291
  saveAsDraft,
291
292
  };
292
- let confirmationRequest = client.put(
293
+ const confirmationRequest = client.put(
293
294
  `api/v1/trainingplans/update/${planId}`,
294
295
  requestData,
295
296
  {
@@ -297,10 +298,10 @@ const updateTrainingPlan = (
297
298
  }
298
299
  );
299
300
  confirmationRequest
300
- .then((response) => {
301
+ .then((response : AxiosResponse) => {
301
302
  resolve(response.data);
302
303
  })
303
- .catch((error) => {
304
+ .catch((error : AxiosError) => {
304
305
  reject(error);
305
306
  });
306
307
  });
@@ -311,7 +312,7 @@ const updateTrainingPlan = (
311
312
  * @param {String} id The ID of the training plan
312
313
  * @param {Number} status
313
314
  * @param {String} token
314
- * @returns {Promise<Object>}
315
+ * @returns {Promise<object>}
315
316
  */
316
317
  const updateTrainingPlanTaskStatus = (
317
318
  id: string,
@@ -319,18 +320,18 @@ const updateTrainingPlanTaskStatus = (
319
320
  token: string
320
321
  ): Promise<object> => {
321
322
  return new Promise((resolve, reject) => {
322
- let data = {
323
+ const data = {
323
324
  id: id,
324
325
  status: status,
325
326
  };
326
- let confirmationRequest = client.post(`api/v1/trainingplans/task`, data, {
327
+ const confirmationRequest = client.post(`api/v1/trainingplans/task`, data, {
327
328
  headers: { authorization: token },
328
329
  });
329
330
  confirmationRequest
330
331
  .then(() => {
331
332
  resolve({});
332
333
  })
333
- .catch((error) => {
334
+ .catch((error : AxiosError) => {
334
335
  reject(error);
335
336
  });
336
337
  });
@@ -341,7 +342,7 @@ const updateTrainingPlanTaskStatus = (
341
342
  * @param {String} planId
342
343
  * @param {Object} data Ordered array of objects containing the activity Id and the new status
343
344
  * @param {String} token Authorization token
344
- * @returns {Promise<Object>}
345
+ * @returns {Promise<object>}
345
346
  */
346
347
  const updateActivities = (
347
348
  planId: string,
@@ -349,7 +350,7 @@ const updateActivities = (
349
350
  token: string
350
351
  ): Promise<object> => {
351
352
  return new Promise((resolve, reject) => {
352
- let confirmationRequest = client.post(
353
+ const confirmationRequest = client.post(
353
354
  `api/v1/trainingplans/${planId}/activities`,
354
355
  data,
355
356
  {
@@ -360,7 +361,7 @@ const updateActivities = (
360
361
  .then(() => {
361
362
  resolve({});
362
363
  })
363
- .catch((error) => {
364
+ .catch((error : AxiosError) => {
364
365
  reject(error);
365
366
  });
366
367
  });