@stackfactor/client-api 1.1.128 → 1.1.130
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/exports.ts +85 -0
- package/index.ts +1 -0
- package/lib/{actionNotifications.js → actionNotifications.ts} +18 -6
- package/lib/{address.js → address.ts} +3 -2
- package/lib/{aiAssistant.js → aiAssistant.ts} +58 -25
- package/lib/{avatar.js → avatar.ts} +10 -4
- package/lib/axiosClient.ts +92 -0
- package/lib/{config.js → config.ts} +19 -6
- package/lib/{constants.js → constants.ts} +6 -41
- package/lib/{dashboard.js → dashboard.ts} +17 -7
- package/lib/{departmentTrainingPlans.js → departmentTrainingPlans.ts} +57 -23
- package/lib/{groups.js → groups.ts} +67 -26
- package/lib/{integration.js → integration.ts} +100 -43
- package/lib/{integrationConfiguration.js → integrationConfiguration.ts} +25 -8
- package/lib/integrations/{contentGenerator.js → contentGenerator.ts} +38 -18
- package/lib/{learningContent.js → learningContent.ts} +127 -66
- package/lib/{learningPath.js → learningPath.ts} +56 -29
- package/lib/{logger.js → logger.ts} +17 -5
- package/lib/{microSkillsQuizes.js → microSkillsQuizes.ts} +15 -6
- package/lib/{quotas.js → quotas.ts} +10 -5
- package/lib/{role.js → role.ts} +114 -66
- package/lib/{roleTemplate.js → roleTemplate.ts} +63 -28
- package/lib/{security.js → security.ts} +14 -10
- package/lib/{skill.js → skill.ts} +119 -82
- package/lib/{skillAssessments.js → skillAssessmentTestingSession.ts} +39 -17
- package/lib/skillAssessments.ts +192 -0
- package/lib/{skillTemplate.js → skillTemplate.ts} +70 -39
- package/lib/{talentTransfromation.js → talentTransfromation.ts} +21 -15
- package/lib/{teams.js → teams.ts} +71 -27
- package/lib/{tenants.js → tenants.ts} +16 -7
- package/lib/{trainingPlans.js → trainingPlans.ts} +96 -59
- package/lib/{trainingPlansProficiencyLevels.js → trainingPlansProficiencyLevels.ts} +29 -23
- package/lib/{userInformation.js → userInformation.ts} +25 -12
- package/lib/{users.js → users.ts} +172 -154
- package/lib/{utils.js → utils.ts} +6 -6
- package/package.json +8 -6
- package/exports.js +0 -85
- package/index.js +0 -1
- package/lib/axiosClient.js +0 -82
- package/lib/skillAssessmentTestingSession.js +0 -147
package/exports.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import actionNotifications from "./lib/actionNotifications.ts";
|
|
2
|
+
import {
|
|
3
|
+
client,
|
|
4
|
+
errorToString,
|
|
5
|
+
getErrorInformation,
|
|
6
|
+
getErrorType,
|
|
7
|
+
shouldReturnError,
|
|
8
|
+
} from "./lib/axiosClient.ts";
|
|
9
|
+
import aiAssistant from "./lib/aiAssistant.ts";
|
|
10
|
+
import avatar from "./lib/avatar.ts";
|
|
11
|
+
import address from "./lib/address.ts";
|
|
12
|
+
import config from "./lib/config.ts";
|
|
13
|
+
import {
|
|
14
|
+
DOCUMENT_VERSION,
|
|
15
|
+
PERMISSIONS,
|
|
16
|
+
PERMISSION_DESCRIPTIONS,
|
|
17
|
+
RESPONSE_TYPE,
|
|
18
|
+
} from "./lib/constants.ts";
|
|
19
|
+
import contentGenerator from "./lib/integrations/contentGenerator.ts";
|
|
20
|
+
import dashboard from "./lib/dashboard.ts";
|
|
21
|
+
import departmentTraingPlans from "./lib/departmentTrainingPlans.ts";
|
|
22
|
+
import integration from "./lib/integration.ts";
|
|
23
|
+
import integrationConfiguration from "./lib/integrationConfiguration.ts";
|
|
24
|
+
import groups from "./lib/groups.ts";
|
|
25
|
+
import learningContent from "./lib/learningContent.ts";
|
|
26
|
+
import learningPath from "./lib/learningPath.ts";
|
|
27
|
+
import logger from "./lib/logger.ts";
|
|
28
|
+
import microSkillsQuizes from "./lib/microSkillsQuizes.ts";
|
|
29
|
+
import quotas from "./lib/quotas.ts";
|
|
30
|
+
import role from "./lib/role.ts";
|
|
31
|
+
import roleTemplate from "./lib/roleTemplate.ts";
|
|
32
|
+
import security from "./lib/security.ts";
|
|
33
|
+
import skill from "./lib/skill.ts";
|
|
34
|
+
import skillAssessment from "./lib/skillAssessments.ts";
|
|
35
|
+
import skillAssessmentTestingSession from "./lib/skillAssessmentTestingSession.ts";
|
|
36
|
+
import skillTemplate from "./lib/skillTemplate.ts";
|
|
37
|
+
import talentTransfromation from "./lib/talentTransfromation.ts";
|
|
38
|
+
import team from "./lib/teams.ts";
|
|
39
|
+
import tenant from "./lib/tenants.ts";
|
|
40
|
+
import trainingPlan from "./lib/trainingPlans.ts";
|
|
41
|
+
import trainingPlanProficiencyLevel from "./lib/trainingPlansProficiencyLevels.ts";
|
|
42
|
+
import userInformation from "./lib/userInformation.ts";
|
|
43
|
+
import users from "./lib/users.ts";
|
|
44
|
+
|
|
45
|
+
export {
|
|
46
|
+
actionNotifications,
|
|
47
|
+
address,
|
|
48
|
+
aiAssistant,
|
|
49
|
+
avatar,
|
|
50
|
+
client,
|
|
51
|
+
config,
|
|
52
|
+
contentGenerator,
|
|
53
|
+
dashboard,
|
|
54
|
+
errorToString,
|
|
55
|
+
getErrorInformation,
|
|
56
|
+
getErrorType,
|
|
57
|
+
DOCUMENT_VERSION,
|
|
58
|
+
integration,
|
|
59
|
+
integrationConfiguration,
|
|
60
|
+
departmentTraingPlans,
|
|
61
|
+
groups,
|
|
62
|
+
learningContent,
|
|
63
|
+
learningPath,
|
|
64
|
+
logger,
|
|
65
|
+
microSkillsQuizes,
|
|
66
|
+
PERMISSIONS,
|
|
67
|
+
PERMISSION_DESCRIPTIONS,
|
|
68
|
+
quotas,
|
|
69
|
+
RESPONSE_TYPE,
|
|
70
|
+
role,
|
|
71
|
+
roleTemplate,
|
|
72
|
+
security,
|
|
73
|
+
shouldReturnError,
|
|
74
|
+
skill,
|
|
75
|
+
skillAssessment,
|
|
76
|
+
skillAssessmentTestingSession,
|
|
77
|
+
skillTemplate,
|
|
78
|
+
talentTransfromation,
|
|
79
|
+
team,
|
|
80
|
+
tenant,
|
|
81
|
+
trainingPlan,
|
|
82
|
+
trainingPlanProficiencyLevel,
|
|
83
|
+
userInformation,
|
|
84
|
+
users,
|
|
85
|
+
};
|
package/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./exports.ts";
|
|
@@ -3,9 +3,10 @@ import { client } from "./axiosClient.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* Get all permissions
|
|
5
5
|
* @param {String} token The authentication token
|
|
6
|
+
* @returns {Promise<Object>}
|
|
6
7
|
*/
|
|
7
|
-
const getAllUserNotifications = (token) => {
|
|
8
|
-
return new Promise(
|
|
8
|
+
const getAllUserNotifications = (token: string): Promise<object> => {
|
|
9
|
+
return new Promise((resolve, reject) => {
|
|
9
10
|
const request = client.get(`api/v1/actionnotifications`, {
|
|
10
11
|
headers: { authorization: token },
|
|
11
12
|
});
|
|
@@ -24,9 +25,14 @@ const getAllUserNotifications = (token) => {
|
|
|
24
25
|
* @param {Array<String>} ids The id of the notifications to be marked
|
|
25
26
|
* @param {String} status The new status
|
|
26
27
|
* @param {String} authToken The authentication token
|
|
28
|
+
* @returns {Promise<Object>}
|
|
27
29
|
*/
|
|
28
|
-
const markNotifications = (
|
|
29
|
-
|
|
30
|
+
const markNotifications = (
|
|
31
|
+
ids: string[],
|
|
32
|
+
status: string,
|
|
33
|
+
authToken: string
|
|
34
|
+
): Promise<object> => {
|
|
35
|
+
return new Promise((resolve, reject) => {
|
|
30
36
|
const request = client.put(
|
|
31
37
|
`api/v1/actionnotifications/mark`,
|
|
32
38
|
{
|
|
@@ -51,9 +57,15 @@ const markNotifications = (ids, status, authToken) => {
|
|
|
51
57
|
* @param {String} action The action to be executed
|
|
52
58
|
* @param {String} comments The comments to be saved in the notification
|
|
53
59
|
* @param {String} authToken The authentication token
|
|
60
|
+
* @returns {Promise<Object>}
|
|
54
61
|
*/
|
|
55
|
-
const processNotification = (
|
|
56
|
-
|
|
62
|
+
const processNotification = (
|
|
63
|
+
id: string,
|
|
64
|
+
action: string,
|
|
65
|
+
comments: string,
|
|
66
|
+
authToken: string
|
|
67
|
+
): Promise<object> => {
|
|
68
|
+
return new Promise((resolve, reject) => {
|
|
57
69
|
const request = client.put(
|
|
58
70
|
`api/v1/actionnotifications/process`,
|
|
59
71
|
{
|
|
@@ -4,9 +4,10 @@ import { client } from "./axiosClient.js";
|
|
|
4
4
|
* Validate Address
|
|
5
5
|
* @param {String} input - the address in raw format
|
|
6
6
|
* @param {String} authToken - Authorization token
|
|
7
|
+
* @returns {Promise<Object>}
|
|
7
8
|
*/
|
|
8
|
-
const autoComplete = (input, authToken) => {
|
|
9
|
-
return new Promise(
|
|
9
|
+
const autoComplete = (input: string, authToken: string): Promise<object> => {
|
|
10
|
+
return new Promise((resolve, reject) => {
|
|
10
11
|
const getAddressesRequest = client.post(
|
|
11
12
|
`api/v1/address/autocomplete/`,
|
|
12
13
|
{ input: input },
|
|
@@ -1,16 +1,40 @@
|
|
|
1
1
|
import { client } from "./axiosClient.js";
|
|
2
2
|
|
|
3
|
+
interface AskQuestionData {
|
|
4
|
+
conversationId: string;
|
|
5
|
+
question: string;
|
|
6
|
+
updatedContext: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface EndConversationData {
|
|
10
|
+
conversationId: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface StartConversationData {
|
|
14
|
+
autoContextRefresh: boolean;
|
|
15
|
+
context: string;
|
|
16
|
+
question: string;
|
|
17
|
+
elementId: string;
|
|
18
|
+
elementType: string;
|
|
19
|
+
conversationId?: string | null;
|
|
20
|
+
}
|
|
21
|
+
|
|
3
22
|
/**
|
|
4
23
|
* Ask Question to the AI
|
|
5
24
|
* @param {String} conversationId
|
|
6
25
|
* @param {String} question
|
|
7
26
|
* @param {String} updatedContext
|
|
8
27
|
* @param {String} token Authorization token
|
|
9
|
-
* @returns {Promise}
|
|
28
|
+
* @returns {Promise<Object>}
|
|
10
29
|
*/
|
|
11
|
-
const askQuestion = (
|
|
12
|
-
|
|
13
|
-
|
|
30
|
+
const askQuestion = (
|
|
31
|
+
conversationId: string,
|
|
32
|
+
question: string,
|
|
33
|
+
updatedContext: string,
|
|
34
|
+
token: string
|
|
35
|
+
): Promise<object> => {
|
|
36
|
+
return new Promise((resolve, reject) => {
|
|
37
|
+
let data: AskQuestionData = {
|
|
14
38
|
conversationId: conversationId,
|
|
15
39
|
question: question,
|
|
16
40
|
updatedContext: updatedContext,
|
|
@@ -36,11 +60,14 @@ const askQuestion = (conversationId, question, updatedContext, token) => {
|
|
|
36
60
|
* End conversation with the AI
|
|
37
61
|
* @param {String} conversationId
|
|
38
62
|
* @param {String} token Authorization token
|
|
39
|
-
* @returns {Promise}
|
|
63
|
+
* @returns {Promise<Object>}
|
|
40
64
|
*/
|
|
41
|
-
const endConversation = (
|
|
42
|
-
|
|
43
|
-
|
|
65
|
+
const endConversation = (
|
|
66
|
+
conversationId: string,
|
|
67
|
+
token: string
|
|
68
|
+
): Promise<object> => {
|
|
69
|
+
return new Promise((resolve, reject) => {
|
|
70
|
+
let data: EndConversationData = {
|
|
44
71
|
conversationId: conversationId,
|
|
45
72
|
};
|
|
46
73
|
let confirmationRequest = client.post(
|
|
@@ -64,10 +91,13 @@ const endConversation = (conversationId, token) => {
|
|
|
64
91
|
* Get conversation by elementId
|
|
65
92
|
* @param {String} elementId
|
|
66
93
|
* @param {String} token
|
|
67
|
-
* @returns {Promise}
|
|
94
|
+
* @returns {Promise<Object>}
|
|
68
95
|
*/
|
|
69
|
-
const getConversationByElementId = (
|
|
70
|
-
|
|
96
|
+
const getConversationByElementId = (
|
|
97
|
+
elementId: string,
|
|
98
|
+
token: string
|
|
99
|
+
): Promise<object> => {
|
|
100
|
+
return new Promise((resolve, reject) => {
|
|
71
101
|
let confirmationRequest = client.get(
|
|
72
102
|
`/api/v1/aiassistant/getconversation/${elementId}`,
|
|
73
103
|
{
|
|
@@ -88,10 +118,13 @@ const getConversationByElementId = (elementId, token) => {
|
|
|
88
118
|
* Get the voice assistant URL
|
|
89
119
|
* @param {String} language
|
|
90
120
|
* @param {String} token
|
|
91
|
-
* @returns {Promise}
|
|
121
|
+
* @returns {Promise<Object>}
|
|
92
122
|
*/
|
|
93
|
-
const getVoiceAssistantUrl = (
|
|
94
|
-
|
|
123
|
+
const getVoiceAssistantUrl = (
|
|
124
|
+
language: string,
|
|
125
|
+
token: string
|
|
126
|
+
): Promise<object> => {
|
|
127
|
+
return new Promise((resolve, reject) => {
|
|
95
128
|
let confirmationRequest = client.get(
|
|
96
129
|
`/api/v1/aiassistant/getvoiceassistanturl/${language}`,
|
|
97
130
|
{
|
|
@@ -116,19 +149,19 @@ const getVoiceAssistantUrl = (language, token) => {
|
|
|
116
149
|
* @param {Boolean} autoContextRefresh
|
|
117
150
|
* @param {String} token
|
|
118
151
|
* @param {String} conversationId Optional
|
|
119
|
-
* @returns {Promise}
|
|
152
|
+
* @returns {Promise<Object>}
|
|
120
153
|
*/
|
|
121
154
|
const startConversation = (
|
|
122
|
-
elementId,
|
|
123
|
-
elementType,
|
|
124
|
-
question,
|
|
125
|
-
context,
|
|
126
|
-
autoContextRefresh,
|
|
127
|
-
token,
|
|
128
|
-
conversationId = null
|
|
129
|
-
) => {
|
|
130
|
-
return new Promise(
|
|
131
|
-
let data = {
|
|
155
|
+
elementId: string,
|
|
156
|
+
elementType: string,
|
|
157
|
+
question: string,
|
|
158
|
+
context: string,
|
|
159
|
+
autoContextRefresh: boolean,
|
|
160
|
+
token: string,
|
|
161
|
+
conversationId: string | null = null
|
|
162
|
+
): Promise<object> => {
|
|
163
|
+
return new Promise((resolve, reject) => {
|
|
164
|
+
let data: StartConversationData = {
|
|
132
165
|
autoContextRefresh: autoContextRefresh,
|
|
133
166
|
context: context,
|
|
134
167
|
question: question,
|
|
@@ -7,10 +7,16 @@ import { client } from "./axiosClient.js";
|
|
|
7
7
|
* @param {Number} width
|
|
8
8
|
* @param {Number} height
|
|
9
9
|
* @param {String} token
|
|
10
|
-
* @returns {Promise}
|
|
10
|
+
* @returns {Promise<Blob>}
|
|
11
11
|
*/
|
|
12
|
-
const getAvatar = (
|
|
13
|
-
|
|
12
|
+
const getAvatar = (
|
|
13
|
+
elementId: string,
|
|
14
|
+
type: string,
|
|
15
|
+
width: number,
|
|
16
|
+
height: number,
|
|
17
|
+
token: string
|
|
18
|
+
): Promise<Blob> => {
|
|
19
|
+
return new Promise((resolve, reject) => {
|
|
14
20
|
let confirmationRequest = client.get(
|
|
15
21
|
`/api/v1/avatar/getavatar/${elementId}/${type}/${width}/${height}`,
|
|
16
22
|
{
|
|
@@ -22,7 +28,7 @@ const getAvatar = (elementId, type, width, height, token) => {
|
|
|
22
28
|
);
|
|
23
29
|
confirmationRequest
|
|
24
30
|
.then((response) => {
|
|
25
|
-
resolve(response);
|
|
31
|
+
resolve(response.data);
|
|
26
32
|
})
|
|
27
33
|
.catch(() => {
|
|
28
34
|
reject("Error getting avatar");
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import axios, { AxiosError } from "axios";
|
|
2
|
+
import { RESPONSE_TYPE } from "./constants.ts";
|
|
3
|
+
import utils from "./utils.ts";
|
|
4
|
+
|
|
5
|
+
const baseUrl = utils.getBaseUrl();
|
|
6
|
+
|
|
7
|
+
const client = axios.create({
|
|
8
|
+
baseURL: baseUrl,
|
|
9
|
+
withCredentials: true,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Returns the error as a string
|
|
14
|
+
* @param {AxiosError} error
|
|
15
|
+
* @returns {string}
|
|
16
|
+
*/
|
|
17
|
+
const errorToString = (error: AxiosError): string => {
|
|
18
|
+
if (error != null) {
|
|
19
|
+
if (error.response?.data) {
|
|
20
|
+
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) => {
|
|
24
|
+
asString += `${index > 0 ? ", " : ""} ${item.msg} param ${
|
|
25
|
+
item.param
|
|
26
|
+
} ${item.value ? `value ${item.value.toString()}` : ""}`;
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
return asString;
|
|
30
|
+
} else if ((error.response.data as any).error) {
|
|
31
|
+
return (error.response.data as any).error.toString();
|
|
32
|
+
} else if (error.response.statusText) {
|
|
33
|
+
return error.response.statusText.toString();
|
|
34
|
+
} else {
|
|
35
|
+
return (error.response.data as any).toString();
|
|
36
|
+
}
|
|
37
|
+
} else {
|
|
38
|
+
return error.message ? error.message : "Unknown error";
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return "Unknown error";
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Returns the code of the error as a number
|
|
46
|
+
* @param {AxiosError} error
|
|
47
|
+
* @returns {number} The error code
|
|
48
|
+
*/
|
|
49
|
+
const getErrorType = (error: AxiosError): number => {
|
|
50
|
+
if (error.response?.status) {
|
|
51
|
+
return error.response.status;
|
|
52
|
+
} else return RESPONSE_TYPE.SERVICE_UNAVAILABLE;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Return the error information to include just the status and the message
|
|
57
|
+
* @param {AxiosError} error
|
|
58
|
+
* @returns {Object}
|
|
59
|
+
*/
|
|
60
|
+
const getErrorInformation = (
|
|
61
|
+
error: AxiosError
|
|
62
|
+
): { status: number; message: string } => {
|
|
63
|
+
return {
|
|
64
|
+
status: getErrorType(error),
|
|
65
|
+
message: errorToString(error),
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Returns true if an exception should be handled to the business and presentation layer
|
|
71
|
+
* @param {boolean} returnAllExceptions - If set true all exceptions will be passed
|
|
72
|
+
* @param {AxiosError} error - The error returned by the server
|
|
73
|
+
* @returns {boolean}
|
|
74
|
+
*/
|
|
75
|
+
const shouldReturnError = (
|
|
76
|
+
returnAllExceptions: boolean,
|
|
77
|
+
error: AxiosError
|
|
78
|
+
): boolean => {
|
|
79
|
+
if (getErrorType(error) === RESPONSE_TYPE.UNAUTHORIZED) {
|
|
80
|
+
return returnAllExceptions;
|
|
81
|
+
} else {
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export {
|
|
87
|
+
client,
|
|
88
|
+
errorToString,
|
|
89
|
+
getErrorType,
|
|
90
|
+
getErrorInformation,
|
|
91
|
+
shouldReturnError,
|
|
92
|
+
};
|
|
@@ -4,9 +4,13 @@ import { client } from "./axiosClient.js";
|
|
|
4
4
|
* Get the specified configuration by Id. It returns a promise
|
|
5
5
|
* @param {String} id - the id of the configuration element
|
|
6
6
|
* @param {String} authToken - Authorization token
|
|
7
|
+
* @returns {Promise<Object>}
|
|
7
8
|
*/
|
|
8
|
-
const getConfigurationById = (
|
|
9
|
-
|
|
9
|
+
const getConfigurationById = (
|
|
10
|
+
id: string,
|
|
11
|
+
authToken: string
|
|
12
|
+
): Promise<object> => {
|
|
13
|
+
return new Promise((resolve, reject) => {
|
|
10
14
|
const getConfigInformationRequest = client.get(
|
|
11
15
|
`api/v1/configurations/configuration/id/${id}`,
|
|
12
16
|
{ headers: { authorization: authToken } }
|
|
@@ -25,9 +29,13 @@ const getConfigurationById = (id, authToken) => {
|
|
|
25
29
|
* Get the specified configuration by type. It returns a promise
|
|
26
30
|
* @param {String} type - the id of the configuration element
|
|
27
31
|
* @param {String} authToken - Authorization token
|
|
32
|
+
* @returns {Promise<Object>}
|
|
28
33
|
*/
|
|
29
|
-
const getConfigurationByType = (
|
|
30
|
-
|
|
34
|
+
const getConfigurationByType = (
|
|
35
|
+
type: string,
|
|
36
|
+
authToken: string
|
|
37
|
+
): Promise<object> => {
|
|
38
|
+
return new Promise((resolve, reject) => {
|
|
31
39
|
const getConfigInformationRequest = client.get(
|
|
32
40
|
`api/v1/configurations/configuration/type/${type}`,
|
|
33
41
|
{ headers: { authorization: authToken } }
|
|
@@ -47,9 +55,14 @@ const getConfigurationByType = (type, authToken) => {
|
|
|
47
55
|
* @param {String} id - the id of the configuration element
|
|
48
56
|
* @param {Object} data - the object containing the updated configuration element
|
|
49
57
|
* @param {String} authToken - Authorization token
|
|
58
|
+
* @returns {Promise<Object>}
|
|
50
59
|
*/
|
|
51
|
-
const setConfigurationById = (
|
|
52
|
-
|
|
60
|
+
const setConfigurationById = (
|
|
61
|
+
id: string,
|
|
62
|
+
data: object,
|
|
63
|
+
authToken: string
|
|
64
|
+
): Promise<object> => {
|
|
65
|
+
return new Promise((resolve, reject) => {
|
|
53
66
|
const getConfigInformationRequest = client.post(
|
|
54
67
|
`api/v1/configurations/configuration/${id}`,
|
|
55
68
|
{ data: data },
|
|
@@ -1,78 +1,44 @@
|
|
|
1
1
|
const DOCUMENT_VERSION = {
|
|
2
2
|
DRAFT: "draft",
|
|
3
3
|
PUBLISHED: "published",
|
|
4
|
-
};
|
|
4
|
+
} as const;
|
|
5
5
|
|
|
6
6
|
const RESPONSE_TYPE = {
|
|
7
|
-
//The requested resource corresponds to any one of a set of representations, each with its own specific location.
|
|
8
7
|
MULTIPLE_CHOICES: 300,
|
|
9
|
-
//The resource has moved permanently. Please refer to the documentation.
|
|
10
8
|
MOVED_PERMANENTLY: 301,
|
|
11
|
-
//The resource has moved temporarily. Please refer to the documentation.
|
|
12
9
|
FOUND: 302,
|
|
13
|
-
//The resource can be found under a different URI.
|
|
14
10
|
SEE_OTHER: 303,
|
|
15
|
-
//The resource is available and not modified.
|
|
16
11
|
NOT_MODIFIED: 304,
|
|
17
|
-
//The requested resource must be accessed through the proxy given by the Location field.
|
|
18
12
|
USE_PROXY: 305,
|
|
19
|
-
//The resource resides temporarily under a different URI.
|
|
20
13
|
TEMPORARY_REDIRECT: 307,
|
|
21
|
-
//Invalid syntax for this request was provided.
|
|
22
14
|
BAD_REQUEST: 400,
|
|
23
|
-
//You are unauthorized to access the requested resource. Please log in.
|
|
24
15
|
UNAUTHORIZED: 401,
|
|
25
|
-
//Your account is not authorized to access the requested resource.
|
|
26
16
|
FORBIDDEN: 403,
|
|
27
|
-
//We could not find the resource you requested. Please refer to the documentation for the list of resources.
|
|
28
17
|
NOT_FOUND: 404,
|
|
29
|
-
//This method type is not currently supported.
|
|
30
18
|
METHOD_NOT_ALLOWED: 405,
|
|
31
|
-
//Acceptance header is invalid for this endpoint resource.
|
|
32
19
|
NOT_ACCEPTABLE: 406,
|
|
33
|
-
//Authentication with proxy is required.
|
|
34
20
|
PROXY_AUTHENTICATION_REQUIRED: 407,
|
|
35
|
-
//Client did not produce a request within the time that the server was prepared to wait.
|
|
36
21
|
REQUEST_TIMEOUT: 408,
|
|
37
|
-
//The request could not be completed due to a conflict with the current state of the resource.
|
|
38
22
|
CONFLICT: 409,
|
|
39
|
-
//The requested resource is no longer available and has been permanently removed.
|
|
40
23
|
GONE: 410,
|
|
41
|
-
//Length of the content is required, please include it with the request.
|
|
42
24
|
LENGTH_REQUIRED: 411,
|
|
43
|
-
//The request did not match the pre-conditions of the requested resource.
|
|
44
25
|
PRECONDITION_FAILED: 412,
|
|
45
|
-
//The request entity is larger than the server is willing or able to process.
|
|
46
26
|
REQUEST_ENTITY_TOO_LARGE: 413,
|
|
47
|
-
//The request URI is longer than the server is willing to interpret.
|
|
48
27
|
REQUEST_URI_TOO_LONG: 414,
|
|
49
|
-
//The requested resource does not support the media type provided.
|
|
50
28
|
UNSUPPORTED_MEDIA_TYPE: 415,
|
|
51
|
-
//The requested range for the resource is not available.
|
|
52
29
|
REQUESTED_RANGE_NOT_SATISFIABLE: 416,
|
|
53
|
-
//Unable to meet the expectation given in the Expect request header.
|
|
54
30
|
EXPECTATION_FAILED: 417,
|
|
55
|
-
//The requested resource is missing required arguments.
|
|
56
31
|
MISSING_ARGUMENTS: 419,
|
|
57
|
-
//The requested resource does not support one or more of the given parameters.
|
|
58
32
|
INVALID_ARGUMENTS: 420,
|
|
59
|
-
//The request was well-formed but was unable to be followed due to semantic errors.
|
|
60
33
|
UNPROCESSABLE_ENTITY: 422,
|
|
61
|
-
//Unexpected internal server error.
|
|
62
34
|
INTERNAL_SERVER_ERROR: 500,
|
|
63
|
-
//The requested resource is recognized but not implemented.
|
|
64
35
|
NOT_IMPLEMENTED: 501,
|
|
65
|
-
//Invalid response received when acting as a proxy or gateway.
|
|
66
36
|
BAD_GATEWAY: 502,
|
|
67
|
-
//The server is currently unavailable.
|
|
68
37
|
SERVICE_UNAVAILABLE: 503,
|
|
69
|
-
//Did not receive a timely response from upstream server while acting as a gateway or proxy.
|
|
70
38
|
GATEWAY_TIMEOUT: 504,
|
|
71
|
-
//The HTTP protocol version used in the request message is not supported.
|
|
72
39
|
HTTP_VERSION_NOT_SUPPORTED: 505,
|
|
73
|
-
//A failure occurred during initialization of services. API will be unavailable.
|
|
74
40
|
INITIALIZATION_FAILURE: 550,
|
|
75
|
-
};
|
|
41
|
+
} as const;
|
|
76
42
|
|
|
77
43
|
const PERMISSIONS = {
|
|
78
44
|
ACCESS_TO_CONTENT_GENERATORS: "651d81d626fb9aafa4077520",
|
|
@@ -98,9 +64,9 @@ const PERMISSIONS = {
|
|
|
98
64
|
MANAGE_USERS: "5dd612e40f0bc559c41a2b29",
|
|
99
65
|
PROMOTE_CONTENT: "5fac2126427ce31f8a92c0cb",
|
|
100
66
|
TALENT_TRANSFORMATION_CHAMPION: "5fac210f7e6539d37a897c95",
|
|
101
|
-
};
|
|
67
|
+
} as const;
|
|
102
68
|
|
|
103
|
-
const PERMISSION_DESCRIPTIONS = {
|
|
69
|
+
const PERMISSION_DESCRIPTIONS: { [key: string]: string } = {
|
|
104
70
|
"5ea3d1152839450e16e72bba": "Author content",
|
|
105
71
|
"5ea3d10bea252025c8ec351b": "Promote content",
|
|
106
72
|
"61970935cee185acf08111f6": "Manage content providers",
|
|
@@ -113,8 +79,7 @@ const PERMISSION_DESCRIPTIONS = {
|
|
|
113
79
|
"5dd61305a73c68b44c3f0827": "Manage learning paths",
|
|
114
80
|
"5dd612d5338ea9a6ae6326da": "Manage organization information",
|
|
115
81
|
"5fac210e7e6539d37a897c94": "Auto approve own profile information updates",
|
|
116
|
-
"650fadb23956a2154ac890ac":
|
|
117
|
-
"Skip assessment when updating own profile information",
|
|
82
|
+
"650fadb23956a2154ac890ac": "Skip assessment when updating own profile information",
|
|
118
83
|
"5fac21164351c6727a34cd4e": "Auto approve own skill set updates",
|
|
119
84
|
"66ff566a911d938bc00618bf": "Manage security",
|
|
120
85
|
"5e1570e087d836dc77888a5f": "Manage settings",
|
|
@@ -129,4 +94,4 @@ export {
|
|
|
129
94
|
PERMISSIONS,
|
|
130
95
|
PERMISSION_DESCRIPTIONS,
|
|
131
96
|
RESPONSE_TYPE,
|
|
132
|
-
};
|
|
97
|
+
};
|
|
@@ -6,9 +6,15 @@ import { client } from "./axiosClient.js";
|
|
|
6
6
|
* @param {Number} position - The position on the dashboard
|
|
7
7
|
* @param {Object} data - The card settings data
|
|
8
8
|
* @param {String} authToken - Authorization token
|
|
9
|
+
* @returns {Promise<Object>}
|
|
9
10
|
*/
|
|
10
|
-
const addCardToDashboard = (
|
|
11
|
-
|
|
11
|
+
const addCardToDashboard = (
|
|
12
|
+
id: string,
|
|
13
|
+
position: number,
|
|
14
|
+
data: object,
|
|
15
|
+
authToken: string
|
|
16
|
+
): Promise<object> => {
|
|
17
|
+
return new Promise((resolve, reject) => {
|
|
12
18
|
const request = client.put(
|
|
13
19
|
`/api/v1/dashboard/card`,
|
|
14
20
|
{
|
|
@@ -31,9 +37,10 @@ const addCardToDashboard = (id, position, data, authToken) => {
|
|
|
31
37
|
/**
|
|
32
38
|
* Get the list of the cards from the dashboard
|
|
33
39
|
* @param {String} authToken - Authorization token
|
|
40
|
+
* @returns {Promise<Object>}
|
|
34
41
|
*/
|
|
35
|
-
const getDashboardCardsList = (authToken) => {
|
|
36
|
-
return new Promise(
|
|
42
|
+
const getDashboardCardsList = (authToken: string): Promise<object> => {
|
|
43
|
+
return new Promise((resolve, reject) => {
|
|
37
44
|
const request = client.get(`/api/v1/dashboard/card`, {
|
|
38
45
|
headers: { authorization: authToken },
|
|
39
46
|
});
|
|
@@ -51,12 +58,15 @@ const getDashboardCardsList = (authToken) => {
|
|
|
51
58
|
* Remove a card from the dashboard
|
|
52
59
|
* @param {String} id - the id of the configuration element
|
|
53
60
|
* @param {String} authToken - Authorization token
|
|
61
|
+
* @returns {Promise<Object>}
|
|
54
62
|
*/
|
|
55
|
-
const removeCardFromDashboard = (
|
|
56
|
-
|
|
63
|
+
const removeCardFromDashboard = (
|
|
64
|
+
id: string,
|
|
65
|
+
authToken: string
|
|
66
|
+
): Promise<object> => {
|
|
67
|
+
return new Promise((resolve, reject) => {
|
|
57
68
|
const request = client.delete(`/api/v1/dashboard/card`, {
|
|
58
69
|
headers: { authorization: authToken },
|
|
59
|
-
|
|
60
70
|
data: {
|
|
61
71
|
id: id,
|
|
62
72
|
},
|