@fluid-topics/public-api 1.0.46 → 1.0.48
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/README.md +0 -10
- package/build/cjs/index.js +36 -29
- package/build/cjs/types/ft-common/public.js +27 -2
- package/build/mjs/index.d.ts +14 -13
- package/build/mjs/index.js +36 -29
- package/build/mjs/types/ft-common/public.d.ts +17 -0
- package/build/mjs/types/ft-common/public.js +23 -0
- package/build/rollup/fluidtopics.min.js +1 -1
- package/dist/cjs/index.js +36 -29
- package/dist/cjs/types/ft-common/public.js +27 -2
- package/dist/fluidtopics.min.js +1 -1
- package/dist/mjs/index.d.ts +14 -13
- package/dist/mjs/index.js +36 -29
- package/dist/mjs/types/ft-common/public.d.ts +17 -0
- package/dist/mjs/types/ft-common/public.js +23 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,16 +20,6 @@ Using unpkg CDN
|
|
|
20
20
|
|
|
21
21
|
`<script src="https://unpkg.com/@fluid-topics/public-api/dist/fluidtopics.min.js"></script>`
|
|
22
22
|
|
|
23
|
-
## Publish
|
|
24
|
-
|
|
25
|
-
### Manual
|
|
26
|
-
|
|
27
|
-
- Update package.json version
|
|
28
|
-
- Build the public API using `gw build`
|
|
29
|
-
- Login with NPM Antidot password `npm login` mail is also present on passbolt
|
|
30
|
-
- Publish with `npm publish`
|
|
31
|
-
- Do not forget to commit the package.json
|
|
32
|
-
|
|
33
23
|
## Examples
|
|
34
24
|
|
|
35
25
|
### Typescript
|
package/build/cjs/index.js
CHANGED
|
@@ -201,41 +201,41 @@ class FluidTopicsApi {
|
|
|
201
201
|
getReaderConfiguration() {
|
|
202
202
|
return this.get(this.endpoints.configuration.reader);
|
|
203
203
|
}
|
|
204
|
-
getMap(mapId) {
|
|
205
|
-
return this.get(this.endpoints.khub.maps.mapId(mapId).info);
|
|
204
|
+
getMap(mapId, v) {
|
|
205
|
+
return this.get(this.endpoints.khub.maps.mapId(mapId).info, v);
|
|
206
206
|
}
|
|
207
|
-
getTableOfContent(mapId) {
|
|
208
|
-
return this.get(this.endpoints.khub.maps.mapId(mapId).toc);
|
|
207
|
+
getTableOfContent(mapId, v) {
|
|
208
|
+
return this.get(this.endpoints.khub.maps.mapId(mapId).toc, v);
|
|
209
209
|
}
|
|
210
|
-
getPages(mapId) {
|
|
211
|
-
return this.get(this.endpoints.khub.maps.mapId(mapId).pages);
|
|
210
|
+
getPages(mapId, v) {
|
|
211
|
+
return this.get(this.endpoints.khub.maps.mapId(mapId).pages, v);
|
|
212
212
|
}
|
|
213
|
-
getTopic(mapId, topicContentId) {
|
|
214
|
-
return this.get(this.endpoints.khub.maps.mapId(mapId).topics.contentId(topicContentId).info);
|
|
213
|
+
getTopic(mapId, topicContentId, v) {
|
|
214
|
+
return this.get(this.endpoints.khub.maps.mapId(mapId).topics.contentId(topicContentId).info, v);
|
|
215
215
|
}
|
|
216
|
-
getTopicHTMLContent(mapId, topicContentId, target) {
|
|
217
|
-
return this.get(this.endpoints.khub.maps.mapId(mapId).topics.contentId(topicContentId).content + (target ? "?target=" + target : ""));
|
|
216
|
+
getTopicHTMLContent(mapId, topicContentId, target, v) {
|
|
217
|
+
return this.get(this.endpoints.khub.maps.mapId(mapId).topics.contentId(topicContentId).content + (target ? "?target=" + target : ""), v);
|
|
218
218
|
}
|
|
219
|
-
getMapAttachments(mapId) {
|
|
220
|
-
return this.get(this.endpoints.khub.maps.mapId(mapId).attachments.list);
|
|
219
|
+
getMapAttachments(mapId, v) {
|
|
220
|
+
return this.get(this.endpoints.khub.maps.mapId(mapId).attachments.list, v);
|
|
221
221
|
}
|
|
222
|
-
getMapAttachmentContent(mapId, attachmentId) {
|
|
223
|
-
return this.fetchRawData(this.endpoints.khub.maps.mapId(mapId).attachments.attachmentId(attachmentId).content);
|
|
222
|
+
getMapAttachmentContent(mapId, attachmentId, v) {
|
|
223
|
+
return this.fetchRawData(this.endpoints.khub.maps.mapId(mapId).attachments.attachmentId(attachmentId).content, v);
|
|
224
224
|
}
|
|
225
|
-
getMapResources(mapId) {
|
|
226
|
-
return this.get(this.endpoints.khub.maps.mapId(mapId).resources.list);
|
|
225
|
+
getMapResources(mapId, v) {
|
|
226
|
+
return this.get(this.endpoints.khub.maps.mapId(mapId).resources.list, v);
|
|
227
227
|
}
|
|
228
|
-
getMapResourceContent(mapId, resourceId) {
|
|
229
|
-
return this.fetchRawData(this.endpoints.khub.maps.mapId(mapId).resources.resourceId(resourceId).content);
|
|
228
|
+
getMapResourceContent(mapId, resourceId, v) {
|
|
229
|
+
return this.fetchRawData(this.endpoints.khub.maps.mapId(mapId).resources.resourceId(resourceId).content, v);
|
|
230
230
|
}
|
|
231
|
-
getUnstructuredDocument(documentId) {
|
|
232
|
-
return this.get(this.endpoints.khub.documents.documentId(documentId).info);
|
|
231
|
+
getUnstructuredDocument(documentId, v) {
|
|
232
|
+
return this.get(this.endpoints.khub.documents.documentId(documentId).info, v);
|
|
233
233
|
}
|
|
234
|
-
getUnstructuredDocumentContent(documentId) {
|
|
235
|
-
return this.fetchRawData(this.endpoints.khub.documents.documentId(documentId).content);
|
|
234
|
+
getUnstructuredDocumentContent(documentId, v) {
|
|
235
|
+
return this.fetchRawData(this.endpoints.khub.documents.documentId(documentId).content, v);
|
|
236
236
|
}
|
|
237
|
-
getUnstructuredDocumentTextContent(documentId) {
|
|
238
|
-
return this.get(this.endpoints.khub.documents.documentId(documentId).text);
|
|
237
|
+
getUnstructuredDocumentTextContent(documentId, v) {
|
|
238
|
+
return this.get(this.endpoints.khub.documents.documentId(documentId).text, v);
|
|
239
239
|
}
|
|
240
240
|
getCollectionDocuments(userId, collectionId) {
|
|
241
241
|
return this.get(this.endpoints.users.userId(userId).collections.collectionId(collectionId).documents);
|
|
@@ -299,8 +299,8 @@ class FluidTopicsApi {
|
|
|
299
299
|
listMyBookmarks(userId) {
|
|
300
300
|
return this.get(this.endpoints.users.userId(userId).bookmarks.list);
|
|
301
301
|
}
|
|
302
|
-
get(endpoint) {
|
|
303
|
-
return this.makeRequest("GET", endpoint);
|
|
302
|
+
get(endpoint, v) {
|
|
303
|
+
return this.makeRequest("GET", this.withVersion(endpoint, v));
|
|
304
304
|
}
|
|
305
305
|
post(endpoint, data) {
|
|
306
306
|
return this.makeRequest("POST", endpoint, data);
|
|
@@ -312,7 +312,7 @@ class FluidTopicsApi {
|
|
|
312
312
|
return this.makeRequest("DELETE", endpoint);
|
|
313
313
|
}
|
|
314
314
|
makeAbsolute(endpoint) {
|
|
315
|
-
return this.tenantBaseUrl + endpoint.replace(/^\//, "");
|
|
315
|
+
return endpoint.startsWith(this.tenantBaseUrl) ? endpoint : (this.tenantBaseUrl + endpoint.replace(/^\//, ""));
|
|
316
316
|
}
|
|
317
317
|
fetch(endpoint, init) {
|
|
318
318
|
var _a;
|
|
@@ -353,14 +353,21 @@ class FluidTopicsApi {
|
|
|
353
353
|
.then(handleError)
|
|
354
354
|
.then(getBody);
|
|
355
355
|
}
|
|
356
|
-
fetchRawData(endpoint) {
|
|
357
|
-
return fetch(this.
|
|
356
|
+
fetchRawData(endpoint, v) {
|
|
357
|
+
return fetch(this.withVersion(endpoint, v), {
|
|
358
358
|
headers: this.defaultHeaders,
|
|
359
359
|
credentials: this.authorization == null ? "include" : undefined
|
|
360
360
|
})
|
|
361
361
|
.then(handleError)
|
|
362
362
|
.then(response => response.arrayBuffer());
|
|
363
363
|
}
|
|
364
|
+
withVersion(endpoint, v) {
|
|
365
|
+
let url = new URL(this.makeAbsolute(endpoint));
|
|
366
|
+
if (v) {
|
|
367
|
+
url.searchParams.append("v", v);
|
|
368
|
+
}
|
|
369
|
+
return url.toString();
|
|
370
|
+
}
|
|
364
371
|
}
|
|
365
372
|
exports.FluidTopicsApi = FluidTopicsApi;
|
|
366
373
|
exports.default = FluidTopicsApi;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.isFtUserProfile = exports.isFtSession = exports.isFtAuthenticatedSession = exports.isFtAuthenticationIdentifier = exports.isFtUserRole = exports.FtUserRole = exports.isFtSuggestResults = exports.isFtSuggestResult = exports.isFtSuggestRequest = exports.isFtTopicResource = exports.isFtSpellcheck = exports.isFtSearchSortCriterion = exports.isFtSearchFacetEntry = exports.isFtSearchFacetConf = exports.isFtSearchFacet = exports.isFtSearchResultType = exports.FtSearchResultType = exports.isFtSearchResultTopic = exports.isFtSearchResultMap = exports.isFtSearchResultUnstructuredDocument = exports.isFtSearchResultClusterEntry = exports.isFtSearchResultCluster = exports.isFtSearchRequest = exports.isFtSearchPrior = exports.isFtLabeledSearchFilter = exports.isFtSearchResults = exports.isFtCollectionDocumentType = exports.FtCollectionDocumentType = exports.isFtPageRequest = exports.isFtOpenMode = exports.FtOpenMode = exports.isFtEditorialType = void 0;
|
|
3
|
+
exports.isFtVirtualField = exports.FtVirtualField = exports.isFtSearchSortCriterionType = exports.FtSearchSortCriterionType = exports.isFtSearchSortCriterionOrder = exports.FtSearchSortCriterionOrder = exports.isFtSearchPreset = exports.isFtSearchFilter = exports.isFtPeriodFilterType = exports.FtPeriodFilterType = exports.isFtPeriodFilter = exports.isFtPeriod = exports.isFtSearchPreferencesConfiguration = exports.isFtMetadataPreferenceConfiguration = exports.isFtMapResource = exports.isFtTopicsRatingSummary = exports.isFtTopicRating = exports.isFtRatingSummary = exports.isFtRatingCreation = exports.isFtPublicationRatingSummary = exports.isFtPublicationRating = exports.isFtRatingType = exports.FtRatingType = exports.isFtMySearchRequest = exports.isFtMySearch = exports.isFtMetadata = exports.isFtUiLocale = exports.isFtMessageContext = exports.isFtSearchLocales = exports.isFtSearchLocale = exports.isFtFeedbackCreation = exports.isFtTopicContentTarget = exports.FtTopicContentTarget = exports.isFtUnstructuredDocument = exports.isFtTopicOrigin = exports.isFtTopic = exports.isFtTocNode = exports.isFtMapStyles = exports.isFtMap = exports.isFtCollectionDocument = exports.isFtBookmark = exports.isFtPersonalBookTopicLinkCreation = exports.isFtPersonalBookNodeCreation = exports.isFtPersonalBookMetadataUpdate = exports.isFtPersonalBookCreation = exports.isFtCredentials = exports.isFtTopicOriginType = exports.FtTopicOriginType = exports.isFtMyLibraryColors = exports.FtMyLibraryColors = void 0;
|
|
4
|
+
exports.isFtUserProfile = exports.isFtSession = exports.isFtAuthenticatedSession = exports.isFtAuthenticationIdentifier = exports.isFtUserRole = exports.FtUserRole = exports.isFtSuggestResults = exports.isFtSuggestResult = exports.isFtSuggestRequest = exports.isFtTopicResource = exports.isFtSpellcheck = exports.isFtSearchSortCriterion = exports.isFtSearchFacetEntry = exports.isFtSearchFacetConf = exports.isFtSearchFacet = exports.isFtSearchScope = exports.FtSearchScope = exports.isFtSearchResultType = exports.FtSearchResultType = exports.isFtSearchResultTopic = exports.isFtSearchResultMap = exports.isFtSearchResultUnstructuredDocument = exports.isFtSearchResultClusterEntry = exports.isFtSearchResultCluster = exports.isFtSearchRequest = exports.isFtSearchPrior = exports.isFtLabeledSearchFilter = exports.isFtSearchResults = exports.isFtCollectionDocumentType = exports.FtCollectionDocumentType = exports.isFtPageRequest = exports.isFtOpenMode = exports.FtOpenMode = exports.isFtEditorialType = exports.FtEditorialType = exports.isFtSearchResultsPageInfo = void 0;
|
|
5
5
|
const isObject = (o) => typeof o === "object" && o != null;
|
|
6
6
|
const isBoolean = (o) => typeof o === "boolean";
|
|
7
7
|
const isNumber = (o) => typeof o === "number";
|
|
@@ -264,10 +264,12 @@ const isFtMySearchRequest = (o) => {
|
|
|
264
264
|
return isObject(o)
|
|
265
265
|
&& (o.periodFilter == null || (0, exports.isFtPeriodFilter)(o.periodFilter))
|
|
266
266
|
&& (isString(o.query))
|
|
267
|
+
&& (o.scope == null || (0, exports.isFtSearchScope)(o.scope))
|
|
267
268
|
&& ((Array.isArray(o.filters)
|
|
268
269
|
&& o.filters.every((v) => (0, exports.isFtLabeledSearchFilter)(v))))
|
|
269
270
|
&& ((Array.isArray(o.sort)
|
|
270
271
|
&& o.sort.every((v) => (0, exports.isFtSearchSortCriterion)(v))))
|
|
272
|
+
&& (o.virtualField == null || (0, exports.isFtVirtualField)(o.virtualField))
|
|
271
273
|
&& (o.contentLocale == null || isString(o.contentLocale));
|
|
272
274
|
};
|
|
273
275
|
exports.isFtMySearchRequest = isFtMySearchRequest;
|
|
@@ -407,6 +409,17 @@ const isFtSearchSortCriterionType = (o) => {
|
|
|
407
409
|
return ["ALPHA", "NATURAL"].includes(o);
|
|
408
410
|
};
|
|
409
411
|
exports.isFtSearchSortCriterionType = isFtSearchSortCriterionType;
|
|
412
|
+
// From: VirtualField
|
|
413
|
+
var FtVirtualField;
|
|
414
|
+
(function (FtVirtualField) {
|
|
415
|
+
FtVirtualField["EVERYWHERE"] = "EVERYWHERE";
|
|
416
|
+
FtVirtualField["TITLE_ONLY"] = "TITLE_ONLY";
|
|
417
|
+
FtVirtualField["NONE"] = "NONE";
|
|
418
|
+
})(FtVirtualField = exports.FtVirtualField || (exports.FtVirtualField = {}));
|
|
419
|
+
const isFtVirtualField = (o) => {
|
|
420
|
+
return ["EVERYWHERE", "TITLE_ONLY", "NONE"].includes(o);
|
|
421
|
+
};
|
|
422
|
+
exports.isFtVirtualField = isFtVirtualField;
|
|
410
423
|
const isFtSearchResultsPageInfo = (o) => {
|
|
411
424
|
return isObject(o)
|
|
412
425
|
&& (isNumber(o.totalResultsCount))
|
|
@@ -485,12 +498,14 @@ const isFtSearchRequest = (o) => {
|
|
|
485
498
|
return isObject(o)
|
|
486
499
|
&& (o.periodFilter == null || (0, exports.isFtPeriodFilter)(o.periodFilter))
|
|
487
500
|
&& (isString(o.query))
|
|
501
|
+
&& (o.scope == null || (0, exports.isFtSearchScope)(o.scope))
|
|
488
502
|
&& ((0, exports.isFtPageRequest)(o.paging))
|
|
489
503
|
&& ((Array.isArray(o.filters)
|
|
490
504
|
&& o.filters.every((v) => (0, exports.isFtSearchFilter)(v))))
|
|
491
505
|
&& ((Array.isArray(o.sort)
|
|
492
506
|
&& o.sort.every((v) => (0, exports.isFtSearchSortCriterion)(v))))
|
|
493
507
|
&& (o.uiLocale == null || isString(o.uiLocale))
|
|
508
|
+
&& (o.virtualField == null || (0, exports.isFtVirtualField)(o.virtualField))
|
|
494
509
|
&& (o.contentLocale == null || isString(o.contentLocale))
|
|
495
510
|
&& (o.priors == null || (Array.isArray(o.priors)
|
|
496
511
|
&& o.priors.every((v) => (0, exports.isFtSearchPrior)(v))))
|
|
@@ -583,6 +598,16 @@ const isFtSearchResultType = (o) => {
|
|
|
583
598
|
return ["MAP", "DOCUMENT", "TOPIC"].includes(o);
|
|
584
599
|
};
|
|
585
600
|
exports.isFtSearchResultType = isFtSearchResultType;
|
|
601
|
+
// From: WsPublicSearchScope
|
|
602
|
+
var FtSearchScope;
|
|
603
|
+
(function (FtSearchScope) {
|
|
604
|
+
FtSearchScope["DEFAULT"] = "DEFAULT";
|
|
605
|
+
FtSearchScope["DOCUMENTS"] = "DOCUMENTS";
|
|
606
|
+
})(FtSearchScope = exports.FtSearchScope || (exports.FtSearchScope = {}));
|
|
607
|
+
const isFtSearchScope = (o) => {
|
|
608
|
+
return ["DEFAULT", "DOCUMENTS"].includes(o);
|
|
609
|
+
};
|
|
610
|
+
exports.isFtSearchScope = isFtSearchScope;
|
|
586
611
|
const isFtSearchFacet = (o) => {
|
|
587
612
|
return isObject(o)
|
|
588
613
|
&& (isBoolean(o.hierarchical))
|
package/build/mjs/index.d.ts
CHANGED
|
@@ -122,18 +122,18 @@ export declare class FluidTopicsApi {
|
|
|
122
122
|
logout(): Promise<void>;
|
|
123
123
|
getCurrentSession(): Promise<FtSession>;
|
|
124
124
|
getReaderConfiguration(): Promise<FtReaderConfiguration>;
|
|
125
|
-
getMap(mapId: string): Promise<FtMap>;
|
|
126
|
-
getTableOfContent(mapId: string): Promise<Array<FtTocNode>>;
|
|
127
|
-
getPages(mapId: string): Promise<FtPaginatedToc>;
|
|
128
|
-
getTopic(mapId: string, topicContentId: string): Promise<FtTopic>;
|
|
129
|
-
getTopicHTMLContent(mapId: string, topicContentId: string, target?: FtTopicContentTarget | FtTopicContentTargetKeys): Promise<string>;
|
|
130
|
-
getMapAttachments(mapId: string): Promise<Array<FtMapAttachment>>;
|
|
131
|
-
getMapAttachmentContent(mapId: string, attachmentId: string): Promise<ArrayBuffer>;
|
|
132
|
-
getMapResources(mapId: string): Promise<Array<FtMapResource>>;
|
|
133
|
-
getMapResourceContent(mapId: string, resourceId: string): Promise<ArrayBuffer>;
|
|
134
|
-
getUnstructuredDocument(documentId: string): Promise<FtUnstructuredDocument>;
|
|
135
|
-
getUnstructuredDocumentContent(documentId: string): Promise<ArrayBuffer>;
|
|
136
|
-
getUnstructuredDocumentTextContent(documentId: string): Promise<string>;
|
|
125
|
+
getMap(mapId: string, v?: string): Promise<FtMap>;
|
|
126
|
+
getTableOfContent(mapId: string, v?: string): Promise<Array<FtTocNode>>;
|
|
127
|
+
getPages(mapId: string, v?: string): Promise<FtPaginatedToc>;
|
|
128
|
+
getTopic(mapId: string, topicContentId: string, v?: string): Promise<FtTopic>;
|
|
129
|
+
getTopicHTMLContent(mapId: string, topicContentId: string, target?: FtTopicContentTarget | FtTopicContentTargetKeys, v?: string): Promise<string>;
|
|
130
|
+
getMapAttachments(mapId: string, v?: string): Promise<Array<FtMapAttachment>>;
|
|
131
|
+
getMapAttachmentContent(mapId: string, attachmentId: string, v?: string): Promise<ArrayBuffer>;
|
|
132
|
+
getMapResources(mapId: string, v?: string): Promise<Array<FtMapResource>>;
|
|
133
|
+
getMapResourceContent(mapId: string, resourceId: string, v?: string): Promise<ArrayBuffer>;
|
|
134
|
+
getUnstructuredDocument(documentId: string, v?: string): Promise<FtUnstructuredDocument>;
|
|
135
|
+
getUnstructuredDocumentContent(documentId: string, v?: string): Promise<ArrayBuffer>;
|
|
136
|
+
getUnstructuredDocumentTextContent(documentId: string, v?: string): Promise<string>;
|
|
137
137
|
getCollectionDocuments(userId: string, collectionId: string): Promise<Array<FtCollectionDocument>>;
|
|
138
138
|
getSuggestions(request: FtSuggestRequest): Promise<FtSuggestResults>;
|
|
139
139
|
search(request: FtSearchRequest): Promise<FtSearchResults>;
|
|
@@ -154,7 +154,7 @@ export declare class FluidTopicsApi {
|
|
|
154
154
|
getCustomMessageContext(locale: string, name: string): Promise<FtMessageContext>;
|
|
155
155
|
listMySearches(userId: string): Promise<FtMySearch[]>;
|
|
156
156
|
listMyBookmarks(userId: string): Promise<FtBookmark[]>;
|
|
157
|
-
get<T>(endpoint: string): Promise<T>;
|
|
157
|
+
get<T>(endpoint: string, v?: string): Promise<T>;
|
|
158
158
|
post<T>(endpoint: string, data?: any): Promise<T>;
|
|
159
159
|
put<T>(endpoint: string, data?: any): Promise<T>;
|
|
160
160
|
delete<T>(endpoint: string): Promise<T>;
|
|
@@ -163,5 +163,6 @@ export declare class FluidTopicsApi {
|
|
|
163
163
|
upload<T>(method: string, endpoint: string, body: any, onProgress?: (e: any) => void): Promise<T>;
|
|
164
164
|
private makeRequest;
|
|
165
165
|
private fetchRawData;
|
|
166
|
+
withVersion(endpoint: string, v: string | undefined): string;
|
|
166
167
|
}
|
|
167
168
|
export default FluidTopicsApi;
|
package/build/mjs/index.js
CHANGED
|
@@ -182,41 +182,41 @@ export class FluidTopicsApi {
|
|
|
182
182
|
getReaderConfiguration() {
|
|
183
183
|
return this.get(this.endpoints.configuration.reader);
|
|
184
184
|
}
|
|
185
|
-
getMap(mapId) {
|
|
186
|
-
return this.get(this.endpoints.khub.maps.mapId(mapId).info);
|
|
185
|
+
getMap(mapId, v) {
|
|
186
|
+
return this.get(this.endpoints.khub.maps.mapId(mapId).info, v);
|
|
187
187
|
}
|
|
188
|
-
getTableOfContent(mapId) {
|
|
189
|
-
return this.get(this.endpoints.khub.maps.mapId(mapId).toc);
|
|
188
|
+
getTableOfContent(mapId, v) {
|
|
189
|
+
return this.get(this.endpoints.khub.maps.mapId(mapId).toc, v);
|
|
190
190
|
}
|
|
191
|
-
getPages(mapId) {
|
|
192
|
-
return this.get(this.endpoints.khub.maps.mapId(mapId).pages);
|
|
191
|
+
getPages(mapId, v) {
|
|
192
|
+
return this.get(this.endpoints.khub.maps.mapId(mapId).pages, v);
|
|
193
193
|
}
|
|
194
|
-
getTopic(mapId, topicContentId) {
|
|
195
|
-
return this.get(this.endpoints.khub.maps.mapId(mapId).topics.contentId(topicContentId).info);
|
|
194
|
+
getTopic(mapId, topicContentId, v) {
|
|
195
|
+
return this.get(this.endpoints.khub.maps.mapId(mapId).topics.contentId(topicContentId).info, v);
|
|
196
196
|
}
|
|
197
|
-
getTopicHTMLContent(mapId, topicContentId, target) {
|
|
198
|
-
return this.get(this.endpoints.khub.maps.mapId(mapId).topics.contentId(topicContentId).content + (target ? "?target=" + target : ""));
|
|
197
|
+
getTopicHTMLContent(mapId, topicContentId, target, v) {
|
|
198
|
+
return this.get(this.endpoints.khub.maps.mapId(mapId).topics.contentId(topicContentId).content + (target ? "?target=" + target : ""), v);
|
|
199
199
|
}
|
|
200
|
-
getMapAttachments(mapId) {
|
|
201
|
-
return this.get(this.endpoints.khub.maps.mapId(mapId).attachments.list);
|
|
200
|
+
getMapAttachments(mapId, v) {
|
|
201
|
+
return this.get(this.endpoints.khub.maps.mapId(mapId).attachments.list, v);
|
|
202
202
|
}
|
|
203
|
-
getMapAttachmentContent(mapId, attachmentId) {
|
|
204
|
-
return this.fetchRawData(this.endpoints.khub.maps.mapId(mapId).attachments.attachmentId(attachmentId).content);
|
|
203
|
+
getMapAttachmentContent(mapId, attachmentId, v) {
|
|
204
|
+
return this.fetchRawData(this.endpoints.khub.maps.mapId(mapId).attachments.attachmentId(attachmentId).content, v);
|
|
205
205
|
}
|
|
206
|
-
getMapResources(mapId) {
|
|
207
|
-
return this.get(this.endpoints.khub.maps.mapId(mapId).resources.list);
|
|
206
|
+
getMapResources(mapId, v) {
|
|
207
|
+
return this.get(this.endpoints.khub.maps.mapId(mapId).resources.list, v);
|
|
208
208
|
}
|
|
209
|
-
getMapResourceContent(mapId, resourceId) {
|
|
210
|
-
return this.fetchRawData(this.endpoints.khub.maps.mapId(mapId).resources.resourceId(resourceId).content);
|
|
209
|
+
getMapResourceContent(mapId, resourceId, v) {
|
|
210
|
+
return this.fetchRawData(this.endpoints.khub.maps.mapId(mapId).resources.resourceId(resourceId).content, v);
|
|
211
211
|
}
|
|
212
|
-
getUnstructuredDocument(documentId) {
|
|
213
|
-
return this.get(this.endpoints.khub.documents.documentId(documentId).info);
|
|
212
|
+
getUnstructuredDocument(documentId, v) {
|
|
213
|
+
return this.get(this.endpoints.khub.documents.documentId(documentId).info, v);
|
|
214
214
|
}
|
|
215
|
-
getUnstructuredDocumentContent(documentId) {
|
|
216
|
-
return this.fetchRawData(this.endpoints.khub.documents.documentId(documentId).content);
|
|
215
|
+
getUnstructuredDocumentContent(documentId, v) {
|
|
216
|
+
return this.fetchRawData(this.endpoints.khub.documents.documentId(documentId).content, v);
|
|
217
217
|
}
|
|
218
|
-
getUnstructuredDocumentTextContent(documentId) {
|
|
219
|
-
return this.get(this.endpoints.khub.documents.documentId(documentId).text);
|
|
218
|
+
getUnstructuredDocumentTextContent(documentId, v) {
|
|
219
|
+
return this.get(this.endpoints.khub.documents.documentId(documentId).text, v);
|
|
220
220
|
}
|
|
221
221
|
getCollectionDocuments(userId, collectionId) {
|
|
222
222
|
return this.get(this.endpoints.users.userId(userId).collections.collectionId(collectionId).documents);
|
|
@@ -280,8 +280,8 @@ export class FluidTopicsApi {
|
|
|
280
280
|
listMyBookmarks(userId) {
|
|
281
281
|
return this.get(this.endpoints.users.userId(userId).bookmarks.list);
|
|
282
282
|
}
|
|
283
|
-
get(endpoint) {
|
|
284
|
-
return this.makeRequest("GET", endpoint);
|
|
283
|
+
get(endpoint, v) {
|
|
284
|
+
return this.makeRequest("GET", this.withVersion(endpoint, v));
|
|
285
285
|
}
|
|
286
286
|
post(endpoint, data) {
|
|
287
287
|
return this.makeRequest("POST", endpoint, data);
|
|
@@ -293,7 +293,7 @@ export class FluidTopicsApi {
|
|
|
293
293
|
return this.makeRequest("DELETE", endpoint);
|
|
294
294
|
}
|
|
295
295
|
makeAbsolute(endpoint) {
|
|
296
|
-
return this.tenantBaseUrl + endpoint.replace(/^\//, "");
|
|
296
|
+
return endpoint.startsWith(this.tenantBaseUrl) ? endpoint : (this.tenantBaseUrl + endpoint.replace(/^\//, ""));
|
|
297
297
|
}
|
|
298
298
|
async fetch(endpoint, init) {
|
|
299
299
|
const requestInit = init;
|
|
@@ -339,13 +339,20 @@ export class FluidTopicsApi {
|
|
|
339
339
|
.then(handleError)
|
|
340
340
|
.then(getBody);
|
|
341
341
|
}
|
|
342
|
-
fetchRawData(endpoint) {
|
|
343
|
-
return fetch(this.
|
|
342
|
+
fetchRawData(endpoint, v) {
|
|
343
|
+
return fetch(this.withVersion(endpoint, v), {
|
|
344
344
|
headers: this.defaultHeaders,
|
|
345
345
|
credentials: this.authorization == null ? "include" : undefined
|
|
346
346
|
})
|
|
347
347
|
.then(handleError)
|
|
348
348
|
.then(response => response.arrayBuffer());
|
|
349
349
|
}
|
|
350
|
+
withVersion(endpoint, v) {
|
|
351
|
+
let url = new URL(this.makeAbsolute(endpoint));
|
|
352
|
+
if (v) {
|
|
353
|
+
url.searchParams.append("v", v);
|
|
354
|
+
}
|
|
355
|
+
return url.toString();
|
|
356
|
+
}
|
|
350
357
|
}
|
|
351
358
|
export default FluidTopicsApi;
|
|
@@ -206,8 +206,10 @@ export declare const isFtMySearch: (o: any) => o is FtMySearch;
|
|
|
206
206
|
export interface FtMySearchRequest {
|
|
207
207
|
periodFilter?: FtPeriodFilter;
|
|
208
208
|
query: string;
|
|
209
|
+
scope?: FtSearchScopeKeys | FtSearchScope;
|
|
209
210
|
filters: Array<FtLabeledSearchFilter>;
|
|
210
211
|
sort: Array<FtSearchSortCriterion>;
|
|
212
|
+
virtualField?: FtVirtualFieldKeys | FtVirtualField;
|
|
211
213
|
contentLocale?: string;
|
|
212
214
|
}
|
|
213
215
|
export declare const isFtMySearchRequest: (o: any) => o is FtMySearchRequest;
|
|
@@ -311,6 +313,13 @@ export declare enum FtSearchSortCriterionType {
|
|
|
311
313
|
}
|
|
312
314
|
export type FtSearchSortCriterionTypeKeys = keyof typeof FtSearchSortCriterionType;
|
|
313
315
|
export declare const isFtSearchSortCriterionType: (o: any) => o is FtSearchSortCriterionType;
|
|
316
|
+
export declare enum FtVirtualField {
|
|
317
|
+
EVERYWHERE = "EVERYWHERE",
|
|
318
|
+
TITLE_ONLY = "TITLE_ONLY",
|
|
319
|
+
NONE = "NONE"
|
|
320
|
+
}
|
|
321
|
+
export type FtVirtualFieldKeys = keyof typeof FtVirtualField;
|
|
322
|
+
export declare const isFtVirtualField: (o: any) => o is FtVirtualField;
|
|
314
323
|
export interface FtSearchResultsPageInfo {
|
|
315
324
|
totalResultsCount: number;
|
|
316
325
|
isLastPage: boolean;
|
|
@@ -368,11 +377,13 @@ export declare const isFtSearchPrior: (o: any) => o is FtSearchPrior;
|
|
|
368
377
|
export interface FtSearchRequest {
|
|
369
378
|
periodFilter?: FtPeriodFilter;
|
|
370
379
|
query: string;
|
|
380
|
+
scope?: FtSearchScopeKeys | FtSearchScope;
|
|
371
381
|
paging: FtPageRequest;
|
|
372
382
|
filters: Array<FtSearchFilter>;
|
|
373
383
|
sort: Array<FtSearchSortCriterion>;
|
|
374
384
|
lastModified?: any;
|
|
375
385
|
uiLocale?: string;
|
|
386
|
+
virtualField?: FtVirtualFieldKeys | FtVirtualField;
|
|
376
387
|
contentLocale?: string;
|
|
377
388
|
priors?: Array<FtSearchPrior>;
|
|
378
389
|
facets: Array<FtSearchFacetConf>;
|
|
@@ -451,6 +462,12 @@ export declare enum FtSearchResultType {
|
|
|
451
462
|
}
|
|
452
463
|
export type FtSearchResultTypeKeys = keyof typeof FtSearchResultType;
|
|
453
464
|
export declare const isFtSearchResultType: (o: any) => o is FtSearchResultType;
|
|
465
|
+
export declare enum FtSearchScope {
|
|
466
|
+
DEFAULT = "DEFAULT",
|
|
467
|
+
DOCUMENTS = "DOCUMENTS"
|
|
468
|
+
}
|
|
469
|
+
export type FtSearchScopeKeys = keyof typeof FtSearchScope;
|
|
470
|
+
export declare const isFtSearchScope: (o: any) => o is FtSearchScope;
|
|
454
471
|
export interface FtSearchFacet {
|
|
455
472
|
hierarchical: boolean;
|
|
456
473
|
label: string;
|
|
@@ -237,10 +237,12 @@ export const isFtMySearchRequest = (o) => {
|
|
|
237
237
|
return isObject(o)
|
|
238
238
|
&& (o.periodFilter == null || isFtPeriodFilter(o.periodFilter))
|
|
239
239
|
&& (isString(o.query))
|
|
240
|
+
&& (o.scope == null || isFtSearchScope(o.scope))
|
|
240
241
|
&& ((Array.isArray(o.filters)
|
|
241
242
|
&& o.filters.every((v) => isFtLabeledSearchFilter(v))))
|
|
242
243
|
&& ((Array.isArray(o.sort)
|
|
243
244
|
&& o.sort.every((v) => isFtSearchSortCriterion(v))))
|
|
245
|
+
&& (o.virtualField == null || isFtVirtualField(o.virtualField))
|
|
244
246
|
&& (o.contentLocale == null || isString(o.contentLocale));
|
|
245
247
|
};
|
|
246
248
|
// From: RatingType
|
|
@@ -362,6 +364,16 @@ export var FtSearchSortCriterionType;
|
|
|
362
364
|
export const isFtSearchSortCriterionType = (o) => {
|
|
363
365
|
return ["ALPHA", "NATURAL"].includes(o);
|
|
364
366
|
};
|
|
367
|
+
// From: VirtualField
|
|
368
|
+
export var FtVirtualField;
|
|
369
|
+
(function (FtVirtualField) {
|
|
370
|
+
FtVirtualField["EVERYWHERE"] = "EVERYWHERE";
|
|
371
|
+
FtVirtualField["TITLE_ONLY"] = "TITLE_ONLY";
|
|
372
|
+
FtVirtualField["NONE"] = "NONE";
|
|
373
|
+
})(FtVirtualField || (FtVirtualField = {}));
|
|
374
|
+
export const isFtVirtualField = (o) => {
|
|
375
|
+
return ["EVERYWHERE", "TITLE_ONLY", "NONE"].includes(o);
|
|
376
|
+
};
|
|
365
377
|
export const isFtSearchResultsPageInfo = (o) => {
|
|
366
378
|
return isObject(o)
|
|
367
379
|
&& (isNumber(o.totalResultsCount))
|
|
@@ -432,12 +444,14 @@ export const isFtSearchRequest = (o) => {
|
|
|
432
444
|
return isObject(o)
|
|
433
445
|
&& (o.periodFilter == null || isFtPeriodFilter(o.periodFilter))
|
|
434
446
|
&& (isString(o.query))
|
|
447
|
+
&& (o.scope == null || isFtSearchScope(o.scope))
|
|
435
448
|
&& (isFtPageRequest(o.paging))
|
|
436
449
|
&& ((Array.isArray(o.filters)
|
|
437
450
|
&& o.filters.every((v) => isFtSearchFilter(v))))
|
|
438
451
|
&& ((Array.isArray(o.sort)
|
|
439
452
|
&& o.sort.every((v) => isFtSearchSortCriterion(v))))
|
|
440
453
|
&& (o.uiLocale == null || isString(o.uiLocale))
|
|
454
|
+
&& (o.virtualField == null || isFtVirtualField(o.virtualField))
|
|
441
455
|
&& (o.contentLocale == null || isString(o.contentLocale))
|
|
442
456
|
&& (o.priors == null || (Array.isArray(o.priors)
|
|
443
457
|
&& o.priors.every((v) => isFtSearchPrior(v))))
|
|
@@ -523,6 +537,15 @@ export var FtSearchResultType;
|
|
|
523
537
|
export const isFtSearchResultType = (o) => {
|
|
524
538
|
return ["MAP", "DOCUMENT", "TOPIC"].includes(o);
|
|
525
539
|
};
|
|
540
|
+
// From: WsPublicSearchScope
|
|
541
|
+
export var FtSearchScope;
|
|
542
|
+
(function (FtSearchScope) {
|
|
543
|
+
FtSearchScope["DEFAULT"] = "DEFAULT";
|
|
544
|
+
FtSearchScope["DOCUMENTS"] = "DOCUMENTS";
|
|
545
|
+
})(FtSearchScope || (FtSearchScope = {}));
|
|
546
|
+
export const isFtSearchScope = (o) => {
|
|
547
|
+
return ["DEFAULT", "DOCUMENTS"].includes(o);
|
|
548
|
+
};
|
|
526
549
|
export const isFtSearchFacet = (o) => {
|
|
527
550
|
return isObject(o)
|
|
528
551
|
&& (isBoolean(o.hierarchical))
|