@stackfactor/client-api 1.1.73 → 1.1.75

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.
@@ -2,12 +2,12 @@ import { client } from "./axiosClient.js";
2
2
 
3
3
  /**
4
4
  * Get all permissions
5
- * @param {String} authToken The authentication token
5
+ * @param {String} token The authentication token
6
6
  */
7
- const getAllUserNotifications = (authToken) => {
7
+ const getAllUserNotifications = (token) => {
8
8
  return new Promise(function (resolve, reject) {
9
9
  const request = client.get(`api/v1/actionnotifications`, {
10
- headers: { authorization: authToken },
10
+ headers: { authorization: token },
11
11
  });
12
12
  request
13
13
  .then((response) => {
@@ -12,6 +12,8 @@ const client = axios.create({
12
12
  }),
13
13
  });
14
14
 
15
+ client.defaults.withCredentials = true;
16
+
15
17
  /**
16
18
  * Returns the error as a string
17
19
  * @param {Object} error
package/lib/dashboard.js CHANGED
@@ -56,6 +56,7 @@ const removeCardFromDashboard = (id, authToken) => {
56
56
  return new Promise(function (resolve, reject) {
57
57
  const request = client.delete(`/api/v1/dashboard/card`, {
58
58
  headers: { authorization: authToken },
59
+
59
60
  data: {
60
61
  id: id,
61
62
  },
@@ -47,6 +47,7 @@ const deleteDepartmentTrainingPlan = (id, token) => {
47
47
  return new Promise(function (resolve, reject) {
48
48
  const request = client.delete(`api/v1/departmenttrainingplans/`, {
49
49
  headers: { authorization: token },
50
+
50
51
  data: {
51
52
  id: id,
52
53
  },
@@ -43,6 +43,7 @@ const deleteLearningContent = (id, comments, token) => {
43
43
  return new Promise(function (resolve, reject) {
44
44
  const request = client.delete(`api/v1/learningcontent/`, {
45
45
  headers: { authorization: token },
46
+
46
47
  data: data,
47
48
  });
48
49
  request
@@ -66,6 +67,7 @@ const discardLearningContentChanges = (id, token) => {
66
67
  const data = {};
67
68
  const request = client.get(`api/v1/learningcontent/discard/${id}`, {
68
69
  headers: { authorization: token },
70
+
69
71
  data: data,
70
72
  });
71
73
  request
@@ -38,6 +38,7 @@ const deleteLearningPath = (id, comments, token) => {
38
38
  if (comments) data.comments = comments;
39
39
  const request = client.delete(`api/v1/learningpaths/`, {
40
40
  headers: { authorization: token },
41
+
41
42
  data: data,
42
43
  });
43
44
  request
@@ -60,6 +61,7 @@ const discardLearningPathChanges = (id, token) => {
60
61
  const data = {};
61
62
  const request = client.get(`api/v1/learningpaths/discard/${id}`, {
62
63
  headers: { authorization: token },
64
+
63
65
  data: data,
64
66
  });
65
67
  request
package/lib/role.js CHANGED
@@ -70,6 +70,7 @@ const deleteRole = (id, comments, token) => {
70
70
  if (comments) data.comments = comments;
71
71
  const request = client.delete(`api/v1/roles/`, {
72
72
  headers: { authorization: token },
73
+
73
74
  data: data,
74
75
  });
75
76
  request
@@ -93,6 +94,7 @@ const discardRoleChanges = (id, token) => {
93
94
  const data = {};
94
95
  const request = client.get(`api/v1/roles/discard/${id}`, {
95
96
  headers: { authorization: token },
97
+
96
98
  data: data,
97
99
  });
98
100
  request
@@ -37,6 +37,7 @@ const deleteRoleTemplate = (id, comments, token) => {
37
37
  if (comments) data.comments = comments;
38
38
  const request = client.delete(`api/v1/roletemplates/`, {
39
39
  headers: { authorization: token },
40
+
40
41
  data: data,
41
42
  });
42
43
  request
@@ -59,6 +60,7 @@ const discardRoleTemplateChanges = (id, token) => {
59
60
  const data = {};
60
61
  const request = client.get(`api/v1/roletemplates/discard/${id}`, {
61
62
  headers: { authorization: token },
63
+
62
64
  data: data,
63
65
  });
64
66
  request
package/lib/skill.js CHANGED
@@ -68,6 +68,7 @@ const deleteSkill = (id, comments, token) => {
68
68
  if (comments) data.comments = comments;
69
69
  const request = client.delete(`api/v1/skills/`, {
70
70
  headers: { authorization: token },
71
+
71
72
  data: data,
72
73
  });
73
74
  request
@@ -91,6 +92,7 @@ const discardSkillChanges = (id, token) => {
91
92
  const data = {};
92
93
  const request = client.get(`api/v1/skills/discard/${id}`, {
93
94
  headers: { authorization: token },
95
+
94
96
  data: data,
95
97
  });
96
98
  request
@@ -76,6 +76,7 @@ const deleteSkillAssessment = (id, comments, token) => {
76
76
  if (comments) data.comments = comments;
77
77
  const request = client.delete(`api/v1/skillassessments`, {
78
78
  headers: { authorization: token },
79
+
79
80
  data: data,
80
81
  });
81
82
  request
@@ -37,6 +37,7 @@ const deleteSkillTemplate = (id, comments, token) => {
37
37
  return new Promise(function (resolve, reject) {
38
38
  const request = client.delete(`api/v1/skilltemplates/`, {
39
39
  headers: { authorization: token },
40
+
40
41
  data: data,
41
42
  });
42
43
  request
@@ -59,6 +60,7 @@ const discardSkillTemplateChanges = (id, token) => {
59
60
  const data = {};
60
61
  const request = client.get(`api/v1/skilltemplates/discard/${id}`, {
61
62
  headers: { authorization: token },
63
+
62
64
  data: data,
63
65
  });
64
66
  request
package/lib/teams.js CHANGED
@@ -64,6 +64,7 @@ const deleteTeam = (teamId, defaultTeamId, authToken) => {
64
64
  return new Promise(function (resolve, reject) {
65
65
  const request = client.delete(`api/v1/teams/delete`, {
66
66
  headers: { authorization: authToken },
67
+
67
68
  data: {
68
69
  id: teamId,
69
70
  defaultTeamId: defaultTeamId,
@@ -63,6 +63,7 @@ const deleteTrainingPlan = (id, comments, token) => {
63
63
  if (comments) data.comments = comments;
64
64
  const request = client.delete(`api/v1/trainingplans/`, {
65
65
  headers: { authorization: token },
66
+
66
67
  data: data,
67
68
  });
68
69
  request
package/lib/users.js CHANGED
@@ -4,9 +4,9 @@ import { client } from "./axiosClient.js";
4
4
  /**
5
5
  * Add a new API Token
6
6
  * @param {Date} expiration Expiration date of the token
7
- * @param {String} authToken Authorization token
7
+ * @param {String} token Authorization token
8
8
  */
9
- const addAPIToken = (name, expiration, authToken) => {
9
+ const addAPIToken = (name, expiration, token) => {
10
10
  return new Promise(function (resolve, reject) {
11
11
  const requestData = {
12
12
  name: name,
@@ -16,7 +16,7 @@ const addAPIToken = (name, expiration, authToken) => {
16
16
  `api/v1/users/addapitoken`,
17
17
  requestData,
18
18
  {
19
- headers: { authorization: authToken },
19
+ headers: { authorization: token },
20
20
  }
21
21
  );
22
22
  addTokenRequest
@@ -59,9 +59,9 @@ const confirmEmailAddress = (validationCode) => {
59
59
  /**
60
60
  * Confirm phone number
61
61
  * @param {String} validationCode The code was provided to the user in advance by email
62
- * @param {String} authToken Authorization token
62
+ * @param {String} token Authorization token
63
63
  */
64
- const confirmPhone = (validationCode, authToken) => {
64
+ const confirmPhone = (validationCode, token) => {
65
65
  return new Promise(function (resolve, reject) {
66
66
  const requestData = {
67
67
  validationCode: validationCode,
@@ -70,7 +70,7 @@ const confirmPhone = (validationCode, authToken) => {
70
70
  "api/v1/users/confirmPhone",
71
71
  requestData,
72
72
  {
73
- headers: { authorization: authToken },
73
+ headers: { authorization: token },
74
74
  }
75
75
  );
76
76
  confirmationRequest
@@ -86,9 +86,9 @@ const confirmPhone = (validationCode, authToken) => {
86
86
  /**
87
87
  * Generate confirmation code
88
88
  * @param {String} phoneNumber Send confirmation code to the phone number
89
- * @param {String} authToken Authorization token
89
+ * @param {String} token Authorization token
90
90
  */
91
- const confirmPhoneGenerateCode = (phoneNumber, authToken) => {
91
+ const confirmPhoneGenerateCode = (phoneNumber, token) => {
92
92
  return new Promise(function (resolve, reject) {
93
93
  const requestData = {
94
94
  phoneNumber: phoneNumber,
@@ -97,7 +97,7 @@ const confirmPhoneGenerateCode = (phoneNumber, authToken) => {
97
97
  "api/v1/users/confirmPhoneGenerateCode",
98
98
  requestData,
99
99
  {
100
- headers: { authorization: authToken },
100
+ headers: { authorization: token },
101
101
  }
102
102
  );
103
103
  confirmationRequest
@@ -206,6 +206,7 @@ const deleteAPIToken = (token, authToken) => {
206
206
  return new Promise(function (resolve, reject) {
207
207
  const deleteTokenRequest = client.delete(`api/v1/users/user/token`, {
208
208
  headers: { authorization: authToken },
209
+
209
210
  data: {
210
211
  token: token,
211
212
  },
@@ -223,12 +224,13 @@ const deleteAPIToken = (token, authToken) => {
223
224
  /**
224
225
  * Delete existing users
225
226
  * @param {Array<String>} userIds The ID of the users to be deleted
226
- * @param {String} authToken Authorization token
227
+ * @param {String} token Authorization token
227
228
  */
228
- const deleteUsers = (userIds, authToken) => {
229
+ const deleteUsers = (userIds, token) => {
229
230
  return new Promise(function (resolve, reject) {
230
231
  const deleteTokenRequest = client.delete(`api/v1/users/`, {
231
- headers: { authorization: authToken },
232
+ headers: { authorization: token },
233
+
232
234
  data: {
233
235
  userIds: userIds,
234
236
  },
@@ -245,12 +247,12 @@ const deleteUsers = (userIds, authToken) => {
245
247
 
246
248
  /**
247
249
  * Get all the API tokens
248
- * @param {String} authToken Authorization token
250
+ * @param {String} token Authorization token
249
251
  */
250
- const getAPITokens = (authToken) => {
252
+ const getAPITokens = (token) => {
251
253
  return new Promise(function (resolve, reject) {
252
254
  const getTokensRequest = client.get(`api/v1/users/getapitokens`, {
253
- headers: { authorization: authToken },
255
+ headers: { authorization: token },
254
256
  });
255
257
  getTokensRequest
256
258
  .then((result) => {
@@ -265,10 +267,13 @@ const getAPITokens = (authToken) => {
265
267
  /**
266
268
  * Get the specified user account by Id. It returns a promise
267
269
  * @param {String} id Id of the user for which information is being requested
270
+ * @param {String} token Authorization token
268
271
  */
269
- const getUserById = (id) => {
272
+ const getUserById = (id, token) => {
270
273
  return new Promise(function (resolve, reject) {
271
- const getUserInformationRequest = client.get(`api/v1/users/user/${id}`);
274
+ const getUserInformationRequest = client.get(`api/v1/users/user/${id}`, {
275
+ headers: { authorization: token },
276
+ });
272
277
  getUserInformationRequest
273
278
  .then((result) => {
274
279
  if (result != null) {
@@ -411,7 +416,7 @@ const logout = (token) => {
411
416
  */
412
417
  const refreshToken = (token) => {
413
418
  return new Promise(function (resolve, reject) {
414
- let options = { headers: { Authorization: token } };
419
+ let options = { headers: { authorization: token } };
415
420
  let request = client.post("api/v1/auth/refreshToken", {}, options);
416
421
  request
417
422
  .then((response) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackfactor/client-api",
3
- "version": "1.1.73",
3
+ "version": "1.1.75",
4
4
  "description": "Node.js library for the StackFactor API",
5
5
  "main": "index.js",
6
6
  "exports": {