@stackfactor/client-api 1.1.12-9.1 → 1.1.12

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