@stackfactor/client-api 1.1.15-8.1 → 1.1.15

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 (304) hide show
  1. package/exports.js +71 -0
  2. package/index.js +3 -0
  3. package/lib/actionNotifications.js +82 -0
  4. package/lib/address.js +27 -0
  5. package/lib/aiAssistant.js +131 -0
  6. package/lib/axiosClient.js +85 -0
  7. package/lib/config.js +74 -0
  8. package/lib/constants.js +127 -0
  9. package/lib/dashboard.js +79 -0
  10. package/lib/departmentTrainingPlans.js +180 -0
  11. package/lib/groups.js +302 -0
  12. package/lib/integration.js +352 -0
  13. package/lib/integrationConfiguration.js +108 -0
  14. package/lib/integrations/contentGenerator.js +79 -0
  15. package/lib/learningContent.js +383 -0
  16. package/lib/learningPath.js +220 -0
  17. package/lib/logger.js +60 -0
  18. package/lib/role.js +406 -0
  19. package/lib/roleTemplate.js +258 -0
  20. package/lib/skill.js +514 -0
  21. package/lib/skillAssessmentTestingSession.js +148 -0
  22. package/lib/skillAssessments.js +145 -0
  23. package/lib/skillTemplate.js +318 -0
  24. package/lib/teams.js +294 -0
  25. package/lib/tenants.js +57 -0
  26. package/lib/trainingPlans.js +279 -0
  27. package/lib/userInformation.js +109 -0
  28. package/lib/users.js +695 -0
  29. package/lib/utils.js +48 -0
  30. package/package.json +10 -31
  31. package/declarations/axios.d.ts +0 -1
  32. package/declarations/html2plaintext.d.ts +0 -1
  33. package/dist/cjs/actionNotifications.d.ts +0 -24
  34. package/dist/cjs/actionNotifications.d.ts.map +0 -1
  35. package/dist/cjs/actionNotifications.js +0 -73
  36. package/dist/cjs/actionNotifications.js.map +0 -1
  37. package/dist/cjs/address.d.ts +0 -8
  38. package/dist/cjs/address.d.ts.map +0 -1
  39. package/dist/cjs/address.js +0 -24
  40. package/dist/cjs/address.js.map +0 -1
  41. package/dist/cjs/aiAssistant.d.ts +0 -42
  42. package/dist/cjs/aiAssistant.d.ts.map +0 -1
  43. package/dist/cjs/aiAssistant.js +0 -135
  44. package/dist/cjs/aiAssistant.js.map +0 -1
  45. package/dist/cjs/avatar.d.ts +0 -11
  46. package/dist/cjs/avatar.d.ts.map +0 -1
  47. package/dist/cjs/avatar.js +0 -32
  48. package/dist/cjs/avatar.js.map +0 -1
  49. package/dist/cjs/axiosClient.d.ts +0 -31
  50. package/dist/cjs/axiosClient.d.ts.map +0 -1
  51. package/dist/cjs/axiosClient.js +0 -126
  52. package/dist/cjs/axiosClient.js.map +0 -1
  53. package/dist/cjs/config.d.ts +0 -23
  54. package/dist/cjs/config.d.ts.map +0 -1
  55. package/dist/cjs/config.js +0 -63
  56. package/dist/cjs/config.js.map +0 -1
  57. package/dist/cjs/constants.d.ts +0 -69
  58. package/dist/cjs/constants.d.ts.map +0 -1
  59. package/dist/cjs/constants.js +0 -91
  60. package/dist/cjs/constants.js.map +0 -1
  61. package/dist/cjs/dashboard.d.ts +0 -23
  62. package/dist/cjs/dashboard.d.ts.map +0 -1
  63. package/dist/cjs/dashboard.js +0 -74
  64. package/dist/cjs/dashboard.js.map +0 -1
  65. package/dist/cjs/departmentTrainingPlans.d.ts +0 -53
  66. package/dist/cjs/departmentTrainingPlans.d.ts.map +0 -1
  67. package/dist/cjs/departmentTrainingPlans.js +0 -153
  68. package/dist/cjs/departmentTrainingPlans.js.map +0 -1
  69. package/dist/cjs/groups.d.ts +0 -90
  70. package/dist/cjs/groups.d.ts.map +0 -1
  71. package/dist/cjs/groups.js +0 -273
  72. package/dist/cjs/groups.js.map +0 -1
  73. package/dist/cjs/index.d.ts +0 -33
  74. package/dist/cjs/index.d.ts.map +0 -1
  75. package/dist/cjs/index.js +0 -77
  76. package/dist/cjs/index.js.map +0 -1
  77. package/dist/cjs/integration.d.ts +0 -82
  78. package/dist/cjs/integration.d.ts.map +0 -1
  79. package/dist/cjs/integration.js +0 -316
  80. package/dist/cjs/integration.js.map +0 -1
  81. package/dist/cjs/integrationConfiguration.d.ts +0 -27
  82. package/dist/cjs/integrationConfiguration.d.ts.map +0 -1
  83. package/dist/cjs/integrationConfiguration.js +0 -86
  84. package/dist/cjs/integrationConfiguration.js.map +0 -1
  85. package/dist/cjs/integrations/contentGenerator.d.ts +0 -22
  86. package/dist/cjs/integrations/contentGenerator.d.ts.map +0 -1
  87. package/dist/cjs/integrations/contentGenerator.js +0 -69
  88. package/dist/cjs/integrations/contentGenerator.js.map +0 -1
  89. package/dist/cjs/learningContent.d.ts +0 -153
  90. package/dist/cjs/learningContent.d.ts.map +0 -1
  91. package/dist/cjs/learningContent.js +0 -474
  92. package/dist/cjs/learningContent.js.map +0 -1
  93. package/dist/cjs/learningPath.d.ts +0 -64
  94. package/dist/cjs/learningPath.d.ts.map +0 -1
  95. package/dist/cjs/learningPath.js +0 -205
  96. package/dist/cjs/learningPath.js.map +0 -1
  97. package/dist/cjs/logger.d.ts +0 -19
  98. package/dist/cjs/logger.d.ts.map +0 -1
  99. package/dist/cjs/logger.js +0 -60
  100. package/dist/cjs/logger.js.map +0 -1
  101. package/dist/cjs/microSkillsQuizes.d.ts +0 -18
  102. package/dist/cjs/microSkillsQuizes.d.ts.map +0 -1
  103. package/dist/cjs/microSkillsQuizes.js +0 -53
  104. package/dist/cjs/microSkillsQuizes.js.map +0 -1
  105. package/dist/cjs/quotas.d.ts +0 -15
  106. package/dist/cjs/quotas.d.ts.map +0 -1
  107. package/dist/cjs/quotas.js +0 -50
  108. package/dist/cjs/quotas.js.map +0 -1
  109. package/dist/cjs/role.d.ts +0 -113
  110. package/dist/cjs/role.d.ts.map +0 -1
  111. package/dist/cjs/role.js +0 -363
  112. package/dist/cjs/role.js.map +0 -1
  113. package/dist/cjs/roleTemplate.d.ts +0 -73
  114. package/dist/cjs/roleTemplate.d.ts.map +0 -1
  115. package/dist/cjs/roleTemplate.js +0 -236
  116. package/dist/cjs/roleTemplate.js.map +0 -1
  117. package/dist/cjs/security.d.ts +0 -27
  118. package/dist/cjs/security.d.ts.map +0 -1
  119. package/dist/cjs/security.js +0 -79
  120. package/dist/cjs/security.js.map +0 -1
  121. package/dist/cjs/skill.d.ts +0 -141
  122. package/dist/cjs/skill.d.ts.map +0 -1
  123. package/dist/cjs/skill.js +0 -440
  124. package/dist/cjs/skill.js.map +0 -1
  125. package/dist/cjs/skillAssessmentTestingSession.d.ts +0 -85
  126. package/dist/cjs/skillAssessmentTestingSession.d.ts.map +0 -1
  127. package/dist/cjs/skillAssessmentTestingSession.js +0 -276
  128. package/dist/cjs/skillAssessmentTestingSession.js.map +0 -1
  129. package/dist/cjs/skillAssessments.d.ts +0 -49
  130. package/dist/cjs/skillAssessments.d.ts.map +0 -1
  131. package/dist/cjs/skillAssessments.js +0 -156
  132. package/dist/cjs/skillAssessments.js.map +0 -1
  133. package/dist/cjs/skillTemplate.d.ts +0 -87
  134. package/dist/cjs/skillTemplate.d.ts.map +0 -1
  135. package/dist/cjs/skillTemplate.js +0 -281
  136. package/dist/cjs/skillTemplate.js.map +0 -1
  137. package/dist/cjs/talentTransfromation.d.ts +0 -29
  138. package/dist/cjs/talentTransfromation.d.ts.map +0 -1
  139. package/dist/cjs/talentTransfromation.js +0 -100
  140. package/dist/cjs/talentTransfromation.js.map +0 -1
  141. package/dist/cjs/teams.d.ts +0 -85
  142. package/dist/cjs/teams.d.ts.map +0 -1
  143. package/dist/cjs/teams.js +0 -252
  144. package/dist/cjs/teams.js.map +0 -1
  145. package/dist/cjs/tenants.d.ts +0 -16
  146. package/dist/cjs/tenants.d.ts.map +0 -1
  147. package/dist/cjs/tenants.js +0 -55
  148. package/dist/cjs/tenants.js.map +0 -1
  149. package/dist/cjs/trainingPlans.d.ts +0 -92
  150. package/dist/cjs/trainingPlans.d.ts.map +0 -1
  151. package/dist/cjs/trainingPlans.js +0 -309
  152. package/dist/cjs/trainingPlans.js.map +0 -1
  153. package/dist/cjs/trainingPlansProficiencyLevels.d.ts +0 -32
  154. package/dist/cjs/trainingPlansProficiencyLevels.d.ts.map +0 -1
  155. package/dist/cjs/trainingPlansProficiencyLevels.js +0 -97
  156. package/dist/cjs/trainingPlansProficiencyLevels.js.map +0 -1
  157. package/dist/cjs/userInformation.d.ts +0 -29
  158. package/dist/cjs/userInformation.d.ts.map +0 -1
  159. package/dist/cjs/userInformation.js +0 -81
  160. package/dist/cjs/userInformation.js.map +0 -1
  161. package/dist/cjs/users.d.ts +0 -206
  162. package/dist/cjs/users.d.ts.map +0 -1
  163. package/dist/cjs/users.js +0 -694
  164. package/dist/cjs/users.js.map +0 -1
  165. package/dist/cjs/utils.d.ts +0 -14
  166. package/dist/cjs/utils.d.ts.map +0 -1
  167. package/dist/cjs/utils.js +0 -58
  168. package/dist/cjs/utils.js.map +0 -1
  169. package/dist/esm/actionNotifications.d.ts +0 -24
  170. package/dist/esm/actionNotifications.d.ts.map +0 -1
  171. package/dist/esm/actionNotifications.js +0 -67
  172. package/dist/esm/actionNotifications.js.map +0 -1
  173. package/dist/esm/address.d.ts +0 -8
  174. package/dist/esm/address.d.ts.map +0 -1
  175. package/dist/esm/address.js +0 -20
  176. package/dist/esm/address.js.map +0 -1
  177. package/dist/esm/aiAssistant.d.ts +0 -42
  178. package/dist/esm/aiAssistant.d.ts.map +0 -1
  179. package/dist/esm/aiAssistant.js +0 -126
  180. package/dist/esm/aiAssistant.js.map +0 -1
  181. package/dist/esm/avatar.d.ts +0 -11
  182. package/dist/esm/avatar.d.ts.map +0 -1
  183. package/dist/esm/avatar.js +0 -28
  184. package/dist/esm/avatar.js.map +0 -1
  185. package/dist/esm/axiosClient.d.ts +0 -31
  186. package/dist/esm/axiosClient.d.ts.map +0 -1
  187. package/dist/esm/axiosClient.js +0 -81
  188. package/dist/esm/axiosClient.js.map +0 -1
  189. package/dist/esm/config.d.ts +0 -23
  190. package/dist/esm/config.d.ts.map +0 -1
  191. package/dist/esm/config.js +0 -57
  192. package/dist/esm/config.js.map +0 -1
  193. package/dist/esm/constants.d.ts +0 -69
  194. package/dist/esm/constants.d.ts.map +0 -1
  195. package/dist/esm/constants.js +0 -88
  196. package/dist/esm/constants.js.map +0 -1
  197. package/dist/esm/dashboard.d.ts +0 -23
  198. package/dist/esm/dashboard.d.ts.map +0 -1
  199. package/dist/esm/dashboard.js +0 -68
  200. package/dist/esm/dashboard.js.map +0 -1
  201. package/dist/esm/departmentTrainingPlans.d.ts +0 -53
  202. package/dist/esm/departmentTrainingPlans.d.ts.map +0 -1
  203. package/dist/esm/departmentTrainingPlans.js +0 -144
  204. package/dist/esm/departmentTrainingPlans.js.map +0 -1
  205. package/dist/esm/groups.d.ts +0 -90
  206. package/dist/esm/groups.d.ts.map +0 -1
  207. package/dist/esm/groups.js +0 -258
  208. package/dist/esm/groups.js.map +0 -1
  209. package/dist/esm/index.d.ts +0 -33
  210. package/dist/esm/index.d.ts.map +0 -1
  211. package/dist/esm/index.js +0 -33
  212. package/dist/esm/index.js.map +0 -1
  213. package/dist/esm/integration.d.ts +0 -82
  214. package/dist/esm/integration.d.ts.map +0 -1
  215. package/dist/esm/integration.js +0 -299
  216. package/dist/esm/integration.js.map +0 -1
  217. package/dist/esm/integrationConfiguration.d.ts +0 -27
  218. package/dist/esm/integrationConfiguration.d.ts.map +0 -1
  219. package/dist/esm/integrationConfiguration.js +0 -80
  220. package/dist/esm/integrationConfiguration.js.map +0 -1
  221. package/dist/esm/integrations/contentGenerator.d.ts +0 -22
  222. package/dist/esm/integrations/contentGenerator.d.ts.map +0 -1
  223. package/dist/esm/integrations/contentGenerator.js +0 -64
  224. package/dist/esm/integrations/contentGenerator.js.map +0 -1
  225. package/dist/esm/learningContent.d.ts +0 -153
  226. package/dist/esm/learningContent.d.ts.map +0 -1
  227. package/dist/esm/learningContent.js +0 -453
  228. package/dist/esm/learningContent.js.map +0 -1
  229. package/dist/esm/learningPath.d.ts +0 -64
  230. package/dist/esm/learningPath.d.ts.map +0 -1
  231. package/dist/esm/learningPath.js +0 -194
  232. package/dist/esm/learningPath.js.map +0 -1
  233. package/dist/esm/logger.d.ts +0 -19
  234. package/dist/esm/logger.d.ts.map +0 -1
  235. package/dist/esm/logger.js +0 -55
  236. package/dist/esm/logger.js.map +0 -1
  237. package/dist/esm/microSkillsQuizes.d.ts +0 -18
  238. package/dist/esm/microSkillsQuizes.d.ts.map +0 -1
  239. package/dist/esm/microSkillsQuizes.js +0 -48
  240. package/dist/esm/microSkillsQuizes.js.map +0 -1
  241. package/dist/esm/quotas.d.ts +0 -15
  242. package/dist/esm/quotas.d.ts.map +0 -1
  243. package/dist/esm/quotas.js +0 -45
  244. package/dist/esm/quotas.js.map +0 -1
  245. package/dist/esm/role.d.ts +0 -113
  246. package/dist/esm/role.d.ts.map +0 -1
  247. package/dist/esm/role.js +0 -346
  248. package/dist/esm/role.js.map +0 -1
  249. package/dist/esm/roleTemplate.d.ts +0 -73
  250. package/dist/esm/roleTemplate.d.ts.map +0 -1
  251. package/dist/esm/roleTemplate.js +0 -224
  252. package/dist/esm/roleTemplate.js.map +0 -1
  253. package/dist/esm/security.d.ts +0 -27
  254. package/dist/esm/security.d.ts.map +0 -1
  255. package/dist/esm/security.js +0 -72
  256. package/dist/esm/security.js.map +0 -1
  257. package/dist/esm/skill.d.ts +0 -141
  258. package/dist/esm/skill.d.ts.map +0 -1
  259. package/dist/esm/skill.js +0 -418
  260. package/dist/esm/skill.js.map +0 -1
  261. package/dist/esm/skillAssessmentTestingSession.d.ts +0 -85
  262. package/dist/esm/skillAssessmentTestingSession.d.ts.map +0 -1
  263. package/dist/esm/skillAssessmentTestingSession.js +0 -261
  264. package/dist/esm/skillAssessmentTestingSession.js.map +0 -1
  265. package/dist/esm/skillAssessments.d.ts +0 -49
  266. package/dist/esm/skillAssessments.d.ts.map +0 -1
  267. package/dist/esm/skillAssessments.js +0 -147
  268. package/dist/esm/skillAssessments.js.map +0 -1
  269. package/dist/esm/skillTemplate.d.ts +0 -87
  270. package/dist/esm/skillTemplate.d.ts.map +0 -1
  271. package/dist/esm/skillTemplate.js +0 -267
  272. package/dist/esm/skillTemplate.js.map +0 -1
  273. package/dist/esm/talentTransfromation.d.ts +0 -29
  274. package/dist/esm/talentTransfromation.d.ts.map +0 -1
  275. package/dist/esm/talentTransfromation.js +0 -93
  276. package/dist/esm/talentTransfromation.js.map +0 -1
  277. package/dist/esm/teams.d.ts +0 -85
  278. package/dist/esm/teams.d.ts.map +0 -1
  279. package/dist/esm/teams.js +0 -238
  280. package/dist/esm/teams.js.map +0 -1
  281. package/dist/esm/tenants.d.ts +0 -16
  282. package/dist/esm/tenants.d.ts.map +0 -1
  283. package/dist/esm/tenants.js +0 -50
  284. package/dist/esm/tenants.js.map +0 -1
  285. package/dist/esm/trainingPlans.d.ts +0 -92
  286. package/dist/esm/trainingPlans.d.ts.map +0 -1
  287. package/dist/esm/trainingPlans.js +0 -293
  288. package/dist/esm/trainingPlans.js.map +0 -1
  289. package/dist/esm/trainingPlansProficiencyLevels.d.ts +0 -32
  290. package/dist/esm/trainingPlansProficiencyLevels.d.ts.map +0 -1
  291. package/dist/esm/trainingPlansProficiencyLevels.js +0 -90
  292. package/dist/esm/trainingPlansProficiencyLevels.js.map +0 -1
  293. package/dist/esm/userInformation.d.ts +0 -29
  294. package/dist/esm/userInformation.d.ts.map +0 -1
  295. package/dist/esm/userInformation.js +0 -75
  296. package/dist/esm/userInformation.js.map +0 -1
  297. package/dist/esm/users.d.ts +0 -206
  298. package/dist/esm/users.d.ts.map +0 -1
  299. package/dist/esm/users.js +0 -663
  300. package/dist/esm/users.js.map +0 -1
  301. package/dist/esm/utils.d.ts +0 -14
  302. package/dist/esm/utils.d.ts.map +0 -1
  303. package/dist/esm/utils.js +0 -50
  304. package/dist/esm/utils.js.map +0 -1
package/exports.js ADDED
@@ -0,0 +1,71 @@
1
+ import actionNotifications from "./lib/actionNotifications.js";
2
+ import {
3
+ client,
4
+ errorToString,
5
+ getErrorInformation,
6
+ getErrorType,
7
+ shouldReturnError,
8
+ } from "./lib/axiosClient.js";
9
+ import address from "./lib/address.js";
10
+ import config from "./lib/config.js";
11
+ import {
12
+ DOCUMENT_VERSION,
13
+ PERMISSIONS,
14
+ PERMISSION_DESCRIPTIONS,
15
+ RESPONSE_TYPE,
16
+ } from "./lib/constants.js";
17
+ import contentGenerator from "./lib/integrations/contentGenerator.js";
18
+ import dashboard from "./lib/dashboard.js";
19
+ import departmentTraingPlans from "./lib/departmentTrainingPlans.js";
20
+ import integration from "./lib/integration.js";
21
+ import integrationConfiguration from "./lib/integrationConfiguration.js";
22
+ import groups from "./lib/groups.js";
23
+ import learningContent from "./lib/learningContent.js";
24
+ import learningPath from "./lib/learningPath.js";
25
+ import logger from "./lib/logger.js";
26
+ import role from "./lib/role.js";
27
+ import roleTemplate from "./lib/roleTemplate.js";
28
+ import skill from "./lib/skill.js";
29
+ import skillAssessment from "./lib/skillAssessments.js";
30
+ import skillAssessmentTestingSession from "./lib/skillAssessmentTestingSession.js";
31
+ import skillTemplate from "./lib/skillTemplate.js";
32
+ import team from "./lib/teams.js";
33
+ import tenant from "./lib/tenants.js";
34
+ import trainingPlan from "./lib/trainingPlans.js";
35
+ import userInformation from "./lib/userInformation.js";
36
+ import users from "./lib/users.js";
37
+
38
+ export {
39
+ actionNotifications,
40
+ address,
41
+ client,
42
+ config,
43
+ contentGenerator,
44
+ dashboard,
45
+ errorToString,
46
+ getErrorInformation,
47
+ getErrorType,
48
+ DOCUMENT_VERSION,
49
+ integration,
50
+ integrationConfiguration,
51
+ departmentTraingPlans,
52
+ groups,
53
+ learningContent,
54
+ learningPath,
55
+ logger,
56
+ PERMISSIONS,
57
+ PERMISSION_DESCRIPTIONS,
58
+ RESPONSE_TYPE,
59
+ role,
60
+ roleTemplate,
61
+ shouldReturnError,
62
+ skill,
63
+ skillAssessment,
64
+ skillAssessmentTestingSession,
65
+ skillTemplate,
66
+ team,
67
+ tenant,
68
+ trainingPlan,
69
+ userInformation,
70
+ users,
71
+ };
package/index.js ADDED
@@ -0,0 +1,3 @@
1
+ import * as api from "./exports.js";
2
+ export * from "./exports.js";
3
+ export default api;
@@ -0,0 +1,82 @@
1
+ import { client } from "./axiosClient.js";
2
+
3
+ /**
4
+ * Get all permissions
5
+ * @param {String} authToken The authentication token
6
+ */
7
+ export const getAllUserNotifications = (authToken) => {
8
+ return new Promise(function (resolve, reject) {
9
+ const request = client.get(`api/v1/actionnotifications`, {
10
+ headers: { authorization: authToken },
11
+ });
12
+ request
13
+ .then((response) => {
14
+ resolve(response.data);
15
+ })
16
+ .catch((error) => {
17
+ reject(error);
18
+ });
19
+ });
20
+ };
21
+
22
+ /**
23
+ * Mark notifications as open or viewed
24
+ * @param {Array<String>} ids The id of the notifications to be marked
25
+ * @param {String} status The new status
26
+ * @param {String} authToken The authentication token
27
+ */
28
+ export const markNotifications = (ids, status, authToken) => {
29
+ return new Promise(function (resolve, reject) {
30
+ const request = client.put(
31
+ `api/v1/actionnotifications/mark`,
32
+ {
33
+ ids: ids,
34
+ status: status,
35
+ },
36
+ { headers: { authorization: authToken } }
37
+ );
38
+ request
39
+ .then((response) => {
40
+ resolve(response.data);
41
+ })
42
+ .catch((error) => {
43
+ reject(error);
44
+ });
45
+ });
46
+ };
47
+
48
+ /**
49
+ * Process a notification
50
+ * @param {String} id The notification id
51
+ * @param {String} action The action to be executed
52
+ * @param {String} comments The comments to be saved in the notification
53
+ * @param {String} authToken The authentication token
54
+ */
55
+ export const processNotification = (id, action, comments, authToken) => {
56
+ return new Promise(function (resolve, reject) {
57
+ const request = client.put(
58
+ `api/v1/actionnotifications/process`,
59
+ {
60
+ id: id,
61
+ action: action,
62
+ comments: comments,
63
+ },
64
+ { headers: { authorization: authToken } }
65
+ );
66
+ request
67
+ .then((response) => {
68
+ resolve(response.data);
69
+ })
70
+ .catch((error) => {
71
+ reject(error);
72
+ });
73
+ });
74
+ };
75
+
76
+ const actionNotifications = {
77
+ getAllUserNotifications,
78
+ markNotifications,
79
+ processNotification,
80
+ };
81
+
82
+ export default actionNotifications;
package/lib/address.js ADDED
@@ -0,0 +1,27 @@
1
+ import { client } from "./axiosClient.js";
2
+
3
+ /**
4
+ * Validate Address
5
+ * @param {String} input - the address in raw format
6
+ * @param {String} authToken - Authorization token
7
+ */
8
+ export const autoComplete = (input, authToken) => {
9
+ return new Promise(function (resolve, reject) {
10
+ const getAddressesRequest = client.post(
11
+ `api/v1/address/autocomplete/`,
12
+ { input: input },
13
+ { headers: { authorization: authToken } }
14
+ );
15
+ getAddressesRequest
16
+ .then((response) => {
17
+ resolve(response.data);
18
+ })
19
+ .catch((error) => {
20
+ reject(error);
21
+ });
22
+ });
23
+ };
24
+
25
+ const address = { autoComplete };
26
+
27
+ export default address;
@@ -0,0 +1,131 @@
1
+ import { client } from "./axiosClient.js";
2
+
3
+ /**
4
+ * Ask Question to the AI
5
+ * @param {String} conversationId
6
+ * @param {String} question
7
+ * @param {String} updatedContext
8
+ * @param {String} token Authorization token
9
+ * @returns {Promise}
10
+ */
11
+ export const askQuestion = (
12
+ conversationId,
13
+ question,
14
+ updatedContext,
15
+ token
16
+ ) => {
17
+ return new Promise(function (resolve, reject) {
18
+ let data = {
19
+ conversationId: conversationId,
20
+ question: question,
21
+ updatedContext: updatedContext,
22
+ };
23
+ let confirmationRequest = client.post(
24
+ "/api/v1/aiasistant/askquestion",
25
+ { data: data },
26
+ {
27
+ headers: { authorization: token },
28
+ }
29
+ );
30
+ confirmationRequest
31
+ .then((response) => {
32
+ resolve(response.data);
33
+ })
34
+ .catch((error) => {
35
+ reject(error);
36
+ });
37
+ });
38
+ };
39
+
40
+ /**
41
+ * End conversation with the AI
42
+ * @param {String} conversationId
43
+ * @param {String} token Authorization token
44
+ * @returns {Promise}
45
+ */
46
+ export const endConversation = (conversationId, token) => {
47
+ return new Promise(function (resolve, reject) {
48
+ let data = {
49
+ conversationId: conversationId,
50
+ };
51
+ let confirmationRequest = client.post(
52
+ "/api/v1/aiasistant/endconversation",
53
+ { data: data },
54
+ {
55
+ headers: { authorization: token },
56
+ }
57
+ );
58
+ confirmationRequest
59
+ .then((response) => {
60
+ resolve(response.data);
61
+ })
62
+ .catch((error) => {
63
+ reject(error);
64
+ });
65
+ });
66
+ };
67
+
68
+ /**
69
+ * Get conversation by elementId
70
+ * @param {String} elementId
71
+ * @param {String} token
72
+ * @returns {Promise}
73
+ */
74
+ const getConversationByElementId = (elementId, token) => {
75
+ return new Promise(function (resolve, reject) {
76
+ let confirmationRequest = client.get(
77
+ `/api/v1/aiasistant/conversation/${elementId}/${userId}`,
78
+ {
79
+ headers: { authorization: token },
80
+ }
81
+ );
82
+ confirmationRequest
83
+ .then((response) => {
84
+ resolve(response.data);
85
+ })
86
+ .catch((error) => {
87
+ reject(error);
88
+ });
89
+ });
90
+ };
91
+
92
+ /**
93
+ * Start conversation with the AI
94
+ * @param {String} context
95
+ * @param {String} elementId
96
+ * @param {String} elementType
97
+ * @param {String} token
98
+ * @returns {Promise}
99
+ */
100
+ const startConversation = (context, elementId, elementType, token) => {
101
+ return new Promise(function (resolve, reject) {
102
+ let data = {
103
+ context: context,
104
+ elementId: elementId,
105
+ elementType: elementType,
106
+ };
107
+ let confirmationRequest = client.post(
108
+ "/api/v1/aiasistant/startconversation",
109
+ { data: data },
110
+ {
111
+ headers: { authorization: token },
112
+ }
113
+ );
114
+ confirmationRequest
115
+ .then((response) => {
116
+ resolve(response.data);
117
+ })
118
+ .catch((error) => {
119
+ reject(error);
120
+ });
121
+ });
122
+ };
123
+
124
+ const aiAssistant = {
125
+ askQuestion,
126
+ endConversation,
127
+ getConversationByElementId,
128
+ startConversation,
129
+ };
130
+
131
+ export default aiAssistant;
@@ -0,0 +1,85 @@
1
+ import axios from "axios";
2
+ import { RESPONSE_TYPE } from "./constants.js";
3
+ import https from "https";
4
+ import utils from "./utils.js";
5
+
6
+ const baseUrl = utils.getBaseUrl();
7
+
8
+ const client = axios.create({
9
+ baseURL: baseUrl,
10
+ httpsAgent: new https.Agent({
11
+ rejectUnauthorized: false,
12
+ }),
13
+ });
14
+
15
+ /**
16
+ * Returns the error as a string
17
+ * @param {Object} error
18
+ */
19
+ const errorToString = (error) => {
20
+ if (error != null) {
21
+ if (error?.response?.data) {
22
+ let asString = "";
23
+ if (Array.isArray(error.response.data.errors)) {
24
+ error.response.data.errors.forEach((item, index) => {
25
+ asString += `${index > 0 ? ", " : ""} ${item.msg} param ${
26
+ item.param
27
+ } ${item.value ? `value ${item.value.toString()}` : ""}`;
28
+ });
29
+ return asString;
30
+ } else if (error.response.data.error) {
31
+ return error.response.data.error.toString();
32
+ } else if (error.response.statusText) {
33
+ return error.response.statusText.toString();
34
+ } else {
35
+ return error.response.data.toString();
36
+ }
37
+ } else {
38
+ return error.message ? error.message : "Unknown error";
39
+ }
40
+ }
41
+ };
42
+
43
+ /**
44
+ * Returns the code of the error as a number
45
+ * @param {Object} error
46
+ * @returns {Number} The error code
47
+ */
48
+ const getErrorType = (error) => {
49
+ if (error?.response?.status) {
50
+ return error.response.status;
51
+ } else return RESPONSE_TYPE.SERVICE_UNAVAILABLE;
52
+ };
53
+
54
+ /**
55
+ * Return the error information to include just the status and the message
56
+ * @param {Object} error
57
+ * @returns Object
58
+ */
59
+ const getErrorInformation = (error) => {
60
+ return {
61
+ status: getErrorType(error),
62
+ message: errorToString(error),
63
+ };
64
+ };
65
+
66
+ /**
67
+ * Returns true if an exception should be handled to the business and presentation layer
68
+ * @param {Boolean} returnAllExceptions - If set true all exceptions will be passed
69
+ * @param {Object} error - The error returned by the server
70
+ */
71
+ const shouldReturnError = (returnAllExceptions, error) => {
72
+ if (getErrorType(error) === RESPONSE_TYPE.UNAUTHORIZED) {
73
+ return returnAllExceptions;
74
+ } else {
75
+ return true;
76
+ }
77
+ };
78
+
79
+ export {
80
+ client,
81
+ errorToString,
82
+ getErrorType,
83
+ getErrorInformation,
84
+ shouldReturnError,
85
+ };
package/lib/config.js ADDED
@@ -0,0 +1,74 @@
1
+ import { client } from "./axiosClient.js";
2
+
3
+ /**
4
+ * Get the specified configuration by Id. It returns a promise
5
+ * @param {String} id - the id of the configuration element
6
+ * @param {String} authToken - Authorization token
7
+ */
8
+ export const getConfigurationById = (id, authToken) => {
9
+ return new Promise(function (resolve, reject) {
10
+ const getConfigInformationRequest = client.get(
11
+ `api/v1/configurations/configuration/id/${id}`,
12
+ { headers: { authorization: authToken } }
13
+ );
14
+ getConfigInformationRequest
15
+ .then((response) => {
16
+ resolve(response.data);
17
+ })
18
+ .catch((error) => {
19
+ reject(error);
20
+ });
21
+ });
22
+ };
23
+
24
+ /**
25
+ * Get the specified configuration by type. It returns a promise
26
+ * @param {String} type - the id of the configuration element
27
+ * @param {String} authToken - Authorization token
28
+ */
29
+ export const getConfigurationByType = (type, authToken) => {
30
+ return new Promise(function (resolve, reject) {
31
+ const getConfigInformationRequest = client.get(
32
+ `api/v1/configurations/configuration/type/${type}`,
33
+ { headers: { authorization: authToken } }
34
+ );
35
+ getConfigInformationRequest
36
+ .then((response) => {
37
+ resolve(response.data);
38
+ })
39
+ .catch((error) => {
40
+ reject(error);
41
+ });
42
+ });
43
+ };
44
+
45
+ /**
46
+ * Set the specified configuration by Id. It returns a promise
47
+ * @param {String} id - the id of the configuration element
48
+ * @param {Object} data - the object containing the updated configuration element
49
+ * @param {String} authToken - Authorization token
50
+ */
51
+ export const setConfigurationById = (id, data, authToken) => {
52
+ return new Promise(function (resolve, reject) {
53
+ const getConfigInformationRequest = client.post(
54
+ `api/v1/configurations/configuration/${id}`,
55
+ { data: data },
56
+ { headers: { authorization: authToken } }
57
+ );
58
+ getConfigInformationRequest
59
+ .then((response) => {
60
+ resolve(response.data);
61
+ })
62
+ .catch((error) => {
63
+ reject(error);
64
+ });
65
+ });
66
+ };
67
+
68
+ const config = {
69
+ getConfigurationById,
70
+ getConfigurationByType,
71
+ setConfigurationById,
72
+ };
73
+
74
+ export default config;
@@ -0,0 +1,127 @@
1
+ const DOCUMENT_VERSION = {
2
+ DRAFT: "draft",
3
+ PUBLISHED: "published",
4
+ };
5
+
6
+ const RESPONSE_TYPE = {
7
+ //The requested resource corresponds to any one of a set of representations, each with its own specific location.
8
+ MULTIPLE_CHOICES: 300,
9
+ //The resource has moved permanently. Please refer to the documentation.
10
+ MOVED_PERMANENTLY: 301,
11
+ //The resource has moved temporarily. Please refer to the documentation.
12
+ FOUND: 302,
13
+ //The resource can be found under a different URI.
14
+ SEE_OTHER: 303,
15
+ //The resource is available and not modified.
16
+ NOT_MODIFIED: 304,
17
+ //The requested resource must be accessed through the proxy given by the Location field.
18
+ USE_PROXY: 305,
19
+ //The resource resides temporarily under a different URI.
20
+ TEMPORARY_REDIRECT: 307,
21
+ //Invalid syntax for this request was provided.
22
+ BAD_REQUEST: 400,
23
+ //You are unauthorized to access the requested resource. Please log in.
24
+ UNAUTHORIZED: 401,
25
+ //Your account is not authorized to access the requested resource.
26
+ FORBIDDEN: 403,
27
+ //We could not find the resource you requested. Please refer to the documentation for the list of resources.
28
+ NOT_FOUND: 404,
29
+ //This method type is not currently supported.
30
+ METHOD_NOT_ALLOWED: 405,
31
+ //Acceptance header is invalid for this endpoint resource.
32
+ NOT_ACCEPTABLE: 406,
33
+ //Authentication with proxy is required.
34
+ PROXY_AUTHENTICATION_REQUIRED: 407,
35
+ //Client did not produce a request within the time that the server was prepared to wait.
36
+ REQUEST_TIMEOUT: 408,
37
+ //The request could not be completed due to a conflict with the current state of the resource.
38
+ CONFLICT: 409,
39
+ //The requested resource is no longer available and has been permanently removed.
40
+ GONE: 410,
41
+ //Length of the content is required, please include it with the request.
42
+ LENGTH_REQUIRED: 411,
43
+ //The request did not match the pre-conditions of the requested resource.
44
+ PRECONDITION_FAILED: 412,
45
+ //The request entity is larger than the server is willing or able to process.
46
+ REQUEST_ENTITY_TOO_LARGE: 413,
47
+ //The request URI is longer than the server is willing to interpret.
48
+ REQUEST_URI_TOO_LONG: 414,
49
+ //The requested resource does not support the media type provided.
50
+ UNSUPPORTED_MEDIA_TYPE: 415,
51
+ //The requested range for the resource is not available.
52
+ REQUESTED_RANGE_NOT_SATISFIABLE: 416,
53
+ //Unable to meet the expectation given in the Expect request header.
54
+ EXPECTATION_FAILED: 417,
55
+ //The requested resource is missing required arguments.
56
+ MISSING_ARGUMENTS: 419,
57
+ //The requested resource does not support one or more of the given parameters.
58
+ INVALID_ARGUMENTS: 420,
59
+ //The request was well-formed but was unable to be followed due to semantic errors.
60
+ UNPROCESSABLE_ENTITY: 422,
61
+ //Unexpected internal server error.
62
+ INTERNAL_SERVER_ERROR: 500,
63
+ //The requested resource is recognized but not implemented.
64
+ NOT_IMPLEMENTED: 501,
65
+ //Invalid response received when acting as a proxy or gateway.
66
+ BAD_GATEWAY: 502,
67
+ //The server is currently unavailable.
68
+ SERVICE_UNAVAILABLE: 503,
69
+ //Did not receive a timely response from upstream server while acting as a gateway or proxy.
70
+ GATEWAY_TIMEOUT: 504,
71
+ //The HTTP protocol version used in the request message is not supported.
72
+ HTTP_VERSION_NOT_SUPPORTED: 505,
73
+ //A failure occurred during initialization of services. API will be unavailable.
74
+ INITIALIZATION_FAILURE: 550,
75
+ };
76
+
77
+ const PERMISSIONS = {
78
+ ACCESS_TO_CONTENT_GENERATORS: "651d81d626fb9aafa4077520",
79
+ ADMIN_AUTHOR_CONTENT: "5ea3d1152839450e16e72bba",
80
+ ADMIN_PROMOTE_CONTENT: "5ea3d10bea252025c8ec351b",
81
+ ADMIN_MANAGE_CONTENT_PROVIDERS: "61970935cee185acf08111f6",
82
+ AUTHOR_CONTENT: "5fac210560e43de7c6b4a208",
83
+ BETA_TESTER: "5fac210b6c8f874bd7137b97",
84
+ MANAGE_BILLING: "5e1570cd03f676213bfdcd08",
85
+ MANAGE_CONTENT_PROVIDERS: "5f0fa12f16a720fde58ea820",
86
+ MANAGE_GROUPS: "5dd612fe59e518ac87b8cf8e",
87
+ MANAGE_LEARNING_CONTENT: "64f54d20b7e49e10c779b4a6",
88
+ MANAGE_LEARNING_PATHS: "5dd61305a73c68b44c3f0827",
89
+ MANAGE_ORGANIZATION_INFORMATION: "5dd612d5338ea9a6ae6326da",
90
+ MANAGE_OWN_PROFILE_INFORMATION_AUTO_APP: "5fac210e7e6539d37a897c94",
91
+ MANAGE_OWN_PROFILE_SKIP_ASSESSMENT: "650fadb23956a2154ac890ac",
92
+ MANAGE_OWN_SKILL_SET_AUTO_APPROVE: "5fac21164351c6727a34cd4e",
93
+ MANAGE_SETTINGS: "5e1570e087d836dc77888a5f",
94
+ MANAGE_TEAM_INFORMATION_AUTO_APPROVE: "5fac211e6c8f874bd7137b98",
95
+ MANAGE_TEAMS: "5dd61314afc2455a89b1a37b",
96
+ MANAGE_USERS: "5dd612e40f0bc559c41a2b29",
97
+ PROMOTE_CONTENT: "5fac2126427ce31f8a92c0cb",
98
+ };
99
+
100
+ const PERMISSION_DESCRIPTIONS = {
101
+ "5ea3d1152839450e16e72bba": "Author content",
102
+ "5ea3d10bea252025c8ec351b": "Promote content",
103
+ "61970935cee185acf08111f6": "Manage content providers",
104
+ "5fac210560e43de7c6b4a208": "Author content",
105
+ "5e1570cd03f676213bfdcd08": "Manage billing",
106
+ "5f0fa12f16a720fde58ea820": "Manage content providers",
107
+ "5dd612fe59e518ac87b8cf8e": "Manage groups",
108
+ "64f54d20b7e49e10c779b4a6": "Manage learning content",
109
+ "5dd61305a73c68b44c3f0827": "Manage learning paths",
110
+ "5dd612d5338ea9a6ae6326da": "Manage organization information",
111
+ "5fac210e7e6539d37a897c94": "Auto approve own profile information updates",
112
+ "650fadb23956a2154ac890ac":
113
+ "Skip assessment when updating own profile information",
114
+ "5fac21164351c6727a34cd4e": "Auto approve own skill set updates",
115
+ "5e1570e087d836dc77888a5f": "Manage settings",
116
+ "5fac211e6c8f874bd7137b98": "Auto approve own team information updates",
117
+ "5dd61314afc2455a89b1a37b": "Manage teams",
118
+ "5dd612e40f0bc559c41a2b29": "Manage users",
119
+ "5fac2126427ce31f8a92c0cb": "Promote content",
120
+ };
121
+
122
+ export {
123
+ DOCUMENT_VERSION,
124
+ PERMISSIONS,
125
+ PERMISSION_DESCRIPTIONS,
126
+ RESPONSE_TYPE,
127
+ };
@@ -0,0 +1,79 @@
1
+ import { client } from "./axiosClient.js";
2
+
3
+ /**
4
+ * Add a card to the dashboard
5
+ * @param {String} id - the id of the card to be added to the dashboard
6
+ * @param {Number} position - The position on the dashboard
7
+ * @param {Object} data - The card settings data
8
+ * @param {String} authToken - Authorization token
9
+ */
10
+ export const addCardToDashboard = (id, position, data, authToken) => {
11
+ return new Promise(function (resolve, reject) {
12
+ const request = client.put(
13
+ `/api/v1/dashboard/card`,
14
+ {
15
+ id: id,
16
+ position: position,
17
+ data: data ? data : {},
18
+ },
19
+ { headers: { authorization: authToken } }
20
+ );
21
+ request
22
+ .then((response) => {
23
+ resolve(response.data);
24
+ })
25
+ .catch((error) => {
26
+ reject(error);
27
+ });
28
+ });
29
+ };
30
+
31
+ /**
32
+ * Get the list of the cards from the dashboard
33
+ * @param {String} authToken - Authorization token
34
+ */
35
+ export const getDashboardCardsList = (authToken) => {
36
+ return new Promise(function (resolve, reject) {
37
+ const request = client.get(`/api/v1/dashboard/card`, {
38
+ headers: { authorization: authToken },
39
+ });
40
+ request
41
+ .then((response) => {
42
+ resolve(response.data);
43
+ })
44
+ .catch((error) => {
45
+ reject(error);
46
+ });
47
+ });
48
+ };
49
+
50
+ /**
51
+ * Remove a card from the dashboard
52
+ * @param {String} id - the id of the configuration element
53
+ * @param {String} authToken - Authorization token
54
+ */
55
+ export const removeCardFromDashboard = (id, authToken) => {
56
+ return new Promise(function (resolve, reject) {
57
+ const request = client.delete(`/api/v1/dashboard/card`, {
58
+ headers: { authorization: authToken },
59
+ data: {
60
+ id: id,
61
+ },
62
+ });
63
+ request
64
+ .then((response) => {
65
+ resolve(response.data);
66
+ })
67
+ .catch((error) => {
68
+ reject(error);
69
+ });
70
+ });
71
+ };
72
+
73
+ const dashboard = {
74
+ addCardToDashboard,
75
+ getDashboardCardsList,
76
+ removeCardFromDashboard,
77
+ };
78
+
79
+ export default dashboard;