@stackfactor/client-api 1.1.30 → 1.1.32

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 ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "env": {
3
+ "browser": true,
4
+ "es2021": true
5
+ },
6
+ "extends": ["eslint:recommended", "plugin:react/recommended"],
7
+ "parserOptions": {
8
+ "ecmaVersion": "latest",
9
+ "sourceType": "module"
10
+ },
11
+ "plugins": [],
12
+ "rules": {}
13
+ }
package/exports.js CHANGED
@@ -34,6 +34,7 @@ import skillTemplate from "./lib/skillTemplate.js";
34
34
  import team from "./lib/teams.js";
35
35
  import tenant from "./lib/tenants.js";
36
36
  import trainingPlan from "./lib/trainingPlans.js";
37
+ import trainingPlanProficiencyLevel from "./lib/trainingPlansProficiencyLevels.js";
37
38
  import userInformation from "./lib/userInformation.js";
38
39
  import users from "./lib/users.js";
39
40
 
@@ -70,6 +71,7 @@ export {
70
71
  team,
71
72
  tenant,
72
73
  trainingPlan,
74
+ trainingPlanProficiencyLevel,
73
75
  userInformation,
74
76
  users,
75
77
  };
package/index.js CHANGED
@@ -1,3 +1 @@
1
- import * as api from "./exports.js";
2
1
  export * from "./exports.js";
3
- export default api;
@@ -73,10 +73,8 @@ export const processNotification = (id, action, comments, authToken) => {
73
73
  });
74
74
  };
75
75
 
76
- const actionNotifications = {
76
+ export default {
77
77
  getAllUserNotifications,
78
78
  markNotifications,
79
79
  processNotification,
80
80
  };
81
-
82
- export default actionNotifications;
package/lib/address.js CHANGED
@@ -22,6 +22,4 @@ export const autoComplete = (input, authToken) => {
22
22
  });
23
23
  };
24
24
 
25
- const address = { autoComplete };
26
-
27
- export default address;
25
+ export default { autoComplete };
@@ -136,11 +136,9 @@ const startConversation = (
136
136
  });
137
137
  };
138
138
 
139
- const aiAssistant = {
139
+ export default {
140
140
  askQuestion,
141
141
  endConversation,
142
142
  getConversationByElementId,
143
143
  startConversation,
144
144
  };
145
-
146
- export default aiAssistant;
package/lib/config.js CHANGED
@@ -65,10 +65,8 @@ export const setConfigurationById = (id, data, authToken) => {
65
65
  });
66
66
  };
67
67
 
68
- const config = {
68
+ export default {
69
69
  getConfigurationById,
70
70
  getConfigurationByType,
71
71
  setConfigurationById,
72
72
  };
73
-
74
- export default config;
package/lib/dashboard.js CHANGED
@@ -14,7 +14,7 @@ export const addCardToDashboard = (id, position, data, authToken) => {
14
14
  {
15
15
  id: id,
16
16
  position: position,
17
- data: data ? data : {},
17
+ data: data || {},
18
18
  },
19
19
  { headers: { authorization: authToken } }
20
20
  );
@@ -70,10 +70,8 @@ export const removeCardFromDashboard = (id, authToken) => {
70
70
  });
71
71
  };
72
72
 
73
- const dashboard = {
73
+ export default {
74
74
  addCardToDashboard,
75
75
  getDashboardCardsList,
76
76
  removeCardFromDashboard,
77
77
  };
78
-
79
- export default dashboard;
@@ -16,10 +16,10 @@ export const createDepartmentTrainingPlan = (
16
16
  ) => {
17
17
  return new Promise(function (resolve, reject) {
18
18
  const requestData = {
19
- name: name ? name : "",
20
- summary: summary ? summary : "",
21
- skill: skill ? skill : "",
22
- activities: activities ? activities : [],
19
+ name: name || "",
20
+ summary: summary || "",
21
+ skill: skill || "",
22
+ activities: activities || [],
23
23
  };
24
24
  let confirmationRequest = client.put(
25
25
  "api/v1/departmentTrainingPlans",
@@ -96,7 +96,7 @@ export const getDepartmentTrainingPlanInformationById = (
96
96
  export const getDepartmentTrainingPlanList = (filter, version, token) => {
97
97
  return new Promise(function (resolve, reject) {
98
98
  const requestData = {
99
- filter: filter ? filter : "",
99
+ filter: filter || "",
100
100
  version: version,
101
101
  };
102
102
  let confirmationRequest = client.post(
package/lib/groups.js CHANGED
@@ -284,7 +284,7 @@ export const updateGroup = (groupId, name, description, authToken) => {
284
284
  });
285
285
  };
286
286
 
287
- const groups = {
287
+ export default {
288
288
  addPermissionsToGroup,
289
289
  addUsersToGroup,
290
290
  createGroup,
@@ -298,5 +298,3 @@ const groups = {
298
298
  setDefault,
299
299
  updateGroup,
300
300
  };
301
-
302
- export default groups;
@@ -335,7 +335,7 @@ export const setDefaultIntegration = (id, token) => {
335
335
  });
336
336
  };
337
337
 
338
- const integration = {
338
+ export default {
339
339
  createIntegration,
340
340
  deleteIntegration,
341
341
  discardIntegrationChanges,
@@ -348,5 +348,3 @@ const integration = {
348
348
  setDefaultIntegration,
349
349
  setIntegrationInformation,
350
350
  };
351
-
352
- export default integration;
@@ -99,10 +99,8 @@ export const testIntegrationConfiguration = (
99
99
  });
100
100
  };
101
101
 
102
- const integrationConfiguration = {
102
+ export default {
103
103
  getIntegrationsConfiguration,
104
104
  saveIntegrationConfiguration,
105
105
  testIntegrationConfiguration,
106
106
  };
107
-
108
- export default integrationConfiguration;
@@ -393,7 +393,7 @@ export const watchLearningContent = (id, watch, token) => {
393
393
  });
394
394
  };
395
395
 
396
- const learningContent = {
396
+ export default {
397
397
  createLearningContent,
398
398
  deleteLearningContent,
399
399
  discardLearningContentChanges,
@@ -408,5 +408,3 @@ const learningContent = {
408
408
  setLearningContentTags,
409
409
  watchLearningContent,
410
410
  };
411
-
412
- export default learningContent;
@@ -206,7 +206,7 @@ export const setLearningPathTags = (id, tags, token) => {
206
206
  });
207
207
  };
208
208
 
209
- const learningPath = {
209
+ export default {
210
210
  createLearningPath,
211
211
  deleteLearningPath,
212
212
  discardLearningPathChanges,
@@ -216,5 +216,3 @@ const learningPath = {
216
216
  setLearningPathInformation,
217
217
  setLearningPathTags,
218
218
  };
219
-
220
- export default learningPath;
package/lib/logger.js CHANGED
@@ -55,6 +55,4 @@ export const getListByElementId = (elementId, page, elementsPerPage, token) => {
55
55
  });
56
56
  };
57
57
 
58
- const logger = { comments, getListByElementId };
59
-
60
- export default logger;
58
+ export default { comments, getListByElementId };
@@ -55,9 +55,7 @@ const saveResponses = (learningContentId, microSkillId, responses, token) => {
55
55
  });
56
56
  };
57
57
 
58
- const microSkillsQuizes = {
58
+ export default {
59
59
  getResponses,
60
60
  saveResponses,
61
61
  };
62
-
63
- export default microSkillsQuizes;
package/lib/role.js CHANGED
@@ -386,7 +386,7 @@ export const watchRole = (id, watch, token) => {
386
386
  });
387
387
  };
388
388
 
389
- const role = {
389
+ export default {
390
390
  createRole,
391
391
  createRoleFromTemplate,
392
392
  deleteRole,
@@ -402,5 +402,3 @@ const role = {
402
402
  setUserRoles,
403
403
  watchRole,
404
404
  };
405
-
406
- export default role;
@@ -243,7 +243,7 @@ export const watchRoleTemplate = (id, watch, token) => {
243
243
  });
244
244
  };
245
245
 
246
- const roleTemplate = {
246
+ export default {
247
247
  createRoleTemplate,
248
248
  deleteRoleTemplate,
249
249
  discardRoleTemplateChanges,
@@ -254,5 +254,3 @@ const roleTemplate = {
254
254
  setTemplateTags,
255
255
  watchRoleTemplate,
256
256
  };
257
-
258
- export default roleTemplate;
package/lib/skill.js CHANGED
@@ -490,7 +490,7 @@ export const watchSkill = (id, watch, token) => {
490
490
  });
491
491
  };
492
492
 
493
- const skill = {
493
+ export default {
494
494
  createSkill,
495
495
  createSkillsFromTemplates,
496
496
  deleteSkill,
@@ -510,5 +510,3 @@ const skill = {
510
510
  validateSkill,
511
511
  watchSkill,
512
512
  };
513
-
514
- export default skill;
@@ -137,12 +137,10 @@ export const startSession = (skillId, saveSession, token) => {
137
137
  });
138
138
  };
139
139
 
140
- const skillAessementTestingSession = {
140
+ export default {
141
141
  endSession,
142
142
  getNextStep,
143
143
  getSkillTestAssessment,
144
144
  pause,
145
145
  startSession,
146
146
  };
147
-
148
- export default skillAessementTestingSession;
@@ -134,12 +134,10 @@ export const getList = (userId, token) => {
134
134
  });
135
135
  };
136
136
 
137
- const skillAssessments = {
137
+ export default {
138
138
  addEntry,
139
139
  create,
140
140
  deleteSkillAssessment,
141
141
  getById,
142
142
  getList,
143
143
  };
144
-
145
- export default skillAssessments;
@@ -301,7 +301,7 @@ export const watchSkillTemplate = (id, watch, token) => {
301
301
  });
302
302
  };
303
303
 
304
- const skillTemplate = {
304
+ export default {
305
305
  createSkillTemplate,
306
306
  deleteSkillTemplate,
307
307
  discardSkillTemplateChanges,
@@ -314,5 +314,3 @@ const skillTemplate = {
314
314
  validateTemplate,
315
315
  watchSkillTemplate,
316
316
  };
317
-
318
- export default skillTemplate;
package/lib/teams.js CHANGED
@@ -161,7 +161,7 @@ export const getTeamByUserId = (
161
161
  ) => {
162
162
  return new Promise(function (resolve, reject) {
163
163
  const request = client.post(
164
- `/api/v1/teams/getuserteam/${userId ? userId : ""}`,
164
+ `/api/v1/teams/getuserteam/${userId || ""}`,
165
165
  {
166
166
  includeUserSummaryInformation: includeUserSummaryInformation,
167
167
  },
@@ -277,7 +277,7 @@ export const updateTeam = (teamId, data, authToken) => {
277
277
  });
278
278
  };
279
279
 
280
- const team = {
280
+ export default {
281
281
  addUsersToTeam,
282
282
  createTeam,
283
283
  deleteTeam,
@@ -290,5 +290,3 @@ const team = {
290
290
  setDefault,
291
291
  updateTeam,
292
292
  };
293
-
294
- export default team;
package/lib/tenants.js CHANGED
@@ -52,6 +52,4 @@ export const setTenantInformation = (category, data, token) => {
52
52
  });
53
53
  };
54
54
 
55
- const tenant = { getTenantInformation, setTenantInformation };
56
-
57
- export default tenant;
55
+ export default { getTenantInformation, setTenantInformation };
@@ -264,7 +264,7 @@ export const updateActivities = (planId, data, token) => {
264
264
  });
265
265
  };
266
266
 
267
- const trainingPlan = {
267
+ export default {
268
268
  createTrainingPlan,
269
269
  deleteTrainingPlan,
270
270
  discardTrainingPlanChanges,
@@ -275,5 +275,3 @@ const trainingPlan = {
275
275
  updateTrainingPlan,
276
276
  updateActivities,
277
277
  };
278
-
279
- export default trainingPlan;
@@ -0,0 +1,99 @@
1
+ import { client } from "./axiosClient.js";
2
+
3
+ /**
4
+ * Get training plan proficiency level
5
+ * @param {String} proficiencyLevelId
6
+ * @param {String} token
7
+ * @returns {Object} An object containing the proficiency level information
8
+ */
9
+ export const getTrainingPlanProficiencyLevel = (proficiencyLevelId, token) => {
10
+ return new Promise(function (resolve, reject) {
11
+ let confirmationRequest = client.get(
12
+ `api/v1/trainingplans/proficiencylevel/${proficiencyLevelId}`,
13
+ {
14
+ headers: { authorization: token },
15
+ }
16
+ );
17
+ confirmationRequest
18
+ .then((response) => {
19
+ resolve(response.data);
20
+ })
21
+ .catch((error) => {
22
+ reject(error);
23
+ });
24
+ });
25
+ };
26
+
27
+ /**
28
+ * Get training plan proficiency level list
29
+ * @param {Boolean} includeDeleted If set true it will return deleted plans too
30
+ * @param {Boolean} includeClosed If set to true it will return all the closed items too
31
+ * @param {String} token Authorization token
32
+ */
33
+ export const getTrainingPlanProficiencyLevelList = (
34
+ includeDeleted,
35
+ includeDetailedInformation,
36
+ includeClosed,
37
+ token
38
+ ) => {
39
+ return new Promise(function (resolve, reject) {
40
+ const requestData = {
41
+ includeClosed: includeClosed,
42
+ includeDeleted: includeDeleted,
43
+ includeDetailedInformation: includeDetailedInformation,
44
+ };
45
+ let confirmationRequest = client.post(
46
+ `api/v1/trainingplans/proficiencylevels`,
47
+ requestData,
48
+ {
49
+ headers: { authorization: token },
50
+ }
51
+ );
52
+ confirmationRequest
53
+ .then((response) => {
54
+ resolve(response.data);
55
+ })
56
+ .catch((error) => {
57
+ reject(error);
58
+ });
59
+ });
60
+ };
61
+
62
+ /**
63
+ * Update a training plan proficiency level
64
+ * @param {String} planId
65
+ * @param {Object} data Ordered array of objects containing the activity Id and the new status
66
+ * @param {Function} successCallBack
67
+ * @param {Function} failCallBack
68
+ * @returns {Object} An object containing the task information
69
+ */
70
+ export const updateTrainingPlanProficiencyLevel = (
71
+ proficiencyLevelId,
72
+ data,
73
+ token
74
+ ) => {
75
+ return new Promise(function (resolve, reject) {
76
+ let confirmationRequest = client.post(
77
+ `api/v1/trainingplans/proficiencylevel/${proficiencyLevelId}`,
78
+ data,
79
+ {
80
+ headers: { authorization: token },
81
+ }
82
+ );
83
+ confirmationRequest
84
+ .then(() => {
85
+ resolve();
86
+ })
87
+ .catch((error) => {
88
+ reject(error);
89
+ });
90
+ });
91
+ };
92
+
93
+ const trainingPlanProficiencyLevel = {
94
+ getTrainingPlanProficiencyLevel,
95
+ getTrainingPlanProficiencyLevelList,
96
+ updateTrainingPlanProficiencyLevel,
97
+ };
98
+
99
+ export default trainingPlanProficiencyLevel;
@@ -100,10 +100,8 @@ export const updateEntryfromArrayBusinessProperty = (
100
100
  });
101
101
  };
102
102
 
103
- export const userInformation = {
103
+ export default {
104
104
  addEntryToArrayBusinessProperty,
105
105
  removeEntryFromArrayBusinessProperty,
106
106
  updateEntryfromArrayBusinessProperty,
107
107
  };
108
-
109
- export default userInformation;
package/lib/users.js CHANGED
@@ -297,7 +297,7 @@ export const getUserById = (id) => {
297
297
  export const getUserInformation = (userId, category, token) => {
298
298
  return new Promise(function (resolve, reject) {
299
299
  let confirmationRequest = client.get(
300
- `api/v1/users/user/${userId ? userId : 0}/${category ? category : "*"}`,
300
+ `api/v1/users/user/${userId || 0}/${category || "*"}`,
301
301
  {
302
302
  headers: { authorization: token },
303
303
  }
@@ -664,7 +664,7 @@ export const validateResetPasswordCode = (email, code) => {
664
664
  });
665
665
  };
666
666
 
667
- const users = {
667
+ export default {
668
668
  addAPIToken,
669
669
  confirmEmailAddress,
670
670
  confirmPhone,
@@ -691,5 +691,3 @@ const users = {
691
691
  updateUserPassword,
692
692
  validateResetPasswordCode,
693
693
  };
694
-
695
- export default users;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackfactor/client-api",
3
- "version": "1.1.30",
3
+ "version": "1.1.32",
4
4
  "description": "Node.js library for the StackFactor API",
5
5
  "main": "index.js",
6
6
  "exports": {
@@ -12,6 +12,7 @@
12
12
  },
13
13
  "type": "module",
14
14
  "scripts": {
15
+ "lint": "eslint lib/**/*.js",
15
16
  "test": "echo \"Error: no test specified\" && exit 1"
16
17
  },
17
18
  "repository": {
@@ -30,5 +31,9 @@
30
31
  "html2plaintext": "^2.1.4",
31
32
  "https": "^1.0.0",
32
33
  "node-html-parser": "^6.1.5"
34
+ },
35
+ "devDependencies": {
36
+ "eslint": "^8.57.0",
37
+ "eslint-plugin-react": "^7.34.0"
33
38
  }
34
39
  }