@stackfactor/client-api 1.1.140 → 1.1.141
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/dist/cjs/actionNotifications.d.ts +24 -0
- package/dist/cjs/actionNotifications.d.ts.map +1 -0
- package/dist/cjs/actionNotifications.js +73 -0
- package/dist/cjs/actionNotifications.js.map +1 -0
- package/dist/cjs/address.d.ts +8 -0
- package/dist/cjs/address.d.ts.map +1 -0
- package/dist/cjs/address.js +24 -0
- package/dist/cjs/address.js.map +1 -0
- package/dist/cjs/aiAssistant.d.ts +42 -0
- package/dist/cjs/aiAssistant.d.ts.map +1 -0
- package/dist/cjs/aiAssistant.js +135 -0
- package/dist/cjs/aiAssistant.js.map +1 -0
- package/dist/cjs/avatar.d.ts +11 -0
- package/dist/cjs/avatar.d.ts.map +1 -0
- package/dist/cjs/avatar.js +32 -0
- package/dist/cjs/avatar.js.map +1 -0
- package/dist/cjs/axiosClient.d.ts +31 -0
- package/dist/cjs/axiosClient.d.ts.map +1 -0
- package/dist/cjs/axiosClient.js +123 -0
- package/dist/cjs/axiosClient.js.map +1 -0
- package/dist/cjs/config.d.ts +23 -0
- package/dist/cjs/config.d.ts.map +1 -0
- package/dist/cjs/config.js +63 -0
- package/dist/cjs/config.js.map +1 -0
- package/dist/cjs/constants.d.ts +69 -0
- package/dist/cjs/constants.d.ts.map +1 -0
- package/dist/cjs/constants.js +91 -0
- package/dist/cjs/constants.js.map +1 -0
- package/dist/cjs/dashboard.d.ts +23 -0
- package/dist/cjs/dashboard.d.ts.map +1 -0
- package/dist/cjs/dashboard.js +74 -0
- package/dist/cjs/dashboard.js.map +1 -0
- package/dist/cjs/departmentTrainingPlans.d.ts +53 -0
- package/dist/cjs/departmentTrainingPlans.d.ts.map +1 -0
- package/dist/cjs/departmentTrainingPlans.js +153 -0
- package/dist/cjs/departmentTrainingPlans.js.map +1 -0
- package/dist/cjs/groups.d.ts +90 -0
- package/dist/cjs/groups.d.ts.map +1 -0
- package/dist/cjs/groups.js +273 -0
- package/dist/cjs/groups.js.map +1 -0
- package/dist/cjs/index.d.ts +33 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +78 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/integration.d.ts +82 -0
- package/dist/cjs/integration.d.ts.map +1 -0
- package/dist/cjs/integration.js +316 -0
- package/dist/cjs/integration.js.map +1 -0
- package/dist/cjs/integrationConfiguration.d.ts +27 -0
- package/dist/cjs/integrationConfiguration.d.ts.map +1 -0
- package/dist/cjs/integrationConfiguration.js +86 -0
- package/dist/cjs/integrationConfiguration.js.map +1 -0
- package/dist/cjs/integrations/contentGenerator.d.ts +22 -0
- package/dist/cjs/integrations/contentGenerator.d.ts.map +1 -0
- package/dist/cjs/integrations/contentGenerator.js +69 -0
- package/dist/cjs/integrations/contentGenerator.js.map +1 -0
- package/dist/cjs/learningContent.d.ts +122 -0
- package/dist/cjs/learningContent.d.ts.map +1 -0
- package/dist/cjs/learningContent.js +394 -0
- package/dist/cjs/learningContent.js.map +1 -0
- package/dist/cjs/learningPath.d.ts +64 -0
- package/dist/cjs/learningPath.d.ts.map +1 -0
- package/dist/cjs/learningPath.js +205 -0
- package/dist/cjs/learningPath.js.map +1 -0
- package/dist/cjs/logger.d.ts +19 -0
- package/dist/cjs/logger.d.ts.map +1 -0
- package/dist/cjs/logger.js +60 -0
- package/dist/cjs/logger.js.map +1 -0
- package/dist/cjs/microSkillsQuizes.d.ts +18 -0
- package/dist/cjs/microSkillsQuizes.d.ts.map +1 -0
- package/dist/cjs/microSkillsQuizes.js +53 -0
- package/dist/cjs/microSkillsQuizes.js.map +1 -0
- package/dist/cjs/quotas.d.ts +15 -0
- package/dist/cjs/quotas.d.ts.map +1 -0
- package/dist/cjs/quotas.js +50 -0
- package/dist/cjs/quotas.js.map +1 -0
- package/dist/cjs/role.d.ts +113 -0
- package/dist/cjs/role.d.ts.map +1 -0
- package/dist/cjs/role.js +363 -0
- package/dist/cjs/role.js.map +1 -0
- package/dist/cjs/roleTemplate.d.ts +73 -0
- package/dist/cjs/roleTemplate.d.ts.map +1 -0
- package/dist/cjs/roleTemplate.js +236 -0
- package/dist/cjs/roleTemplate.js.map +1 -0
- package/dist/cjs/security.d.ts +27 -0
- package/dist/cjs/security.d.ts.map +1 -0
- package/dist/cjs/security.js +79 -0
- package/dist/cjs/security.js.map +1 -0
- package/dist/cjs/skill.d.ts +141 -0
- package/dist/cjs/skill.d.ts.map +1 -0
- package/dist/cjs/skill.js +440 -0
- package/dist/cjs/skill.js.map +1 -0
- package/dist/cjs/skillAssessmentTestingSession.d.ts +49 -0
- package/dist/cjs/skillAssessmentTestingSession.d.ts.map +1 -0
- package/dist/cjs/skillAssessmentTestingSession.js +156 -0
- package/dist/cjs/skillAssessmentTestingSession.js.map +1 -0
- package/dist/cjs/skillAssessments.d.ts +49 -0
- package/dist/cjs/skillAssessments.d.ts.map +1 -0
- package/dist/cjs/skillAssessments.js +156 -0
- package/dist/cjs/skillAssessments.js.map +1 -0
- package/dist/cjs/skillTemplate.d.ts +87 -0
- package/dist/cjs/skillTemplate.d.ts.map +1 -0
- package/dist/cjs/skillTemplate.js +281 -0
- package/dist/cjs/skillTemplate.js.map +1 -0
- package/dist/cjs/talentTransfromation.d.ts +29 -0
- package/dist/cjs/talentTransfromation.d.ts.map +1 -0
- package/dist/cjs/talentTransfromation.js +100 -0
- package/dist/cjs/talentTransfromation.js.map +1 -0
- package/dist/cjs/teams.d.ts +85 -0
- package/dist/cjs/teams.d.ts.map +1 -0
- package/dist/cjs/teams.js +252 -0
- package/dist/cjs/teams.js.map +1 -0
- package/dist/cjs/tenants.d.ts +16 -0
- package/dist/cjs/tenants.d.ts.map +1 -0
- package/dist/cjs/tenants.js +55 -0
- package/dist/cjs/tenants.js.map +1 -0
- package/dist/cjs/trainingPlans.d.ts +92 -0
- package/dist/cjs/trainingPlans.d.ts.map +1 -0
- package/dist/cjs/trainingPlans.js +309 -0
- package/dist/cjs/trainingPlans.js.map +1 -0
- package/dist/cjs/trainingPlansProficiencyLevels.d.ts +32 -0
- package/dist/cjs/trainingPlansProficiencyLevels.d.ts.map +1 -0
- package/dist/cjs/trainingPlansProficiencyLevels.js +97 -0
- package/dist/cjs/trainingPlansProficiencyLevels.js.map +1 -0
- package/dist/cjs/userInformation.d.ts +29 -0
- package/dist/cjs/userInformation.d.ts.map +1 -0
- package/dist/cjs/userInformation.js +81 -0
- package/dist/cjs/userInformation.js.map +1 -0
- package/dist/cjs/users.d.ts +206 -0
- package/dist/cjs/users.d.ts.map +1 -0
- package/dist/cjs/users.js +694 -0
- package/dist/cjs/users.js.map +1 -0
- package/dist/cjs/utils.d.ts +14 -0
- package/dist/cjs/utils.d.ts.map +1 -0
- package/dist/cjs/utils.js +58 -0
- package/dist/cjs/utils.js.map +1 -0
- package/dist/esm/actionNotifications.d.ts +24 -0
- package/dist/esm/actionNotifications.d.ts.map +1 -0
- package/dist/esm/actionNotifications.js +67 -0
- package/dist/esm/actionNotifications.js.map +1 -0
- package/dist/esm/address.d.ts +8 -0
- package/dist/esm/address.d.ts.map +1 -0
- package/dist/esm/address.js +20 -0
- package/dist/esm/address.js.map +1 -0
- package/dist/esm/aiAssistant.d.ts +42 -0
- package/dist/esm/aiAssistant.d.ts.map +1 -0
- package/dist/esm/aiAssistant.js +126 -0
- package/dist/esm/aiAssistant.js.map +1 -0
- package/dist/esm/avatar.d.ts +11 -0
- package/dist/esm/avatar.d.ts.map +1 -0
- package/dist/esm/avatar.js +28 -0
- package/dist/esm/avatar.js.map +1 -0
- package/dist/esm/axiosClient.d.ts +31 -0
- package/dist/esm/axiosClient.d.ts.map +1 -0
- package/dist/esm/axiosClient.js +78 -0
- package/dist/esm/axiosClient.js.map +1 -0
- package/dist/esm/config.d.ts +23 -0
- package/dist/esm/config.d.ts.map +1 -0
- package/dist/esm/config.js +57 -0
- package/dist/esm/config.js.map +1 -0
- package/dist/esm/constants.d.ts +69 -0
- package/dist/esm/constants.d.ts.map +1 -0
- package/dist/esm/constants.js +88 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/dashboard.d.ts +23 -0
- package/dist/esm/dashboard.d.ts.map +1 -0
- package/dist/esm/dashboard.js +68 -0
- package/dist/esm/dashboard.js.map +1 -0
- package/dist/esm/departmentTrainingPlans.d.ts +53 -0
- package/dist/esm/departmentTrainingPlans.d.ts.map +1 -0
- package/dist/esm/departmentTrainingPlans.js +144 -0
- package/dist/esm/departmentTrainingPlans.js.map +1 -0
- package/dist/esm/groups.d.ts +90 -0
- package/dist/esm/groups.d.ts.map +1 -0
- package/dist/esm/groups.js +258 -0
- package/dist/esm/groups.js.map +1 -0
- package/dist/esm/index.d.ts +33 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/{src/lib/index.ts → dist/esm/index.js} +3 -13
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/integration.d.ts +82 -0
- package/dist/esm/integration.d.ts.map +1 -0
- package/dist/esm/integration.js +299 -0
- package/dist/esm/integration.js.map +1 -0
- package/dist/esm/integrationConfiguration.d.ts +27 -0
- package/dist/esm/integrationConfiguration.d.ts.map +1 -0
- package/dist/esm/integrationConfiguration.js +80 -0
- package/dist/esm/integrationConfiguration.js.map +1 -0
- package/dist/esm/integrations/contentGenerator.d.ts +22 -0
- package/dist/esm/integrations/contentGenerator.d.ts.map +1 -0
- package/dist/esm/integrations/contentGenerator.js +64 -0
- package/dist/esm/integrations/contentGenerator.js.map +1 -0
- package/dist/esm/learningContent.d.ts +122 -0
- package/dist/esm/learningContent.d.ts.map +1 -0
- package/dist/esm/learningContent.js +376 -0
- package/dist/esm/learningContent.js.map +1 -0
- package/dist/esm/learningPath.d.ts +64 -0
- package/dist/esm/learningPath.d.ts.map +1 -0
- package/dist/esm/learningPath.js +194 -0
- package/dist/esm/learningPath.js.map +1 -0
- package/dist/esm/logger.d.ts +19 -0
- package/dist/esm/logger.d.ts.map +1 -0
- package/dist/esm/logger.js +55 -0
- package/dist/esm/logger.js.map +1 -0
- package/dist/esm/microSkillsQuizes.d.ts +18 -0
- package/dist/esm/microSkillsQuizes.d.ts.map +1 -0
- package/dist/esm/microSkillsQuizes.js +48 -0
- package/dist/esm/microSkillsQuizes.js.map +1 -0
- package/dist/esm/quotas.d.ts +15 -0
- package/dist/esm/quotas.d.ts.map +1 -0
- package/dist/esm/quotas.js +45 -0
- package/dist/esm/quotas.js.map +1 -0
- package/dist/esm/role.d.ts +113 -0
- package/dist/esm/role.d.ts.map +1 -0
- package/dist/esm/role.js +346 -0
- package/dist/esm/role.js.map +1 -0
- package/dist/esm/roleTemplate.d.ts +73 -0
- package/dist/esm/roleTemplate.d.ts.map +1 -0
- package/dist/esm/roleTemplate.js +224 -0
- package/dist/esm/roleTemplate.js.map +1 -0
- package/dist/esm/security.d.ts +27 -0
- package/dist/esm/security.d.ts.map +1 -0
- package/dist/esm/security.js +72 -0
- package/dist/esm/security.js.map +1 -0
- package/dist/esm/skill.d.ts +141 -0
- package/dist/esm/skill.d.ts.map +1 -0
- package/dist/esm/skill.js +418 -0
- package/dist/esm/skill.js.map +1 -0
- package/dist/esm/skillAssessmentTestingSession.d.ts +49 -0
- package/dist/esm/skillAssessmentTestingSession.d.ts.map +1 -0
- package/dist/esm/skillAssessmentTestingSession.js +147 -0
- package/dist/esm/skillAssessmentTestingSession.js.map +1 -0
- package/dist/esm/skillAssessments.d.ts +49 -0
- package/dist/esm/skillAssessments.d.ts.map +1 -0
- package/dist/esm/skillAssessments.js +147 -0
- package/dist/esm/skillAssessments.js.map +1 -0
- package/dist/esm/skillTemplate.d.ts +87 -0
- package/dist/esm/skillTemplate.d.ts.map +1 -0
- package/dist/esm/skillTemplate.js +267 -0
- package/dist/esm/skillTemplate.js.map +1 -0
- package/dist/esm/talentTransfromation.d.ts +29 -0
- package/dist/esm/talentTransfromation.d.ts.map +1 -0
- package/dist/esm/talentTransfromation.js +93 -0
- package/dist/esm/talentTransfromation.js.map +1 -0
- package/dist/esm/teams.d.ts +85 -0
- package/dist/esm/teams.d.ts.map +1 -0
- package/dist/esm/teams.js +238 -0
- package/dist/esm/teams.js.map +1 -0
- package/dist/esm/tenants.d.ts +16 -0
- package/dist/esm/tenants.d.ts.map +1 -0
- package/dist/esm/tenants.js +50 -0
- package/dist/esm/tenants.js.map +1 -0
- package/dist/esm/trainingPlans.d.ts +92 -0
- package/dist/esm/trainingPlans.d.ts.map +1 -0
- package/dist/esm/trainingPlans.js +293 -0
- package/dist/esm/trainingPlans.js.map +1 -0
- package/dist/esm/trainingPlansProficiencyLevels.d.ts +32 -0
- package/dist/esm/trainingPlansProficiencyLevels.d.ts.map +1 -0
- package/dist/esm/trainingPlansProficiencyLevels.js +90 -0
- package/dist/esm/trainingPlansProficiencyLevels.js.map +1 -0
- package/dist/esm/userInformation.d.ts +29 -0
- package/dist/esm/userInformation.d.ts.map +1 -0
- package/dist/esm/userInformation.js +75 -0
- package/dist/esm/userInformation.js.map +1 -0
- package/dist/esm/users.d.ts +206 -0
- package/dist/esm/users.d.ts.map +1 -0
- package/dist/esm/users.js +663 -0
- package/dist/esm/users.js.map +1 -0
- package/dist/esm/utils.d.ts +14 -0
- package/dist/esm/utils.d.ts.map +1 -0
- package/dist/esm/utils.js +50 -0
- package/dist/esm/utils.js.map +1 -0
- package/package.json +8 -1
- package/. npmignore +0 -11
- package/.eslintrc.json +0 -14
- package/src/lib/actionNotifications.ts +0 -87
- package/src/lib/address.ts +0 -25
- package/src/lib/aiAssistant.ts +0 -190
- package/src/lib/avatar.ts +0 -38
- package/src/lib/axiosClient.ts +0 -97
- package/src/lib/config.ts +0 -80
- package/src/lib/constants.ts +0 -90
- package/src/lib/dashboard.ts +0 -83
- package/src/lib/departmentTrainingPlans.ts +0 -197
- package/src/lib/groups.ts +0 -327
- package/src/lib/integration.ts +0 -395
- package/src/lib/integrationConfiguration.ts +0 -108
- package/src/lib/integrations/contentGenerator.ts +0 -97
- package/src/lib/learningContent.ts +0 -522
- package/src/lib/learningPath.ts +0 -237
- package/src/lib/logger.ts +0 -69
- package/src/lib/microSkillsQuizes.ts +0 -66
- package/src/lib/quotas.ts +0 -55
- package/src/lib/role.ts +0 -438
- package/src/lib/roleTemplate.ts +0 -282
- package/src/lib/security.ts +0 -93
- package/src/lib/skill.ts +0 -532
- package/src/lib/skillAssessmentTestingSession.ts +0 -184
- package/src/lib/skillAssessments.ts +0 -184
- package/src/lib/skillTemplate.ts +0 -336
- package/src/lib/talentTransfromation.ts +0 -120
- package/src/lib/teams.ts +0 -316
- package/src/lib/tenants.ts +0 -63
- package/src/lib/trainingPlans.ts +0 -368
- package/src/lib/trainingPlansProficiencyLevels.ts +0 -124
- package/src/lib/userInformation.ts +0 -105
- package/src/lib/users.ts +0 -764
- package/src/lib/utils.ts +0 -51
- package/tsconfig.cjs.json +0 -9
- package/tsconfig.esm.json +0 -9
- package/tsconfig.json +0 -23
package/src/lib/integration.ts
DELETED
|
@@ -1,395 +0,0 @@
|
|
|
1
|
-
import { AxiosError, AxiosResponse } from "axios";
|
|
2
|
-
import { client, errorToString } from "./axiosClient";
|
|
3
|
-
import axiosLib from "axios";
|
|
4
|
-
import htmlParser from "node-html-parser";
|
|
5
|
-
import htmlToText from "html2plaintext";
|
|
6
|
-
|
|
7
|
-
interface IntegrationData {
|
|
8
|
-
data: object;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
interface IntegrationFilter {
|
|
12
|
-
filter?: string[];
|
|
13
|
-
type?: string;
|
|
14
|
-
version: string;
|
|
15
|
-
includeSupportedCapabilities: boolean;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface ContentInformation {
|
|
19
|
-
url: string;
|
|
20
|
-
verb: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
interface ContentInformationResponse {
|
|
24
|
-
description: string;
|
|
25
|
-
duration: number;
|
|
26
|
-
icon: string;
|
|
27
|
-
title: string;
|
|
28
|
-
type: number;
|
|
29
|
-
internal: boolean;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Create integration and set information
|
|
34
|
-
* @param {Object} data The new integration information
|
|
35
|
-
* @param {String} token Authorization token
|
|
36
|
-
*/
|
|
37
|
-
export const createIntegration = (
|
|
38
|
-
data: object,
|
|
39
|
-
token: string
|
|
40
|
-
): Promise<object> => {
|
|
41
|
-
return new Promise((resolve, reject) => {
|
|
42
|
-
const requestData: IntegrationData = {
|
|
43
|
-
data: data,
|
|
44
|
-
};
|
|
45
|
-
const confirmationRequest = client.put("api/v1/integrations/", requestData, {
|
|
46
|
-
headers: { authorization: token },
|
|
47
|
-
});
|
|
48
|
-
confirmationRequest
|
|
49
|
-
.then((response : AxiosResponse) => {
|
|
50
|
-
resolve(response.data);
|
|
51
|
-
})
|
|
52
|
-
.catch((error : AxiosError) => {
|
|
53
|
-
reject(error);
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Delete integration
|
|
60
|
-
* @param {String} id The id of the integration to be deleted
|
|
61
|
-
* @param {String} token Authorization token
|
|
62
|
-
*/
|
|
63
|
-
export const deleteIntegration = (
|
|
64
|
-
id: string,
|
|
65
|
-
token: string
|
|
66
|
-
): Promise<object> => {
|
|
67
|
-
return new Promise((resolve, reject) => {
|
|
68
|
-
const request = client.delete(`api/v1/integrations/`, {
|
|
69
|
-
headers: { authorization: token },
|
|
70
|
-
data: {
|
|
71
|
-
id: id,
|
|
72
|
-
},
|
|
73
|
-
});
|
|
74
|
-
request
|
|
75
|
-
.then((response : AxiosResponse) => {
|
|
76
|
-
resolve(response.data);
|
|
77
|
-
})
|
|
78
|
-
.catch((error : AxiosError) => {
|
|
79
|
-
reject(error);
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Discard the integration draft changes
|
|
86
|
-
* @param {String} id The id of the role template to be deleted
|
|
87
|
-
* @param {String} token Authorization token
|
|
88
|
-
*/
|
|
89
|
-
export const discardIntegrationChanges = (
|
|
90
|
-
id: string,
|
|
91
|
-
token: string
|
|
92
|
-
): Promise<object> => {
|
|
93
|
-
return new Promise((resolve, reject) => {
|
|
94
|
-
const data = {};
|
|
95
|
-
const request = client.get(`api/v1/integrations/discard/${id}`, {
|
|
96
|
-
headers: { authorization: token },
|
|
97
|
-
data: data,
|
|
98
|
-
});
|
|
99
|
-
request
|
|
100
|
-
.then((response : AxiosResponse) => {
|
|
101
|
-
resolve(response.data);
|
|
102
|
-
})
|
|
103
|
-
.catch((error : AxiosError) => {
|
|
104
|
-
reject(error);
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Get integration information
|
|
111
|
-
* @param {String} id The id of the integration
|
|
112
|
-
* @param {String} version The version of the integration to be received
|
|
113
|
-
* @param {String} token Authorization token
|
|
114
|
-
*/
|
|
115
|
-
export const getIntegrationInformationById = (
|
|
116
|
-
id: string,
|
|
117
|
-
version: string,
|
|
118
|
-
token: string
|
|
119
|
-
): Promise<object> => {
|
|
120
|
-
return new Promise((resolve, reject) => {
|
|
121
|
-
const confirmationRequest = client.get(
|
|
122
|
-
`api/v1/integrations/${id}/${version}`,
|
|
123
|
-
{
|
|
124
|
-
headers: { authorization: token },
|
|
125
|
-
}
|
|
126
|
-
);
|
|
127
|
-
confirmationRequest
|
|
128
|
-
.then((response : AxiosResponse) => {
|
|
129
|
-
resolve(response.data);
|
|
130
|
-
})
|
|
131
|
-
.catch((error : AxiosError) => {
|
|
132
|
-
reject(error);
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Get integrations list
|
|
139
|
-
* @param {Array<String>} filter The filter used to select the integration
|
|
140
|
-
* @param {String} type The type of the integration
|
|
141
|
-
* @param {String} version The version to be retrieved
|
|
142
|
-
* @param {Boolean} includeSupportedCapabilities If true, the supported capabilities will be included in the response
|
|
143
|
-
* @param {String} token Authorization token
|
|
144
|
-
*/
|
|
145
|
-
export const getIntegrationsList = (
|
|
146
|
-
filter: string[],
|
|
147
|
-
type: string,
|
|
148
|
-
version: string,
|
|
149
|
-
includeSupportedCapabilities: boolean,
|
|
150
|
-
token: string
|
|
151
|
-
): Promise<object> => {
|
|
152
|
-
return new Promise((resolve, reject) => {
|
|
153
|
-
const requestData: IntegrationFilter = {
|
|
154
|
-
includeSupportedCapabilities: includeSupportedCapabilities,
|
|
155
|
-
version: version,
|
|
156
|
-
};
|
|
157
|
-
if (filter) requestData.filter = filter;
|
|
158
|
-
if (type) requestData.type = type;
|
|
159
|
-
const confirmationRequest = client.post(`api/v1/integrations`, requestData, {
|
|
160
|
-
headers: { authorization: token },
|
|
161
|
-
});
|
|
162
|
-
confirmationRequest
|
|
163
|
-
.then((response : AxiosResponse) => {
|
|
164
|
-
resolve(response.data);
|
|
165
|
-
})
|
|
166
|
-
.catch((error : AxiosError) => {
|
|
167
|
-
reject(error);
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Get content information by Url
|
|
174
|
-
* @param {String} url The training url
|
|
175
|
-
* @param {String} verb The verb
|
|
176
|
-
* @param {String} token Authorization token
|
|
177
|
-
*/
|
|
178
|
-
export const getContentInformationByUrl = (
|
|
179
|
-
url: string,
|
|
180
|
-
verb: string,
|
|
181
|
-
token: string
|
|
182
|
-
): Promise<object> => {
|
|
183
|
-
return new Promise((resolve, reject) => {
|
|
184
|
-
const requestData: ContentInformation = {
|
|
185
|
-
url: url,
|
|
186
|
-
verb: verb,
|
|
187
|
-
};
|
|
188
|
-
const confirmationRequest = client.post(
|
|
189
|
-
`api/v1/contentproviders/getcontentinformationbyurl`,
|
|
190
|
-
requestData,
|
|
191
|
-
{
|
|
192
|
-
headers: { authorization: token },
|
|
193
|
-
}
|
|
194
|
-
);
|
|
195
|
-
confirmationRequest
|
|
196
|
-
.then((response : AxiosResponse) => {
|
|
197
|
-
resolve(response.data);
|
|
198
|
-
})
|
|
199
|
-
.catch((error : AxiosError) => {
|
|
200
|
-
reject(error);
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Get content information by url from the browser instead of the backend
|
|
207
|
-
* @param {String} url
|
|
208
|
-
* @returns {Promise<ContentInformationResponse>}
|
|
209
|
-
*/
|
|
210
|
-
export const getContentInformationByUrlFromBrowser = (
|
|
211
|
-
url: string
|
|
212
|
-
): Promise<ContentInformationResponse> => {
|
|
213
|
-
return new Promise((resolve, reject) => {
|
|
214
|
-
const domain = new URL(url);
|
|
215
|
-
const instance = axiosLib.create({
|
|
216
|
-
baseURL: domain.origin,
|
|
217
|
-
});
|
|
218
|
-
const confirmationRequest = instance.get(domain.pathname, {
|
|
219
|
-
headers: {
|
|
220
|
-
"Access-Control-Allow-Origin": "*",
|
|
221
|
-
"Access-Control-Allow-Headers":
|
|
222
|
-
"Authorization, Origin, X-Requested-With, Content-Type, Accept",
|
|
223
|
-
Accept:
|
|
224
|
-
"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
|
|
225
|
-
"Accept-Encoding": "gzip, deflate, br",
|
|
226
|
-
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE",
|
|
227
|
-
"User-Agent": "Mozilla/5.0",
|
|
228
|
-
},
|
|
229
|
-
});
|
|
230
|
-
confirmationRequest
|
|
231
|
-
.then((response : AxiosResponse) => {
|
|
232
|
-
//get the reading time
|
|
233
|
-
const getReadingTime = (text: string): number => {
|
|
234
|
-
const wpm = 225;
|
|
235
|
-
const words = text.trim().split(/\s+/).length;
|
|
236
|
-
return Math.ceil(words / wpm);
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
const document = htmlParser.parse(response.data);
|
|
240
|
-
const duration = getReadingTime(htmlToText(response.data));
|
|
241
|
-
const titleTag = document.querySelector("title");
|
|
242
|
-
const title = titleTag ? titleTag.rawText : "";
|
|
243
|
-
const description = "";
|
|
244
|
-
const descriptionEl = document.querySelector("meta");
|
|
245
|
-
try {
|
|
246
|
-
if (descriptionEl) {
|
|
247
|
-
const descriptionParentNode = descriptionEl.parentNode;
|
|
248
|
-
if (descriptionEl) {
|
|
249
|
-
const descriptionChildNodes = descriptionParentNode.childNodes;
|
|
250
|
-
if (descriptionChildNodes) {
|
|
251
|
-
//TODO: Code needs fixing
|
|
252
|
-
// const descriptionRawAttr = descriptionChildNodes.find((element) => {
|
|
253
|
-
// return element.rawAttrs && element.rawAttrs.includes("description");
|
|
254
|
-
// });
|
|
255
|
-
// if (descriptionRawAttr) {
|
|
256
|
-
// const element = descriptionRawAttr as any; // Cast to any to access rawAttrs
|
|
257
|
-
// const descriptionContent = element.rawAttrs.substring(
|
|
258
|
-
// element.rawAttrs.indexOf("content=") + 8
|
|
259
|
-
// );
|
|
260
|
-
// description = descriptionContent.substring(
|
|
261
|
-
// 0,
|
|
262
|
-
// descriptionContent.length - 1
|
|
263
|
-
// );
|
|
264
|
-
// }
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
} finally {
|
|
269
|
-
resolve({
|
|
270
|
-
description: description,
|
|
271
|
-
duration: duration,
|
|
272
|
-
icon: `http://www.google.com/s2/favicons?sz=128&domain_url=${domain.hostname}`,
|
|
273
|
-
title: title ? title.trim() : url,
|
|
274
|
-
type: 0,
|
|
275
|
-
internal: true,
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
})
|
|
279
|
-
.catch((error : AxiosError) => {
|
|
280
|
-
reject(new Error(errorToString(error)));
|
|
281
|
-
});
|
|
282
|
-
});
|
|
283
|
-
};
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* Get enabled content providers
|
|
287
|
-
* @param {String} userId
|
|
288
|
-
* @param {String} token Authorization token
|
|
289
|
-
*/
|
|
290
|
-
export const getEnabledContentProviders = (
|
|
291
|
-
userId: string,
|
|
292
|
-
token: string
|
|
293
|
-
): Promise<object> => {
|
|
294
|
-
return new Promise((resolve, reject) => {
|
|
295
|
-
const confirmationRequest = client.get(
|
|
296
|
-
`api/v1/contentproviders/getenabledcontentproviders/${userId}`,
|
|
297
|
-
{
|
|
298
|
-
headers: { authorization: token },
|
|
299
|
-
}
|
|
300
|
-
);
|
|
301
|
-
confirmationRequest
|
|
302
|
-
.then((response : AxiosResponse) => {
|
|
303
|
-
resolve(response.data);
|
|
304
|
-
})
|
|
305
|
-
.catch((error : AxiosError) => {
|
|
306
|
-
reject(error);
|
|
307
|
-
});
|
|
308
|
-
});
|
|
309
|
-
};
|
|
310
|
-
|
|
311
|
-
/**
|
|
312
|
-
* Publish integration
|
|
313
|
-
* @param {String} id The id of the integration to be published
|
|
314
|
-
* @param {String} token Authorization token
|
|
315
|
-
*/
|
|
316
|
-
export const publishIntegration = (
|
|
317
|
-
id: string,
|
|
318
|
-
token: string
|
|
319
|
-
): Promise<object> => {
|
|
320
|
-
return new Promise((resolve, reject) => {
|
|
321
|
-
const confirmationRequest = client.post(
|
|
322
|
-
`api/v1/integrations/publish/${id}`,
|
|
323
|
-
{},
|
|
324
|
-
{
|
|
325
|
-
headers: { authorization: token },
|
|
326
|
-
}
|
|
327
|
-
);
|
|
328
|
-
confirmationRequest
|
|
329
|
-
.then((response : AxiosResponse) => {
|
|
330
|
-
resolve(response.data);
|
|
331
|
-
})
|
|
332
|
-
.catch((error : AxiosError) => {
|
|
333
|
-
reject(error);
|
|
334
|
-
});
|
|
335
|
-
});
|
|
336
|
-
};
|
|
337
|
-
|
|
338
|
-
/**
|
|
339
|
-
* Set integration information
|
|
340
|
-
* @param {String} id The id of the integration to be updated
|
|
341
|
-
* @param {Object} data Data used to update the integration
|
|
342
|
-
* @param {String} token Authorization token
|
|
343
|
-
*/
|
|
344
|
-
export const setIntegrationInformation = (
|
|
345
|
-
id: string,
|
|
346
|
-
data: object,
|
|
347
|
-
token: string
|
|
348
|
-
): Promise<object> => {
|
|
349
|
-
return new Promise((resolve, reject) => {
|
|
350
|
-
const requestData: IntegrationData = {
|
|
351
|
-
data: data,
|
|
352
|
-
};
|
|
353
|
-
const confirmationRequest = client.post(
|
|
354
|
-
`api/v1/integrations/${id}`,
|
|
355
|
-
requestData,
|
|
356
|
-
{
|
|
357
|
-
headers: { authorization: token },
|
|
358
|
-
}
|
|
359
|
-
);
|
|
360
|
-
confirmationRequest
|
|
361
|
-
.then((response : AxiosResponse) => {
|
|
362
|
-
resolve(response.data);
|
|
363
|
-
})
|
|
364
|
-
.catch((error : AxiosError) => {
|
|
365
|
-
reject(error);
|
|
366
|
-
});
|
|
367
|
-
});
|
|
368
|
-
};
|
|
369
|
-
|
|
370
|
-
/**
|
|
371
|
-
* Set default integration
|
|
372
|
-
* @param {String} id The id of the integration to be set as default
|
|
373
|
-
* @param {String} token Authorization token
|
|
374
|
-
*/
|
|
375
|
-
export const setDefaultIntegration = (
|
|
376
|
-
id: string,
|
|
377
|
-
token: string
|
|
378
|
-
): Promise<object> => {
|
|
379
|
-
return new Promise((resolve, reject) => {
|
|
380
|
-
const confirmationRequest = client.post(
|
|
381
|
-
`api/v1/integrations/${id}/default`,
|
|
382
|
-
"",
|
|
383
|
-
{
|
|
384
|
-
headers: { authorization: token },
|
|
385
|
-
}
|
|
386
|
-
);
|
|
387
|
-
confirmationRequest
|
|
388
|
-
.then((response : AxiosResponse) => {
|
|
389
|
-
resolve(response.data);
|
|
390
|
-
})
|
|
391
|
-
.catch((error : AxiosError) => {
|
|
392
|
-
reject(error);
|
|
393
|
-
});
|
|
394
|
-
});
|
|
395
|
-
};
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { AxiosError, AxiosResponse } from "axios";
|
|
2
|
-
import { client } from "./axiosClient";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Get the integration configuration
|
|
6
|
-
* @param {Array<String>} ids
|
|
7
|
-
* @param {Number} type
|
|
8
|
-
* @param {String} token Authorization token
|
|
9
|
-
* @returns {Promise<object>}
|
|
10
|
-
*/
|
|
11
|
-
export const getIntegrationsConfiguration = (
|
|
12
|
-
ids: string[],
|
|
13
|
-
type: number,
|
|
14
|
-
token: string
|
|
15
|
-
): Promise<object> => {
|
|
16
|
-
return new Promise((resolve, reject) => {
|
|
17
|
-
const requestData: { type: number; ids?: string[] } = { type: type };
|
|
18
|
-
if (ids) requestData.ids = ids;
|
|
19
|
-
const confirmationRequest = client.post(
|
|
20
|
-
"api/v1/integrationsconfiguration",
|
|
21
|
-
requestData,
|
|
22
|
-
{
|
|
23
|
-
headers: { authorization: token },
|
|
24
|
-
}
|
|
25
|
-
);
|
|
26
|
-
confirmationRequest
|
|
27
|
-
.then((response : AxiosResponse) => {
|
|
28
|
-
resolve(response.data);
|
|
29
|
-
})
|
|
30
|
-
.catch((error : AxiosError) => {
|
|
31
|
-
reject(error);
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Save integration configuration
|
|
38
|
-
* @param {String} id The id of the integration configuration to be updated
|
|
39
|
-
* @param {Number} type The type of configuration
|
|
40
|
-
* @param {Object} configuration Data used to update the integration configuration
|
|
41
|
-
* @param {String} token Authorization token
|
|
42
|
-
* @returns {Promise<object>}
|
|
43
|
-
*/
|
|
44
|
-
export const saveIntegrationConfiguration = (
|
|
45
|
-
id: string,
|
|
46
|
-
type: number,
|
|
47
|
-
configuration: object,
|
|
48
|
-
token: string
|
|
49
|
-
): Promise<object> => {
|
|
50
|
-
return new Promise((resolve, reject) => {
|
|
51
|
-
const requestData = {
|
|
52
|
-
id: id,
|
|
53
|
-
configuration: configuration,
|
|
54
|
-
type: type,
|
|
55
|
-
};
|
|
56
|
-
const confirmationRequest = client.put(
|
|
57
|
-
`api/v1/integrationsconfiguration`,
|
|
58
|
-
requestData,
|
|
59
|
-
{
|
|
60
|
-
headers: { authorization: token },
|
|
61
|
-
}
|
|
62
|
-
);
|
|
63
|
-
confirmationRequest
|
|
64
|
-
.then((response : AxiosResponse) => {
|
|
65
|
-
resolve(response.data);
|
|
66
|
-
})
|
|
67
|
-
.catch((error : AxiosError) => {
|
|
68
|
-
reject(error);
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Test integration configuration
|
|
75
|
-
* @param {String} id The id of the integration to be updated
|
|
76
|
-
* @param {String} type The type of configuration
|
|
77
|
-
* @param {Object} configuration Configuration to be tested
|
|
78
|
-
* @param {String} token Authorization token
|
|
79
|
-
* @returns {Promise<object>}
|
|
80
|
-
*/
|
|
81
|
-
export const testIntegrationConfiguration = (
|
|
82
|
-
id: string,
|
|
83
|
-
type: string,
|
|
84
|
-
configuration: object,
|
|
85
|
-
token: string
|
|
86
|
-
): Promise<object> => {
|
|
87
|
-
return new Promise((resolve, reject) => {
|
|
88
|
-
const requestData = {
|
|
89
|
-
id: id,
|
|
90
|
-
configuration: configuration,
|
|
91
|
-
type: type,
|
|
92
|
-
};
|
|
93
|
-
const confirmationRequest = client.post(
|
|
94
|
-
`api/v1/integrationsconfiguration/testConfiguration`,
|
|
95
|
-
requestData,
|
|
96
|
-
{
|
|
97
|
-
headers: { authorization: token },
|
|
98
|
-
}
|
|
99
|
-
);
|
|
100
|
-
confirmationRequest
|
|
101
|
-
.then((response : AxiosResponse) => {
|
|
102
|
-
resolve(response.data);
|
|
103
|
-
})
|
|
104
|
-
.catch((error : AxiosError) => {
|
|
105
|
-
reject(error);
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
};
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { AxiosError, AxiosResponse } from "axios";
|
|
2
|
-
import { client } from "../axiosClient";
|
|
3
|
-
|
|
4
|
-
interface GenerateContentData {
|
|
5
|
-
data: string[];
|
|
6
|
-
contentType: string;
|
|
7
|
-
integrationId?: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface GenerateContentAsyncData {
|
|
11
|
-
id: string;
|
|
12
|
-
data: object;
|
|
13
|
-
contentType: string;
|
|
14
|
-
elementType: string;
|
|
15
|
-
integrationId?: string;
|
|
16
|
-
comments: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Generate content
|
|
21
|
-
* @param {Array<String>} data
|
|
22
|
-
* @param {String} contentType
|
|
23
|
-
* @param {String} integrationId
|
|
24
|
-
* @param {String} token
|
|
25
|
-
* @returns {Promise<object>}
|
|
26
|
-
*/
|
|
27
|
-
export const generateContent = (
|
|
28
|
-
data: string[],
|
|
29
|
-
contentType: string,
|
|
30
|
-
integrationId: string,
|
|
31
|
-
token: string
|
|
32
|
-
): Promise<object> => {
|
|
33
|
-
return new Promise((resolve, reject) => {
|
|
34
|
-
const data_: GenerateContentData = {
|
|
35
|
-
data: data,
|
|
36
|
-
contentType: contentType,
|
|
37
|
-
};
|
|
38
|
-
if (integrationId) data_.integrationId = integrationId;
|
|
39
|
-
const request = client.post(`api/v1/contentgenerators/generate`, data_, {
|
|
40
|
-
headers: { authorization: token },
|
|
41
|
-
});
|
|
42
|
-
request
|
|
43
|
-
.then((response : AxiosResponse) => {
|
|
44
|
-
resolve(response.data);
|
|
45
|
-
})
|
|
46
|
-
.catch((error : AxiosError) => {
|
|
47
|
-
reject(error);
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Generate content async
|
|
54
|
-
* @param {String} id
|
|
55
|
-
* @param {Object} data
|
|
56
|
-
* @param {String} contentType
|
|
57
|
-
* @param {String} elementType
|
|
58
|
-
* @param {String} integrationId
|
|
59
|
-
* @param {String} comments
|
|
60
|
-
* @param {String} token
|
|
61
|
-
* @returns {Promise<object>}
|
|
62
|
-
*/
|
|
63
|
-
export const generateContentAsync = (
|
|
64
|
-
id: string,
|
|
65
|
-
data: object,
|
|
66
|
-
contentType: string,
|
|
67
|
-
elementType: string,
|
|
68
|
-
integrationId: string,
|
|
69
|
-
comments: string,
|
|
70
|
-
token: string
|
|
71
|
-
): Promise<object> => {
|
|
72
|
-
return new Promise((resolve, reject) => {
|
|
73
|
-
const data_: GenerateContentAsyncData = {
|
|
74
|
-
id: id,
|
|
75
|
-
data: data,
|
|
76
|
-
comments: comments,
|
|
77
|
-
contentType: contentType,
|
|
78
|
-
elementType: elementType,
|
|
79
|
-
};
|
|
80
|
-
if (integrationId) data_.integrationId = integrationId;
|
|
81
|
-
const request = client.post(
|
|
82
|
-
`api/v1/contentgenerators/generateasync`,
|
|
83
|
-
data_,
|
|
84
|
-
{
|
|
85
|
-
headers: { authorization: token },
|
|
86
|
-
}
|
|
87
|
-
);
|
|
88
|
-
request
|
|
89
|
-
.then((response : AxiosResponse) => {
|
|
90
|
-
resolve(response.data);
|
|
91
|
-
})
|
|
92
|
-
.catch((error : AxiosError) => {
|
|
93
|
-
reject(error);
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
};
|
|
97
|
-
|