@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
@@ -1,3 +1,4 @@
1
+ import { AxiosError, AxiosResponse } from "axios";
1
2
  import { client } from "./axiosClient";
2
3
 
3
4
  interface AskQuestionData {
@@ -25,7 +26,7 @@ interface StartConversationData {
25
26
  * @param {String} question
26
27
  * @param {String} updatedContext
27
28
  * @param {String} token Authorization token
28
- * @returns {Promise<Object>}
29
+ * @returns {Promise<object>}
29
30
  */
30
31
  const askQuestion = (
31
32
  conversationId: string,
@@ -34,12 +35,12 @@ const askQuestion = (
34
35
  token: string
35
36
  ): Promise<object> => {
36
37
  return new Promise((resolve, reject) => {
37
- let data: AskQuestionData = {
38
+ const data: AskQuestionData = {
38
39
  conversationId: conversationId,
39
40
  question: question,
40
41
  updatedContext: updatedContext,
41
42
  };
42
- let confirmationRequest = client.post(
43
+ const confirmationRequest = client.post(
43
44
  "/api/v1/aiassistant/askquestion",
44
45
  data,
45
46
  {
@@ -47,10 +48,10 @@ const askQuestion = (
47
48
  }
48
49
  );
49
50
  confirmationRequest
50
- .then((response) => {
51
+ .then((response : AxiosResponse) => {
51
52
  resolve(response.data);
52
53
  })
53
- .catch((error) => {
54
+ .catch((error : AxiosError) => {
54
55
  reject(error);
55
56
  });
56
57
  });
@@ -60,17 +61,17 @@ const askQuestion = (
60
61
  * End conversation with the AI
61
62
  * @param {String} conversationId
62
63
  * @param {String} token Authorization token
63
- * @returns {Promise<Object>}
64
+ * @returns {Promise<object>}
64
65
  */
65
66
  const endConversation = (
66
67
  conversationId: string,
67
68
  token: string
68
69
  ): Promise<object> => {
69
70
  return new Promise((resolve, reject) => {
70
- let data: EndConversationData = {
71
+ const data: EndConversationData = {
71
72
  conversationId: conversationId,
72
73
  };
73
- let confirmationRequest = client.post(
74
+ const confirmationRequest = client.post(
74
75
  "/api/v1/aiassistant/endconversation",
75
76
  data,
76
77
  {
@@ -78,10 +79,10 @@ const endConversation = (
78
79
  }
79
80
  );
80
81
  confirmationRequest
81
- .then((response) => {
82
+ .then((response : AxiosResponse) => {
82
83
  resolve(response.data);
83
84
  })
84
- .catch((error) => {
85
+ .catch((error : AxiosError) => {
85
86
  reject(error);
86
87
  });
87
88
  });
@@ -91,24 +92,24 @@ const endConversation = (
91
92
  * Get conversation by elementId
92
93
  * @param {String} elementId
93
94
  * @param {String} token
94
- * @returns {Promise<Object>}
95
+ * @returns {Promise<object>}
95
96
  */
96
97
  const getConversationByElementId = (
97
98
  elementId: string,
98
99
  token: string
99
100
  ): Promise<object> => {
100
101
  return new Promise((resolve, reject) => {
101
- let confirmationRequest = client.get(
102
+ const confirmationRequest = client.get(
102
103
  `/api/v1/aiassistant/getconversation/${elementId}`,
103
104
  {
104
105
  headers: { authorization: token },
105
106
  }
106
107
  );
107
108
  confirmationRequest
108
- .then((response) => {
109
+ .then((response : AxiosResponse) => {
109
110
  resolve(response.data);
110
111
  })
111
- .catch((error) => {
112
+ .catch((error : AxiosError) => {
112
113
  reject(error);
113
114
  });
114
115
  });
@@ -118,24 +119,24 @@ const getConversationByElementId = (
118
119
  * Get the voice assistant URL
119
120
  * @param {String} language
120
121
  * @param {String} token
121
- * @returns {Promise<Object>}
122
+ * @returns {Promise<object>}
122
123
  */
123
124
  const getVoiceAssistantUrl = (
124
125
  language: string,
125
126
  token: string
126
127
  ): Promise<object> => {
127
128
  return new Promise((resolve, reject) => {
128
- let confirmationRequest = client.get(
129
+ const confirmationRequest = client.get(
129
130
  `/api/v1/aiassistant/getvoiceassistanturl/${language}`,
130
131
  {
131
132
  headers: { authorization: token },
132
133
  }
133
134
  );
134
135
  confirmationRequest
135
- .then((response) => {
136
+ .then((response : AxiosResponse) => {
136
137
  resolve(response.data);
137
138
  })
138
- .catch((error) => {
139
+ .catch((error : AxiosError) => {
139
140
  reject(error);
140
141
  });
141
142
  });
@@ -149,7 +150,7 @@ const getVoiceAssistantUrl = (
149
150
  * @param {Boolean} autoContextRefresh
150
151
  * @param {String} token
151
152
  * @param {String} conversationId Optional
152
- * @returns {Promise<Object>}
153
+ * @returns {Promise<object>}
153
154
  */
154
155
  const startConversation = (
155
156
  elementId: string,
@@ -161,7 +162,7 @@ const startConversation = (
161
162
  conversationId: string | null = null
162
163
  ): Promise<object> => {
163
164
  return new Promise((resolve, reject) => {
164
- let data: StartConversationData = {
165
+ const data: StartConversationData = {
165
166
  autoContextRefresh: autoContextRefresh,
166
167
  context: context,
167
168
  question: question,
@@ -171,7 +172,7 @@ const startConversation = (
171
172
  if (conversationId) {
172
173
  data.conversationId = conversationId;
173
174
  }
174
- let confirmationRequest = client.post(
175
+ const confirmationRequest = client.post(
175
176
  "/api/v1/aiassistant/startconversation",
176
177
  data,
177
178
  {
@@ -179,10 +180,10 @@ const startConversation = (
179
180
  }
180
181
  );
181
182
  confirmationRequest
182
- .then((response) => {
183
+ .then((response : AxiosResponse) => {
183
184
  resolve(response.data);
184
185
  })
185
- .catch((error) => {
186
+ .catch((error : AxiosError) => {
186
187
  reject(error);
187
188
  });
188
189
  });
package/src/lib/avatar.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { AxiosError, AxiosResponse } from "axios";
1
2
  import { client } from "./axiosClient";
2
3
 
3
4
  /**
@@ -17,7 +18,7 @@ const getAvatar = (
17
18
  token: string
18
19
  ): Promise<Blob> => {
19
20
  return new Promise((resolve, reject) => {
20
- let confirmationRequest = client.get(
21
+ const confirmationRequest = client.get(
21
22
  `/api/v1/avatar/getavatar/${elementId}/${type}/${width}/${height}`,
22
23
  {
23
24
  headers: {
@@ -27,7 +28,7 @@ const getAvatar = (
27
28
  }
28
29
  );
29
30
  confirmationRequest
30
- .then((response) => {
31
+ .then((response : AxiosResponse) => {
31
32
  resolve(response.data);
32
33
  })
33
34
  .catch(() => {
@@ -1,7 +1,19 @@
1
- import axios, { AxiosError } from "axios";
1
+ import axios, { AxiosError, AxiosResponse } from "axios";
2
2
  import { RESPONSE_TYPE } from "./constants";
3
3
  import utils from "./utils";
4
4
 
5
+ interface ErrorResponse {
6
+ msg: string;
7
+ param: string;
8
+ value: string;
9
+ toString: () => string;
10
+ }
11
+
12
+ interface CustomAxiosResponse extends AxiosResponse {
13
+ errors?: ErrorResponse[];
14
+ toString: () => string;
15
+ }
16
+
5
17
  const baseUrl = utils.getBaseUrl();
6
18
 
7
19
  const client = axios.create({
@@ -18,21 +30,22 @@ const errorToString = (error: AxiosError): string => {
18
30
  if (error != null) {
19
31
  if (error.response?.data) {
20
32
  let asString = "";
21
- if (Array.isArray((error.response.data as any).errors)) {
22
- (error.response.data as any).errors.forEach(
23
- (item: any, index: number) => {
33
+ const responseData = error.response.data as CustomAxiosResponse;
34
+ if (Array.isArray(responseData.errors)) {
35
+ responseData.errors.forEach(
36
+ (item: ErrorResponse, index: number) => {
24
37
  asString += `${index > 0 ? ", " : ""} ${item.msg} param ${
25
38
  item.param
26
39
  } ${item.value ? `value ${item.value.toString()}` : ""}`;
27
40
  }
28
41
  );
29
42
  return asString;
30
- } else if ((error.response.data as any).error) {
31
- return (error.response.data as any).error.toString();
43
+ } else if (responseData.errors) {
44
+ return JSON.stringify(responseData.errors);
32
45
  } else if (error.response.statusText) {
33
46
  return error.response.statusText.toString();
34
47
  } else {
35
- return (error.response.data as any).toString();
48
+ return responseData.toString();
36
49
  }
37
50
  } else {
38
51
  return error.message ? error.message : "Unknown error";
package/src/lib/config.ts CHANGED
@@ -1,10 +1,11 @@
1
+ import { AxiosError, AxiosResponse } from "axios";
1
2
  import { client } from "./axiosClient";
2
3
 
3
4
  /**
4
5
  * Get the specified configuration by Id. It returns a promise
5
6
  * @param {String} id - the id of the configuration element
6
7
  * @param {String} authToken - Authorization token
7
- * @returns {Promise<Object>}
8
+ * @returns {Promise<object>}
8
9
  */
9
10
  const getConfigurationById = (
10
11
  id: string,
@@ -16,10 +17,10 @@ const getConfigurationById = (
16
17
  { headers: { authorization: authToken } }
17
18
  );
18
19
  getConfigInformationRequest
19
- .then((response) => {
20
+ .then((response : AxiosResponse) => {
20
21
  resolve(response.data);
21
22
  })
22
- .catch((error) => {
23
+ .catch((error : AxiosError) => {
23
24
  reject(error);
24
25
  });
25
26
  });
@@ -29,7 +30,7 @@ const getConfigurationById = (
29
30
  * Get the specified configuration by type. It returns a promise
30
31
  * @param {String} type - the id of the configuration element
31
32
  * @param {String} authToken - Authorization token
32
- * @returns {Promise<Object>}
33
+ * @returns {Promise<object>}
33
34
  */
34
35
  const getConfigurationByType = (
35
36
  type: string,
@@ -41,10 +42,10 @@ const getConfigurationByType = (
41
42
  { headers: { authorization: authToken } }
42
43
  );
43
44
  getConfigInformationRequest
44
- .then((response) => {
45
+ .then((response : AxiosResponse) => {
45
46
  resolve(response.data);
46
47
  })
47
- .catch((error) => {
48
+ .catch((error : AxiosError) => {
48
49
  reject(error);
49
50
  });
50
51
  });
@@ -55,7 +56,7 @@ const getConfigurationByType = (
55
56
  * @param {String} id - the id of the configuration element
56
57
  * @param {Object} data - the object containing the updated configuration element
57
58
  * @param {String} authToken - Authorization token
58
- * @returns {Promise<Object>}
59
+ * @returns {Promise<object>}
59
60
  */
60
61
  const setConfigurationById = (
61
62
  id: string,
@@ -69,10 +70,10 @@ const setConfigurationById = (
69
70
  { headers: { authorization: authToken } }
70
71
  );
71
72
  getConfigInformationRequest
72
- .then((response) => {
73
+ .then((response : AxiosResponse) => {
73
74
  resolve(response.data);
74
75
  })
75
- .catch((error) => {
76
+ .catch((error : AxiosError) => {
76
77
  reject(error);
77
78
  });
78
79
  });
@@ -1,3 +1,4 @@
1
+ import { AxiosError, AxiosResponse } from "axios";
1
2
  import { client } from "./axiosClient";
2
3
 
3
4
  /**
@@ -6,7 +7,7 @@ import { client } from "./axiosClient";
6
7
  * @param {Number} position - The position on the dashboard
7
8
  * @param {Object} data - The card settings data
8
9
  * @param {String} authToken - Authorization token
9
- * @returns {Promise<Object>}
10
+ * @returns {Promise<object>}
10
11
  */
11
12
  const addCardToDashboard = (
12
13
  id: string,
@@ -25,10 +26,10 @@ const addCardToDashboard = (
25
26
  { headers: { authorization: authToken } }
26
27
  );
27
28
  request
28
- .then((response) => {
29
+ .then((response : AxiosResponse) => {
29
30
  resolve(response.data);
30
31
  })
31
- .catch((error) => {
32
+ .catch((error : AxiosError) => {
32
33
  reject(error);
33
34
  });
34
35
  });
@@ -37,7 +38,7 @@ const addCardToDashboard = (
37
38
  /**
38
39
  * Get the list of the cards from the dashboard
39
40
  * @param {String} authToken - Authorization token
40
- * @returns {Promise<Object>}
41
+ * @returns {Promise<object>}
41
42
  */
42
43
  const getDashboardCardsList = (authToken: string): Promise<object> => {
43
44
  return new Promise((resolve, reject) => {
@@ -45,10 +46,10 @@ const getDashboardCardsList = (authToken: string): Promise<object> => {
45
46
  headers: { authorization: authToken },
46
47
  });
47
48
  request
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
  });
@@ -58,7 +59,7 @@ const getDashboardCardsList = (authToken: string): Promise<object> => {
58
59
  * Remove a card from the dashboard
59
60
  * @param {String} id - the id of the configuration element
60
61
  * @param {String} authToken - Authorization token
61
- * @returns {Promise<Object>}
62
+ * @returns {Promise<object>}
62
63
  */
63
64
  const removeCardFromDashboard = (
64
65
  id: string,
@@ -72,10 +73,10 @@ const removeCardFromDashboard = (
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
  });
@@ -1,11 +1,8 @@
1
+ import { AxiosError, AxiosResponse } from "axios";
1
2
  import { client } from "./axiosClient";
2
3
 
3
4
  interface Activity {
4
- // Define the structure of an activity object here
5
- }
6
-
7
- interface Filter {
8
- // Define the structure of a filter object here
5
+ _id: string;
9
6
  }
10
7
 
11
8
  /**
@@ -15,13 +12,13 @@ interface Filter {
15
12
  * @param {String} skill
16
13
  * @param {Array<Activity>} activities
17
14
  * @param {String} token Authorization token
18
- * @returns {Promise<Object>}
15
+ * @returns {Promise<object>}
19
16
  */
20
17
  const createDepartmentTrainingPlan = (
21
18
  name: string,
22
19
  summary: string,
23
20
  skill: string,
24
- activities: Activity[],
21
+ activities: Array<Activity>,
25
22
  token: string
26
23
  ): Promise<object> => {
27
24
  return new Promise((resolve, reject) => {
@@ -31,7 +28,7 @@ const createDepartmentTrainingPlan = (
31
28
  skill: skill || "",
32
29
  activities: activities || [],
33
30
  };
34
- let confirmationRequest = client.put(
31
+ const confirmationRequest = client.put(
35
32
  "api/v1/departmentTrainingPlans",
36
33
  requestData,
37
34
  {
@@ -39,10 +36,10 @@ const createDepartmentTrainingPlan = (
39
36
  }
40
37
  );
41
38
  confirmationRequest
42
- .then((response) => {
39
+ .then((response : AxiosResponse) => {
43
40
  resolve(response.data);
44
41
  })
45
- .catch((error) => {
42
+ .catch((error : AxiosError) => {
46
43
  reject(error);
47
44
  });
48
45
  });
@@ -52,7 +49,7 @@ const createDepartmentTrainingPlan = (
52
49
  * Delete department training plan
53
50
  * @param {String} id The id of the template to be deleted
54
51
  * @param {String} token Authorization token
55
- * @returns {Promise<Object>}
52
+ * @returns {Promise<object>}
56
53
  */
57
54
  const deleteDepartmentTrainingPlan = (
58
55
  id: string,
@@ -66,10 +63,10 @@ const deleteDepartmentTrainingPlan = (
66
63
  },
67
64
  });
68
65
  request
69
- .then((response) => {
66
+ .then((response : AxiosResponse) => {
70
67
  resolve(response.data);
71
68
  })
72
- .catch((error) => {
69
+ .catch((error : AxiosError) => {
73
70
  reject(error);
74
71
  });
75
72
  });
@@ -80,7 +77,7 @@ const deleteDepartmentTrainingPlan = (
80
77
  * @param {Number} id The id of the plan
81
78
  * @param {String} version The version of the plan
82
79
  * @param {String} token Authorization token
83
- * @returns {Promise<Object>}
80
+ * @returns {Promise<object>}
84
81
  */
85
82
  const getDepartmentTrainingPlanInformationById = (
86
83
  id: number,
@@ -88,17 +85,17 @@ const getDepartmentTrainingPlanInformationById = (
88
85
  token: string
89
86
  ): Promise<object> => {
90
87
  return new Promise((resolve, reject) => {
91
- let confirmationRequest = client.get(
88
+ const confirmationRequest = client.get(
92
89
  `api/v1/departmenttrainingplans/${id}/${version}`,
93
90
  {
94
91
  headers: { authorization: token },
95
92
  }
96
93
  );
97
94
  confirmationRequest
98
- .then((response) => {
95
+ .then((response : AxiosResponse) => {
99
96
  resolve(response.data);
100
97
  })
101
- .catch((error) => {
98
+ .catch((error : AxiosError) => {
102
99
  reject(error);
103
100
  });
104
101
  });
@@ -106,13 +103,13 @@ const getDepartmentTrainingPlanInformationById = (
106
103
 
107
104
  /**
108
105
  * Get department training plan list
109
- * @param {Filter} filter The filter used to select the plan
106
+ * @param {String} filter The filter used to select the plan
110
107
  * @param {String} version The version of the plan
111
108
  * @param {String} token Authorization token
112
- * @returns {Promise<Object>}
109
+ * @returns {Promise<object>}
113
110
  */
114
111
  const getDepartmentTrainingPlanList = (
115
- filter: Filter,
112
+ filter: string,
116
113
  version: string,
117
114
  token: string
118
115
  ): Promise<object> => {
@@ -121,7 +118,7 @@ const getDepartmentTrainingPlanList = (
121
118
  filter: filter || "",
122
119
  version: version,
123
120
  };
124
- let confirmationRequest = client.post(
121
+ const confirmationRequest = client.post(
125
122
  `api/v1/departmenttrainingplans`,
126
123
  requestData,
127
124
  {
@@ -129,10 +126,10 @@ const getDepartmentTrainingPlanList = (
129
126
  }
130
127
  );
131
128
  confirmationRequest
132
- .then((response) => {
129
+ .then((response : AxiosResponse) => {
133
130
  resolve(response.data);
134
131
  })
135
- .catch((error) => {
132
+ .catch((error : AxiosError) => {
136
133
  reject(error);
137
134
  });
138
135
  });
@@ -142,14 +139,14 @@ const getDepartmentTrainingPlanList = (
142
139
  * Publish department training plan
143
140
  * @param {number} id The id of the plan to be published
144
141
  * @param {String} token Authorization token
145
- * @returns {Promise<Object>}
142
+ * @returns {Promise<object>}
146
143
  */
147
144
  const publishDepartmentTrainingPlan = (
148
145
  id: number,
149
146
  token: string
150
147
  ): Promise<object> => {
151
148
  return new Promise((resolve, reject) => {
152
- let confirmationRequest = client.post(
149
+ const confirmationRequest = client.post(
153
150
  `api/v1/departmenttrainingplans/publish/${id}`,
154
151
  {},
155
152
  {
@@ -157,10 +154,10 @@ const publishDepartmentTrainingPlan = (
157
154
  }
158
155
  );
159
156
  confirmationRequest
160
- .then((response) => {
157
+ .then((response : AxiosResponse) => {
161
158
  resolve(response.data);
162
159
  })
163
- .catch((error) => {
160
+ .catch((error : AxiosError) => {
164
161
  reject(error);
165
162
  });
166
163
  });
@@ -171,7 +168,7 @@ const publishDepartmentTrainingPlan = (
171
168
  * @param {String} id The id of the plan to be updated
172
169
  * @param {Object} data Data used to update the plan
173
170
  * @param {String} token Authorization token
174
- * @returns {Promise<Object>}
171
+ * @returns {Promise<object>}
175
172
  */
176
173
  const setDepartmentTrainingPlanInformation = (
177
174
  id: string,
@@ -182,7 +179,7 @@ const setDepartmentTrainingPlanInformation = (
182
179
  const requestData = {
183
180
  data: data,
184
181
  };
185
- let confirmationRequest = client.post(
182
+ const confirmationRequest = client.post(
186
183
  `api/v1/departmenttrainingplans/${id}`,
187
184
  requestData,
188
185
  {
@@ -190,10 +187,10 @@ const setDepartmentTrainingPlanInformation = (
190
187
  }
191
188
  );
192
189
  confirmationRequest
193
- .then((response) => {
190
+ .then((response : AxiosResponse) => {
194
191
  resolve(response.data);
195
192
  })
196
- .catch((error) => {
193
+ .catch((error : AxiosError) => {
197
194
  reject(error);
198
195
  });
199
196
  });