@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.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import actionNotifications from "./lib/actionNotifications.js";
|
|
2
|
-
import {
|
|
3
|
-
client,
|
|
4
|
-
errorToString,
|
|
5
|
-
getErrorInformation,
|
|
6
|
-
getErrorType,
|
|
7
|
-
shouldReturnError,
|
|
8
|
-
} from "./lib/axiosClient.js";
|
|
9
|
-
import aiAssistant from "./lib/aiAssistant.js";
|
|
10
|
-
import avatar from "./lib/avatar.js";
|
|
11
|
-
import address from "./lib/address.js";
|
|
12
|
-
import config from "./lib/config.js";
|
|
13
|
-
import {
|
|
14
|
-
DOCUMENT_VERSION,
|
|
15
|
-
PERMISSIONS,
|
|
16
|
-
PERMISSION_DESCRIPTIONS,
|
|
17
|
-
RESPONSE_TYPE,
|
|
18
|
-
} from "./lib/constants.js";
|
|
19
|
-
import contentGenerator from "./lib/integrations/contentGenerator.js";
|
|
20
|
-
import dashboard from "./lib/dashboard.js";
|
|
21
|
-
import departmentTraingPlans from "./lib/departmentTrainingPlans.js";
|
|
22
|
-
import integration from "./lib/integration.js";
|
|
23
|
-
import integrationConfiguration from "./lib/integrationConfiguration.js";
|
|
24
|
-
import groups from "./lib/groups.js";
|
|
25
|
-
import learningContent from "./lib/learningContent.js";
|
|
26
|
-
import learningPath from "./lib/learningPath.js";
|
|
27
|
-
import logger from "./lib/logger.js";
|
|
28
|
-
import microSkillsQuizes from "./lib/microSkillsQuizes.js";
|
|
29
|
-
import quotas from "./lib/quotas.js";
|
|
30
|
-
import role from "./lib/role.js";
|
|
31
|
-
import roleTemplate from "./lib/roleTemplate.js";
|
|
32
|
-
import security from "./lib/security.js";
|
|
33
|
-
import skill from "./lib/skill.js";
|
|
34
|
-
import skillAssessment from "./lib/skillAssessments.js";
|
|
35
|
-
import skillAssessmentTestingSession from "./lib/skillAssessmentTestingSession.js";
|
|
36
|
-
import skillTemplate from "./lib/skillTemplate.js";
|
|
37
|
-
import talentTransfromation from "./lib/talentTransfromation.js";
|
|
38
|
-
import team from "./lib/teams.js";
|
|
39
|
-
import tenant from "./lib/tenants.js";
|
|
40
|
-
import trainingPlan from "./lib/trainingPlans.js";
|
|
41
|
-
import trainingPlanProficiencyLevel from "./lib/trainingPlansProficiencyLevels.js";
|
|
42
|
-
import userInformation from "./lib/userInformation.js";
|
|
43
|
-
import users from "./lib/users.js";
|
|
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.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./exports.js";
|
package/lib/axiosClient.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import axios 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 {Object} error
|
|
15
|
-
*/
|
|
16
|
-
const errorToString = (error) => {
|
|
17
|
-
if (error != null) {
|
|
18
|
-
if (error?.response?.data) {
|
|
19
|
-
let asString = "";
|
|
20
|
-
if (Array.isArray(error.response.data.errors)) {
|
|
21
|
-
error.response.data.errors.forEach((item, index) => {
|
|
22
|
-
asString += `${index > 0 ? ", " : ""} ${item.msg} param ${
|
|
23
|
-
item.param
|
|
24
|
-
} ${item.value ? `value ${item.value.toString()}` : ""}`;
|
|
25
|
-
});
|
|
26
|
-
return asString;
|
|
27
|
-
} else if (error.response.data.error) {
|
|
28
|
-
return error.response.data.error.toString();
|
|
29
|
-
} else if (error.response.statusText) {
|
|
30
|
-
return error.response.statusText.toString();
|
|
31
|
-
} else {
|
|
32
|
-
return error.response.data.toString();
|
|
33
|
-
}
|
|
34
|
-
} else {
|
|
35
|
-
return error.message ? error.message : "Unknown error";
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Returns the code of the error as a number
|
|
42
|
-
* @param {Object} error
|
|
43
|
-
* @returns {Number} The error code
|
|
44
|
-
*/
|
|
45
|
-
const getErrorType = (error) => {
|
|
46
|
-
if (error?.response?.status) {
|
|
47
|
-
return error.response.status;
|
|
48
|
-
} else return RESPONSE_TYPE.SERVICE_UNAVAILABLE;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Return the error information to include just the status and the message
|
|
53
|
-
* @param {Object} error
|
|
54
|
-
* @returns Object
|
|
55
|
-
*/
|
|
56
|
-
const getErrorInformation = (error) => {
|
|
57
|
-
return {
|
|
58
|
-
status: getErrorType(error),
|
|
59
|
-
message: errorToString(error),
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Returns true if an exception should be handled to the business and presentation layer
|
|
65
|
-
* @param {Boolean} returnAllExceptions - If set true all exceptions will be passed
|
|
66
|
-
* @param {Object} error - The error returned by the server
|
|
67
|
-
*/
|
|
68
|
-
const shouldReturnError = (returnAllExceptions, error) => {
|
|
69
|
-
if (getErrorType(error) === RESPONSE_TYPE.UNAUTHORIZED) {
|
|
70
|
-
return returnAllExceptions;
|
|
71
|
-
} else {
|
|
72
|
-
return true;
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export {
|
|
77
|
-
client,
|
|
78
|
-
errorToString,
|
|
79
|
-
getErrorType,
|
|
80
|
-
getErrorInformation,
|
|
81
|
-
shouldReturnError,
|
|
82
|
-
};
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import { client } from "./axiosClient.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* End an existing testing session
|
|
5
|
-
* @param {String} testingSessionId
|
|
6
|
-
* @param {String} token Authorization token
|
|
7
|
-
* @param {Boolean} deletePartial
|
|
8
|
-
*/
|
|
9
|
-
const endSession = (testingSessionId, token, keepPartial = false) => {
|
|
10
|
-
return new Promise(function (resolve, reject) {
|
|
11
|
-
let confirmationRequest = client.post(
|
|
12
|
-
"api/v1/skillassessmenttestingsession/endsession",
|
|
13
|
-
{ id: testingSessionId, keepPartial: keepPartial },
|
|
14
|
-
{
|
|
15
|
-
headers: { authorization: token },
|
|
16
|
-
}
|
|
17
|
-
);
|
|
18
|
-
confirmationRequest
|
|
19
|
-
.then((response) => {
|
|
20
|
-
resolve(response.data);
|
|
21
|
-
})
|
|
22
|
-
.catch((error) => {
|
|
23
|
-
reject(error);
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* End an existing testing session
|
|
30
|
-
* @param {String} testingSessionId
|
|
31
|
-
* @param {Array<String>} selectedAnswers
|
|
32
|
-
* @param {String} token Authorization token
|
|
33
|
-
*/
|
|
34
|
-
const getNextStep = (testingSessionId, selectedAnswers, token) => {
|
|
35
|
-
return new Promise(function (resolve, reject) {
|
|
36
|
-
let data = {
|
|
37
|
-
id: testingSessionId,
|
|
38
|
-
};
|
|
39
|
-
if (selectedAnswers) data.selectedAnswers = selectedAnswers;
|
|
40
|
-
let confirmationRequest = client.post(
|
|
41
|
-
`api/v1/skillassessmenttestingsession/getnextstep`,
|
|
42
|
-
data,
|
|
43
|
-
{
|
|
44
|
-
headers: { authorization: token },
|
|
45
|
-
}
|
|
46
|
-
);
|
|
47
|
-
confirmationRequest
|
|
48
|
-
.then((response) => {
|
|
49
|
-
resolve(response.data);
|
|
50
|
-
})
|
|
51
|
-
.catch((error) => {
|
|
52
|
-
reject(error);
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Get skill assessment by user and skill
|
|
59
|
-
* @param {String} userId
|
|
60
|
-
* @param {String} skillId
|
|
61
|
-
* @param {String} token
|
|
62
|
-
* @returns
|
|
63
|
-
*/
|
|
64
|
-
const getSkillTestAssessment = (userId, skillId, token) => {
|
|
65
|
-
return new Promise(function (resolve, reject) {
|
|
66
|
-
let confirmationRequest = client.post(
|
|
67
|
-
`api/v1/skillassessmenttestingsession/getbyuserandskill`,
|
|
68
|
-
{
|
|
69
|
-
userId: userId,
|
|
70
|
-
skillId: skillId,
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
headers: { authorization: token },
|
|
74
|
-
}
|
|
75
|
-
);
|
|
76
|
-
confirmationRequest
|
|
77
|
-
.then((response) => {
|
|
78
|
-
resolve(response.data);
|
|
79
|
-
})
|
|
80
|
-
.catch((error) => {
|
|
81
|
-
reject(error);
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Pause skill assessment
|
|
88
|
-
* @param {String} testingSessionId
|
|
89
|
-
* @param {String} token
|
|
90
|
-
* @returns
|
|
91
|
-
*/
|
|
92
|
-
const pause = (testingSessionId, token) => {
|
|
93
|
-
return new Promise(function (resolve, reject) {
|
|
94
|
-
let confirmationRequest = client.post(
|
|
95
|
-
`api/v1/skillassessmenttestingsession/pausesession`,
|
|
96
|
-
{
|
|
97
|
-
id: testingSessionId,
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
headers: { authorization: token },
|
|
101
|
-
}
|
|
102
|
-
);
|
|
103
|
-
confirmationRequest
|
|
104
|
-
.then((response) => {
|
|
105
|
-
resolve(response.data);
|
|
106
|
-
})
|
|
107
|
-
.catch((error) => {
|
|
108
|
-
reject(error);
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Start a new test skill test assessment session
|
|
115
|
-
* @param {String} skillId
|
|
116
|
-
* @param {Boolean} saveSession
|
|
117
|
-
* @param {String} token
|
|
118
|
-
*/
|
|
119
|
-
const startSession = (skillId, saveSession, token) => {
|
|
120
|
-
return new Promise(function (resolve, reject) {
|
|
121
|
-
let confirmationRequest = client.post(
|
|
122
|
-
"api/v1/skillassessmenttestingsession/startsession",
|
|
123
|
-
{
|
|
124
|
-
saveSession: saveSession,
|
|
125
|
-
skillId: skillId,
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
headers: { authorization: token },
|
|
129
|
-
}
|
|
130
|
-
);
|
|
131
|
-
confirmationRequest
|
|
132
|
-
.then((response) => {
|
|
133
|
-
resolve(response.data);
|
|
134
|
-
})
|
|
135
|
-
.catch((error) => {
|
|
136
|
-
reject(error);
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
export default {
|
|
142
|
-
endSession,
|
|
143
|
-
getNextStep,
|
|
144
|
-
getSkillTestAssessment,
|
|
145
|
-
pause,
|
|
146
|
-
startSession,
|
|
147
|
-
};
|