@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.
- 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 -77
- 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 +10 -9
- package/src/lib/address.ts +4 -3
- package/src/lib/aiAssistant.ts +24 -23
- package/src/lib/avatar.ts +3 -2
- package/src/lib/axiosClient.ts +20 -7
- package/src/lib/config.ts +10 -9
- package/src/lib/dashboard.ts +10 -9
- package/src/lib/departmentTrainingPlans.ts +28 -31
- package/src/lib/groups.ts +37 -36
- package/src/lib/integration.ts +55 -54
- package/src/lib/integrationConfiguration.ts +14 -13
- package/src/lib/integrations/contentGenerator.ts +9 -8
- package/src/lib/learningContent.ts +55 -54
- package/src/lib/learningPath.ts +31 -30
- package/src/lib/logger.ts +8 -7
- package/src/lib/microSkillsQuizes.ts +10 -9
- package/src/lib/quotas.ts +9 -8
- package/src/lib/role.ts +55 -54
- package/src/lib/roleTemplate.ts +36 -35
- package/src/lib/security.ts +13 -12
- package/src/lib/skill.ts +71 -70
- package/src/lib/skillAssessmentTestingSession.ts +24 -23
- package/src/lib/skillAssessments.ts +24 -23
- package/src/lib/skillTemplate.ts +44 -43
- package/src/lib/talentTransfromation.ts +14 -13
- package/src/lib/teams.ts +34 -33
- package/src/lib/tenants.ts +9 -8
- package/src/lib/trainingPlans.ts +36 -35
- package/src/lib/trainingPlansProficiencyLevels.ts +13 -12
- package/src/lib/userInformation.ts +12 -11
- package/src/lib/users.ts +71 -71
- 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/logger.ts
CHANGED
|
@@ -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 {String} elementType
|
|
7
8
|
* @param {Object} data
|
|
8
9
|
* @param {String} token Authorization token
|
|
9
|
-
* @returns {Promise<
|
|
10
|
+
* @returns {Promise<object>}
|
|
10
11
|
*/
|
|
11
12
|
const comments = (
|
|
12
13
|
elementId: string,
|
|
@@ -15,7 +16,7 @@ const comments = (
|
|
|
15
16
|
token: string
|
|
16
17
|
): Promise<object> => {
|
|
17
18
|
return new Promise((resolve, reject) => {
|
|
18
|
-
|
|
19
|
+
const confirmationRequest = client.post(
|
|
19
20
|
"api/v1/logger/comments/",
|
|
20
21
|
{
|
|
21
22
|
data: data,
|
|
@@ -27,10 +28,10 @@ const comments = (
|
|
|
27
28
|
}
|
|
28
29
|
);
|
|
29
30
|
confirmationRequest
|
|
30
|
-
.then((response) => {
|
|
31
|
+
.then((response : AxiosResponse) => {
|
|
31
32
|
resolve(response.data);
|
|
32
33
|
})
|
|
33
|
-
.catch((error) => {
|
|
34
|
+
.catch((error : AxiosError) => {
|
|
34
35
|
reject(error);
|
|
35
36
|
});
|
|
36
37
|
});
|
|
@@ -42,7 +43,7 @@ const comments = (
|
|
|
42
43
|
* @param {Number} page The results page
|
|
43
44
|
* @param {Number} elementsPerPage The number of elements per page
|
|
44
45
|
* @param {String} token
|
|
45
|
-
* @returns {Promise<
|
|
46
|
+
* @returns {Promise<object>}
|
|
46
47
|
*/
|
|
47
48
|
const getListByElementId = (
|
|
48
49
|
elementId: string,
|
|
@@ -51,7 +52,7 @@ const getListByElementId = (
|
|
|
51
52
|
token: string
|
|
52
53
|
): Promise<object> => {
|
|
53
54
|
return new Promise((resolve, reject) => {
|
|
54
|
-
|
|
55
|
+
const data: { elementsPerPage?: number, page?: number } = {};
|
|
55
56
|
if (elementsPerPage !== null) data.elementsPerPage = elementsPerPage;
|
|
56
57
|
if (page !== null) data.page = page;
|
|
57
58
|
const getTokensRequest = client.post(`api/v1/logger/${elementId}`, data, {
|
|
@@ -61,7 +62,7 @@ const getListByElementId = (
|
|
|
61
62
|
.then((result) => {
|
|
62
63
|
resolve(result.data);
|
|
63
64
|
})
|
|
64
|
-
.catch((error) => {
|
|
65
|
+
.catch((error : AxiosError) => {
|
|
65
66
|
reject(error);
|
|
66
67
|
});
|
|
67
68
|
});
|
|
@@ -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} learningContentId
|
|
6
7
|
* @param {String} microSkillId
|
|
7
8
|
* @param {String} token
|
|
8
|
-
* @returns {Promise<
|
|
9
|
+
* @returns {Promise<object>}
|
|
9
10
|
*/
|
|
10
11
|
const getResponses = (
|
|
11
12
|
learningContentId: string,
|
|
@@ -13,17 +14,17 @@ const getResponses = (
|
|
|
13
14
|
token: string
|
|
14
15
|
): Promise<object> => {
|
|
15
16
|
return new Promise((resolve, reject) => {
|
|
16
|
-
|
|
17
|
+
const confirmationRequest = client.get(
|
|
17
18
|
`api/v1/microskillsresponses/${learningContentId}/${microSkillId}`,
|
|
18
19
|
{
|
|
19
20
|
headers: { authorization: token },
|
|
20
21
|
}
|
|
21
22
|
);
|
|
22
23
|
confirmationRequest
|
|
23
|
-
.then((response) => {
|
|
24
|
+
.then((response : AxiosResponse) => {
|
|
24
25
|
resolve(response.data);
|
|
25
26
|
})
|
|
26
|
-
.catch((error) => {
|
|
27
|
+
.catch((error : AxiosError) => {
|
|
27
28
|
reject(error);
|
|
28
29
|
});
|
|
29
30
|
});
|
|
@@ -35,7 +36,7 @@ const getResponses = (
|
|
|
35
36
|
* @param {String} microSkillId
|
|
36
37
|
* @param {Array<Object>} responses
|
|
37
38
|
* @param {String} token Authorization token
|
|
38
|
-
* @returns {Promise<
|
|
39
|
+
* @returns {Promise<object>}
|
|
39
40
|
*/
|
|
40
41
|
const saveResponses = (
|
|
41
42
|
learningContentId: string,
|
|
@@ -44,10 +45,10 @@ const saveResponses = (
|
|
|
44
45
|
token: string
|
|
45
46
|
): Promise<object> => {
|
|
46
47
|
return new Promise((resolve, reject) => {
|
|
47
|
-
|
|
48
|
+
const data = {
|
|
48
49
|
responses: responses,
|
|
49
50
|
};
|
|
50
|
-
|
|
51
|
+
const confirmationRequest = client.post(
|
|
51
52
|
`api/v1/microskillsresponses/${learningContentId}/${microSkillId}`,
|
|
52
53
|
data,
|
|
53
54
|
{
|
|
@@ -55,10 +56,10 @@ const saveResponses = (
|
|
|
55
56
|
}
|
|
56
57
|
);
|
|
57
58
|
confirmationRequest
|
|
58
|
-
.then((response) => {
|
|
59
|
+
.then((response : AxiosResponse) => {
|
|
59
60
|
resolve(response.data);
|
|
60
61
|
})
|
|
61
|
-
.catch((error) => {
|
|
62
|
+
.catch((error : AxiosError) => {
|
|
62
63
|
reject(error);
|
|
63
64
|
});
|
|
64
65
|
});
|
package/src/lib/quotas.ts
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
+
import { AxiosError, AxiosResponse } from "axios";
|
|
1
2
|
import { client } from "./axiosClient";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Get the current quota for the user and tenant
|
|
5
6
|
* @param {String} token
|
|
6
|
-
* @returns {Promise<
|
|
7
|
+
* @returns {Promise<object>}
|
|
7
8
|
*/
|
|
8
9
|
const getAllQuota = (token: string): Promise<object> => {
|
|
9
10
|
return new Promise((resolve, reject) => {
|
|
10
|
-
|
|
11
|
+
const confirmationRequest = client.get(`/api/v1/quotas/getallquota`, {
|
|
11
12
|
headers: { authorization: token },
|
|
12
13
|
});
|
|
13
14
|
confirmationRequest
|
|
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
|
});
|
|
@@ -25,7 +26,7 @@ const getAllQuota = (token: string): Promise<object> => {
|
|
|
25
26
|
* @param {String} quotaId
|
|
26
27
|
* @param {Number} value
|
|
27
28
|
* @param {String} token
|
|
28
|
-
* @returns {Promise<
|
|
29
|
+
* @returns {Promise<object>}
|
|
29
30
|
*/
|
|
30
31
|
const increaseQuotaUtilization = (
|
|
31
32
|
quotaId: string,
|
|
@@ -33,7 +34,7 @@ const increaseQuotaUtilization = (
|
|
|
33
34
|
token: string
|
|
34
35
|
): Promise<object> => {
|
|
35
36
|
return new Promise((resolve, reject) => {
|
|
36
|
-
|
|
37
|
+
const confirmationRequest = client.post(
|
|
37
38
|
`/api/v1/quotas/increaseutilization`,
|
|
38
39
|
{
|
|
39
40
|
id: quotaId,
|
|
@@ -44,10 +45,10 @@ const increaseQuotaUtilization = (
|
|
|
44
45
|
}
|
|
45
46
|
);
|
|
46
47
|
confirmationRequest
|
|
47
|
-
.then((response) => {
|
|
48
|
+
.then((response : AxiosResponse) => {
|
|
48
49
|
resolve(response.data);
|
|
49
50
|
})
|
|
50
|
-
.catch((error) => {
|
|
51
|
+
.catch((error : AxiosError) => {
|
|
51
52
|
reject(error);
|
|
52
53
|
});
|
|
53
54
|
});
|
package/src/lib/role.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import { AxiosError, AxiosResponse } from "axios";
|
|
1
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
|
});
|