@stackfactor/client-api 1.1.73 → 1.1.74

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.
@@ -12,6 +12,7 @@ const getTrainingPlanProficiencyLevel = (proficiencyLevelId, token) => {
12
12
  `api/v1/trainingplans/proficiencylevels/${proficiencyLevelId}`,
13
13
  {
14
14
  headers: { authorization: token },
15
+ withCredentials: true,
15
16
  }
16
17
  );
17
18
  confirmationRequest
@@ -48,6 +49,7 @@ const getTrainingPlanProficiencyLevelList = (
48
49
  requestData,
49
50
  {
50
51
  headers: { authorization: token },
52
+ withCredentials: true,
51
53
  }
52
54
  );
53
55
  confirmationRequest
@@ -73,6 +75,7 @@ const reorderTrainingPlansProficiencyLevels = (order, token) => {
73
75
  { order: order },
74
76
  {
75
77
  headers: { authorization: token },
78
+ withCredentials: true,
76
79
  }
77
80
  );
78
81
  confirmationRequest
@@ -104,6 +107,7 @@ const updateTrainingPlanProficiencyLevel = (
104
107
  data,
105
108
  {
106
109
  headers: { authorization: token },
110
+ withCredentials: true,
107
111
  }
108
112
  );
109
113
  confirmationRequest
@@ -17,6 +17,7 @@ const addEntryToArrayBusinessProperty = (userId, property, data, token) => {
17
17
  requestData,
18
18
  {
19
19
  headers: { authorization: token },
20
+ withCredentials: true,
20
21
  }
21
22
  );
22
23
  confirmationRequest
@@ -42,6 +43,7 @@ const removeEntryFromArrayBusinessProperty = (userId, property, id, token) => {
42
43
  `api/v1/user/arrayproperty/${userId}/${property}/${id}`,
43
44
  {
44
45
  headers: { authorization: token },
46
+ withCredentials: true,
45
47
  }
46
48
  );
47
49
  confirmationRequest
@@ -78,6 +80,7 @@ const updateEntryfromArrayBusinessProperty = (
78
80
  requestData,
79
81
  {
80
82
  headers: { authorization: token },
83
+ withCredentials: true,
81
84
  }
82
85
  );
83
86
  confirmationRequest
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,8 @@ 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
+ withCredentials: true,
20
21
  }
21
22
  );
22
23
  addTokenRequest
@@ -59,9 +60,9 @@ const confirmEmailAddress = (validationCode) => {
59
60
  /**
60
61
  * Confirm phone number
61
62
  * @param {String} validationCode The code was provided to the user in advance by email
62
- * @param {String} authToken Authorization token
63
+ * @param {String} token Authorization token
63
64
  */
64
- const confirmPhone = (validationCode, authToken) => {
65
+ const confirmPhone = (validationCode, token) => {
65
66
  return new Promise(function (resolve, reject) {
66
67
  const requestData = {
67
68
  validationCode: validationCode,
@@ -70,7 +71,8 @@ const confirmPhone = (validationCode, authToken) => {
70
71
  "api/v1/users/confirmPhone",
71
72
  requestData,
72
73
  {
73
- headers: { authorization: authToken },
74
+ headers: { authorization: token },
75
+ withCredentials: true,
74
76
  }
75
77
  );
76
78
  confirmationRequest
@@ -86,9 +88,9 @@ const confirmPhone = (validationCode, authToken) => {
86
88
  /**
87
89
  * Generate confirmation code
88
90
  * @param {String} phoneNumber Send confirmation code to the phone number
89
- * @param {String} authToken Authorization token
91
+ * @param {String} token Authorization token
90
92
  */
91
- const confirmPhoneGenerateCode = (phoneNumber, authToken) => {
93
+ const confirmPhoneGenerateCode = (phoneNumber, token) => {
92
94
  return new Promise(function (resolve, reject) {
93
95
  const requestData = {
94
96
  phoneNumber: phoneNumber,
@@ -97,7 +99,8 @@ const confirmPhoneGenerateCode = (phoneNumber, authToken) => {
97
99
  "api/v1/users/confirmPhoneGenerateCode",
98
100
  requestData,
99
101
  {
100
- headers: { authorization: authToken },
102
+ headers: { authorization: token },
103
+ withCredentials: true,
101
104
  }
102
105
  );
103
106
  confirmationRequest
@@ -206,6 +209,7 @@ const deleteAPIToken = (token, authToken) => {
206
209
  return new Promise(function (resolve, reject) {
207
210
  const deleteTokenRequest = client.delete(`api/v1/users/user/token`, {
208
211
  headers: { authorization: authToken },
212
+ withCredentials: true,
209
213
  data: {
210
214
  token: token,
211
215
  },
@@ -223,12 +227,13 @@ const deleteAPIToken = (token, authToken) => {
223
227
  /**
224
228
  * Delete existing users
225
229
  * @param {Array<String>} userIds The ID of the users to be deleted
226
- * @param {String} authToken Authorization token
230
+ * @param {String} token Authorization token
227
231
  */
228
- const deleteUsers = (userIds, authToken) => {
232
+ const deleteUsers = (userIds, token) => {
229
233
  return new Promise(function (resolve, reject) {
230
234
  const deleteTokenRequest = client.delete(`api/v1/users/`, {
231
- headers: { authorization: authToken },
235
+ headers: { authorization: token },
236
+ withCredentials: true,
232
237
  data: {
233
238
  userIds: userIds,
234
239
  },
@@ -245,12 +250,13 @@ const deleteUsers = (userIds, authToken) => {
245
250
 
246
251
  /**
247
252
  * Get all the API tokens
248
- * @param {String} authToken Authorization token
253
+ * @param {String} token Authorization token
249
254
  */
250
- const getAPITokens = (authToken) => {
255
+ const getAPITokens = (token) => {
251
256
  return new Promise(function (resolve, reject) {
252
257
  const getTokensRequest = client.get(`api/v1/users/getapitokens`, {
253
- headers: { authorization: authToken },
258
+ headers: { authorization: token },
259
+ withCredentials: true,
254
260
  });
255
261
  getTokensRequest
256
262
  .then((result) => {
@@ -265,10 +271,14 @@ const getAPITokens = (authToken) => {
265
271
  /**
266
272
  * Get the specified user account by Id. It returns a promise
267
273
  * @param {String} id Id of the user for which information is being requested
274
+ * @param {String} token Authorization token
268
275
  */
269
- const getUserById = (id) => {
276
+ const getUserById = (id, token) => {
270
277
  return new Promise(function (resolve, reject) {
271
- const getUserInformationRequest = client.get(`api/v1/users/user/${id}`);
278
+ const getUserInformationRequest = client.get(`api/v1/users/user/${id}`, {
279
+ headers: { authorization: token },
280
+ withCredentials: true,
281
+ });
272
282
  getUserInformationRequest
273
283
  .then((result) => {
274
284
  if (result != null) {
@@ -295,6 +305,7 @@ const getUserInformation = (userId, category, token) => {
295
305
  `api/v1/users/user/${userId || 0}/${category || "*"}`,
296
306
  {
297
307
  headers: { authorization: token },
308
+ withCredentials: true,
298
309
  }
299
310
  );
300
311
  confirmationRequest
@@ -321,6 +332,7 @@ const getUsers = (filter, fields, token) => {
321
332
  };
322
333
  let confirmationRequest = client.post(`api/v1/users/`, requestData, {
323
334
  headers: { authorization: token },
335
+ withCredentials: true,
324
336
  });
325
337
  confirmationRequest
326
338
  .then((response) => {
@@ -349,6 +361,7 @@ const inviteUsers = (invitees, groupId, teamId, authToken) => {
349
361
  };
350
362
  let request = client.post("api/v1/users/invite", requestData, {
351
363
  headers: { authorization: authToken },
364
+ withCredentials: true,
352
365
  });
353
366
  request
354
367
  .then((response) => {
@@ -392,6 +405,7 @@ const logout = (token) => {
392
405
  return new Promise(function (resolve, reject) {
393
406
  const options = {
394
407
  headers: { authorization: token },
408
+ withCredentials: true,
395
409
  };
396
410
  let request = client.post("api/v1/auth/logout", {}, options);
397
411
  request
@@ -411,7 +425,7 @@ const logout = (token) => {
411
425
  */
412
426
  const refreshToken = (token) => {
413
427
  return new Promise(function (resolve, reject) {
414
- let options = { headers: { Authorization: token } };
428
+ let options = { headers: { authorization: token }, withCredentials: true };
415
429
  let request = client.post("api/v1/auth/refreshToken", {}, options);
416
430
  request
417
431
  .then((response) => {
@@ -438,6 +452,7 @@ const removeAPIToken = (id, authToken) => {
438
452
  requestData,
439
453
  {
440
454
  headers: { authorization: authToken },
455
+ withCredentials: true,
441
456
  }
442
457
  );
443
458
  removeTokenRequest
@@ -463,6 +478,7 @@ const resendInvitationEmails = (invitees, authToken) => {
463
478
  };
464
479
  let request = client.post("api/v1/users/resendinvite", requestData, {
465
480
  headers: { authorization: authToken },
481
+ withCredentials: true,
466
482
  });
467
483
  request
468
484
  .then((response) => {
@@ -536,6 +552,7 @@ const setUserInformation = (userId, category, data, token) => {
536
552
  };
537
553
  let confirmationRequest = client.post("api/v1/users/user", requestData, {
538
554
  headers: { authorization: token },
555
+ withCredentials: true,
539
556
  });
540
557
  confirmationRequest
541
558
  .then((response) => {
@@ -564,6 +581,7 @@ const updateUserEmail = (email, password, token) => {
564
581
  requestData,
565
582
  {
566
583
  headers: { authorization: token },
584
+ withCredentials: true,
567
585
  }
568
586
  );
569
587
  confirmationRequest
@@ -593,6 +611,7 @@ const updateUserGroups = (userId, groups, token) => {
593
611
  requestData,
594
612
  {
595
613
  headers: { authorization: token },
614
+ withCredentials: true,
596
615
  }
597
616
  );
598
617
  confirmationRequest
@@ -622,6 +641,7 @@ const updateUserPassword = (password, newPassword, token) => {
622
641
  requestData,
623
642
  {
624
643
  headers: { authorization: token },
644
+ withCredentials: true,
625
645
  }
626
646
  );
627
647
  confirmationRequest
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.74",
4
4
  "description": "Node.js library for the StackFactor API",
5
5
  "main": "index.js",
6
6
  "exports": {