@stackfactor/client-api 1.1.140 → 1.1.143
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/{src/lib/index.ts → dist/cjs/index.d.ts} +3 -13
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +77 -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/dist/esm/index.js +33 -0
- 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 +9 -2
- 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
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the backend base API URL
|
|
3
|
+
* @returns {String}
|
|
4
|
+
*/
|
|
5
|
+
export declare const getBaseUrl: () => string;
|
|
6
|
+
/**
|
|
7
|
+
* Remove null properties
|
|
8
|
+
* @param {Object} object
|
|
9
|
+
* @returns {Object}
|
|
10
|
+
*/
|
|
11
|
+
export declare const removeNullProperties: (object: {
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}) => object;
|
|
14
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,eAAO,MAAM,UAAU,QAAO,MAqB7B,CAAC;AAEF;;;;GAIG;AAEH,eAAO,MAAM,oBAAoB,WAAY;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,KAAG,MAWrE,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import dotenv from "dotenv";
|
|
2
|
+
// Load environment variables from .env file
|
|
3
|
+
dotenv.config();
|
|
4
|
+
/**
|
|
5
|
+
* Returns the backend base API URL
|
|
6
|
+
* @returns {String}
|
|
7
|
+
*/
|
|
8
|
+
export const getBaseUrl = () => {
|
|
9
|
+
if (process.env.REACT_APP_BACKEND_URL) {
|
|
10
|
+
return process.env.REACT_APP_BACKEND_URL;
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
switch (process.env.REACT_APP_NODE_ENV) {
|
|
14
|
+
case "development":
|
|
15
|
+
case null:
|
|
16
|
+
case undefined:
|
|
17
|
+
return "https://localhost/";
|
|
18
|
+
case "testing":
|
|
19
|
+
return "https://qaapi.stackfactor.ai/";
|
|
20
|
+
case "nonprod":
|
|
21
|
+
return "https://apiqa.stackfactor.ai/";
|
|
22
|
+
case "production":
|
|
23
|
+
return "https://api.stackfactor.ai/";
|
|
24
|
+
case "security":
|
|
25
|
+
return "https://csapi.stackfactor.ai/";
|
|
26
|
+
default:
|
|
27
|
+
throw new Error("Invalid environment");
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Remove null properties
|
|
33
|
+
* @param {Object} object
|
|
34
|
+
* @returns {Object}
|
|
35
|
+
*/
|
|
36
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
37
|
+
export const removeNullProperties = (object) => {
|
|
38
|
+
Object.keys(object).forEach((key) => {
|
|
39
|
+
const value = object[key];
|
|
40
|
+
const hasProperties = value && Object.keys(value).length > 0;
|
|
41
|
+
if (value === null) {
|
|
42
|
+
delete object[key];
|
|
43
|
+
}
|
|
44
|
+
else if (typeof value !== "string" && hasProperties) {
|
|
45
|
+
removeNullProperties(value);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return object;
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,4CAA4C;AAC5C,MAAM,CAAC,MAAM,EAAE,CAAC;AAIhB;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,GAAW,EAAE;IACrC,IAAI,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC;QACtC,OAAO,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC;IAC3C,CAAC;SAAM,CAAC;QACN,QAAQ,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,CAAC;YACvC,KAAK,aAAa,CAAC;YACnB,KAAK,IAAI,CAAC;YACV,KAAK,SAAS;gBACZ,OAAO,oBAAoB,CAAC;YAC9B,KAAK,SAAS;gBACZ,OAAO,+BAA+B,CAAC;YACzC,KAAK,SAAS;gBACZ,OAAO,+BAA+B,CAAC;YACzC,KAAK,YAAY;gBACf,OAAO,6BAA6B,CAAC;YACvC,KAAK,UAAU;gBACb,OAAO,+BAA+B,CAAC;YACzC;gBACE,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AAEF;;;;GAIG;AACH,uDAAuD;AACvD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,MAA8B,EAAU,EAAE;IAC7E,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QAClC,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1B,MAAM,aAAa,GAAG,KAAK,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;QAC7D,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACnB,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC;aAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,aAAa,EAAE,CAAC;YACtD,oBAAoB,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackfactor/client-api",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.143",
|
|
4
4
|
"description": "Node.js library for the StackFactor API",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -11,6 +11,13 @@
|
|
|
11
11
|
"require": "./dist/cjs/index.js"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
|
+
"files": [
|
|
15
|
+
"declarations",
|
|
16
|
+
"dist",
|
|
17
|
+
"package.json",
|
|
18
|
+
"README.md",
|
|
19
|
+
"LICENSE"
|
|
20
|
+
],
|
|
14
21
|
"type": "module",
|
|
15
22
|
"scripts": {
|
|
16
23
|
"build": "npm run build:esm && npm run build:cjs",
|
|
@@ -34,7 +41,7 @@
|
|
|
34
41
|
"axios": "^1.8.1",
|
|
35
42
|
"dotenv": "^16.4.7",
|
|
36
43
|
"html2plaintext": "^2.1.4",
|
|
37
|
-
"https": "
|
|
44
|
+
"https": "latest",
|
|
38
45
|
"node-html-parser": "^7.0.1"
|
|
39
46
|
},
|
|
40
47
|
"devDependencies": {
|
package/. npmignore
DELETED
package/.eslintrc.json
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"env": {
|
|
3
|
-
"browser": true,
|
|
4
|
-
"es2021": true
|
|
5
|
-
},
|
|
6
|
-
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
|
|
7
|
-
"parser": "@typescript-eslint/parser",
|
|
8
|
-
"parserOptions": {
|
|
9
|
-
"ecmaVersion": 2020,
|
|
10
|
-
"sourceType": "module"
|
|
11
|
-
},
|
|
12
|
-
"plugins": [],
|
|
13
|
-
"rules": { "@typescript-eslint/no-explicit-any": "error" }
|
|
14
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { AxiosError, AxiosResponse } from "axios";
|
|
2
|
-
import { client } from "./axiosClient";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Get all permissions
|
|
6
|
-
* @param {String} token The authentication token
|
|
7
|
-
* @returns {Promise<object>}
|
|
8
|
-
*/
|
|
9
|
-
export const getAllUserNotifications = (token: string): Promise<object> => {
|
|
10
|
-
return new Promise((resolve, reject) => {
|
|
11
|
-
const request = client.get(`api/v1/actionnotifications`, {
|
|
12
|
-
headers: { authorization: token },
|
|
13
|
-
});
|
|
14
|
-
request
|
|
15
|
-
.then((response : AxiosResponse) => {
|
|
16
|
-
resolve(response.data);
|
|
17
|
-
})
|
|
18
|
-
.catch((error : AxiosError) => {
|
|
19
|
-
reject(error);
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Mark notifications as open or viewed
|
|
26
|
-
* @param {Array<String>} ids The id of the notifications to be marked
|
|
27
|
-
* @param {String} status The new status
|
|
28
|
-
* @param {String} authToken The authentication token
|
|
29
|
-
* @returns {Promise<object>}
|
|
30
|
-
*/
|
|
31
|
-
export const markNotifications = (
|
|
32
|
-
ids: string[],
|
|
33
|
-
status: string,
|
|
34
|
-
authToken: string
|
|
35
|
-
): Promise<object> => {
|
|
36
|
-
return new Promise((resolve, reject) => {
|
|
37
|
-
const request = client.put(
|
|
38
|
-
`api/v1/actionnotifications/mark`,
|
|
39
|
-
{
|
|
40
|
-
ids: ids,
|
|
41
|
-
status: status,
|
|
42
|
-
},
|
|
43
|
-
{ headers: { authorization: authToken } }
|
|
44
|
-
);
|
|
45
|
-
request
|
|
46
|
-
.then((response : AxiosResponse) => {
|
|
47
|
-
resolve(response.data);
|
|
48
|
-
})
|
|
49
|
-
.catch((error : AxiosError) => {
|
|
50
|
-
reject(error);
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Process a notification
|
|
57
|
-
* @param {String} id The notification id
|
|
58
|
-
* @param {String} action The action to be executed
|
|
59
|
-
* @param {String} comments The comments to be saved in the notification
|
|
60
|
-
* @param {String} authToken The authentication token
|
|
61
|
-
* @returns {Promise<object>}
|
|
62
|
-
*/
|
|
63
|
-
export const processNotification = (
|
|
64
|
-
id: string,
|
|
65
|
-
action: string,
|
|
66
|
-
comments: string,
|
|
67
|
-
authToken: string
|
|
68
|
-
): Promise<object> => {
|
|
69
|
-
return new Promise((resolve, reject) => {
|
|
70
|
-
const request = client.put(
|
|
71
|
-
`api/v1/actionnotifications/process`,
|
|
72
|
-
{
|
|
73
|
-
id: id,
|
|
74
|
-
action: action,
|
|
75
|
-
comments: comments,
|
|
76
|
-
},
|
|
77
|
-
{ headers: { authorization: authToken } }
|
|
78
|
-
);
|
|
79
|
-
request
|
|
80
|
-
.then((response : AxiosResponse) => {
|
|
81
|
-
resolve(response.data);
|
|
82
|
-
})
|
|
83
|
-
.catch((error : AxiosError) => {
|
|
84
|
-
reject(error);
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
};
|
package/src/lib/address.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { AxiosError, AxiosResponse } from "axios";
|
|
2
|
-
import { client } from "./axiosClient";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Validate Address
|
|
6
|
-
* @param {String} input - the address in raw format
|
|
7
|
-
* @param {String} authToken - Authorization token
|
|
8
|
-
* @returns {Promise<object>}
|
|
9
|
-
*/
|
|
10
|
-
export const autoComplete = (input: string, authToken: string): Promise<object> => {
|
|
11
|
-
return new Promise((resolve, reject) => {
|
|
12
|
-
const getAddressesRequest = client.post(
|
|
13
|
-
`api/v1/address/autocomplete/`,
|
|
14
|
-
{ input: input },
|
|
15
|
-
{ headers: { authorization: authToken } }
|
|
16
|
-
);
|
|
17
|
-
getAddressesRequest
|
|
18
|
-
.then((response : AxiosResponse) => {
|
|
19
|
-
resolve(response.data);
|
|
20
|
-
})
|
|
21
|
-
.catch((error : AxiosError) => {
|
|
22
|
-
reject(error);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
};
|
package/src/lib/aiAssistant.ts
DELETED
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import { AxiosError, AxiosResponse } from "axios";
|
|
2
|
-
import { client } from "./axiosClient";
|
|
3
|
-
|
|
4
|
-
interface AskQuestionData {
|
|
5
|
-
conversationId: string;
|
|
6
|
-
question: string;
|
|
7
|
-
updatedContext: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface EndConversationData {
|
|
11
|
-
conversationId: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
interface StartConversationData {
|
|
15
|
-
autoContextRefresh: boolean;
|
|
16
|
-
context: string;
|
|
17
|
-
question: string;
|
|
18
|
-
elementId: string;
|
|
19
|
-
elementType: string;
|
|
20
|
-
conversationId?: string | null;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Ask Question to the AI
|
|
25
|
-
* @param {String} conversationId
|
|
26
|
-
* @param {String} question
|
|
27
|
-
* @param {String} updatedContext
|
|
28
|
-
* @param {String} token Authorization token
|
|
29
|
-
* @returns {Promise<object>}
|
|
30
|
-
*/
|
|
31
|
-
export const askQuestion = (
|
|
32
|
-
conversationId: string,
|
|
33
|
-
question: string,
|
|
34
|
-
updatedContext: string,
|
|
35
|
-
token: string
|
|
36
|
-
): Promise<object> => {
|
|
37
|
-
return new Promise((resolve, reject) => {
|
|
38
|
-
const data: AskQuestionData = {
|
|
39
|
-
conversationId: conversationId,
|
|
40
|
-
question: question,
|
|
41
|
-
updatedContext: updatedContext,
|
|
42
|
-
};
|
|
43
|
-
const confirmationRequest = client.post(
|
|
44
|
-
"/api/v1/aiassistant/askquestion",
|
|
45
|
-
data,
|
|
46
|
-
{
|
|
47
|
-
headers: { authorization: token },
|
|
48
|
-
}
|
|
49
|
-
);
|
|
50
|
-
confirmationRequest
|
|
51
|
-
.then((response : AxiosResponse) => {
|
|
52
|
-
resolve(response.data);
|
|
53
|
-
})
|
|
54
|
-
.catch((error : AxiosError) => {
|
|
55
|
-
reject(error);
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* End conversation with the AI
|
|
62
|
-
* @param {String} conversationId
|
|
63
|
-
* @param {String} token Authorization token
|
|
64
|
-
* @returns {Promise<object>}
|
|
65
|
-
*/
|
|
66
|
-
export const endConversation = (
|
|
67
|
-
conversationId: string,
|
|
68
|
-
token: string
|
|
69
|
-
): Promise<object> => {
|
|
70
|
-
return new Promise((resolve, reject) => {
|
|
71
|
-
const data: EndConversationData = {
|
|
72
|
-
conversationId: conversationId,
|
|
73
|
-
};
|
|
74
|
-
const confirmationRequest = client.post(
|
|
75
|
-
"/api/v1/aiassistant/endconversation",
|
|
76
|
-
data,
|
|
77
|
-
{
|
|
78
|
-
headers: { authorization: token },
|
|
79
|
-
}
|
|
80
|
-
);
|
|
81
|
-
confirmationRequest
|
|
82
|
-
.then((response : AxiosResponse) => {
|
|
83
|
-
resolve(response.data);
|
|
84
|
-
})
|
|
85
|
-
.catch((error : AxiosError) => {
|
|
86
|
-
reject(error);
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Get conversation by elementId
|
|
93
|
-
* @param {String} elementId
|
|
94
|
-
* @param {String} token
|
|
95
|
-
* @returns {Promise<object>}
|
|
96
|
-
*/
|
|
97
|
-
export const getConversationByElementId = (
|
|
98
|
-
elementId: string,
|
|
99
|
-
token: string
|
|
100
|
-
): Promise<object> => {
|
|
101
|
-
return new Promise((resolve, reject) => {
|
|
102
|
-
const confirmationRequest = client.get(
|
|
103
|
-
`/api/v1/aiassistant/getconversation/${elementId}`,
|
|
104
|
-
{
|
|
105
|
-
headers: { authorization: token },
|
|
106
|
-
}
|
|
107
|
-
);
|
|
108
|
-
confirmationRequest
|
|
109
|
-
.then((response : AxiosResponse) => {
|
|
110
|
-
resolve(response.data);
|
|
111
|
-
})
|
|
112
|
-
.catch((error : AxiosError) => {
|
|
113
|
-
reject(error);
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Get the voice assistant URL
|
|
120
|
-
* @param {String} language
|
|
121
|
-
* @param {String} token
|
|
122
|
-
* @returns {Promise<object>}
|
|
123
|
-
*/
|
|
124
|
-
export const getVoiceAssistantUrl = (
|
|
125
|
-
language: string,
|
|
126
|
-
token: string
|
|
127
|
-
): Promise<object> => {
|
|
128
|
-
return new Promise((resolve, reject) => {
|
|
129
|
-
const confirmationRequest = client.get(
|
|
130
|
-
`/api/v1/aiassistant/getvoiceassistanturl/${language}`,
|
|
131
|
-
{
|
|
132
|
-
headers: { authorization: token },
|
|
133
|
-
}
|
|
134
|
-
);
|
|
135
|
-
confirmationRequest
|
|
136
|
-
.then((response : AxiosResponse) => {
|
|
137
|
-
resolve(response.data);
|
|
138
|
-
})
|
|
139
|
-
.catch((error : AxiosError) => {
|
|
140
|
-
reject(error);
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Start conversation with the AI
|
|
147
|
-
* @param {String} elementId
|
|
148
|
-
* @param {String} elementType
|
|
149
|
-
* @param {String} context
|
|
150
|
-
* @param {Boolean} autoContextRefresh
|
|
151
|
-
* @param {String} token
|
|
152
|
-
* @param {String} conversationId Optional
|
|
153
|
-
* @returns {Promise<object>}
|
|
154
|
-
*/
|
|
155
|
-
export const startConversation = (
|
|
156
|
-
elementId: string,
|
|
157
|
-
elementType: string,
|
|
158
|
-
question: string,
|
|
159
|
-
context: string,
|
|
160
|
-
autoContextRefresh: boolean,
|
|
161
|
-
token: string,
|
|
162
|
-
conversationId: string | null = null
|
|
163
|
-
): Promise<object> => {
|
|
164
|
-
return new Promise((resolve, reject) => {
|
|
165
|
-
const data: StartConversationData = {
|
|
166
|
-
autoContextRefresh: autoContextRefresh,
|
|
167
|
-
context: context,
|
|
168
|
-
question: question,
|
|
169
|
-
elementId: elementId,
|
|
170
|
-
elementType: elementType,
|
|
171
|
-
};
|
|
172
|
-
if (conversationId) {
|
|
173
|
-
data.conversationId = conversationId;
|
|
174
|
-
}
|
|
175
|
-
const confirmationRequest = client.post(
|
|
176
|
-
"/api/v1/aiassistant/startconversation",
|
|
177
|
-
data,
|
|
178
|
-
{
|
|
179
|
-
headers: { authorization: token },
|
|
180
|
-
}
|
|
181
|
-
);
|
|
182
|
-
confirmationRequest
|
|
183
|
-
.then((response : AxiosResponse) => {
|
|
184
|
-
resolve(response.data);
|
|
185
|
-
})
|
|
186
|
-
.catch((error : AxiosError) => {
|
|
187
|
-
reject(error);
|
|
188
|
-
});
|
|
189
|
-
});
|
|
190
|
-
};
|
package/src/lib/avatar.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { AxiosResponse } from "axios";
|
|
2
|
-
import { client } from "./axiosClient";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Get avatar for an elementId
|
|
6
|
-
* @param {String} elementId
|
|
7
|
-
* @param {String} type
|
|
8
|
-
* @param {Number} width
|
|
9
|
-
* @param {Number} height
|
|
10
|
-
* @param {String} token
|
|
11
|
-
* @returns {Promise<Blob>}
|
|
12
|
-
*/
|
|
13
|
-
export const getAvatar = (
|
|
14
|
-
elementId: string,
|
|
15
|
-
type: string,
|
|
16
|
-
width: number,
|
|
17
|
-
height: number,
|
|
18
|
-
token: string
|
|
19
|
-
): Promise<Blob> => {
|
|
20
|
-
return new Promise((resolve, reject) => {
|
|
21
|
-
const confirmationRequest = client.get(
|
|
22
|
-
`/api/v1/avatar/getavatar/${elementId}/${type}/${width}/${height}`,
|
|
23
|
-
{
|
|
24
|
-
headers: {
|
|
25
|
-
authorization: token,
|
|
26
|
-
},
|
|
27
|
-
responseType: "blob",
|
|
28
|
-
}
|
|
29
|
-
);
|
|
30
|
-
confirmationRequest
|
|
31
|
-
.then((response : AxiosResponse) => {
|
|
32
|
-
resolve(response.data);
|
|
33
|
-
})
|
|
34
|
-
.catch(() => {
|
|
35
|
-
reject("Error getting avatar");
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
};
|
package/src/lib/axiosClient.ts
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import axios, { AxiosError, AxiosResponse } from "axios";
|
|
2
|
-
import { RESPONSE_TYPE } from "./constants";
|
|
3
|
-
import * as utils from "./utils";
|
|
4
|
-
|
|
5
|
-
interface ErrorResponse {
|
|
6
|
-
msg: string;
|
|
7
|
-
param: string;
|
|
8
|
-
value: string;
|
|
9
|
-
toString: () => string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
interface CustomAxiosResponse extends AxiosResponse {
|
|
13
|
-
errors?: ErrorResponse[];
|
|
14
|
-
toString: () => string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const baseUrl = utils.getBaseUrl();
|
|
18
|
-
|
|
19
|
-
export const client = axios.create({
|
|
20
|
-
baseURL: baseUrl,
|
|
21
|
-
withCredentials: true,
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Returns the error as a string
|
|
26
|
-
* @param {AxiosError} error
|
|
27
|
-
* @returns {string}
|
|
28
|
-
*/
|
|
29
|
-
export const errorToString = (error: AxiosError): string => {
|
|
30
|
-
if (error != null) {
|
|
31
|
-
if (error.response?.data) {
|
|
32
|
-
let asString = "";
|
|
33
|
-
const responseData = error.response.data as CustomAxiosResponse;
|
|
34
|
-
if (Array.isArray(responseData.errors)) {
|
|
35
|
-
responseData.errors.forEach(
|
|
36
|
-
(item: ErrorResponse, index: number) => {
|
|
37
|
-
asString += `${index > 0 ? ", " : ""} ${item.msg} param ${
|
|
38
|
-
item.param
|
|
39
|
-
} ${item.value ? `value ${item.value.toString()}` : ""}`;
|
|
40
|
-
}
|
|
41
|
-
);
|
|
42
|
-
return asString;
|
|
43
|
-
} else if (responseData.errors) {
|
|
44
|
-
return JSON.stringify(responseData.errors);
|
|
45
|
-
} else if (error.response.statusText) {
|
|
46
|
-
return error.response.statusText.toString();
|
|
47
|
-
} else {
|
|
48
|
-
return responseData.toString();
|
|
49
|
-
}
|
|
50
|
-
} else {
|
|
51
|
-
return error.message ? error.message : "Unknown error";
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return "Unknown error";
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Returns the code of the error as a number
|
|
59
|
-
* @param {AxiosError} error
|
|
60
|
-
* @returns {number} The error code
|
|
61
|
-
*/
|
|
62
|
-
export const getErrorType = (error: AxiosError): number => {
|
|
63
|
-
if (error.response?.status) {
|
|
64
|
-
return error.response.status;
|
|
65
|
-
} else return RESPONSE_TYPE.SERVICE_UNAVAILABLE;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Return the error information to include just the status and the message
|
|
70
|
-
* @param {AxiosError} error
|
|
71
|
-
* @returns {Object}
|
|
72
|
-
*/
|
|
73
|
-
export const getErrorInformation = (
|
|
74
|
-
error: AxiosError
|
|
75
|
-
): { status: number; message: string } => {
|
|
76
|
-
return {
|
|
77
|
-
status: getErrorType(error),
|
|
78
|
-
message: errorToString(error),
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Returns true if an exception should be handled to the business and presentation layer
|
|
84
|
-
* @param {boolean} returnAllExceptions - If set true all exceptions will be passed
|
|
85
|
-
* @param {AxiosError} error - The error returned by the server
|
|
86
|
-
* @returns {boolean}
|
|
87
|
-
*/
|
|
88
|
-
export const shouldReturnError = (
|
|
89
|
-
returnAllExceptions: boolean,
|
|
90
|
-
error: AxiosError
|
|
91
|
-
): boolean => {
|
|
92
|
-
if (getErrorType(error) === RESPONSE_TYPE.UNAUTHORIZED) {
|
|
93
|
-
return returnAllExceptions;
|
|
94
|
-
} else {
|
|
95
|
-
return true;
|
|
96
|
-
}
|
|
97
|
-
};
|
package/src/lib/config.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { AxiosError, AxiosResponse } from "axios";
|
|
2
|
-
import { client } from "./axiosClient";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Get the specified configuration by Id. It returns a promise
|
|
6
|
-
* @param {String} id - the id of the configuration element
|
|
7
|
-
* @param {String} authToken - Authorization token
|
|
8
|
-
* @returns {Promise<object>}
|
|
9
|
-
*/
|
|
10
|
-
export const getConfigurationById = (
|
|
11
|
-
id: string,
|
|
12
|
-
authToken: string
|
|
13
|
-
): Promise<object> => {
|
|
14
|
-
return new Promise((resolve, reject) => {
|
|
15
|
-
const getConfigInformationRequest = client.get(
|
|
16
|
-
`api/v1/configurations/configuration/id/${id}`,
|
|
17
|
-
{ headers: { authorization: authToken } }
|
|
18
|
-
);
|
|
19
|
-
getConfigInformationRequest
|
|
20
|
-
.then((response : AxiosResponse) => {
|
|
21
|
-
resolve(response.data);
|
|
22
|
-
})
|
|
23
|
-
.catch((error : AxiosError) => {
|
|
24
|
-
reject(error);
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Get the specified configuration by type. It returns a promise
|
|
31
|
-
* @param {String} type - the id of the configuration element
|
|
32
|
-
* @param {String} authToken - Authorization token
|
|
33
|
-
* @returns {Promise<object>}
|
|
34
|
-
*/
|
|
35
|
-
export const getConfigurationByType = (
|
|
36
|
-
type: string,
|
|
37
|
-
authToken: string
|
|
38
|
-
): Promise<object> => {
|
|
39
|
-
return new Promise((resolve, reject) => {
|
|
40
|
-
const getConfigInformationRequest = client.get(
|
|
41
|
-
`api/v1/configurations/configuration/type/${type}`,
|
|
42
|
-
{ headers: { authorization: authToken } }
|
|
43
|
-
);
|
|
44
|
-
getConfigInformationRequest
|
|
45
|
-
.then((response : AxiosResponse) => {
|
|
46
|
-
resolve(response.data);
|
|
47
|
-
})
|
|
48
|
-
.catch((error : AxiosError) => {
|
|
49
|
-
reject(error);
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Set the specified configuration by Id. It returns a promise
|
|
56
|
-
* @param {String} id - the id of the configuration element
|
|
57
|
-
* @param {Object} data - the object containing the updated configuration element
|
|
58
|
-
* @param {String} authToken - Authorization token
|
|
59
|
-
* @returns {Promise<object>}
|
|
60
|
-
*/
|
|
61
|
-
export const setConfigurationById = (
|
|
62
|
-
id: string,
|
|
63
|
-
data: object,
|
|
64
|
-
authToken: string
|
|
65
|
-
): Promise<object> => {
|
|
66
|
-
return new Promise((resolve, reject) => {
|
|
67
|
-
const getConfigInformationRequest = client.post(
|
|
68
|
-
`api/v1/configurations/configuration/${id}`,
|
|
69
|
-
{ data: data },
|
|
70
|
-
{ headers: { authorization: authToken } }
|
|
71
|
-
);
|
|
72
|
-
getConfigInformationRequest
|
|
73
|
-
.then((response : AxiosResponse) => {
|
|
74
|
-
resolve(response.data);
|
|
75
|
-
})
|
|
76
|
-
.catch((error : AxiosError) => {
|
|
77
|
-
reject(error);
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
};
|