@stackfactor/client-api 1.1.11 → 1.1.12-9.2
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 +13 -0
- package/{exports.js → exports.ts} +14 -0
- package/index.ts +1 -0
- package/lib/{actionNotifications.js → actionNotifications.ts} +21 -11
- package/lib/{address.js → address.ts} +4 -5
- package/lib/aiAssistant.ts +197 -0
- package/lib/avatar.ts +41 -0
- package/lib/axiosClient.ts +92 -0
- package/lib/{config.js → config.ts} +20 -9
- package/lib/{constants.js → constants.ts} +11 -41
- package/lib/{dashboard.js → dashboard.ts} +19 -10
- package/lib/{departmentTrainingPlans.js → departmentTrainingPlans.ts} +63 -32
- package/lib/{groups.js → groups.ts} +68 -29
- package/lib/{integration.js → integration.ts} +103 -47
- package/lib/{integrationConfiguration.js → integrationConfiguration.ts} +27 -22
- package/lib/integrations/{contentGenerator.js → contentGenerator.ts} +38 -18
- package/lib/{learningContent.js → learningContent.ts} +218 -62
- package/lib/{learningPath.js → learningPath.ts} +57 -30
- package/lib/{logger.js → logger.ts} +18 -8
- package/lib/microSkillsQuizes.ts +70 -0
- package/lib/quotas.ts +59 -0
- package/lib/{role.js → role.ts} +117 -69
- package/lib/{roleTemplate.js → roleTemplate.ts} +65 -30
- package/lib/security.ts +99 -0
- package/lib/{skill.js → skill.ts} +125 -87
- package/lib/{skillAssessments.js → skillAssessmentTestingSession.ts} +63 -16
- package/lib/skillAssessments.ts +192 -0
- package/lib/{skillTemplate.js → skillTemplate.ts} +73 -42
- package/lib/talentTransfromation.ts +126 -0
- package/lib/{teams.js → teams.ts} +73 -38
- package/lib/{tenants.js → tenants.ts} +17 -10
- package/lib/{trainingPlans.js → trainingPlans.ts} +159 -56
- package/lib/trainingPlansProficiencyLevels.ts +132 -0
- package/lib/{userInformation.js → userInformation.ts} +27 -26
- package/lib/{users.js → users.ts} +239 -140
- package/lib/utils.ts +64 -0
- package/package.json +12 -1
- package/index.js +0 -3
- package/lib/axiosClient.js +0 -85
- package/lib/skillAssessmentTestingSession.js +0 -148
- package/lib/utils.js +0 -48
package/.eslintrc.json
ADDED
|
@@ -6,6 +6,8 @@ import {
|
|
|
6
6
|
getErrorType,
|
|
7
7
|
shouldReturnError,
|
|
8
8
|
} from "./lib/axiosClient.js";
|
|
9
|
+
import aiAssistant from "./lib/aiAssistant.js";
|
|
10
|
+
import avatar from "./lib/avatar.js";
|
|
9
11
|
import address from "./lib/address.js";
|
|
10
12
|
import config from "./lib/config.js";
|
|
11
13
|
import {
|
|
@@ -23,21 +25,28 @@ import groups from "./lib/groups.js";
|
|
|
23
25
|
import learningContent from "./lib/learningContent.js";
|
|
24
26
|
import learningPath from "./lib/learningPath.js";
|
|
25
27
|
import logger from "./lib/logger.js";
|
|
28
|
+
import microSkillsQuizes from "./lib/microSkillsQuizes.js";
|
|
29
|
+
import quotas from "./lib/quotas.js";
|
|
26
30
|
import role from "./lib/role.js";
|
|
27
31
|
import roleTemplate from "./lib/roleTemplate.js";
|
|
32
|
+
import security from "./lib/security.js";
|
|
28
33
|
import skill from "./lib/skill.js";
|
|
29
34
|
import skillAssessment from "./lib/skillAssessments.js";
|
|
30
35
|
import skillAssessmentTestingSession from "./lib/skillAssessmentTestingSession.js";
|
|
31
36
|
import skillTemplate from "./lib/skillTemplate.js";
|
|
37
|
+
import talentTransfromation from "./lib/talentTransfromation.js";
|
|
32
38
|
import team from "./lib/teams.js";
|
|
33
39
|
import tenant from "./lib/tenants.js";
|
|
34
40
|
import trainingPlan from "./lib/trainingPlans.js";
|
|
41
|
+
import trainingPlanProficiencyLevel from "./lib/trainingPlansProficiencyLevels.js";
|
|
35
42
|
import userInformation from "./lib/userInformation.js";
|
|
36
43
|
import users from "./lib/users.js";
|
|
37
44
|
|
|
38
45
|
export {
|
|
39
46
|
actionNotifications,
|
|
40
47
|
address,
|
|
48
|
+
aiAssistant,
|
|
49
|
+
avatar,
|
|
41
50
|
client,
|
|
42
51
|
config,
|
|
43
52
|
contentGenerator,
|
|
@@ -53,19 +62,24 @@ export {
|
|
|
53
62
|
learningContent,
|
|
54
63
|
learningPath,
|
|
55
64
|
logger,
|
|
65
|
+
microSkillsQuizes,
|
|
56
66
|
PERMISSIONS,
|
|
57
67
|
PERMISSION_DESCRIPTIONS,
|
|
68
|
+
quotas,
|
|
58
69
|
RESPONSE_TYPE,
|
|
59
70
|
role,
|
|
60
71
|
roleTemplate,
|
|
72
|
+
security,
|
|
61
73
|
shouldReturnError,
|
|
62
74
|
skill,
|
|
63
75
|
skillAssessment,
|
|
64
76
|
skillAssessmentTestingSession,
|
|
65
77
|
skillTemplate,
|
|
78
|
+
talentTransfromation,
|
|
66
79
|
team,
|
|
67
80
|
tenant,
|
|
68
81
|
trainingPlan,
|
|
82
|
+
trainingPlanProficiencyLevel,
|
|
69
83
|
userInformation,
|
|
70
84
|
users,
|
|
71
85
|
};
|
package/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./exports.js";
|
|
@@ -2,12 +2,13 @@ import { client } from "./axiosClient.js";
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Get all permissions
|
|
5
|
-
* @param {String}
|
|
5
|
+
* @param {String} token The authentication token
|
|
6
|
+
* @returns {Promise<Object>}
|
|
6
7
|
*/
|
|
7
|
-
|
|
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
|
-
headers: { authorization:
|
|
11
|
+
headers: { authorization: token },
|
|
11
12
|
});
|
|
12
13
|
request
|
|
13
14
|
.then((response) => {
|
|
@@ -24,9 +25,14 @@ export const getAllUserNotifications = (authToken) => {
|
|
|
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
|
-
|
|
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 @@ export 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
|
-
|
|
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
|
{
|
|
@@ -73,10 +85,8 @@ export const processNotification = (id, action, comments, authToken) => {
|
|
|
73
85
|
});
|
|
74
86
|
};
|
|
75
87
|
|
|
76
|
-
|
|
88
|
+
export default {
|
|
77
89
|
getAllUserNotifications,
|
|
78
90
|
markNotifications,
|
|
79
91
|
processNotification,
|
|
80
92
|
};
|
|
81
|
-
|
|
82
|
-
export default actionNotifications;
|
|
@@ -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
|
-
|
|
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 },
|
|
@@ -22,6 +23,4 @@ export const autoComplete = (input, authToken) => {
|
|
|
22
23
|
});
|
|
23
24
|
};
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
export default address;
|
|
26
|
+
export default { autoComplete };
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { client } from "./axiosClient.js";
|
|
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
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Ask Question to the AI
|
|
24
|
+
* @param {String} conversationId
|
|
25
|
+
* @param {String} question
|
|
26
|
+
* @param {String} updatedContext
|
|
27
|
+
* @param {String} token Authorization token
|
|
28
|
+
* @returns {Promise<Object>}
|
|
29
|
+
*/
|
|
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 = {
|
|
38
|
+
conversationId: conversationId,
|
|
39
|
+
question: question,
|
|
40
|
+
updatedContext: updatedContext,
|
|
41
|
+
};
|
|
42
|
+
let confirmationRequest = client.post(
|
|
43
|
+
"/api/v1/aiassistant/askquestion",
|
|
44
|
+
data,
|
|
45
|
+
{
|
|
46
|
+
headers: { authorization: token },
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
confirmationRequest
|
|
50
|
+
.then((response) => {
|
|
51
|
+
resolve(response.data);
|
|
52
|
+
})
|
|
53
|
+
.catch((error) => {
|
|
54
|
+
reject(error);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* End conversation with the AI
|
|
61
|
+
* @param {String} conversationId
|
|
62
|
+
* @param {String} token Authorization token
|
|
63
|
+
* @returns {Promise<Object>}
|
|
64
|
+
*/
|
|
65
|
+
const endConversation = (
|
|
66
|
+
conversationId: string,
|
|
67
|
+
token: string
|
|
68
|
+
): Promise<object> => {
|
|
69
|
+
return new Promise((resolve, reject) => {
|
|
70
|
+
let data: EndConversationData = {
|
|
71
|
+
conversationId: conversationId,
|
|
72
|
+
};
|
|
73
|
+
let confirmationRequest = client.post(
|
|
74
|
+
"/api/v1/aiassistant/endconversation",
|
|
75
|
+
data,
|
|
76
|
+
{
|
|
77
|
+
headers: { authorization: token },
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
confirmationRequest
|
|
81
|
+
.then((response) => {
|
|
82
|
+
resolve(response.data);
|
|
83
|
+
})
|
|
84
|
+
.catch((error) => {
|
|
85
|
+
reject(error);
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Get conversation by elementId
|
|
92
|
+
* @param {String} elementId
|
|
93
|
+
* @param {String} token
|
|
94
|
+
* @returns {Promise<Object>}
|
|
95
|
+
*/
|
|
96
|
+
const getConversationByElementId = (
|
|
97
|
+
elementId: string,
|
|
98
|
+
token: string
|
|
99
|
+
): Promise<object> => {
|
|
100
|
+
return new Promise((resolve, reject) => {
|
|
101
|
+
let confirmationRequest = client.get(
|
|
102
|
+
`/api/v1/aiassistant/getconversation/${elementId}`,
|
|
103
|
+
{
|
|
104
|
+
headers: { authorization: token },
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
confirmationRequest
|
|
108
|
+
.then((response) => {
|
|
109
|
+
resolve(response.data);
|
|
110
|
+
})
|
|
111
|
+
.catch((error) => {
|
|
112
|
+
reject(error);
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Get the voice assistant URL
|
|
119
|
+
* @param {String} language
|
|
120
|
+
* @param {String} token
|
|
121
|
+
* @returns {Promise<Object>}
|
|
122
|
+
*/
|
|
123
|
+
const getVoiceAssistantUrl = (
|
|
124
|
+
language: string,
|
|
125
|
+
token: string
|
|
126
|
+
): Promise<object> => {
|
|
127
|
+
return new Promise((resolve, reject) => {
|
|
128
|
+
let confirmationRequest = client.get(
|
|
129
|
+
`/api/v1/aiassistant/getvoiceassistanturl/${language}`,
|
|
130
|
+
{
|
|
131
|
+
headers: { authorization: token },
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
confirmationRequest
|
|
135
|
+
.then((response) => {
|
|
136
|
+
resolve(response.data);
|
|
137
|
+
})
|
|
138
|
+
.catch((error) => {
|
|
139
|
+
reject(error);
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Start conversation with the AI
|
|
146
|
+
* @param {String} elementId
|
|
147
|
+
* @param {String} elementType
|
|
148
|
+
* @param {String} context
|
|
149
|
+
* @param {Boolean} autoContextRefresh
|
|
150
|
+
* @param {String} token
|
|
151
|
+
* @param {String} conversationId Optional
|
|
152
|
+
* @returns {Promise<Object>}
|
|
153
|
+
*/
|
|
154
|
+
const startConversation = (
|
|
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 = {
|
|
165
|
+
autoContextRefresh: autoContextRefresh,
|
|
166
|
+
context: context,
|
|
167
|
+
question: question,
|
|
168
|
+
elementId: elementId,
|
|
169
|
+
elementType: elementType,
|
|
170
|
+
};
|
|
171
|
+
if (conversationId) {
|
|
172
|
+
data.conversationId = conversationId;
|
|
173
|
+
}
|
|
174
|
+
let confirmationRequest = client.post(
|
|
175
|
+
"/api/v1/aiassistant/startconversation",
|
|
176
|
+
data,
|
|
177
|
+
{
|
|
178
|
+
headers: { authorization: token },
|
|
179
|
+
}
|
|
180
|
+
);
|
|
181
|
+
confirmationRequest
|
|
182
|
+
.then((response) => {
|
|
183
|
+
resolve(response.data);
|
|
184
|
+
})
|
|
185
|
+
.catch((error) => {
|
|
186
|
+
reject(error);
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
export default {
|
|
192
|
+
askQuestion,
|
|
193
|
+
endConversation,
|
|
194
|
+
getConversationByElementId,
|
|
195
|
+
getVoiceAssistantUrl,
|
|
196
|
+
startConversation,
|
|
197
|
+
};
|
package/lib/avatar.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { client } from "./axiosClient.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Get avatar for an elementId
|
|
5
|
+
* @param {String} elementId
|
|
6
|
+
* @param {String} type
|
|
7
|
+
* @param {Number} width
|
|
8
|
+
* @param {Number} height
|
|
9
|
+
* @param {String} token
|
|
10
|
+
* @returns {Promise<Blob>}
|
|
11
|
+
*/
|
|
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) => {
|
|
20
|
+
let confirmationRequest = client.get(
|
|
21
|
+
`/api/v1/avatar/getavatar/${elementId}/${type}/${width}/${height}`,
|
|
22
|
+
{
|
|
23
|
+
headers: {
|
|
24
|
+
authorization: token,
|
|
25
|
+
},
|
|
26
|
+
responseType: "blob",
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
confirmationRequest
|
|
30
|
+
.then((response) => {
|
|
31
|
+
resolve(response.data);
|
|
32
|
+
})
|
|
33
|
+
.catch(() => {
|
|
34
|
+
reject("Error getting avatar");
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default {
|
|
40
|
+
getAvatar,
|
|
41
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import axios, { AxiosError } from "axios";
|
|
2
|
+
import { RESPONSE_TYPE } from "./constants.js";
|
|
3
|
+
import utils from "./utils.js";
|
|
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
|
-
|
|
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 @@ export 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
|
-
|
|
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 @@ export 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
|
-
|
|
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 },
|
|
@@ -65,10 +78,8 @@ export const setConfigurationById = (id, data, authToken) => {
|
|
|
65
78
|
});
|
|
66
79
|
};
|
|
67
80
|
|
|
68
|
-
|
|
81
|
+
export default {
|
|
69
82
|
getConfigurationById,
|
|
70
83
|
getConfigurationByType,
|
|
71
84
|
setConfigurationById,
|
|
72
85
|
};
|
|
73
|
-
|
|
74
|
-
export default config;
|
|
@@ -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",
|
|
@@ -83,6 +49,7 @@ const PERMISSIONS = {
|
|
|
83
49
|
BETA_TESTER: "5fac210b6c8f874bd7137b97",
|
|
84
50
|
MANAGE_BILLING: "5e1570cd03f676213bfdcd08",
|
|
85
51
|
MANAGE_CONTENT_PROVIDERS: "5f0fa12f16a720fde58ea820",
|
|
52
|
+
MANAGE_EXECUTIVE: "5fac2111b7e49e10c779b4a5",
|
|
86
53
|
MANAGE_GROUPS: "5dd612fe59e518ac87b8cf8e",
|
|
87
54
|
MANAGE_LEARNING_CONTENT: "64f54d20b7e49e10c779b4a6",
|
|
88
55
|
MANAGE_LEARNING_PATHS: "5dd61305a73c68b44c3f0827",
|
|
@@ -90,28 +57,31 @@ const PERMISSIONS = {
|
|
|
90
57
|
MANAGE_OWN_PROFILE_INFORMATION_AUTO_APP: "5fac210e7e6539d37a897c94",
|
|
91
58
|
MANAGE_OWN_PROFILE_SKIP_ASSESSMENT: "650fadb23956a2154ac890ac",
|
|
92
59
|
MANAGE_OWN_SKILL_SET_AUTO_APPROVE: "5fac21164351c6727a34cd4e",
|
|
60
|
+
MANAGE_SECURITY: "66ff566a911d938bc00618bf",
|
|
93
61
|
MANAGE_SETTINGS: "5e1570e087d836dc77888a5f",
|
|
94
62
|
MANAGE_TEAM_INFORMATION_AUTO_APPROVE: "5fac211e6c8f874bd7137b98",
|
|
95
63
|
MANAGE_TEAMS: "5dd61314afc2455a89b1a37b",
|
|
96
64
|
MANAGE_USERS: "5dd612e40f0bc559c41a2b29",
|
|
97
65
|
PROMOTE_CONTENT: "5fac2126427ce31f8a92c0cb",
|
|
98
|
-
|
|
66
|
+
TALENT_TRANSFORMATION_CHAMPION: "5fac210f7e6539d37a897c95",
|
|
67
|
+
} as const;
|
|
99
68
|
|
|
100
|
-
const PERMISSION_DESCRIPTIONS = {
|
|
69
|
+
const PERMISSION_DESCRIPTIONS: { [key: string]: string } = {
|
|
101
70
|
"5ea3d1152839450e16e72bba": "Author content",
|
|
102
71
|
"5ea3d10bea252025c8ec351b": "Promote content",
|
|
103
72
|
"61970935cee185acf08111f6": "Manage content providers",
|
|
104
73
|
"5fac210560e43de7c6b4a208": "Author content",
|
|
105
74
|
"5e1570cd03f676213bfdcd08": "Manage billing",
|
|
106
75
|
"5f0fa12f16a720fde58ea820": "Manage content providers",
|
|
76
|
+
"5fac2111b7e49e10c779b4a5": "Manage executive",
|
|
107
77
|
"5dd612fe59e518ac87b8cf8e": "Manage groups",
|
|
108
78
|
"64f54d20b7e49e10c779b4a6": "Manage learning content",
|
|
109
79
|
"5dd61305a73c68b44c3f0827": "Manage learning paths",
|
|
110
80
|
"5dd612d5338ea9a6ae6326da": "Manage organization information",
|
|
111
81
|
"5fac210e7e6539d37a897c94": "Auto approve own profile information updates",
|
|
112
|
-
"650fadb23956a2154ac890ac":
|
|
113
|
-
"Skip assessment when updating own profile information",
|
|
82
|
+
"650fadb23956a2154ac890ac": "Skip assessment when updating own profile information",
|
|
114
83
|
"5fac21164351c6727a34cd4e": "Auto approve own skill set updates",
|
|
84
|
+
"66ff566a911d938bc00618bf": "Manage security",
|
|
115
85
|
"5e1570e087d836dc77888a5f": "Manage settings",
|
|
116
86
|
"5fac211e6c8f874bd7137b98": "Auto approve own team information updates",
|
|
117
87
|
"5dd61314afc2455a89b1a37b": "Manage teams",
|
|
@@ -124,4 +94,4 @@ export {
|
|
|
124
94
|
PERMISSIONS,
|
|
125
95
|
PERMISSION_DESCRIPTIONS,
|
|
126
96
|
RESPONSE_TYPE,
|
|
127
|
-
};
|
|
97
|
+
};
|