@stackfactor/client-api 1.1.12-9.2 → 1.1.12

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.
Files changed (41) hide show
  1. package/{exports.ts → exports.js} +0 -14
  2. package/index.js +3 -0
  3. package/lib/{actionNotifications.ts → actionNotifications.js} +11 -21
  4. package/lib/{address.ts → address.js} +5 -4
  5. package/lib/axiosClient.js +85 -0
  6. package/lib/{config.ts → config.js} +9 -20
  7. package/lib/{constants.ts → constants.js} +41 -11
  8. package/lib/{dashboard.ts → dashboard.js} +10 -19
  9. package/lib/{departmentTrainingPlans.ts → departmentTrainingPlans.js} +32 -63
  10. package/lib/{groups.ts → groups.js} +29 -68
  11. package/lib/{integration.ts → integration.js} +47 -103
  12. package/lib/{integrationConfiguration.ts → integrationConfiguration.js} +22 -27
  13. package/lib/integrations/{contentGenerator.ts → contentGenerator.js} +18 -38
  14. package/lib/{learningContent.ts → learningContent.js} +62 -218
  15. package/lib/{learningPath.ts → learningPath.js} +30 -57
  16. package/lib/{logger.ts → logger.js} +8 -18
  17. package/lib/{role.ts → role.js} +69 -117
  18. package/lib/{roleTemplate.ts → roleTemplate.js} +30 -65
  19. package/lib/{skill.ts → skill.js} +87 -125
  20. package/lib/skillAssessmentTestingSession.js +148 -0
  21. package/lib/{skillAssessments.ts → skillAssessments.js} +16 -63
  22. package/lib/{skillTemplate.ts → skillTemplate.js} +42 -73
  23. package/lib/{teams.ts → teams.js} +38 -73
  24. package/lib/{tenants.ts → tenants.js} +10 -17
  25. package/lib/{trainingPlans.ts → trainingPlans.js} +56 -159
  26. package/lib/{userInformation.ts → userInformation.js} +26 -27
  27. package/lib/{users.ts → users.js} +140 -239
  28. package/lib/utils.js +48 -0
  29. package/package.json +1 -12
  30. package/.eslintrc.json +0 -13
  31. package/index.ts +0 -1
  32. package/lib/aiAssistant.ts +0 -197
  33. package/lib/avatar.ts +0 -41
  34. package/lib/axiosClient.ts +0 -92
  35. package/lib/microSkillsQuizes.ts +0 -70
  36. package/lib/quotas.ts +0 -59
  37. package/lib/security.ts +0 -99
  38. package/lib/skillAssessmentTestingSession.ts +0 -192
  39. package/lib/talentTransfromation.ts +0 -126
  40. package/lib/trainingPlansProficiencyLevels.ts +0 -132
  41. package/lib/utils.ts +0 -64
@@ -1,192 +0,0 @@
1
- import { client } from "./axiosClient.js";
2
-
3
- /**
4
- * Add new entry skill assessment
5
- * @param {String} id
6
- * @param {Object} data
7
- * @param {String} comments
8
- * @param {String} token Authorization token
9
- * @returns {Promise<Object>}
10
- */
11
- const addEntry = (
12
- id: string,
13
- data: object,
14
- comments: string,
15
- token: string
16
- ): Promise<object> => {
17
- return new Promise((resolve, reject) => {
18
- const requestData = {
19
- comments: comments,
20
- data: data,
21
- id: id,
22
- };
23
- let confirmationRequest = client.put(
24
- "api/v1/skillassessments/addentry",
25
- requestData,
26
- {
27
- headers: { authorization: token },
28
- }
29
- );
30
- confirmationRequest
31
- .then((response) => {
32
- resolve(response.data);
33
- })
34
- .catch((error) => {
35
- reject(error);
36
- });
37
- });
38
- };
39
-
40
- /**
41
- * Create skill assessment
42
- * @param {Object} data
43
- * @param {String} comments
44
- * @param {String} userId
45
- * @param {String} token Authorization token
46
- * @returns {Promise<Object>}
47
- */
48
- const create = (
49
- data: object,
50
- comments: string,
51
- userId: string,
52
- token: string
53
- ): Promise<object> => {
54
- return new Promise((resolve, reject) => {
55
- const requestData = {
56
- comments: comments,
57
- data: data,
58
- userId: userId,
59
- };
60
- let confirmationRequest = client.put(
61
- "api/v1/skillassessments/",
62
- requestData,
63
- {
64
- headers: { authorization: token },
65
- }
66
- );
67
- confirmationRequest
68
- .then((response) => {
69
- resolve(response.data);
70
- })
71
- .catch((error) => {
72
- reject(error);
73
- });
74
- });
75
- };
76
-
77
- /**
78
- * Delete skill assessment
79
- * @param {number} id The id of the skill to be deleted
80
- * @param {String} comments The comments included with the deletion
81
- * @param {String} token Authorization token
82
- * @returns {Promise<Object>}
83
- */
84
- const deleteSkillAssessment = (
85
- id: number,
86
- comments: string,
87
- token: string
88
- ): Promise<object> => {
89
- return new Promise((resolve, reject) => {
90
- const data: { id: number, comments?: string } = {
91
- id: id,
92
- };
93
- if (comments) data.comments = comments;
94
- const request = client.delete(`api/v1/skillassessments`, {
95
- headers: { authorization: token },
96
- data: data,
97
- });
98
- request
99
- .then((response) => {
100
- resolve(response.data);
101
- })
102
- .catch((error) => {
103
- reject(error);
104
- });
105
- });
106
- };
107
-
108
- /**
109
- * Get skill assessment by id
110
- * @param {String} id
111
- * @param {String} token
112
- * @returns {Promise<Object>}
113
- */
114
- const getById = (id: string, token: string): Promise<object> => {
115
- return new Promise((resolve, reject) => {
116
- let confirmationRequest = client.get(`api/v1/skillassessments/${id}`, {
117
- headers: { authorization: token },
118
- });
119
- confirmationRequest
120
- .then((response) => {
121
- resolve(response.data);
122
- })
123
- .catch((error) => {
124
- reject(error);
125
- });
126
- });
127
- };
128
-
129
- /**
130
- * Get skill assessment by user and skill
131
- * @param {String} userId
132
- * @param {String} skillId
133
- * @param {String} token
134
- * @returns {Promise<Object>} The skill assessment
135
- */
136
- const getByUserAndSkill = (
137
- userId: string,
138
- skillId: string,
139
- token: string
140
- ): Promise<object> => {
141
- return new Promise((resolve, reject) => {
142
- let confirmationRequest = client.get(
143
- `api/v1/skillassessments/getbyuserandskill/${userId}/${skillId}`,
144
- {
145
- headers: { authorization: token },
146
- }
147
- );
148
- confirmationRequest
149
- .then((response) => {
150
- resolve(response.data);
151
- })
152
- .catch((error) => {
153
- reject(error);
154
- });
155
- });
156
- };
157
-
158
- /**
159
- * Get list
160
- * @param {String} userId The user used to select the skill
161
- * @param {String} token Authorization token
162
- * @returns {Promise<Object>}
163
- */
164
- const getList = (userId: string, token: string): Promise<object> => {
165
- return new Promise((resolve, reject) => {
166
- const requestData: { userId?: string } = {};
167
- if (userId) requestData.userId = userId;
168
- let confirmationRequest = client.post(
169
- `api/v1/skillassessments`,
170
- requestData,
171
- {
172
- headers: { authorization: token },
173
- }
174
- );
175
- confirmationRequest
176
- .then((response) => {
177
- resolve(response.data);
178
- })
179
- .catch((error) => {
180
- reject(error);
181
- });
182
- });
183
- };
184
-
185
- export default {
186
- addEntry,
187
- create,
188
- deleteSkillAssessment,
189
- getById,
190
- getByUserAndSkill,
191
- getList,
192
- };
@@ -1,126 +0,0 @@
1
- import { client } from "./axiosClient.js";
2
-
3
- /**
4
- * Get talent transformation steps for the current user
5
- * @param {String} authToken The authentication token
6
- * @returns {Promise<Object>}
7
- */
8
- const getTalentTransformationStepsForCurrentUser = (
9
- authToken: string
10
- ): Promise<object> => {
11
- return new Promise((resolve, reject) => {
12
- const request = client.get(
13
- `api/v1/talenttransformation/getforcurrentuser`,
14
- authToken
15
- ? {
16
- headers: { authorization: authToken },
17
- }
18
- : {}
19
- );
20
- request
21
- .then((response) => {
22
- resolve(response.data);
23
- })
24
- .catch((error) => {
25
- reject(error);
26
- });
27
- });
28
- };
29
-
30
- /**
31
- * Get the talent transformation summary for the whole organization
32
- * @param {String} authToken
33
- * @returns {Promise<Object>} The talent transformation summary
34
- */
35
- const getTalentTransformationSummary = (authToken: string): Promise<object> => {
36
- return new Promise((resolve, reject) => {
37
- const request = client.get(
38
- `api/v1/talenttransformation/summary`,
39
- authToken
40
- ? {
41
- headers: { authorization: authToken },
42
- }
43
- : {}
44
- );
45
- request
46
- .then((response) => {
47
- resolve(response.data);
48
- })
49
- .catch((error) => {
50
- reject(error);
51
- });
52
- });
53
- };
54
-
55
- /**
56
- * Get the talent transformation summary for the team
57
- * @param {String} teamId
58
- * @param {String} authToken
59
- * @returns {Promise<Object>} The talent transformation summary
60
- */
61
- const getTalentTransformationSummaryForTeam = (
62
- teamId: string,
63
- authToken: string
64
- ): Promise<object> => {
65
- return new Promise((resolve, reject) => {
66
- const request = client.get(
67
- `api/v1/talenttransformation/summaryforteam/${teamId}`,
68
- authToken
69
- ? {
70
- headers: { authorization: authToken },
71
- }
72
- : {}
73
- );
74
- request
75
- .then((response) => {
76
- resolve(response.data);
77
- })
78
- .catch((error) => {
79
- reject(error);
80
- });
81
- });
82
- };
83
-
84
- /**
85
- * Set talent transformation step data
86
- * @param {String} id The id of the talent transformation step to be updated
87
- * @param {Object} data Data used to update the talent transformation step
88
- * @param {Boolean} returnAllStepsStatuses If true, return all steps statuses
89
- * @param {String} token Authorization token
90
- * @returns {Promise<Object>}
91
- */
92
- const setTalentTransformationStepData = (
93
- id: string,
94
- data: object,
95
- returnAllStepsStatuses: boolean,
96
- token: string
97
- ): Promise<object> => {
98
- return new Promise((resolve, reject) => {
99
- const requestData = {
100
- data: data,
101
- id: id,
102
- returnAllStepsStatuses: returnAllStepsStatuses,
103
- };
104
- let confirmationRequest = client.post(
105
- `api/v1/talenttransformation/setdata/`,
106
- requestData,
107
- {
108
- headers: { authorization: token },
109
- }
110
- );
111
- confirmationRequest
112
- .then((response) => {
113
- resolve(response.data);
114
- })
115
- .catch((error) => {
116
- reject(error);
117
- });
118
- });
119
- };
120
-
121
- export default {
122
- getTalentTransformationStepsForCurrentUser,
123
- getTalentTransformationSummary,
124
- getTalentTransformationSummaryForTeam,
125
- setTalentTransformationStepData,
126
- };
@@ -1,132 +0,0 @@
1
- import { client } from "./axiosClient.js";
2
-
3
- /**
4
- * Get training plan proficiency level
5
- * @param {String} proficiencyLevelId
6
- * @param {String} token
7
- * @returns {Promise<Object>} An object containing the proficiency level information
8
- */
9
- const getTrainingPlanProficiencyLevel = (
10
- proficiencyLevelId: string,
11
- token: string
12
- ): Promise<object> => {
13
- return new Promise((resolve, reject) => {
14
- let confirmationRequest = client.get(
15
- `api/v1/trainingplans/proficiencylevels/${proficiencyLevelId}`,
16
- {
17
- headers: { authorization: token },
18
- }
19
- );
20
- confirmationRequest
21
- .then((response) => {
22
- resolve(response.data);
23
- })
24
- .catch((error) => {
25
- reject(error);
26
- });
27
- });
28
- };
29
-
30
- /**
31
- * Get training plan proficiency level list
32
- * @param {Boolean} includeDeleted If set true it will return deleted plans too
33
- * @param {Boolean} includeDetailedInformation If set to true it will return detailed information for each plan
34
- * @param {Boolean} includeArchived If set to true it will return all the closed items too
35
- * @param {String} token Authorization token
36
- * @returns {Promise<Object>}
37
- */
38
- const getTrainingPlanProficiencyLevelList = (
39
- includeDeleted: boolean,
40
- includeDetailedInformation: boolean,
41
- includeArchived: boolean,
42
- token: string
43
- ): Promise<object> => {
44
- return new Promise((resolve, reject) => {
45
- const requestData = {
46
- includeArchived: includeArchived,
47
- includeDeleted: includeDeleted,
48
- includeDetailedInformation: includeDetailedInformation,
49
- };
50
- let confirmationRequest = client.post(
51
- `api/v1/trainingplans/proficiencylevels`,
52
- requestData,
53
- {
54
- headers: { authorization: token },
55
- }
56
- );
57
- confirmationRequest
58
- .then((response) => {
59
- resolve(response.data);
60
- })
61
- .catch((error) => {
62
- reject(error);
63
- });
64
- });
65
- };
66
-
67
- /**
68
- * Reorder training plan proficiency levels
69
- * @param {Array<Object>} order
70
- * @param {String} token
71
- * @returns {Promise<void>}
72
- */
73
- const reorderTrainingPlansProficiencyLevels = (
74
- order: object[],
75
- token: string
76
- ): Promise<void> => {
77
- return new Promise((resolve, reject) => {
78
- let confirmationRequest = client.post(
79
- `api/v1/trainingplans/proficiencylevels/reorder`,
80
- { order: order },
81
- {
82
- headers: { authorization: token },
83
- }
84
- );
85
- confirmationRequest
86
- .then(() => {
87
- resolve();
88
- })
89
- .catch((error) => {
90
- reject(error);
91
- });
92
- });
93
- };
94
-
95
- /**
96
- * Update a training plan proficiency level
97
- * @param {String} proficiencyLevelId
98
- * @param {Object} data Ordered array of objects containing the activity Id and the new status
99
- * @param {String} token
100
- * @returns {Promise<void>}
101
- */
102
- const updateTrainingPlanProficiencyLevel = (
103
- proficiencyLevelId: string,
104
- data: object,
105
- token: string
106
- ): Promise<void> => {
107
- return new Promise((resolve, reject) => {
108
- let confirmationRequest = client.post(
109
- `api/v1/trainingplans/proficiencylevel/${proficiencyLevelId}`,
110
- data,
111
- {
112
- headers: { authorization: token },
113
- }
114
- );
115
- confirmationRequest
116
- .then(() => {
117
- resolve();
118
- })
119
- .catch((error) => {
120
- reject(error);
121
- });
122
- });
123
- };
124
-
125
- const trainingPlanProficiencyLevel = {
126
- getTrainingPlanProficiencyLevel,
127
- getTrainingPlanProficiencyLevelList,
128
- reorderTrainingPlansProficiencyLevels,
129
- updateTrainingPlanProficiencyLevel,
130
- };
131
-
132
- export default trainingPlanProficiencyLevel;
package/lib/utils.ts DELETED
@@ -1,64 +0,0 @@
1
- /* eslint-disable no-undef */
2
- //import dotenv from "dotenv";
3
- // Load environment variables from .env file
4
- //dotenv.config();
5
-
6
- /**
7
- * Convert object to array
8
- * @param {Object} data
9
- * @returns {Array}
10
- */
11
- const objectToArray = (data: object): any[] => {
12
- if (typeof data === "object") {
13
- return [...Object.values(data)];
14
- } else throw new Error("Invalid type");
15
- };
16
-
17
- /**
18
- * Returns the backend base API URL
19
- * @returns {String}
20
- */
21
- const getBaseUrl = (): string => {
22
- if (process.env.REACT_APP_BACKEND_URL) {
23
- return process.env.REACT_APP_BACKEND_URL;
24
- } else {
25
- switch (process.env.REACT_APP_NODE_ENV) {
26
- case "development":
27
- case null:
28
- case undefined:
29
- return "https://localhost/";
30
- case "testing":
31
- return "https://qaapi.stackfactor.ai/";
32
- case "nonprod":
33
- return "https://apiqa.stackfactor.ai/";
34
- case "production":
35
- return "https://api.stackfactor.ai/";
36
- case "security":
37
- return "https://csapi.stackfactor.ai/";
38
- default:
39
- throw new Error("Invalid environment");
40
- }
41
- }
42
- };
43
-
44
- /**
45
- * Remove null properties
46
- * @param {Object} object
47
- * @returns {Object}
48
- */
49
- const removeNullProperties = (object: { [key: string]: any }): object => {
50
- Object.keys(object).forEach((key) => {
51
- let value = object[key];
52
- let hasProperties = value && Object.keys(value).length > 0;
53
- if (value === null) {
54
- delete object[key];
55
- } else if (typeof value !== "string" && hasProperties) {
56
- removeNullProperties(value);
57
- }
58
- });
59
- return object;
60
- };
61
-
62
- const utils = { getBaseUrl, objectToArray, removeNullProperties };
63
-
64
- export default utils;