@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/role.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AxiosError, AxiosResponse } from "axios";
|
|
2
|
+
import { client } from "./axiosClient";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Create role and set information
|
|
5
6
|
* @param {Object} data
|
|
6
7
|
* @param {String} token Authorization token
|
|
7
|
-
* @returns {Promise<
|
|
8
|
+
* @returns {Promise<object>}
|
|
8
9
|
*/
|
|
9
10
|
const createRole = (data: object, token: string): Promise<object> => {
|
|
10
11
|
return new Promise((resolve, reject) => {
|
|
11
|
-
|
|
12
|
+
const confirmationRequest = client.put(
|
|
12
13
|
"api/v1/roles",
|
|
13
14
|
{ data: data },
|
|
14
15
|
{
|
|
@@ -16,10 +17,10 @@ const createRole = (data: object, token: string): Promise<object> => {
|
|
|
16
17
|
}
|
|
17
18
|
);
|
|
18
19
|
confirmationRequest
|
|
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
|
});
|
|
@@ -30,7 +31,7 @@ const createRole = (data: object, token: string): Promise<object> => {
|
|
|
30
31
|
* @param {String} templateId
|
|
31
32
|
* @param {Object} data
|
|
32
33
|
* @param {String} token Authorization token
|
|
33
|
-
* @returns {Promise<
|
|
34
|
+
* @returns {Promise<object>}
|
|
34
35
|
*/
|
|
35
36
|
const createRoleFromTemplate = (
|
|
36
37
|
templateId: string,
|
|
@@ -54,7 +55,7 @@ const createRoleFromTemplate = (
|
|
|
54
55
|
returnDefaultIfVersionNotAvailable: false,
|
|
55
56
|
version: "1.0",
|
|
56
57
|
};
|
|
57
|
-
|
|
58
|
+
const confirmationRequest = client.put(
|
|
58
59
|
"api/v1/roles/createfromtemplate/",
|
|
59
60
|
requestData,
|
|
60
61
|
{
|
|
@@ -62,10 +63,10 @@ const createRoleFromTemplate = (
|
|
|
62
63
|
}
|
|
63
64
|
);
|
|
64
65
|
confirmationRequest
|
|
65
|
-
.then((response) => {
|
|
66
|
+
.then((response : AxiosResponse) => {
|
|
66
67
|
resolve(response.data);
|
|
67
68
|
})
|
|
68
|
-
.catch((error) => {
|
|
69
|
+
.catch((error : AxiosError) => {
|
|
69
70
|
reject(error);
|
|
70
71
|
});
|
|
71
72
|
});
|
|
@@ -76,7 +77,7 @@ const createRoleFromTemplate = (
|
|
|
76
77
|
* @param {String} id The id of the role to be deleted
|
|
77
78
|
* @param {String} comments The comments included with the deletion
|
|
78
79
|
* @param {String} token Authorization token
|
|
79
|
-
* @returns {Promise<
|
|
80
|
+
* @returns {Promise<object>}
|
|
80
81
|
*/
|
|
81
82
|
const deleteRole = (
|
|
82
83
|
id: string,
|
|
@@ -93,10 +94,10 @@ const deleteRole = (
|
|
|
93
94
|
data: data,
|
|
94
95
|
});
|
|
95
96
|
request
|
|
96
|
-
.then((response) => {
|
|
97
|
+
.then((response : AxiosResponse) => {
|
|
97
98
|
resolve(response.data);
|
|
98
99
|
})
|
|
99
|
-
.catch((error) => {
|
|
100
|
+
.catch((error : AxiosError) => {
|
|
100
101
|
reject(error);
|
|
101
102
|
});
|
|
102
103
|
});
|
|
@@ -106,7 +107,7 @@ const deleteRole = (
|
|
|
106
107
|
* Discard the role draft changes
|
|
107
108
|
* @param {String} id The id of the role to be deleted
|
|
108
109
|
* @param {String} token Authorization token
|
|
109
|
-
* @returns {Promise<
|
|
110
|
+
* @returns {Promise<object>}
|
|
110
111
|
*/
|
|
111
112
|
const discardRoleChanges = (id: string, token: string): Promise<object> => {
|
|
112
113
|
return new Promise((resolve, reject) => {
|
|
@@ -116,10 +117,10 @@ const discardRoleChanges = (id: string, token: string): Promise<object> => {
|
|
|
116
117
|
data: data,
|
|
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
|
});
|
|
@@ -128,7 +129,7 @@ const discardRoleChanges = (id: string, token: string): Promise<object> => {
|
|
|
128
129
|
/**
|
|
129
130
|
* Get the list of imported role templates
|
|
130
131
|
* @param {String} token
|
|
131
|
-
* @returns {Promise<
|
|
132
|
+
* @returns {Promise<object>}
|
|
132
133
|
*/
|
|
133
134
|
const getImportedRoleTemplates = (token: string): Promise<object> => {
|
|
134
135
|
return new Promise((resolve, reject) => {
|
|
@@ -136,10 +137,10 @@ const getImportedRoleTemplates = (token: string): Promise<object> => {
|
|
|
136
137
|
headers: { authorization: token },
|
|
137
138
|
});
|
|
138
139
|
request
|
|
139
|
-
.then((response) => {
|
|
140
|
+
.then((response : AxiosResponse) => {
|
|
140
141
|
resolve(response.data);
|
|
141
142
|
})
|
|
142
|
-
.catch((error) => {
|
|
143
|
+
.catch((error : AxiosError) => {
|
|
143
144
|
reject(error);
|
|
144
145
|
});
|
|
145
146
|
});
|
|
@@ -151,7 +152,7 @@ const getImportedRoleTemplates = (token: string): Promise<object> => {
|
|
|
151
152
|
* @param {String} version The version to be retrieved
|
|
152
153
|
* @param {Boolean} returnNullIfVersionNotFound Return null if the version is not found
|
|
153
154
|
* @param {String} token Authorization token
|
|
154
|
-
* @returns {Promise<
|
|
155
|
+
* @returns {Promise<object>}
|
|
155
156
|
*/
|
|
156
157
|
const getRoleInformationById = (
|
|
157
158
|
id: number,
|
|
@@ -160,17 +161,17 @@ const getRoleInformationById = (
|
|
|
160
161
|
token: string
|
|
161
162
|
): Promise<object> => {
|
|
162
163
|
return new Promise((resolve, reject) => {
|
|
163
|
-
|
|
164
|
+
const confirmationRequest = client.get(
|
|
164
165
|
`api/v1/roles/role/${id}/${version}/${returnNullIfVersionNotFound}`,
|
|
165
166
|
{
|
|
166
167
|
headers: { authorization: token },
|
|
167
168
|
}
|
|
168
169
|
);
|
|
169
170
|
confirmationRequest
|
|
170
|
-
.then((response) => {
|
|
171
|
+
.then((response : AxiosResponse) => {
|
|
171
172
|
resolve(response.data);
|
|
172
173
|
})
|
|
173
|
-
.catch((error) => {
|
|
174
|
+
.catch((error : AxiosError) => {
|
|
174
175
|
reject(error);
|
|
175
176
|
});
|
|
176
177
|
});
|
|
@@ -185,7 +186,7 @@ const getRoleInformationById = (
|
|
|
185
186
|
* @param {Boolean} returnDefaultIfVersionNotAvailable Return the default version if published not available
|
|
186
187
|
* @param {Boolean} namesOnly Return only the names of the roles
|
|
187
188
|
* @param {String} token Authorization token
|
|
188
|
-
* @returns {Promise<
|
|
189
|
+
* @returns {Promise<object>}
|
|
189
190
|
*/
|
|
190
191
|
const getRolesList = (
|
|
191
192
|
filter: object,
|
|
@@ -212,14 +213,14 @@ const getRolesList = (
|
|
|
212
213
|
version: version,
|
|
213
214
|
};
|
|
214
215
|
if (filter) requestData.filter = filter;
|
|
215
|
-
|
|
216
|
+
const confirmationRequest = client.post(`api/v1/roles`, requestData, {
|
|
216
217
|
headers: { authorization: token },
|
|
217
218
|
});
|
|
218
219
|
confirmationRequest
|
|
219
|
-
.then((response) => {
|
|
220
|
+
.then((response : AxiosResponse) => {
|
|
220
221
|
resolve(response.data);
|
|
221
222
|
})
|
|
222
|
-
.catch((error) => {
|
|
223
|
+
.catch((error : AxiosError) => {
|
|
223
224
|
reject(error);
|
|
224
225
|
});
|
|
225
226
|
});
|
|
@@ -229,21 +230,21 @@ const getRolesList = (
|
|
|
229
230
|
* Get role template updates
|
|
230
231
|
* @param {String} id The role id
|
|
231
232
|
* @param {String} token
|
|
232
|
-
* @returns {Promise<
|
|
233
|
+
* @returns {Promise<object>}
|
|
233
234
|
*/
|
|
234
235
|
const getRoleTemplateUpdates = (id: string, token: string): Promise<object> => {
|
|
235
236
|
return new Promise((resolve, reject) => {
|
|
236
|
-
|
|
237
|
+
const confirmationRequest = client.get(
|
|
237
238
|
`api/v1/roles/getroletemplateupdates/${id}`,
|
|
238
239
|
{
|
|
239
240
|
headers: { authorization: token },
|
|
240
241
|
}
|
|
241
242
|
);
|
|
242
243
|
confirmationRequest
|
|
243
|
-
.then((response) => {
|
|
244
|
+
.then((response : AxiosResponse) => {
|
|
244
245
|
resolve(response.data);
|
|
245
246
|
})
|
|
246
|
-
.catch((error) => {
|
|
247
|
+
.catch((error : AxiosError) => {
|
|
247
248
|
reject(error);
|
|
248
249
|
});
|
|
249
250
|
});
|
|
@@ -253,7 +254,7 @@ const getRoleTemplateUpdates = (id: string, token: string): Promise<object> => {
|
|
|
253
254
|
* Import role templates
|
|
254
255
|
* @param {Array<Object>} data The list of role templates to be imported
|
|
255
256
|
* @param {String} token
|
|
256
|
-
* @returns {Promise<
|
|
257
|
+
* @returns {Promise<object>}
|
|
257
258
|
*/
|
|
258
259
|
const importRoleTemplates = (
|
|
259
260
|
data: object[],
|
|
@@ -264,7 +265,7 @@ const importRoleTemplates = (
|
|
|
264
265
|
roles: data,
|
|
265
266
|
jobDescription: "default job description", // Add a default job description or pass it as a parameter
|
|
266
267
|
};
|
|
267
|
-
|
|
268
|
+
const confirmationRequest = client.post(
|
|
268
269
|
`api/v1/roles/importRoleTemplates`,
|
|
269
270
|
requestData,
|
|
270
271
|
{
|
|
@@ -272,10 +273,10 @@ const importRoleTemplates = (
|
|
|
272
273
|
}
|
|
273
274
|
);
|
|
274
275
|
confirmationRequest
|
|
275
|
-
.then((response) => {
|
|
276
|
+
.then((response : AxiosResponse) => {
|
|
276
277
|
resolve(response.data);
|
|
277
278
|
})
|
|
278
|
-
.catch((error) => {
|
|
279
|
+
.catch((error : AxiosError) => {
|
|
279
280
|
reject(error);
|
|
280
281
|
});
|
|
281
282
|
});
|
|
@@ -286,7 +287,7 @@ const importRoleTemplates = (
|
|
|
286
287
|
* @param {number} id The id of the role to be published
|
|
287
288
|
* @param {String} comments The comments to be include with the request
|
|
288
289
|
* @param {String} token Authorization token
|
|
289
|
-
* @returns {Promise<
|
|
290
|
+
* @returns {Promise<object>}
|
|
290
291
|
*/
|
|
291
292
|
const publishRole = (
|
|
292
293
|
id: number,
|
|
@@ -294,16 +295,16 @@ const publishRole = (
|
|
|
294
295
|
token: string
|
|
295
296
|
): Promise<object> => {
|
|
296
297
|
return new Promise((resolve, reject) => {
|
|
297
|
-
|
|
298
|
+
const data: { comments?: string } = {};
|
|
298
299
|
if (comments) data.comments = comments;
|
|
299
|
-
|
|
300
|
+
const confirmationRequest = client.post(`api/v1/roles/publish/${id}`, data, {
|
|
300
301
|
headers: { authorization: token },
|
|
301
302
|
});
|
|
302
303
|
confirmationRequest
|
|
303
|
-
.then((response) => {
|
|
304
|
+
.then((response : AxiosResponse) => {
|
|
304
305
|
resolve(response.data);
|
|
305
306
|
})
|
|
306
|
-
.catch((error) => {
|
|
307
|
+
.catch((error : AxiosError) => {
|
|
307
308
|
reject(error);
|
|
308
309
|
});
|
|
309
310
|
});
|
|
@@ -314,7 +315,7 @@ const publishRole = (
|
|
|
314
315
|
* @param {String} id The id of the role to be updated
|
|
315
316
|
* @param {Object} data Data used to update the role
|
|
316
317
|
* @param {String} token Authorization token
|
|
317
|
-
* @returns {Promise<
|
|
318
|
+
* @returns {Promise<object>}
|
|
318
319
|
*/
|
|
319
320
|
const setRoleInformation = (
|
|
320
321
|
id: string,
|
|
@@ -326,14 +327,14 @@ const setRoleInformation = (
|
|
|
326
327
|
data: data,
|
|
327
328
|
id: id,
|
|
328
329
|
};
|
|
329
|
-
|
|
330
|
+
const confirmationRequest = client.post(`api/v1/roles/update`, requestData, {
|
|
330
331
|
headers: { authorization: token },
|
|
331
332
|
});
|
|
332
333
|
confirmationRequest
|
|
333
|
-
.then((response) => {
|
|
334
|
+
.then((response : AxiosResponse) => {
|
|
334
335
|
resolve(response.data);
|
|
335
336
|
})
|
|
336
|
-
.catch((error) => {
|
|
337
|
+
.catch((error : AxiosError) => {
|
|
337
338
|
reject(error);
|
|
338
339
|
});
|
|
339
340
|
});
|
|
@@ -344,7 +345,7 @@ const setRoleInformation = (
|
|
|
344
345
|
* @param {String} id The id of the role to be updated
|
|
345
346
|
* @param {Object} data Data used to update the role
|
|
346
347
|
* @param {String} token Authorization token
|
|
347
|
-
* @returns {Promise<
|
|
348
|
+
* @returns {Promise<object>}
|
|
348
349
|
*/
|
|
349
350
|
const setRoleInformationFromTemplate = (
|
|
350
351
|
id: string,
|
|
@@ -356,7 +357,7 @@ const setRoleInformationFromTemplate = (
|
|
|
356
357
|
data: data,
|
|
357
358
|
id: id,
|
|
358
359
|
};
|
|
359
|
-
|
|
360
|
+
const confirmationRequest = client.post(
|
|
360
361
|
`api/v1/roles/updatefromtemplate/`,
|
|
361
362
|
requestData,
|
|
362
363
|
{
|
|
@@ -364,10 +365,10 @@ const setRoleInformationFromTemplate = (
|
|
|
364
365
|
}
|
|
365
366
|
);
|
|
366
367
|
confirmationRequest
|
|
367
|
-
.then((response) => {
|
|
368
|
+
.then((response : AxiosResponse) => {
|
|
368
369
|
resolve(response.data);
|
|
369
370
|
})
|
|
370
|
-
.catch((error) => {
|
|
371
|
+
.catch((error : AxiosError) => {
|
|
371
372
|
reject(error);
|
|
372
373
|
});
|
|
373
374
|
});
|
|
@@ -379,7 +380,7 @@ const setRoleInformationFromTemplate = (
|
|
|
379
380
|
* @param {Array<Object>} roles The list of roles to be assigned to the user
|
|
380
381
|
* @param {String} jobDescription The job description to be assigned to the user
|
|
381
382
|
* @param {String} token Authorization token
|
|
382
|
-
* @returns {Promise<
|
|
383
|
+
* @returns {Promise<object>}
|
|
383
384
|
*/
|
|
384
385
|
const setUserRoles = (
|
|
385
386
|
id: string,
|
|
@@ -393,14 +394,14 @@ const setUserRoles = (
|
|
|
393
394
|
jobDescription: jobDescription,
|
|
394
395
|
};
|
|
395
396
|
if (id) requestData.userid = id;
|
|
396
|
-
|
|
397
|
+
const request = client.post(`api/v1/roles/settouser/`, requestData, {
|
|
397
398
|
headers: { authorization: token },
|
|
398
399
|
});
|
|
399
400
|
request
|
|
400
|
-
.then((response) => {
|
|
401
|
+
.then((response : AxiosResponse) => {
|
|
401
402
|
resolve(response.data);
|
|
402
403
|
})
|
|
403
|
-
.catch((error) => {
|
|
404
|
+
.catch((error : AxiosError) => {
|
|
404
405
|
reject(error);
|
|
405
406
|
});
|
|
406
407
|
});
|
|
@@ -411,7 +412,7 @@ const setUserRoles = (
|
|
|
411
412
|
* @param {String} id The id of the role to be updated
|
|
412
413
|
* @param {Boolean} watch Set to true or false
|
|
413
414
|
* @param {String} token Authorization token
|
|
414
|
-
* @returns {Promise<
|
|
415
|
+
* @returns {Promise<object>}
|
|
415
416
|
*/
|
|
416
417
|
const watchRole = (
|
|
417
418
|
id: string,
|
|
@@ -423,14 +424,14 @@ const watchRole = (
|
|
|
423
424
|
id: id,
|
|
424
425
|
watch: watch,
|
|
425
426
|
};
|
|
426
|
-
|
|
427
|
+
const confirmationRequest = client.post(`api/v1/roles/watch`, requestData, {
|
|
427
428
|
headers: { authorization: token },
|
|
428
429
|
});
|
|
429
430
|
confirmationRequest
|
|
430
|
-
.then((response) => {
|
|
431
|
+
.then((response : AxiosResponse) => {
|
|
431
432
|
resolve(response.data);
|
|
432
433
|
})
|
|
433
|
-
.catch((error) => {
|
|
434
|
+
.catch((error : AxiosError) => {
|
|
434
435
|
reject(error);
|
|
435
436
|
});
|
|
436
437
|
});
|
package/src/lib/roleTemplate.ts
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AxiosError, AxiosResponse } from "axios";
|
|
2
|
+
import { client } from "./axiosClient";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Create role template and set information
|
|
5
6
|
* @param {Object} data
|
|
6
7
|
* @param {String} token Authorization token
|
|
7
|
-
* @returns {Promise<
|
|
8
|
+
* @returns {Promise<object>}
|
|
8
9
|
*/
|
|
9
10
|
const createRoleTemplate = (data: object, token: string): Promise<object> => {
|
|
10
11
|
return new Promise((resolve, reject) => {
|
|
11
12
|
const requestData = {
|
|
12
13
|
data: data,
|
|
13
14
|
};
|
|
14
|
-
|
|
15
|
+
const confirmationRequest = client.put("api/v1/roletemplates", requestData, {
|
|
15
16
|
headers: { authorization: token },
|
|
16
17
|
});
|
|
17
18
|
confirmationRequest
|
|
18
|
-
.then((response) => {
|
|
19
|
+
.then((response : AxiosResponse) => {
|
|
19
20
|
resolve(response.data);
|
|
20
21
|
})
|
|
21
|
-
.catch((error) => {
|
|
22
|
+
.catch((error : AxiosError) => {
|
|
22
23
|
reject(error);
|
|
23
24
|
});
|
|
24
25
|
});
|
|
@@ -29,7 +30,7 @@ const createRoleTemplate = (data: object, token: string): Promise<object> => {
|
|
|
29
30
|
* @param {String} id The id of the template to be deleted
|
|
30
31
|
* @param {String} comments The comments included with the deletion
|
|
31
32
|
* @param {String} token Authorization token
|
|
32
|
-
* @returns {Promise<
|
|
33
|
+
* @returns {Promise<object>}
|
|
33
34
|
*/
|
|
34
35
|
const deleteRoleTemplate = (
|
|
35
36
|
id: string,
|
|
@@ -46,10 +47,10 @@ const deleteRoleTemplate = (
|
|
|
46
47
|
data: data,
|
|
47
48
|
});
|
|
48
49
|
request
|
|
49
|
-
.then((response) => {
|
|
50
|
+
.then((response : AxiosResponse) => {
|
|
50
51
|
resolve(response.data);
|
|
51
52
|
})
|
|
52
|
-
.catch((error) => {
|
|
53
|
+
.catch((error : AxiosError) => {
|
|
53
54
|
reject(error);
|
|
54
55
|
});
|
|
55
56
|
});
|
|
@@ -59,7 +60,7 @@ const deleteRoleTemplate = (
|
|
|
59
60
|
* Discard the role template draft changes
|
|
60
61
|
* @param {String} id The id of the role template to be deleted
|
|
61
62
|
* @param {String} token Authorization token
|
|
62
|
-
* @returns {Promise<
|
|
63
|
+
* @returns {Promise<object>}
|
|
63
64
|
*/
|
|
64
65
|
const discardRoleTemplateChanges = (
|
|
65
66
|
id: string,
|
|
@@ -72,10 +73,10 @@ const discardRoleTemplateChanges = (
|
|
|
72
73
|
data: data,
|
|
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
|
});
|
|
@@ -86,7 +87,7 @@ const discardRoleTemplateChanges = (
|
|
|
86
87
|
* @param {String} id The id of the template
|
|
87
88
|
* @param {String} version The version of the template
|
|
88
89
|
* @param {String} token Authorization token
|
|
89
|
-
* @returns {Promise<
|
|
90
|
+
* @returns {Promise<object>}
|
|
90
91
|
*/
|
|
91
92
|
const getRoleTemplateInformationById = (
|
|
92
93
|
id: string,
|
|
@@ -94,17 +95,17 @@ const getRoleTemplateInformationById = (
|
|
|
94
95
|
token: string
|
|
95
96
|
): Promise<object> => {
|
|
96
97
|
return new Promise((resolve, reject) => {
|
|
97
|
-
|
|
98
|
+
const confirmationRequest = client.get(
|
|
98
99
|
`api/v1/roletemplates/${id}/${version}`,
|
|
99
100
|
{
|
|
100
101
|
headers: { authorization: token },
|
|
101
102
|
}
|
|
102
103
|
);
|
|
103
104
|
confirmationRequest
|
|
104
|
-
.then((response) => {
|
|
105
|
+
.then((response : AxiosResponse) => {
|
|
105
106
|
resolve(response.data);
|
|
106
107
|
})
|
|
107
|
-
.catch((error) => {
|
|
108
|
+
.catch((error : AxiosError) => {
|
|
108
109
|
reject(error);
|
|
109
110
|
});
|
|
110
111
|
});
|
|
@@ -117,7 +118,7 @@ const getRoleTemplateInformationById = (
|
|
|
117
118
|
* @param {Boolean} includeDeleted When true it will return the deleted records as well
|
|
118
119
|
* @param {Boolean} namesOnly When true it will return only the names of the templates
|
|
119
120
|
* @param {String} token Authorization token
|
|
120
|
-
* @returns {Promise<
|
|
121
|
+
* @returns {Promise<object>}
|
|
121
122
|
*/
|
|
122
123
|
const getRoleTemplateList = (
|
|
123
124
|
filter: string[],
|
|
@@ -133,14 +134,14 @@ const getRoleTemplateList = (
|
|
|
133
134
|
version: version,
|
|
134
135
|
};
|
|
135
136
|
if (filter) requestData.filter = filter;
|
|
136
|
-
|
|
137
|
+
const confirmationRequest = client.post(`api/v1/roletemplates`, requestData, {
|
|
137
138
|
headers: { authorization: token },
|
|
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
|
});
|
|
@@ -151,7 +152,7 @@ const getRoleTemplateList = (
|
|
|
151
152
|
* @param {number} id The id of the template to be published
|
|
152
153
|
* @param {String} comments The comments to be include with the request
|
|
153
154
|
* @param {String} token Authorization token
|
|
154
|
-
* @returns {Promise<
|
|
155
|
+
* @returns {Promise<object>}
|
|
155
156
|
*/
|
|
156
157
|
const publishTemplate = (
|
|
157
158
|
id: number,
|
|
@@ -159,9 +160,9 @@ const publishTemplate = (
|
|
|
159
160
|
token: string
|
|
160
161
|
): Promise<object> => {
|
|
161
162
|
return new Promise((resolve, reject) => {
|
|
162
|
-
|
|
163
|
+
const data: { comments?: string } = {};
|
|
163
164
|
if (comments) data.comments = comments;
|
|
164
|
-
|
|
165
|
+
const confirmationRequest = client.post(
|
|
165
166
|
`api/v1/roletemplates/publish/${id}`,
|
|
166
167
|
data,
|
|
167
168
|
{
|
|
@@ -169,10 +170,10 @@ const publishTemplate = (
|
|
|
169
170
|
}
|
|
170
171
|
);
|
|
171
172
|
confirmationRequest
|
|
172
|
-
.then((response) => {
|
|
173
|
+
.then((response : AxiosResponse) => {
|
|
173
174
|
resolve(response.data);
|
|
174
175
|
})
|
|
175
|
-
.catch((error) => {
|
|
176
|
+
.catch((error : AxiosError) => {
|
|
176
177
|
reject(error);
|
|
177
178
|
});
|
|
178
179
|
});
|
|
@@ -183,7 +184,7 @@ const publishTemplate = (
|
|
|
183
184
|
* @param {String} id The id of the template to be updated
|
|
184
185
|
* @param {Object} data Data used to update the template
|
|
185
186
|
* @param {String} token Authorization token
|
|
186
|
-
* @returns {Promise<
|
|
187
|
+
* @returns {Promise<object>}
|
|
187
188
|
*/
|
|
188
189
|
const setTemplateInformation = (
|
|
189
190
|
id: string,
|
|
@@ -195,7 +196,7 @@ const setTemplateInformation = (
|
|
|
195
196
|
data: data,
|
|
196
197
|
id: id,
|
|
197
198
|
};
|
|
198
|
-
|
|
199
|
+
const confirmationRequest = client.post(
|
|
199
200
|
`api/v1/roletemplates/update`,
|
|
200
201
|
requestData,
|
|
201
202
|
{
|
|
@@ -203,10 +204,10 @@ const setTemplateInformation = (
|
|
|
203
204
|
}
|
|
204
205
|
);
|
|
205
206
|
confirmationRequest
|
|
206
|
-
.then((response) => {
|
|
207
|
+
.then((response : AxiosResponse) => {
|
|
207
208
|
resolve(response.data);
|
|
208
209
|
})
|
|
209
|
-
.catch((error) => {
|
|
210
|
+
.catch((error : AxiosError) => {
|
|
210
211
|
reject(error);
|
|
211
212
|
});
|
|
212
213
|
});
|
|
@@ -217,7 +218,7 @@ const setTemplateInformation = (
|
|
|
217
218
|
* @param {String} id The id of the template to be updated
|
|
218
219
|
* @param {Object} tags Updated template tags
|
|
219
220
|
* @param {String} token Authorization token
|
|
220
|
-
* @returns {Promise<
|
|
221
|
+
* @returns {Promise<object>}
|
|
221
222
|
*/
|
|
222
223
|
const setTemplateTags = (
|
|
223
224
|
id: string,
|
|
@@ -229,7 +230,7 @@ const setTemplateTags = (
|
|
|
229
230
|
tags: tags,
|
|
230
231
|
id: id,
|
|
231
232
|
};
|
|
232
|
-
|
|
233
|
+
const confirmationRequest = client.post(
|
|
233
234
|
`api/v1/roletemplates/updatetags/`,
|
|
234
235
|
requestData,
|
|
235
236
|
{
|
|
@@ -237,10 +238,10 @@ const setTemplateTags = (
|
|
|
237
238
|
}
|
|
238
239
|
);
|
|
239
240
|
confirmationRequest
|
|
240
|
-
.then((response) => {
|
|
241
|
+
.then((response : AxiosResponse) => {
|
|
241
242
|
resolve(response.data);
|
|
242
243
|
})
|
|
243
|
-
.catch((error) => {
|
|
244
|
+
.catch((error : AxiosError) => {
|
|
244
245
|
reject(error);
|
|
245
246
|
});
|
|
246
247
|
});
|
|
@@ -251,7 +252,7 @@ const setTemplateTags = (
|
|
|
251
252
|
* @param {String} id The id of the skill to be updated
|
|
252
253
|
* @param {Boolean} watch Set to true or false
|
|
253
254
|
* @param {String} token Authorization token
|
|
254
|
-
* @returns {Promise<
|
|
255
|
+
* @returns {Promise<object>}
|
|
255
256
|
*/
|
|
256
257
|
const watchRoleTemplate = (
|
|
257
258
|
id: string,
|
|
@@ -263,7 +264,7 @@ const watchRoleTemplate = (
|
|
|
263
264
|
id: id,
|
|
264
265
|
watch: watch,
|
|
265
266
|
};
|
|
266
|
-
|
|
267
|
+
const confirmationRequest = client.post(
|
|
267
268
|
`api/v1/roletemplates/watch`,
|
|
268
269
|
requestData,
|
|
269
270
|
{
|
|
@@ -271,10 +272,10 @@ const watchRoleTemplate = (
|
|
|
271
272
|
}
|
|
272
273
|
);
|
|
273
274
|
confirmationRequest
|
|
274
|
-
.then((response) => {
|
|
275
|
+
.then((response : AxiosResponse) => {
|
|
275
276
|
resolve(response.data);
|
|
276
277
|
})
|
|
277
|
-
.catch((error) => {
|
|
278
|
+
.catch((error : AxiosError) => {
|
|
278
279
|
reject(error);
|
|
279
280
|
});
|
|
280
281
|
});
|