@stackfactor/client-api 1.1.12-9.1 → 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
@@ -4,10 +4,10 @@ import { client } from "./axiosClient.js";
4
4
  * Create role and set information
5
5
  * @param {Object} data
6
6
  * @param {String} token Authorization token
7
- * @returns {Promise<Object>}
7
+ * @returns {Promise}
8
8
  */
9
- const createRole = (data: object, token: string): Promise<object> => {
10
- return new Promise((resolve, reject) => {
9
+ export const createRole = (data, token) => {
10
+ return new Promise(function (resolve, reject) {
11
11
  let confirmationRequest = client.put(
12
12
  "api/v1/roles",
13
13
  { data: data },
@@ -30,29 +30,13 @@ const createRole = (data: object, token: string): Promise<object> => {
30
30
  * @param {String} templateId
31
31
  * @param {Object} data
32
32
  * @param {String} token Authorization token
33
- * @returns {Promise<Object>}
33
+ * @returns {Promise}
34
34
  */
35
- const createRoleFromTemplate = (
36
- templateId: string,
37
- data: object,
38
- token: string
39
- ): Promise<object> => {
40
- return new Promise((resolve, reject) => {
41
- const requestData: {
42
- includeDeleted: boolean;
43
- includeDetailedInformation: boolean;
44
- namesOnly: boolean;
45
- returnDefaultIfVersionNotAvailable: boolean;
46
- version: string;
47
- filter?: object;
48
- templateId: string;
49
- } = {
35
+ export const createRoleFromTemplate = (templateId, data, token) => {
36
+ return new Promise(function (resolve, reject) {
37
+ const requestData = {
50
38
  templateId: templateId,
51
- includeDeleted: false,
52
- includeDetailedInformation: false,
53
- namesOnly: false,
54
- returnDefaultIfVersionNotAvailable: false,
55
- version: "1.0",
39
+ data: data,
56
40
  };
57
41
  let confirmationRequest = client.put(
58
42
  "api/v1/roles/createfromtemplate/",
@@ -76,15 +60,11 @@ const createRoleFromTemplate = (
76
60
  * @param {String} id The id of the role to be deleted
77
61
  * @param {String} comments The comments included with the deletion
78
62
  * @param {String} token Authorization token
79
- * @returns {Promise<Object>}
63
+ * @returns {Promise}
80
64
  */
81
- const deleteRole = (
82
- id: string,
83
- comments: string,
84
- token: string
85
- ): Promise<object> => {
86
- return new Promise((resolve, reject) => {
87
- const data: { id: string, comments?: string } = {
65
+ export const deleteRole = (id, comments, token) => {
66
+ return new Promise(function (resolve, reject) {
67
+ const data = {
88
68
  id: id,
89
69
  };
90
70
  if (comments) data.comments = comments;
@@ -106,10 +86,10 @@ const deleteRole = (
106
86
  * Discard the role draft changes
107
87
  * @param {String} id The id of the role to be deleted
108
88
  * @param {String} token Authorization token
109
- * @returns {Promise<Object>}
89
+ * @returns {Promise}
110
90
  */
111
- const discardRoleChanges = (id: string, token: string): Promise<object> => {
112
- return new Promise((resolve, reject) => {
91
+ export const discardRoleChanges = (id, token) => {
92
+ return new Promise(function (resolve, reject) {
113
93
  const data = {};
114
94
  const request = client.get(`api/v1/roles/discard/${id}`, {
115
95
  headers: { authorization: token },
@@ -128,14 +108,15 @@ const discardRoleChanges = (id: string, token: string): Promise<object> => {
128
108
  /**
129
109
  * Get the list of imported role templates
130
110
  * @param {String} token
131
- * @returns {Promise<Object>}
111
+ * @returns {Promise}
132
112
  */
133
- const getImportedRoleTemplates = (token: string): Promise<object> => {
134
- return new Promise((resolve, reject) => {
113
+ export const getImportedRoleTemplates = (token) => {
114
+ return new Promise(function (resolve, reject) {
135
115
  const request = client.get(`api/v1/roles/getimportedroletemplates`, {
136
116
  headers: { authorization: token },
137
117
  });
138
118
  request
119
+
139
120
  .then((response) => {
140
121
  resolve(response.data);
141
122
  })
@@ -151,15 +132,15 @@ const getImportedRoleTemplates = (token: string): Promise<object> => {
151
132
  * @param {String} version The version to be retrieved
152
133
  * @param {Boolean} returnNullIfVersionNotFound Return null if the version is not found
153
134
  * @param {String} token Authorization token
154
- * @returns {Promise<Object>}
135
+ * @returns {Promise}
155
136
  */
156
- const getRoleInformationById = (
157
- id: number,
158
- version: string,
159
- returnNullIfVersionNotFound: boolean,
160
- token: string
161
- ): Promise<object> => {
162
- return new Promise((resolve, reject) => {
137
+ export const getRoleInformationById = (
138
+ id,
139
+ version,
140
+ returnNullIfVersionNotFound,
141
+ token
142
+ ) => {
143
+ return new Promise(function (resolve, reject) {
163
144
  let confirmationRequest = client.get(
164
145
  `api/v1/roles/role/${id}/${version}/${returnNullIfVersionNotFound}`,
165
146
  {
@@ -185,26 +166,19 @@ const getRoleInformationById = (
185
166
  * @param {Boolean} returnDefaultIfVersionNotAvailable Return the default version if published not available
186
167
  * @param {Boolean} namesOnly Return only the names of the roles
187
168
  * @param {String} token Authorization token
188
- * @returns {Promise<Object>}
169
+ * @returns {Promise}
189
170
  */
190
- const getRolesList = (
191
- filter: object,
192
- version: string,
193
- includeDeleted: boolean,
194
- includeDetailedInformation: boolean,
195
- returnDefaultIfVersionNotAvailable: boolean,
196
- namesOnly: boolean,
197
- token: string
198
- ): Promise<object> => {
199
- return new Promise((resolve, reject) => {
200
- const requestData: {
201
- includeDeleted: boolean;
202
- includeDetailedInformation: boolean;
203
- namesOnly: boolean;
204
- returnDefaultIfVersionNotAvailable: boolean;
205
- version: string;
206
- filter?: object;
207
- } = {
171
+ export const getRolesList = (
172
+ filter,
173
+ version,
174
+ includeDeleted,
175
+ includeDetailedInformation,
176
+ returnDefaultIfVersionNotAvailable,
177
+ namesOnly,
178
+ token
179
+ ) => {
180
+ return new Promise(function (resolve, reject) {
181
+ const requestData = {
208
182
  includeDeleted: includeDeleted,
209
183
  includeDetailedInformation: includeDetailedInformation,
210
184
  namesOnly: namesOnly,
@@ -229,10 +203,10 @@ const getRolesList = (
229
203
  * Get role template updates
230
204
  * @param {String} id The role id
231
205
  * @param {String} token
232
- * @returns {Promise<Object>}
206
+ * @returns {Promise}
233
207
  */
234
- const getRoleTemplateUpdates = (id: string, token: string): Promise<object> => {
235
- return new Promise((resolve, reject) => {
208
+ export const getRoleTemplateUpdates = (id, token) => {
209
+ return new Promise(function (resolve, reject) {
236
210
  let confirmationRequest = client.get(
237
211
  `api/v1/roles/getroletemplateupdates/${id}`,
238
212
  {
@@ -251,18 +225,14 @@ const getRoleTemplateUpdates = (id: string, token: string): Promise<object> => {
251
225
 
252
226
  /**
253
227
  * Import role templates
254
- * @param {Array<Object>} data The list of role templates to be imported
228
+ * @param {Array<String>} data The list of role templates to be imported
255
229
  * @param {String} token
256
- * @returns {Promise<Object>}
230
+ * @returns {Promise}
257
231
  */
258
- const importRoleTemplates = (
259
- data: object[],
260
- token: string
261
- ): Promise<object> => {
262
- return new Promise((resolve, reject) => {
263
- const requestData: { roles: object[]; jobDescription: string; userid?: string } = {
264
- roles: data,
265
- jobDescription: "default job description", // Add a default job description or pass it as a parameter
232
+ export const importRoleTemplates = (data, token) => {
233
+ return new Promise(function (resolve, reject) {
234
+ const requestData = {
235
+ data: data,
266
236
  };
267
237
  let confirmationRequest = client.post(
268
238
  `api/v1/roles/importRoleTemplates`,
@@ -272,6 +242,7 @@ const importRoleTemplates = (
272
242
  }
273
243
  );
274
244
  confirmationRequest
245
+
275
246
  .then((response) => {
276
247
  resolve(response.data);
277
248
  })
@@ -286,15 +257,11 @@ const importRoleTemplates = (
286
257
  * @param {number} id The id of the role to be published
287
258
  * @param {String} comments The comments to be include with the request
288
259
  * @param {String} token Authorization token
289
- * @returns {Promise<Object>}
260
+ * @returns {Promise}
290
261
  */
291
- const publishRole = (
292
- id: number,
293
- comments: string,
294
- token: string
295
- ): Promise<object> => {
296
- return new Promise((resolve, reject) => {
297
- let data: { comments?: string } = {};
262
+ export const publishRole = (id, comments, token) => {
263
+ return new Promise(function (resolve, reject) {
264
+ let data = {};
298
265
  if (comments) data.comments = comments;
299
266
  let confirmationRequest = client.post(`api/v1/roles/publish/${id}`, data, {
300
267
  headers: { authorization: token },
@@ -314,14 +281,10 @@ const publishRole = (
314
281
  * @param {String} id The id of the role to be updated
315
282
  * @param {Object} data Data used to update the role
316
283
  * @param {String} token Authorization token
317
- * @returns {Promise<Object>}
284
+ * @returns {Promise}
318
285
  */
319
- const setRoleInformation = (
320
- id: string,
321
- data: object,
322
- token: string
323
- ): Promise<object> => {
324
- return new Promise((resolve, reject) => {
286
+ export const setRoleInformation = (id, data, token) => {
287
+ return new Promise(function (resolve, reject) {
325
288
  const requestData = {
326
289
  data: data,
327
290
  id: id,
@@ -344,14 +307,10 @@ const setRoleInformation = (
344
307
  * @param {String} id The id of the role to be updated
345
308
  * @param {Object} data Data used to update the role
346
309
  * @param {String} token Authorization token
347
- * @returns {Promise<Object>}
310
+ * @returns {Promise}
348
311
  */
349
- const setRoleInformationFromTemplate = (
350
- id: string,
351
- data: object,
352
- token: string
353
- ): Promise<object> => {
354
- return new Promise((resolve, reject) => {
312
+ export const setRoleInformationFromTemplate = (id, data, token) => {
313
+ return new Promise(function (resolve, reject) {
355
314
  const requestData = {
356
315
  data: data,
357
316
  id: id,
@@ -379,16 +338,11 @@ const setRoleInformationFromTemplate = (
379
338
  * @param {Array<Object>} roles The list of roles to be assigned to the user
380
339
  * @param {String} jobDescription The job description to be assigned to the user
381
340
  * @param {String} token Authorization token
382
- * @returns {Promise<Object>}
341
+ * @returns {Promise}
383
342
  */
384
- const setUserRoles = (
385
- id: string,
386
- roles: object[],
387
- jobDescription: string,
388
- token: string
389
- ): Promise<object> => {
390
- return new Promise((resolve, reject) => {
391
- const requestData: { roles: object[]; jobDescription: string; userid?: string } = {
343
+ export const setUserRoles = (id, roles, jobDescription, token) => {
344
+ return new Promise(function (resolve, reject) {
345
+ const requestData = {
392
346
  roles: roles,
393
347
  jobDescription: jobDescription,
394
348
  };
@@ -411,14 +365,10 @@ const setUserRoles = (
411
365
  * @param {String} id The id of the role to be updated
412
366
  * @param {Boolean} watch Set to true or false
413
367
  * @param {String} token Authorization token
414
- * @returns {Promise<Object>}
368
+ * @returns {Promise}
415
369
  */
416
- const watchRole = (
417
- id: string,
418
- watch: boolean,
419
- token: string
420
- ): Promise<object> => {
421
- return new Promise((resolve, reject) => {
370
+ export const watchRole = (id, watch, token) => {
371
+ return new Promise(function (resolve, reject) {
422
372
  const requestData = {
423
373
  id: id,
424
374
  watch: watch,
@@ -436,7 +386,7 @@ const watchRole = (
436
386
  });
437
387
  };
438
388
 
439
- export default {
389
+ const role = {
440
390
  createRole,
441
391
  createRoleFromTemplate,
442
392
  deleteRole,
@@ -452,3 +402,5 @@ export default {
452
402
  setUserRoles,
453
403
  watchRole,
454
404
  };
405
+
406
+ export default role;
@@ -4,10 +4,9 @@ import { client } from "./axiosClient.js";
4
4
  * Create role template and set information
5
5
  * @param {Object} data
6
6
  * @param {String} token Authorization token
7
- * @returns {Promise<Object>}
8
7
  */
9
- const createRoleTemplate = (data: object, token: string): Promise<object> => {
10
- return new Promise((resolve, reject) => {
8
+ export const createRoleTemplate = (data, token) => {
9
+ return new Promise(function (resolve, reject) {
11
10
  const requestData = {
12
11
  data: data,
13
12
  };
@@ -29,15 +28,10 @@ const createRoleTemplate = (data: object, token: string): Promise<object> => {
29
28
  * @param {String} id The id of the template to be deleted
30
29
  * @param {String} comments The comments included with the deletion
31
30
  * @param {String} token Authorization token
32
- * @returns {Promise<Object>}
33
31
  */
34
- const deleteRoleTemplate = (
35
- id: string,
36
- comments: string,
37
- token: string
38
- ): Promise<object> => {
39
- return new Promise((resolve, reject) => {
40
- const data: { id: string, comments?: string } = {
32
+ export const deleteRoleTemplate = (id, comments, token) => {
33
+ return new Promise(function (resolve, reject) {
34
+ const data = {
41
35
  id: id,
42
36
  };
43
37
  if (comments) data.comments = comments;
@@ -59,13 +53,9 @@ const deleteRoleTemplate = (
59
53
  * Discard the role template draft changes
60
54
  * @param {String} id The id of the role template to be deleted
61
55
  * @param {String} token Authorization token
62
- * @returns {Promise<Object>}
63
56
  */
64
- const discardRoleTemplateChanges = (
65
- id: string,
66
- token: string
67
- ): Promise<object> => {
68
- return new Promise((resolve, reject) => {
57
+ export const discardRoleTemplateChanges = (id, token) => {
58
+ return new Promise(function (resolve, reject) {
69
59
  const data = {};
70
60
  const request = client.get(`api/v1/roletemplates/discard/${id}`, {
71
61
  headers: { authorization: token },
@@ -84,16 +74,10 @@ const discardRoleTemplateChanges = (
84
74
  /**
85
75
  * Get role template information
86
76
  * @param {String} id The id of the template
87
- * @param {String} version The version of the template
88
77
  * @param {String} token Authorization token
89
- * @returns {Promise<Object>}
90
78
  */
91
- const getRoleTemplateInformationById = (
92
- id: string,
93
- version: string,
94
- token: string
95
- ): Promise<object> => {
96
- return new Promise((resolve, reject) => {
79
+ export const getRoleTemplateInformationById = (id, version, token) => {
80
+ return new Promise(function (resolve, reject) {
97
81
  let confirmationRequest = client.get(
98
82
  `api/v1/roletemplates/${id}/${version}`,
99
83
  {
@@ -117,17 +101,16 @@ const getRoleTemplateInformationById = (
117
101
  * @param {Boolean} includeDeleted When true it will return the deleted records as well
118
102
  * @param {Boolean} namesOnly When true it will return only the names of the templates
119
103
  * @param {String} token Authorization token
120
- * @returns {Promise<Object>}
121
104
  */
122
- const getRoleTemplateList = (
123
- filter: string[],
124
- version: string,
125
- includeDeleted: boolean,
126
- namesOnly: boolean,
127
- token: string
128
- ): Promise<object> => {
129
- return new Promise((resolve, reject) => {
130
- const requestData: { includeDeleted: boolean; namesOnly: boolean; version: string; filter?: string[] } = {
105
+ export const getRoleTemplateList = (
106
+ filter,
107
+ version,
108
+ includeDeleted,
109
+ namesOnly,
110
+ token
111
+ ) => {
112
+ return new Promise(function (resolve, reject) {
113
+ const requestData = {
131
114
  includeDeleted: includeDeleted,
132
115
  namesOnly: namesOnly,
133
116
  version: version,
@@ -151,15 +134,10 @@ const getRoleTemplateList = (
151
134
  * @param {number} id The id of the template to be published
152
135
  * @param {String} comments The comments to be include with the request
153
136
  * @param {String} token Authorization token
154
- * @returns {Promise<Object>}
155
137
  */
156
- const publishTemplate = (
157
- id: number,
158
- comments: string,
159
- token: string
160
- ): Promise<object> => {
161
- return new Promise((resolve, reject) => {
162
- let data: { comments?: string } = {};
138
+ export const publishTemplate = (id, comments, token) => {
139
+ return new Promise(function (resolve, reject) {
140
+ let data = {};
163
141
  if (comments) data.comments = comments;
164
142
  let confirmationRequest = client.post(
165
143
  `api/v1/roletemplates/publish/${id}`,
@@ -183,14 +161,9 @@ const publishTemplate = (
183
161
  * @param {String} id The id of the template to be updated
184
162
  * @param {Object} data Data used to update the template
185
163
  * @param {String} token Authorization token
186
- * @returns {Promise<Object>}
187
164
  */
188
- const setTemplateInformation = (
189
- id: string,
190
- data: object,
191
- token: string
192
- ): Promise<object> => {
193
- return new Promise((resolve, reject) => {
165
+ export const setTemplateInformation = (id, data, token) => {
166
+ return new Promise(function (resolve, reject) {
194
167
  const requestData = {
195
168
  data: data,
196
169
  id: id,
@@ -217,14 +190,9 @@ const setTemplateInformation = (
217
190
  * @param {String} id The id of the template to be updated
218
191
  * @param {Object} tags Updated template tags
219
192
  * @param {String} token Authorization token
220
- * @returns {Promise<Object>}
221
193
  */
222
- const setTemplateTags = (
223
- id: string,
224
- tags: object,
225
- token: string
226
- ): Promise<object> => {
227
- return new Promise((resolve, reject) => {
194
+ export const setTemplateTags = (id, tags, token) => {
195
+ return new Promise(function (resolve, reject) {
228
196
  const requestData = {
229
197
  tags: tags,
230
198
  id: id,
@@ -251,14 +219,9 @@ const setTemplateTags = (
251
219
  * @param {String} id The id of the skill to be updated
252
220
  * @param {Boolean} watch Set to true or false
253
221
  * @param {String} token Authorization token
254
- * @returns {Promise<Object>}
255
222
  */
256
- const watchRoleTemplate = (
257
- id: string,
258
- watch: boolean,
259
- token: string
260
- ): Promise<object> => {
261
- return new Promise((resolve, reject) => {
223
+ export const watchRoleTemplate = (id, watch, token) => {
224
+ return new Promise(function (resolve, reject) {
262
225
  const requestData = {
263
226
  id: id,
264
227
  watch: watch,
@@ -280,7 +243,7 @@ const watchRoleTemplate = (
280
243
  });
281
244
  };
282
245
 
283
- export default {
246
+ const roleTemplate = {
284
247
  createRoleTemplate,
285
248
  deleteRoleTemplate,
286
249
  discardRoleTemplateChanges,
@@ -291,3 +254,5 @@ export default {
291
254
  setTemplateTags,
292
255
  watchRoleTemplate,
293
256
  };
257
+
258
+ export default roleTemplate;