@stackfactor/client-api 1.1.11 → 1.1.12-9.2
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 +13 -0
- package/{exports.js → exports.ts} +14 -0
- package/index.ts +1 -0
- package/lib/{actionNotifications.js → actionNotifications.ts} +21 -11
- package/lib/{address.js → address.ts} +4 -5
- package/lib/aiAssistant.ts +197 -0
- package/lib/avatar.ts +41 -0
- package/lib/axiosClient.ts +92 -0
- package/lib/{config.js → config.ts} +20 -9
- package/lib/{constants.js → constants.ts} +11 -41
- package/lib/{dashboard.js → dashboard.ts} +19 -10
- package/lib/{departmentTrainingPlans.js → departmentTrainingPlans.ts} +63 -32
- package/lib/{groups.js → groups.ts} +68 -29
- package/lib/{integration.js → integration.ts} +103 -47
- package/lib/{integrationConfiguration.js → integrationConfiguration.ts} +27 -22
- package/lib/integrations/{contentGenerator.js → contentGenerator.ts} +38 -18
- package/lib/{learningContent.js → learningContent.ts} +218 -62
- package/lib/{learningPath.js → learningPath.ts} +57 -30
- package/lib/{logger.js → logger.ts} +18 -8
- package/lib/microSkillsQuizes.ts +70 -0
- package/lib/quotas.ts +59 -0
- package/lib/{role.js → role.ts} +117 -69
- package/lib/{roleTemplate.js → roleTemplate.ts} +65 -30
- package/lib/security.ts +99 -0
- package/lib/{skill.js → skill.ts} +125 -87
- package/lib/{skillAssessments.js → skillAssessmentTestingSession.ts} +63 -16
- package/lib/skillAssessments.ts +192 -0
- package/lib/{skillTemplate.js → skillTemplate.ts} +73 -42
- package/lib/talentTransfromation.ts +126 -0
- package/lib/{teams.js → teams.ts} +73 -38
- package/lib/{tenants.js → tenants.ts} +17 -10
- package/lib/{trainingPlans.js → trainingPlans.ts} +159 -56
- package/lib/trainingPlansProficiencyLevels.ts +132 -0
- package/lib/{userInformation.js → userInformation.ts} +27 -26
- package/lib/{users.js → users.ts} +239 -140
- package/lib/utils.ts +64 -0
- package/package.json +12 -1
- package/index.js +0 -3
- package/lib/axiosClient.js +0 -85
- package/lib/skillAssessmentTestingSession.js +0 -148
- package/lib/utils.js +0 -48
|
@@ -3,14 +3,42 @@ import axiosLib from "axios";
|
|
|
3
3
|
import htmlParser from "node-html-parser";
|
|
4
4
|
import htmlToText from "html2plaintext";
|
|
5
5
|
|
|
6
|
+
interface IntegrationData {
|
|
7
|
+
data: object;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface IntegrationFilter {
|
|
11
|
+
filter?: string[];
|
|
12
|
+
type?: string;
|
|
13
|
+
version: string;
|
|
14
|
+
includeSupportedCapabilities: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface ContentInformation {
|
|
18
|
+
url: string;
|
|
19
|
+
verb: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface ContentInformationResponse {
|
|
23
|
+
description: string;
|
|
24
|
+
duration: number;
|
|
25
|
+
icon: string;
|
|
26
|
+
title: string;
|
|
27
|
+
type: number;
|
|
28
|
+
internal: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
6
31
|
/**
|
|
7
32
|
* Create integration and set information
|
|
8
33
|
* @param {Object} data The new integration information
|
|
9
34
|
* @param {String} token Authorization token
|
|
10
35
|
*/
|
|
11
|
-
export const createIntegration = (
|
|
12
|
-
|
|
13
|
-
|
|
36
|
+
export const createIntegration = (
|
|
37
|
+
data: object,
|
|
38
|
+
token: string
|
|
39
|
+
): Promise<object> => {
|
|
40
|
+
return new Promise((resolve, reject) => {
|
|
41
|
+
const requestData: IntegrationData = {
|
|
14
42
|
data: data,
|
|
15
43
|
};
|
|
16
44
|
let confirmationRequest = client.put("api/v1/integrations/", requestData, {
|
|
@@ -31,8 +59,11 @@ export const createIntegration = (data, token) => {
|
|
|
31
59
|
* @param {String} id The id of the integration to be deleted
|
|
32
60
|
* @param {String} token Authorization token
|
|
33
61
|
*/
|
|
34
|
-
export const deleteIntegration = (
|
|
35
|
-
|
|
62
|
+
export const deleteIntegration = (
|
|
63
|
+
id: string,
|
|
64
|
+
token: string
|
|
65
|
+
): Promise<object> => {
|
|
66
|
+
return new Promise((resolve, reject) => {
|
|
36
67
|
const request = client.delete(`api/v1/integrations/`, {
|
|
37
68
|
headers: { authorization: token },
|
|
38
69
|
data: {
|
|
@@ -54,8 +85,11 @@ export const deleteIntegration = (id, token) => {
|
|
|
54
85
|
* @param {String} id The id of the role template to be deleted
|
|
55
86
|
* @param {String} token Authorization token
|
|
56
87
|
*/
|
|
57
|
-
export const discardIntegrationChanges = (
|
|
58
|
-
|
|
88
|
+
export const discardIntegrationChanges = (
|
|
89
|
+
id: string,
|
|
90
|
+
token: string
|
|
91
|
+
): Promise<object> => {
|
|
92
|
+
return new Promise((resolve, reject) => {
|
|
59
93
|
const data = {};
|
|
60
94
|
const request = client.get(`api/v1/integrations/discard/${id}`, {
|
|
61
95
|
headers: { authorization: token },
|
|
@@ -77,8 +111,12 @@ export const discardIntegrationChanges = (id, token) => {
|
|
|
77
111
|
* @param {String} version The version of the integration to be received
|
|
78
112
|
* @param {String} token Authorization token
|
|
79
113
|
*/
|
|
80
|
-
export const getIntegrationInformationById = (
|
|
81
|
-
|
|
114
|
+
export const getIntegrationInformationById = (
|
|
115
|
+
id: string,
|
|
116
|
+
version: string,
|
|
117
|
+
token: string
|
|
118
|
+
): Promise<object> => {
|
|
119
|
+
return new Promise((resolve, reject) => {
|
|
82
120
|
let confirmationRequest = client.get(
|
|
83
121
|
`api/v1/integrations/${id}/${version}`,
|
|
84
122
|
{
|
|
@@ -104,14 +142,14 @@ export const getIntegrationInformationById = (id, version, token) => {
|
|
|
104
142
|
* @param {String} token Authorization token
|
|
105
143
|
*/
|
|
106
144
|
export const getIntegrationsList = (
|
|
107
|
-
filter,
|
|
108
|
-
type,
|
|
109
|
-
version,
|
|
110
|
-
includeSupportedCapabilities,
|
|
111
|
-
token
|
|
112
|
-
) => {
|
|
113
|
-
return new Promise(
|
|
114
|
-
const requestData = {
|
|
145
|
+
filter: string[],
|
|
146
|
+
type: string,
|
|
147
|
+
version: string,
|
|
148
|
+
includeSupportedCapabilities: boolean,
|
|
149
|
+
token: string
|
|
150
|
+
): Promise<object> => {
|
|
151
|
+
return new Promise((resolve, reject) => {
|
|
152
|
+
const requestData: IntegrationFilter = {
|
|
115
153
|
includeSupportedCapabilities: includeSupportedCapabilities,
|
|
116
154
|
version: version,
|
|
117
155
|
};
|
|
@@ -136,9 +174,13 @@ export const getIntegrationsList = (
|
|
|
136
174
|
* @param {String} verb The verb
|
|
137
175
|
* @param {String} token Authorization token
|
|
138
176
|
*/
|
|
139
|
-
export const getContentInformationByUrl = (
|
|
140
|
-
|
|
141
|
-
|
|
177
|
+
export const getContentInformationByUrl = (
|
|
178
|
+
url: string,
|
|
179
|
+
verb: string,
|
|
180
|
+
token: string
|
|
181
|
+
): Promise<object> => {
|
|
182
|
+
return new Promise((resolve, reject) => {
|
|
183
|
+
const requestData: ContentInformation = {
|
|
142
184
|
url: url,
|
|
143
185
|
verb: verb,
|
|
144
186
|
};
|
|
@@ -162,10 +204,12 @@ export const getContentInformationByUrl = (url, verb, token) => {
|
|
|
162
204
|
/**
|
|
163
205
|
* Get content information by url from the browser instead of the backend
|
|
164
206
|
* @param {String} url
|
|
165
|
-
* @returns {
|
|
207
|
+
* @returns {Promise<ContentInformationResponse>}
|
|
166
208
|
*/
|
|
167
|
-
export const getContentInformationByUrlFromBrowser = (
|
|
168
|
-
|
|
209
|
+
export const getContentInformationByUrlFromBrowser = (
|
|
210
|
+
url: string
|
|
211
|
+
): Promise<ContentInformationResponse> => {
|
|
212
|
+
return new Promise((resolve, reject) => {
|
|
169
213
|
let domain = new URL(url);
|
|
170
214
|
let instance = axiosLib.create({
|
|
171
215
|
baseURL: domain.origin,
|
|
@@ -185,15 +229,16 @@ export const getContentInformationByUrlFromBrowser = (url) => {
|
|
|
185
229
|
confirmationRequest
|
|
186
230
|
.then((response) => {
|
|
187
231
|
//get the reading time
|
|
188
|
-
const getReadingTime = (text) => {
|
|
232
|
+
const getReadingTime = (text: string): number => {
|
|
189
233
|
const wpm = 225;
|
|
190
234
|
const words = text.trim().split(/\s+/).length;
|
|
191
235
|
return Math.ceil(words / wpm);
|
|
192
236
|
};
|
|
193
237
|
|
|
194
|
-
let document = htmlParser.parse(response.
|
|
195
|
-
let duration = getReadingTime(htmlToText(response.
|
|
196
|
-
let
|
|
238
|
+
let document = htmlParser.parse(response.data);
|
|
239
|
+
let duration = getReadingTime(htmlToText(response.data));
|
|
240
|
+
let titleTag = document.querySelector("title");
|
|
241
|
+
let title = titleTag ? titleTag.rawText : "";
|
|
197
242
|
let description = "";
|
|
198
243
|
const descriptionEl = document.querySelector("meta");
|
|
199
244
|
try {
|
|
@@ -203,13 +248,14 @@ export const getContentInformationByUrlFromBrowser = (url) => {
|
|
|
203
248
|
const descriptionChildNodes = descriptionParentNode.childNodes;
|
|
204
249
|
if (descriptionChildNodes) {
|
|
205
250
|
const descriptionRawAttr = descriptionChildNodes.find((item) =>
|
|
206
|
-
item.rawAttrs.includes("description")
|
|
251
|
+
(item as any).rawAttrs.includes("description")
|
|
207
252
|
);
|
|
208
253
|
if (descriptionRawAttr) {
|
|
209
|
-
const descriptionContent =
|
|
210
|
-
descriptionRawAttr
|
|
211
|
-
|
|
212
|
-
)
|
|
254
|
+
const descriptionContent = (
|
|
255
|
+
descriptionRawAttr as any
|
|
256
|
+
).rawAttrs.substring(
|
|
257
|
+
(descriptionRawAttr as any).rawAttrs.indexOf("content=") + 9
|
|
258
|
+
);
|
|
213
259
|
description = descriptionContent.substring(
|
|
214
260
|
0,
|
|
215
261
|
descriptionContent.length - 1
|
|
@@ -222,7 +268,7 @@ export const getContentInformationByUrlFromBrowser = (url) => {
|
|
|
222
268
|
resolve({
|
|
223
269
|
description: description,
|
|
224
270
|
duration: duration,
|
|
225
|
-
icon: `http://www.google.com/s2/favicons?sz=128&domain_url=${
|
|
271
|
+
icon: `http://www.google.com/s2/favicons?sz=128&domain_url=${domain.hostname}`,
|
|
226
272
|
title: title ? title.trim() : url,
|
|
227
273
|
type: 0,
|
|
228
274
|
internal: true,
|
|
@@ -237,12 +283,14 @@ export const getContentInformationByUrlFromBrowser = (url) => {
|
|
|
237
283
|
|
|
238
284
|
/**
|
|
239
285
|
* Get enabled content providers
|
|
240
|
-
* @param {String}
|
|
241
|
-
* @param {String} verb The verb
|
|
286
|
+
* @param {String} userId
|
|
242
287
|
* @param {String} token Authorization token
|
|
243
288
|
*/
|
|
244
|
-
export const getEnabledContentProviders = (
|
|
245
|
-
|
|
289
|
+
export const getEnabledContentProviders = (
|
|
290
|
+
userId: string,
|
|
291
|
+
token: string
|
|
292
|
+
): Promise<object> => {
|
|
293
|
+
return new Promise((resolve, reject) => {
|
|
246
294
|
let confirmationRequest = client.get(
|
|
247
295
|
`api/v1/contentproviders/getenabledcontentproviders/${userId}`,
|
|
248
296
|
{
|
|
@@ -264,8 +312,11 @@ export const getEnabledContentProviders = (userId, token) => {
|
|
|
264
312
|
* @param {String} id The id of the integration to be published
|
|
265
313
|
* @param {String} token Authorization token
|
|
266
314
|
*/
|
|
267
|
-
export const publishIntegration = (
|
|
268
|
-
|
|
315
|
+
export const publishIntegration = (
|
|
316
|
+
id: string,
|
|
317
|
+
token: string
|
|
318
|
+
): Promise<object> => {
|
|
319
|
+
return new Promise((resolve, reject) => {
|
|
269
320
|
let confirmationRequest = client.post(
|
|
270
321
|
`api/v1/integrations/publish/${id}`,
|
|
271
322
|
{},
|
|
@@ -289,9 +340,13 @@ export const publishIntegration = (id, token) => {
|
|
|
289
340
|
* @param {Object} data Data used to update the integration
|
|
290
341
|
* @param {String} token Authorization token
|
|
291
342
|
*/
|
|
292
|
-
export const setIntegrationInformation = (
|
|
293
|
-
|
|
294
|
-
|
|
343
|
+
export const setIntegrationInformation = (
|
|
344
|
+
id: string,
|
|
345
|
+
data: object,
|
|
346
|
+
token: string
|
|
347
|
+
): Promise<object> => {
|
|
348
|
+
return new Promise((resolve, reject) => {
|
|
349
|
+
const requestData: IntegrationData = {
|
|
295
350
|
data: data,
|
|
296
351
|
};
|
|
297
352
|
let confirmationRequest = client.post(
|
|
@@ -316,8 +371,11 @@ export const setIntegrationInformation = (id, data, token) => {
|
|
|
316
371
|
* @param {String} id The id of the integration to be set as default
|
|
317
372
|
* @param {String} token Authorization token
|
|
318
373
|
*/
|
|
319
|
-
export const setDefaultIntegration = (
|
|
320
|
-
|
|
374
|
+
export const setDefaultIntegration = (
|
|
375
|
+
id: string,
|
|
376
|
+
token: string
|
|
377
|
+
): Promise<object> => {
|
|
378
|
+
return new Promise((resolve, reject) => {
|
|
321
379
|
let confirmationRequest = client.post(
|
|
322
380
|
`api/v1/integrations/${id}/default`,
|
|
323
381
|
"",
|
|
@@ -335,7 +393,7 @@ export const setDefaultIntegration = (id, token) => {
|
|
|
335
393
|
});
|
|
336
394
|
};
|
|
337
395
|
|
|
338
|
-
|
|
396
|
+
export default {
|
|
339
397
|
createIntegration,
|
|
340
398
|
deleteIntegration,
|
|
341
399
|
discardIntegrationChanges,
|
|
@@ -348,5 +406,3 @@ const integration = {
|
|
|
348
406
|
setDefaultIntegration,
|
|
349
407
|
setIntegrationInformation,
|
|
350
408
|
};
|
|
351
|
-
|
|
352
|
-
export default integration;
|
|
@@ -3,12 +3,17 @@ import { client } from "./axiosClient.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* Get the integration configuration
|
|
5
5
|
* @param {Array<String>} ids
|
|
6
|
-
* @param {Number}
|
|
6
|
+
* @param {Array<Number>} types
|
|
7
7
|
* @param {String} token Authorization token
|
|
8
|
+
* @returns {Promise<Object>}
|
|
8
9
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const getIntegrationsConfiguration = (
|
|
11
|
+
ids: string[],
|
|
12
|
+
types: number[],
|
|
13
|
+
token: string
|
|
14
|
+
): Promise<object> => {
|
|
15
|
+
return new Promise((resolve, reject) => {
|
|
16
|
+
let requestData: { types: number[]; ids?: string[] } = { types: types };
|
|
12
17
|
if (ids) requestData.ids = ids;
|
|
13
18
|
let confirmationRequest = client.post(
|
|
14
19
|
"api/v1/integrationsconfiguration",
|
|
@@ -29,18 +34,19 @@ export const getIntegrationsConfiguration = (ids, type, token) => {
|
|
|
29
34
|
|
|
30
35
|
/**
|
|
31
36
|
* Save integration configuration
|
|
32
|
-
* @param {String} id The id of the integration
|
|
37
|
+
* @param {String} id The id of the integration configuration to be updated
|
|
33
38
|
* @param {Number} type The type of configuration
|
|
34
39
|
* @param {Object} configuration Data used to update the integration configuration
|
|
35
40
|
* @param {String} token Authorization token
|
|
41
|
+
* @returns {Promise<Object>}
|
|
36
42
|
*/
|
|
37
|
-
|
|
38
|
-
id,
|
|
39
|
-
type,
|
|
40
|
-
configuration,
|
|
41
|
-
token
|
|
42
|
-
) => {
|
|
43
|
-
return new Promise(
|
|
43
|
+
const saveIntegrationConfiguration = (
|
|
44
|
+
id: string,
|
|
45
|
+
type: number,
|
|
46
|
+
configuration: object,
|
|
47
|
+
token: string
|
|
48
|
+
): Promise<object> => {
|
|
49
|
+
return new Promise((resolve, reject) => {
|
|
44
50
|
const requestData = {
|
|
45
51
|
id: id,
|
|
46
52
|
configuration: configuration,
|
|
@@ -69,14 +75,15 @@ export const saveIntegrationConfiguration = (
|
|
|
69
75
|
* @param {String} type The type of configuration
|
|
70
76
|
* @param {Object} configuration Configuration to be tested
|
|
71
77
|
* @param {String} token Authorization token
|
|
78
|
+
* @returns {Promise<Object>}
|
|
72
79
|
*/
|
|
73
|
-
|
|
74
|
-
id,
|
|
75
|
-
type,
|
|
76
|
-
configuration,
|
|
77
|
-
token
|
|
78
|
-
) => {
|
|
79
|
-
return new Promise(
|
|
80
|
+
const testIntegrationConfiguration = (
|
|
81
|
+
id: string,
|
|
82
|
+
type: string,
|
|
83
|
+
configuration: object,
|
|
84
|
+
token: string
|
|
85
|
+
): Promise<object> => {
|
|
86
|
+
return new Promise((resolve, reject) => {
|
|
80
87
|
const requestData = {
|
|
81
88
|
id: id,
|
|
82
89
|
configuration: configuration,
|
|
@@ -99,10 +106,8 @@ export const testIntegrationConfiguration = (
|
|
|
99
106
|
});
|
|
100
107
|
};
|
|
101
108
|
|
|
102
|
-
|
|
109
|
+
export default {
|
|
103
110
|
getIntegrationsConfiguration,
|
|
104
111
|
saveIntegrationConfiguration,
|
|
105
112
|
testIntegrationConfiguration,
|
|
106
113
|
};
|
|
107
|
-
|
|
108
|
-
export default integrationConfiguration;
|
|
@@ -1,20 +1,40 @@
|
|
|
1
1
|
import { client } from "../axiosClient.js";
|
|
2
2
|
|
|
3
|
+
interface GenerateContentData {
|
|
4
|
+
data: string[];
|
|
5
|
+
contentType: string;
|
|
6
|
+
integrationId?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface GenerateContentAsyncData {
|
|
10
|
+
id: string;
|
|
11
|
+
data: object;
|
|
12
|
+
contentType: string;
|
|
13
|
+
elementType: string;
|
|
14
|
+
integrationId?: string;
|
|
15
|
+
comments: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
3
18
|
/**
|
|
4
19
|
* Generate content
|
|
5
20
|
* @param {Array<String>} data
|
|
6
21
|
* @param {String} contentType
|
|
7
22
|
* @param {String} integrationId
|
|
8
23
|
* @param {String} token
|
|
9
|
-
* @returns {Object}
|
|
24
|
+
* @returns {Promise<Object>}
|
|
10
25
|
*/
|
|
11
|
-
export const generateContent = (
|
|
12
|
-
|
|
13
|
-
|
|
26
|
+
export const generateContent = (
|
|
27
|
+
data: string[],
|
|
28
|
+
contentType: string,
|
|
29
|
+
integrationId: string,
|
|
30
|
+
token: string
|
|
31
|
+
): Promise<object> => {
|
|
32
|
+
return new Promise((resolve, reject) => {
|
|
33
|
+
let data_: GenerateContentData = {
|
|
14
34
|
data: data,
|
|
15
35
|
contentType: contentType,
|
|
16
36
|
};
|
|
17
|
-
if (integrationId)
|
|
37
|
+
if (integrationId) data_.integrationId = integrationId;
|
|
18
38
|
const request = client.post(`api/v1/contentgenerators/generate`, data_, {
|
|
19
39
|
headers: { authorization: token },
|
|
20
40
|
});
|
|
@@ -29,7 +49,7 @@ export const generateContent = (data, contentType, integrationId, token) => {
|
|
|
29
49
|
};
|
|
30
50
|
|
|
31
51
|
/**
|
|
32
|
-
* Generate content
|
|
52
|
+
* Generate content async
|
|
33
53
|
* @param {String} id
|
|
34
54
|
* @param {Object} data
|
|
35
55
|
* @param {String} contentType
|
|
@@ -37,24 +57,24 @@ export const generateContent = (data, contentType, integrationId, token) => {
|
|
|
37
57
|
* @param {String} integrationId
|
|
38
58
|
* @param {String} comments
|
|
39
59
|
* @param {String} token
|
|
40
|
-
* @returns {Object}
|
|
60
|
+
* @returns {Promise<Object>}
|
|
41
61
|
*/
|
|
42
62
|
export const generateContentAsync = (
|
|
43
|
-
id,
|
|
44
|
-
data,
|
|
45
|
-
contentType,
|
|
46
|
-
elementType,
|
|
47
|
-
integrationId,
|
|
48
|
-
comments,
|
|
49
|
-
token
|
|
50
|
-
) => {
|
|
51
|
-
return new Promise(
|
|
52
|
-
let data_ = {
|
|
63
|
+
id: string,
|
|
64
|
+
data: object,
|
|
65
|
+
contentType: string,
|
|
66
|
+
elementType: string,
|
|
67
|
+
integrationId: string,
|
|
68
|
+
comments: string,
|
|
69
|
+
token: string
|
|
70
|
+
): Promise<object> => {
|
|
71
|
+
return new Promise((resolve, reject) => {
|
|
72
|
+
let data_: GenerateContentAsyncData = {
|
|
73
|
+
id: id,
|
|
53
74
|
data: data,
|
|
54
75
|
comments: comments,
|
|
55
76
|
contentType: contentType,
|
|
56
77
|
elementType: elementType,
|
|
57
|
-
id: id,
|
|
58
78
|
};
|
|
59
79
|
if (integrationId) data_.integrationId = integrationId;
|
|
60
80
|
const request = client.post(
|