@fluid-topics/public-api 1.0.142-alpha1 → 1.0.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/index.js CHANGED
@@ -83,7 +83,7 @@ function handleError(method, endpoint, response) {
83
83
  endpoint,
84
84
  status: response.status,
85
85
  statusText: response.statusText,
86
- body: yield response.text(),
86
+ body: yield response.text()
87
87
  };
88
88
  if (typeof wnd.dispatchEvent === "function") {
89
89
  wnd.dispatchEvent(new HttpErrorEvent(details));
@@ -107,9 +107,9 @@ class FluidTopicsApi {
107
107
  stickyFilters: {
108
108
  endpoint: "api/admin/sticky-filters",
109
109
  id: (id) => ({
110
- endpoint: `api/admin/sticky-filters/${id}`,
111
- }),
112
- },
110
+ endpoint: `api/admin/sticky-filters/${id}`
111
+ })
112
+ }
113
113
  },
114
114
  authentication: {
115
115
  login: `api/authentication/login`,
@@ -129,14 +129,14 @@ class FluidTopicsApi {
129
129
  attachmentId: (attachmentId) => ({
130
130
  info: `api/khub/maps/${mapId}/attachments/${attachmentId}`,
131
131
  content: `api/khub/maps/${mapId}/attachments/${attachmentId}/content`,
132
- }),
132
+ })
133
133
  },
134
134
  resources: {
135
135
  list: `api/khub/maps/${mapId}/resources`,
136
136
  resourceId: (resourceId) => ({
137
137
  info: `api/khub/maps/${mapId}/resources/${resourceId}`,
138
138
  content: `api/khub/maps/${mapId}/resources/${resourceId}/content`,
139
- }),
139
+ })
140
140
  },
141
141
  topics: {
142
142
  contentId: (contentId) => ({
@@ -147,9 +147,9 @@ class FluidTopicsApi {
147
147
  tocId: (tocId) => ({
148
148
  feedback: `api/khub/maps/${mapId}/topics/${tocId}/feedback`,
149
149
  rating: `api/khub/maps/${mapId}/topics/${tocId}/rating`,
150
- }),
150
+ })
151
151
  },
152
- }),
152
+ })
153
153
  },
154
154
  documents: {
155
155
  documentId: (documentId) => ({
@@ -163,9 +163,9 @@ class FluidTopicsApi {
163
163
  attachmentId: (attachmentId) => ({
164
164
  info: `api/khub/documents/${documentId}/attachments/${attachmentId}`,
165
165
  content: `api/khub/documents/${documentId}/attachments/${attachmentId}/content`,
166
- }),
166
+ })
167
167
  },
168
- }),
168
+ })
169
169
  },
170
170
  semantic: {
171
171
  search: `api/khub/semantic/search`,
@@ -178,14 +178,14 @@ class FluidTopicsApi {
178
178
  user: {
179
179
  locales: {
180
180
  ui: `api/user/locales/ui`,
181
- },
181
+ }
182
182
  },
183
183
  users: {
184
184
  userId: (userId) => ({
185
185
  collections: {
186
186
  collectionId: (collectionId) => ({
187
187
  documents: `api/users/${userId}/collections/${collectionId}/documents`,
188
- }),
188
+ })
189
189
  },
190
190
  searches: {
191
191
  list: `api/users/${userId}/searches`,
@@ -193,11 +193,11 @@ class FluidTopicsApi {
193
193
  mySearchId: (mySearchId) => ({
194
194
  delete: `api/users/${userId}/searches/${mySearchId}`,
195
195
  update: `api/users/${userId}/searches/${mySearchId}`,
196
- }),
196
+ })
197
197
  },
198
198
  bookmarks: {
199
199
  list: `api/users/${userId}/bookmarks`,
200
- },
200
+ }
201
201
  }),
202
202
  },
203
203
  stylesheets: {
@@ -231,8 +231,8 @@ class FluidTopicsApi {
231
231
  backups: `api/remote-portals/${remoteId}/backups`,
232
232
  backup: (backupId) => ({
233
233
  restore: `api/remote-portals/${remoteId}/backups/${backupId}/restore`,
234
- }),
235
- }),
234
+ })
235
+ })
236
236
  },
237
237
  locales: {
238
238
  ui: `api/locales/ui`,
@@ -243,14 +243,14 @@ class FluidTopicsApi {
243
243
  fluidTopics: {
244
244
  contextName: (contextName) => ({
245
245
  endpoint: `api/messages/${locale}/fluid-topics/${contextName}`,
246
- }),
246
+ })
247
247
  },
248
248
  custom: {
249
249
  contextName: (contextName) => ({
250
250
  endpoint: `api/messages/${locale}/custom/${contextName}`,
251
- }),
252
- },
253
- }),
251
+ })
252
+ }
253
+ })
254
254
  },
255
255
  ai: {
256
256
  generate: `api/ai/generate`,
@@ -260,24 +260,24 @@ class FluidTopicsApi {
260
260
  translate: `api/ai/translate`,
261
261
  destinationLanguages: (profileId) => ({
262
262
  endpoint: `api/ai/translate/${profileId}/languages`,
263
- }),
263
+ })
264
264
  },
265
265
  assets: {
266
266
  highlightjs: `assets/scripts/highlightjs`,
267
267
  customCode: (subPath) => ({
268
268
  endpoint: `portal/custom-code/${subPath}`,
269
- }),
269
+ })
270
270
  },
271
271
  analytics: {
272
272
  events: "api/analytics/events",
273
273
  },
274
274
  stickyFilters: {
275
275
  id: (id) => ({
276
- get: `api/sticky-filters/${id}`,
276
+ get: `api/sticky-filters/${id}`
277
277
  }),
278
278
  find: `api/sticky-filters/find`,
279
- suggest: `api/sticky-filters/suggest`,
280
- },
279
+ suggest: `api/sticky-filters/suggest`
280
+ }
281
281
  };
282
282
  //@ts-ignore
283
283
  tenantBaseUrl = ((_b = (_a = tenantBaseUrl !== null && tenantBaseUrl !== void 0 ? tenantBaseUrl : wnd.fluidTopicsBaseUrl) !== null && _a !== void 0 ? _a : wnd.__gwt_ft_moduleBase) !== null && _b !== void 0 ? _b : "").trim();
@@ -309,7 +309,7 @@ class FluidTopicsApi {
309
309
  let credentials = {
310
310
  login: login,
311
311
  password: password,
312
- rememberMe: true,
312
+ rememberMe: true
313
313
  };
314
314
  return this.post(this.endpoints.authentication.login, credentials)
315
315
  .then(result => {
@@ -320,7 +320,7 @@ class FluidTopicsApi {
320
320
  logout() {
321
321
  return this.fetch(this.endpoints.authentication.logout, {
322
322
  method: "POST",
323
- credentials: this.authorization == null ? "include" : undefined,
323
+ credentials: this.authorization == null ? "include" : undefined
324
324
  })
325
325
  .then((response) => handleError("POST", this.endpoints.authentication.logout, response))
326
326
  .then((response) => __awaiter(this, void 0, void 0, function* () {
@@ -444,7 +444,7 @@ class FluidTopicsApi {
444
444
  }
445
445
  rateTopic(mapId, tocId, type, value) {
446
446
  return this.post(this.endpoints.khub.maps.mapId(mapId).topics.tocId(tocId).rating, {
447
- type, value,
447
+ type, value
448
448
  });
449
449
  }
450
450
  unrateTopic(mapId, tocId) {
@@ -563,7 +563,7 @@ class FluidTopicsApi {
563
563
  "Content-Type": "application/json",
564
564
  },
565
565
  body: JSON.stringify({ profileId, parameters }),
566
- credentials: this.authorization == null ? "include" : undefined,
566
+ credentials: this.authorization == null ? "include" : undefined
567
567
  }));
568
568
  yield __await(handleError("POST", this.endpoints.ai.generate, response));
569
569
  const reader = new AIChunkReader_js_1.AIChunkReader(response.body.getReader());
@@ -578,7 +578,7 @@ class FluidTopicsApi {
578
578
  "Content-Type": "application/json",
579
579
  },
580
580
  body: JSON.stringify(input),
581
- credentials: this.authorization == null ? "include" : undefined,
581
+ credentials: this.authorization == null ? "include" : undefined
582
582
  }));
583
583
  yield __await(handleError("POST", this.endpoints.ai.chat, response));
584
584
  const reader = new AIChunkReader_js_1.AIChunkReader(response.body.getReader());
@@ -594,7 +594,7 @@ class FluidTopicsApi {
594
594
  "Content-Type": "application/json",
595
595
  },
596
596
  body: JSON.stringify(input),
597
- credentials: this.authorization == null ? "include" : undefined,
597
+ credentials: this.authorization == null ? "include" : undefined
598
598
  }));
599
599
  yield __await(handleError("POST", endpoint, response));
600
600
  const reader = new AIChunkReader_js_1.AIChunkReader(response.body.getReader());
@@ -680,7 +680,7 @@ class FluidTopicsApi {
680
680
  method: method,
681
681
  headers: Object.assign({}, (data != null ? { "Content-Type": "application/json" } : {})),
682
682
  body: data != null ? JSON.stringify(data) : undefined,
683
- credentials: this.authorization == null ? "include" : undefined,
683
+ credentials: this.authorization == null ? "include" : undefined
684
684
  })
685
685
  .then((r) => handleError(method, endpoint, r))
686
686
  .then(getBody);
@@ -688,7 +688,7 @@ class FluidTopicsApi {
688
688
  fetchRawData(endpoint, v) {
689
689
  return fetch(this.withVersion(endpoint, v), {
690
690
  headers: this.defaultHeaders,
691
- credentials: this.authorization == null ? "include" : undefined,
691
+ credentials: this.authorization == null ? "include" : undefined
692
692
  })
693
693
  .then((r) => handleError("GET", endpoint, r))
694
694
  .then(response => response.arrayBuffer());
@@ -722,7 +722,7 @@ class FluidTopicsApi {
722
722
  return {
723
723
  translationProfileId: translationSettings.profileId,
724
724
  translationDestinationLanguage: translationSettings.destinationLanguage,
725
- translationSourceLanguage: (_a = translationSettings.sourceLanguage) === null || _a === void 0 ? void 0 : _a.slice(0, 2),
725
+ translationSourceLanguage: (_a = translationSettings.sourceLanguage) === null || _a === void 0 ? void 0 : _a.slice(0, 2)
726
726
  };
727
727
  }
728
728
  }
package/dist/mjs/index.js CHANGED
@@ -34,7 +34,7 @@ async function handleError(method, endpoint, response) {
34
34
  endpoint,
35
35
  status: response.status,
36
36
  statusText: response.statusText,
37
- body: await response.text(),
37
+ body: await response.text()
38
38
  };
39
39
  if (typeof wnd.dispatchEvent === "function") {
40
40
  wnd.dispatchEvent(new HttpErrorEvent(details));
@@ -57,9 +57,9 @@ export class FluidTopicsApi {
57
57
  stickyFilters: {
58
58
  endpoint: "api/admin/sticky-filters",
59
59
  id: (id) => ({
60
- endpoint: `api/admin/sticky-filters/${id}`,
61
- }),
62
- },
60
+ endpoint: `api/admin/sticky-filters/${id}`
61
+ })
62
+ }
63
63
  },
64
64
  authentication: {
65
65
  login: `api/authentication/login`,
@@ -79,14 +79,14 @@ export class FluidTopicsApi {
79
79
  attachmentId: (attachmentId) => ({
80
80
  info: `api/khub/maps/${mapId}/attachments/${attachmentId}`,
81
81
  content: `api/khub/maps/${mapId}/attachments/${attachmentId}/content`,
82
- }),
82
+ })
83
83
  },
84
84
  resources: {
85
85
  list: `api/khub/maps/${mapId}/resources`,
86
86
  resourceId: (resourceId) => ({
87
87
  info: `api/khub/maps/${mapId}/resources/${resourceId}`,
88
88
  content: `api/khub/maps/${mapId}/resources/${resourceId}/content`,
89
- }),
89
+ })
90
90
  },
91
91
  topics: {
92
92
  contentId: (contentId) => ({
@@ -97,9 +97,9 @@ export class FluidTopicsApi {
97
97
  tocId: (tocId) => ({
98
98
  feedback: `api/khub/maps/${mapId}/topics/${tocId}/feedback`,
99
99
  rating: `api/khub/maps/${mapId}/topics/${tocId}/rating`,
100
- }),
100
+ })
101
101
  },
102
- }),
102
+ })
103
103
  },
104
104
  documents: {
105
105
  documentId: (documentId) => ({
@@ -113,9 +113,9 @@ export class FluidTopicsApi {
113
113
  attachmentId: (attachmentId) => ({
114
114
  info: `api/khub/documents/${documentId}/attachments/${attachmentId}`,
115
115
  content: `api/khub/documents/${documentId}/attachments/${attachmentId}/content`,
116
- }),
116
+ })
117
117
  },
118
- }),
118
+ })
119
119
  },
120
120
  semantic: {
121
121
  search: `api/khub/semantic/search`,
@@ -128,14 +128,14 @@ export class FluidTopicsApi {
128
128
  user: {
129
129
  locales: {
130
130
  ui: `api/user/locales/ui`,
131
- },
131
+ }
132
132
  },
133
133
  users: {
134
134
  userId: (userId) => ({
135
135
  collections: {
136
136
  collectionId: (collectionId) => ({
137
137
  documents: `api/users/${userId}/collections/${collectionId}/documents`,
138
- }),
138
+ })
139
139
  },
140
140
  searches: {
141
141
  list: `api/users/${userId}/searches`,
@@ -143,11 +143,11 @@ export class FluidTopicsApi {
143
143
  mySearchId: (mySearchId) => ({
144
144
  delete: `api/users/${userId}/searches/${mySearchId}`,
145
145
  update: `api/users/${userId}/searches/${mySearchId}`,
146
- }),
146
+ })
147
147
  },
148
148
  bookmarks: {
149
149
  list: `api/users/${userId}/bookmarks`,
150
- },
150
+ }
151
151
  }),
152
152
  },
153
153
  stylesheets: {
@@ -181,8 +181,8 @@ export class FluidTopicsApi {
181
181
  backups: `api/remote-portals/${remoteId}/backups`,
182
182
  backup: (backupId) => ({
183
183
  restore: `api/remote-portals/${remoteId}/backups/${backupId}/restore`,
184
- }),
185
- }),
184
+ })
185
+ })
186
186
  },
187
187
  locales: {
188
188
  ui: `api/locales/ui`,
@@ -193,14 +193,14 @@ export class FluidTopicsApi {
193
193
  fluidTopics: {
194
194
  contextName: (contextName) => ({
195
195
  endpoint: `api/messages/${locale}/fluid-topics/${contextName}`,
196
- }),
196
+ })
197
197
  },
198
198
  custom: {
199
199
  contextName: (contextName) => ({
200
200
  endpoint: `api/messages/${locale}/custom/${contextName}`,
201
- }),
202
- },
203
- }),
201
+ })
202
+ }
203
+ })
204
204
  },
205
205
  ai: {
206
206
  generate: `api/ai/generate`,
@@ -210,30 +210,30 @@ export class FluidTopicsApi {
210
210
  translate: `api/ai/translate`,
211
211
  destinationLanguages: (profileId) => ({
212
212
  endpoint: `api/ai/translate/${profileId}/languages`,
213
- }),
213
+ })
214
214
  },
215
215
  assets: {
216
216
  highlightjs: `assets/scripts/highlightjs`,
217
217
  customCode: (subPath) => ({
218
218
  endpoint: `portal/custom-code/${subPath}`,
219
- }),
219
+ })
220
220
  },
221
221
  analytics: {
222
222
  events: "api/analytics/events",
223
223
  },
224
224
  stickyFilters: {
225
225
  id: (id) => ({
226
- get: `api/sticky-filters/${id}`,
226
+ get: `api/sticky-filters/${id}`
227
227
  }),
228
228
  find: `api/sticky-filters/find`,
229
- suggest: `api/sticky-filters/suggest`,
230
- },
229
+ suggest: `api/sticky-filters/suggest`
230
+ }
231
231
  };
232
232
  get defaultHeaders() {
233
233
  return {
234
234
  ...this.authorization,
235
235
  ...this.searchLabel,
236
- "Ft-Calling-App": this.ftCallingApp,
236
+ "Ft-Calling-App": this.ftCallingApp
237
237
  };
238
238
  }
239
239
  constructor(tenantBaseUrl, integrationIdentifier, overrideIdentifierIfOnTenant) {
@@ -267,7 +267,7 @@ export class FluidTopicsApi {
267
267
  let credentials = {
268
268
  login: login,
269
269
  password: password,
270
- rememberMe: true,
270
+ rememberMe: true
271
271
  };
272
272
  return this.post(this.endpoints.authentication.login, credentials)
273
273
  .then(result => {
@@ -278,7 +278,7 @@ export class FluidTopicsApi {
278
278
  logout() {
279
279
  return this.fetch(this.endpoints.authentication.logout, {
280
280
  method: "POST",
281
- credentials: this.authorization == null ? "include" : undefined,
281
+ credentials: this.authorization == null ? "include" : undefined
282
282
  })
283
283
  .then((response) => handleError("POST", this.endpoints.authentication.logout, response))
284
284
  .then(async (response) => {
@@ -319,7 +319,7 @@ export class FluidTopicsApi {
319
319
  }
320
320
  const tocRequest = {
321
321
  metadataFilters: metadataFilters || [],
322
- ...this.buildTranslationParameters(translationSettings),
322
+ ...this.buildTranslationParameters(translationSettings)
323
323
  };
324
324
  return this.post(this.endpoints.khub.maps.mapId(mapId).pages, tocRequest);
325
325
  }
@@ -405,7 +405,7 @@ export class FluidTopicsApi {
405
405
  }
406
406
  rateTopic(mapId, tocId, type, value) {
407
407
  return this.post(this.endpoints.khub.maps.mapId(mapId).topics.tocId(tocId).rating, {
408
- type, value,
408
+ type, value
409
409
  });
410
410
  }
411
411
  unrateTopic(mapId, tocId) {
@@ -523,7 +523,7 @@ export class FluidTopicsApi {
523
523
  "Content-Type": "application/json",
524
524
  },
525
525
  body: JSON.stringify({ profileId, parameters }),
526
- credentials: this.authorization == null ? "include" : undefined,
526
+ credentials: this.authorization == null ? "include" : undefined
527
527
  });
528
528
  await handleError("POST", this.endpoints.ai.generate, response);
529
529
  const reader = new AIChunkReader(response.body.getReader());
@@ -536,7 +536,7 @@ export class FluidTopicsApi {
536
536
  "Content-Type": "application/json",
537
537
  },
538
538
  body: JSON.stringify(input),
539
- credentials: this.authorization == null ? "include" : undefined,
539
+ credentials: this.authorization == null ? "include" : undefined
540
540
  });
541
541
  await handleError("POST", this.endpoints.ai.chat, response);
542
542
  const reader = new AIChunkReader(response.body.getReader());
@@ -550,7 +550,7 @@ export class FluidTopicsApi {
550
550
  "Content-Type": "application/json",
551
551
  },
552
552
  body: JSON.stringify(input),
553
- credentials: this.authorization == null ? "include" : undefined,
553
+ credentials: this.authorization == null ? "include" : undefined
554
554
  });
555
555
  await handleError("POST", endpoint, response);
556
556
  const reader = new AIChunkReader(response.body.getReader());
@@ -600,8 +600,8 @@ export class FluidTopicsApi {
600
600
  ...(requestInit ?? {}),
601
601
  headers: {
602
602
  ...this.defaultHeaders,
603
- ...(requestInit?.headers ?? {}),
604
- },
603
+ ...(requestInit?.headers ?? {})
604
+ }
605
605
  });
606
606
  }
607
607
  upload(method, endpoint, body, onProgress = () => undefined) {
@@ -637,10 +637,10 @@ export class FluidTopicsApi {
637
637
  return this.fetch(endpoint, {
638
638
  method: method,
639
639
  headers: {
640
- ...(data != null ? { "Content-Type": "application/json" } : {}),
640
+ ...(data != null ? { "Content-Type": "application/json" } : {})
641
641
  },
642
642
  body: data != null ? JSON.stringify(data) : undefined,
643
- credentials: this.authorization == null ? "include" : undefined,
643
+ credentials: this.authorization == null ? "include" : undefined
644
644
  })
645
645
  .then((r) => handleError(method, endpoint, r))
646
646
  .then(getBody);
@@ -648,7 +648,7 @@ export class FluidTopicsApi {
648
648
  fetchRawData(endpoint, v) {
649
649
  return fetch(this.withVersion(endpoint, v), {
650
650
  headers: this.defaultHeaders,
651
- credentials: this.authorization == null ? "include" : undefined,
651
+ credentials: this.authorization == null ? "include" : undefined
652
652
  })
653
653
  .then((r) => handleError("GET", endpoint, r))
654
654
  .then(response => response.arrayBuffer());
@@ -681,7 +681,7 @@ export class FluidTopicsApi {
681
681
  return {
682
682
  translationProfileId: translationSettings.profileId,
683
683
  translationDestinationLanguage: translationSettings.destinationLanguage,
684
- translationSourceLanguage: translationSettings.sourceLanguage?.slice(0, 2),
684
+ translationSourceLanguage: translationSettings.sourceLanguage?.slice(0, 2)
685
685
  };
686
686
  }
687
687
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/public-api",
3
- "version": "1.0.142-alpha1",
3
+ "version": "1.0.143",
4
4
  "description": "Fluid Topics Public API",
5
5
  "author": "Fluid Topics dev team <opensource@antidot.net>",
6
6
  "license": "LGPL-3.0-only",
@@ -36,7 +36,7 @@
36
36
  "chai": "6.2.2",
37
37
  "mocha": "12.0.2",
38
38
  "playwright": "1.63.0",
39
- "rollup": "4.63.3",
39
+ "rollup": "4.63.4",
40
40
  "ts-node": "10.9.2",
41
41
  "tslib": "2.8.1",
42
42
  "tsx": "4.23.13",