@stackfactor/client-api 1.0.1 → 1.0.3
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/index.js +22 -22
- package/lib/actionNotifications.js +16 -19
- package/lib/address.js +3 -3
- package/lib/axios.js +66 -62
- package/lib/config.js +5 -12
- package/lib/dashboard.js +5 -5
- package/lib/departmentTrainingPlans.js +9 -9
- package/lib/groups.js +19 -23
- package/lib/integration.js +24 -20
- package/lib/integrationConfiguration.js +5 -5
- package/lib/integrations/contentgenerator.js +4 -5
- package/lib/logger.js +6 -6
- package/lib/role.js +14 -14
- package/lib/roleTemplate.js +11 -11
- package/lib/skill.js +16 -17
- package/lib/skillAssessmentTestingSession.js +7 -7
- package/lib/skillAssessments.js +7 -7
- package/lib/skillTemplate.js +11 -11
- package/lib/teams.js +15 -18
- package/lib/templateDocument.js +6 -14
- package/lib/templatePhase.js +5 -13
- package/lib/templateRelease.js +4 -10
- package/lib/templates.js +8 -19
- package/lib/tenants.js +4 -7
- package/lib/trainingPlanTemplate.js +10 -10
- package/lib/trainingPlans.js +12 -12
- package/lib/userInformation.js +4 -4
- package/lib/users.js +34 -44
- package/lib/utils.js +1 -5
- package/package.json +9 -2
package/lib/userInformation.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const { axios } = require("./axios");
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
axios: axios,
|
|
@@ -10,7 +10,7 @@ export default {
|
|
|
10
10
|
* @param {Object} data
|
|
11
11
|
* @param {String} token Authorization token
|
|
12
12
|
*/
|
|
13
|
-
addEntryToArrayBusinessProperty(userId, property, data, token) {
|
|
13
|
+
addEntryToArrayBusinessProperty: (userId, property, data, token) => {
|
|
14
14
|
return new Promise(function (resolve, reject) {
|
|
15
15
|
const requestData = {
|
|
16
16
|
data: data,
|
|
@@ -39,7 +39,7 @@ export default {
|
|
|
39
39
|
* @param {String} id
|
|
40
40
|
* @param {String} token Authorization token
|
|
41
41
|
*/
|
|
42
|
-
removeEntryFromArrayBusinessProperty(userId, property, id, token) {
|
|
42
|
+
removeEntryFromArrayBusinessProperty: (userId, property, id, token) => {
|
|
43
43
|
return new Promise(function (resolve, reject) {
|
|
44
44
|
const confirmationRequest = axios.delete(
|
|
45
45
|
`api/v1/user/arrayproperty/${userId}/${property}/${id}`,
|
|
@@ -65,7 +65,7 @@ export default {
|
|
|
65
65
|
* @param {Object} data
|
|
66
66
|
* @param {String} token Authorization token
|
|
67
67
|
*/
|
|
68
|
-
updateEntryfromArrayBusinessProperty(userId, property, id, data, token) {
|
|
68
|
+
updateEntryfromArrayBusinessProperty: (userId, property, id, data, token) => {
|
|
69
69
|
return new Promise(function (resolve, reject) {
|
|
70
70
|
const requestData = {
|
|
71
71
|
data: data,
|
package/lib/users.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
// User sepcific requests
|
|
3
|
-
//
|
|
4
|
-
import axios from "./axios";
|
|
1
|
+
const { axios } = require("./axios");
|
|
5
2
|
import { removeNullProperties } from "../components/Utils";
|
|
6
3
|
|
|
7
4
|
export default {
|
|
@@ -12,7 +9,7 @@ export default {
|
|
|
12
9
|
* @param {Date} expiration Expiration date of the token
|
|
13
10
|
* @param {String} authToken Authorization token
|
|
14
11
|
*/
|
|
15
|
-
addAPIToken(name, expiration, authToken) {
|
|
12
|
+
addAPIToken: (name, expiration, authToken) => {
|
|
16
13
|
return new Promise(function (resolve, reject) {
|
|
17
14
|
const requestData = removeNullProperties({
|
|
18
15
|
name: name,
|
|
@@ -41,11 +38,9 @@ export default {
|
|
|
41
38
|
|
|
42
39
|
/**
|
|
43
40
|
* Confirm email address
|
|
44
|
-
*
|
|
45
41
|
* @param {String} validationCode The code was provided to the user in advance by email
|
|
46
|
-
*
|
|
47
42
|
*/
|
|
48
|
-
confirmEmailAddress(validationCode) {
|
|
43
|
+
confirmEmailAddress: (validationCode) => {
|
|
49
44
|
return new Promise(function (resolve, reject) {
|
|
50
45
|
const requestData = removeNullProperties({
|
|
51
46
|
validationCode: validationCode,
|
|
@@ -65,9 +60,7 @@ export default {
|
|
|
65
60
|
},
|
|
66
61
|
|
|
67
62
|
/**
|
|
68
|
-
*
|
|
69
63
|
* Create a new account (tenant). It returns a promise
|
|
70
|
-
*
|
|
71
64
|
* @param {String} email User's email address
|
|
72
65
|
* @param {String} firstName User's first name
|
|
73
66
|
* @param {String} lastName User's last name
|
|
@@ -76,7 +69,14 @@ export default {
|
|
|
76
69
|
* @param {String} inviteCode Invitation code received in advance from one of the account owners
|
|
77
70
|
* @param
|
|
78
71
|
*/
|
|
79
|
-
createAccount(
|
|
72
|
+
createAccount: (
|
|
73
|
+
email,
|
|
74
|
+
firstName,
|
|
75
|
+
lastName,
|
|
76
|
+
password,
|
|
77
|
+
subSite,
|
|
78
|
+
inviteCode
|
|
79
|
+
) => {
|
|
80
80
|
return new Promise(function (resolve, reject) {
|
|
81
81
|
if (
|
|
82
82
|
email.trim() === "" ||
|
|
@@ -110,15 +110,13 @@ export default {
|
|
|
110
110
|
|
|
111
111
|
/**
|
|
112
112
|
* Create a new user account. It returns a promise
|
|
113
|
-
*
|
|
114
113
|
* @param {String} email User's email address
|
|
115
114
|
* @param {String} firstName User's first name
|
|
116
115
|
* @param {String} lastName User's last name
|
|
117
116
|
* @param {String} password User's password
|
|
118
117
|
* @param {String} token Invitation token provided to the user
|
|
119
|
-
*
|
|
120
118
|
*/
|
|
121
|
-
createUserAccount(email, firstName, lastName, password, token) {
|
|
119
|
+
createUserAccount: (email, firstName, lastName, password, token) => {
|
|
122
120
|
return new Promise(function (resolve, reject) {
|
|
123
121
|
if (
|
|
124
122
|
email.trim() === "" ||
|
|
@@ -150,11 +148,10 @@ export default {
|
|
|
150
148
|
|
|
151
149
|
/**
|
|
152
150
|
* Delete an existing API token
|
|
153
|
-
*
|
|
154
151
|
* @param {String} token Expiration date of the token
|
|
155
152
|
* @param {String} authToken Authorization token
|
|
156
153
|
*/
|
|
157
|
-
deleteAPIToken(token, authToken) {
|
|
154
|
+
deleteAPIToken: (token, authToken) => {
|
|
158
155
|
return new Promise(function (resolve, reject) {
|
|
159
156
|
const deleteTokenRequest = axios.delete(
|
|
160
157
|
`api/v1/users/user/token`,
|
|
@@ -177,11 +174,10 @@ export default {
|
|
|
177
174
|
|
|
178
175
|
/**
|
|
179
176
|
* Delete existing users
|
|
180
|
-
*
|
|
181
|
-
* @param {Array} userIds The ID of the users to be deleted
|
|
177
|
+
* @param {Array<String>} userIds The ID of the users to be deleted
|
|
182
178
|
* @param {String} authToken Authorization token
|
|
183
179
|
*/
|
|
184
|
-
deleteUsers(userIds, authToken) {
|
|
180
|
+
deleteUsers: (userIds, authToken) => {
|
|
185
181
|
return new Promise(function (resolve, reject) {
|
|
186
182
|
const deleteTokenRequest = axios.delete(
|
|
187
183
|
`api/v1/users/`,
|
|
@@ -206,7 +202,7 @@ export default {
|
|
|
206
202
|
* Get all the API tokens
|
|
207
203
|
* @param {String} authToken Authorization token
|
|
208
204
|
*/
|
|
209
|
-
getAPITokens(authToken) {
|
|
205
|
+
getAPITokens: (authToken) => {
|
|
210
206
|
return new Promise(function (resolve, reject) {
|
|
211
207
|
const getTokensRequest = axios.get(`api/v1/users/getapitokens`, {
|
|
212
208
|
headers: { authorization: authToken },
|
|
@@ -222,13 +218,10 @@ export default {
|
|
|
222
218
|
},
|
|
223
219
|
|
|
224
220
|
/**
|
|
225
|
-
*
|
|
226
221
|
* Get the specified user account by Id. It returns a promise
|
|
227
|
-
*
|
|
228
222
|
* @param {String} id Id of the user for which information is being requested
|
|
229
|
-
*
|
|
230
223
|
*/
|
|
231
|
-
getUserById(id) {
|
|
224
|
+
getUserById: (id) => {
|
|
232
225
|
return new Promise(function (resolve, reject) {
|
|
233
226
|
const getUserInformationRequest = axios.get(`api/v1/users/user/${id}`);
|
|
234
227
|
getUserInformationRequest
|
|
@@ -251,7 +244,7 @@ export default {
|
|
|
251
244
|
* @param {String} category User information category
|
|
252
245
|
* @param {String} token Authorization token
|
|
253
246
|
*/
|
|
254
|
-
getUserInformation(userId, category, token) {
|
|
247
|
+
getUserInformation: (userId, category, token) => {
|
|
255
248
|
return new Promise(function (resolve, reject) {
|
|
256
249
|
let confirmationRequest = axios.get(
|
|
257
250
|
`api/v1/users/user/${userId ? userId : 0}/${category ? category : "*"}`,
|
|
@@ -275,7 +268,7 @@ export default {
|
|
|
275
268
|
* @param {Array} fields Fields to be loaded. Ex: ["firstName"]
|
|
276
269
|
* @param {String} token Authorization token
|
|
277
270
|
*/
|
|
278
|
-
getUsers(filter, fields, token) {
|
|
271
|
+
getUsers: (filter, fields, token) => {
|
|
279
272
|
return new Promise(function (resolve, reject) {
|
|
280
273
|
const requestData = removeNullProperties({
|
|
281
274
|
filter: filter,
|
|
@@ -296,10 +289,10 @@ export default {
|
|
|
296
289
|
|
|
297
290
|
/**
|
|
298
291
|
* Invite other users to join the same account
|
|
299
|
-
* @param {Array} invitees List of emails of the invitees
|
|
292
|
+
* @param {Array<String>} invitees List of emails of the invitees
|
|
300
293
|
* @param {String} token Authorization token
|
|
301
294
|
*/
|
|
302
|
-
inviteUsers(invitees, authToken) {
|
|
295
|
+
inviteUsers: (invitees, authToken) => {
|
|
303
296
|
return new Promise(function (resolve, reject) {
|
|
304
297
|
const requestData = removeNullProperties({
|
|
305
298
|
invitees: invitees,
|
|
@@ -324,7 +317,7 @@ export default {
|
|
|
324
317
|
* @param {String} password User's password
|
|
325
318
|
* @param {boolean} rememberMe Set to true if the user wants his account to be saved on the current machine
|
|
326
319
|
*/
|
|
327
|
-
login(email, password, rememberMe) {
|
|
320
|
+
login: (email, password, rememberMe) => {
|
|
328
321
|
return new Promise(function (resolve, reject) {
|
|
329
322
|
const requestData = removeNullProperties({
|
|
330
323
|
email: email,
|
|
@@ -346,7 +339,7 @@ export default {
|
|
|
346
339
|
* Logout from the server. It returns a promise
|
|
347
340
|
* @param {String} token Authorization token
|
|
348
341
|
*/
|
|
349
|
-
logout(token) {
|
|
342
|
+
logout: (token) => {
|
|
350
343
|
return new Promise(function (resolve, reject) {
|
|
351
344
|
const options = removeNullProperties({
|
|
352
345
|
headers: { authorization: token },
|
|
@@ -367,7 +360,7 @@ export default {
|
|
|
367
360
|
* a new token can be restablished using login
|
|
368
361
|
* @param {String} token User's auth token to be refreshed
|
|
369
362
|
*/
|
|
370
|
-
refreshToken(token) {
|
|
363
|
+
refreshToken: (token) => {
|
|
371
364
|
return new Promise(function (resolve, reject) {
|
|
372
365
|
let options = removeNullProperties({ headers: { Authorization: token } });
|
|
373
366
|
let request = axios.post("api/v1/auth/refreshToken", {}, options);
|
|
@@ -386,7 +379,7 @@ export default {
|
|
|
386
379
|
* @param {String} id The ID of the token to be removed
|
|
387
380
|
* @param {String} authToken Authorization token
|
|
388
381
|
*/
|
|
389
|
-
removeAPIToken(id, authToken) {
|
|
382
|
+
removeAPIToken: (id, authToken) => {
|
|
390
383
|
return new Promise(function (resolve, reject) {
|
|
391
384
|
const requestData = removeNullProperties({
|
|
392
385
|
id: id,
|
|
@@ -410,10 +403,10 @@ export default {
|
|
|
410
403
|
|
|
411
404
|
/**
|
|
412
405
|
* Resend invitation emails
|
|
413
|
-
* @param {Array} invitees List of emails of the invitees
|
|
406
|
+
* @param {Array<String>} invitees List of emails of the invitees
|
|
414
407
|
* @param {String} token Authorization token
|
|
415
408
|
*/
|
|
416
|
-
resendInvitationEmails(invitees, authToken) {
|
|
409
|
+
resendInvitationEmails: (invitees, authToken) => {
|
|
417
410
|
return new Promise(function (resolve, reject) {
|
|
418
411
|
const requestData = removeNullProperties({
|
|
419
412
|
invitees: invitees,
|
|
@@ -438,7 +431,7 @@ export default {
|
|
|
438
431
|
* @param {String} email User's email address
|
|
439
432
|
* @param {String} password User's new password
|
|
440
433
|
*/
|
|
441
|
-
resetPassword(email, code, password) {
|
|
434
|
+
resetPassword: (email, code, password) => {
|
|
442
435
|
return new Promise(function (resolve, reject) {
|
|
443
436
|
let postData = removeNullProperties({
|
|
444
437
|
email: email,
|
|
@@ -460,7 +453,7 @@ export default {
|
|
|
460
453
|
* Send an email to the user indicated by the email address to reset the password. It returns a promise
|
|
461
454
|
* @param {String} email Email of the user who needs to reset the password
|
|
462
455
|
*/
|
|
463
|
-
sendPasswordResetNotification(email) {
|
|
456
|
+
sendPasswordResetNotification: (email) => {
|
|
464
457
|
return new Promise(function (resolve, reject) {
|
|
465
458
|
let postData = removeNullProperties({
|
|
466
459
|
email: email,
|
|
@@ -486,7 +479,7 @@ export default {
|
|
|
486
479
|
* @param {String} data New or updated user data information
|
|
487
480
|
* @param {Object} token Authorization token
|
|
488
481
|
*/
|
|
489
|
-
setUserInformation(userId, category, data, token) {
|
|
482
|
+
setUserInformation: (userId, category, data, token) => {
|
|
490
483
|
return new Promise(function (resolve, reject) {
|
|
491
484
|
const requestData = removeNullProperties({
|
|
492
485
|
data: category ? { category: { ...data } } : data,
|
|
@@ -511,7 +504,7 @@ export default {
|
|
|
511
504
|
* @param {String} password The current password
|
|
512
505
|
* @param {String} token Authorization token
|
|
513
506
|
*/
|
|
514
|
-
updateUserEmail(email, password, token) {
|
|
507
|
+
updateUserEmail: (email, password, token) => {
|
|
515
508
|
return new Promise(function (resolve, reject) {
|
|
516
509
|
const requestData = removeNullProperties({
|
|
517
510
|
email: email,
|
|
@@ -540,7 +533,7 @@ export default {
|
|
|
540
533
|
* @param {Array<String>} groups The id of the groups the user should belong to
|
|
541
534
|
* @param {String} token Authorization token
|
|
542
535
|
*/
|
|
543
|
-
updateUserGroups(userId, groups, token) {
|
|
536
|
+
updateUserGroups: (userId, groups, token) => {
|
|
544
537
|
return new Promise(function (resolve, reject) {
|
|
545
538
|
const requestData = removeNullProperties({
|
|
546
539
|
userId: userId,
|
|
@@ -569,7 +562,7 @@ export default {
|
|
|
569
562
|
* @param {String} newPassword The new password
|
|
570
563
|
* @param {String} token Authorization token
|
|
571
564
|
*/
|
|
572
|
-
updateUserPassword(password, newPassword, token) {
|
|
565
|
+
updateUserPassword: (password, newPassword, token) => {
|
|
573
566
|
return new Promise(function (resolve, reject) {
|
|
574
567
|
const requestData = removeNullProperties({
|
|
575
568
|
password: password,
|
|
@@ -593,14 +586,11 @@ export default {
|
|
|
593
586
|
},
|
|
594
587
|
|
|
595
588
|
/**
|
|
596
|
-
*
|
|
597
589
|
* Validate reset password code. It returns a promise
|
|
598
|
-
*
|
|
599
590
|
* @param {String} email User's email address
|
|
600
591
|
* @param {String} code Provided reset code
|
|
601
|
-
*
|
|
602
592
|
*/
|
|
603
|
-
validateResetPasswordCode(email, code) {
|
|
593
|
+
validateResetPasswordCode: (email, code) => {
|
|
604
594
|
return new Promise(function (resolve, reject) {
|
|
605
595
|
let postData = removeNullProperties({
|
|
606
596
|
email: email,
|
package/lib/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackfactor/client-api",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "StackFactor
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"description": "Node.js library for the StackFactor API",
|
|
5
5
|
"main": "index.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"require": "./index.js",
|
|
9
|
+
"import": "./index.js",
|
|
10
|
+
"default": "./index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
6
13
|
"scripts": {
|
|
7
14
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
15
|
},
|