@fluid-topics/public-api 1.0.12 → 1.0.13
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 +11 -11
- package/dist/cjs/types/ft-common/public.js +1 -199
- package/dist/fluidtopics.min.js +1 -1
- package/dist/mjs/index.d.ts +7 -4
- package/dist/mjs/index.js +12 -10
- package/dist/mjs/types/ft-common/public.d.ts +0 -166
- package/dist/mjs/types/ft-common/public.js +0 -178
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -19,17 +19,26 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
19
19
|
});
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.FluidTopicsApi = void 0;
|
|
22
|
+
exports.FluidTopicsApi = exports.HttpError = void 0;
|
|
23
23
|
require("cross-fetch/polyfill");
|
|
24
24
|
__exportStar(require("./types/ft-common/public"), exports);
|
|
25
25
|
__exportStar(require("./types/ft-server/public"), exports);
|
|
26
26
|
function toBase64(s) {
|
|
27
27
|
return typeof Buffer !== "undefined" ? Buffer.from(s).toString("base64") : btoa(s);
|
|
28
28
|
}
|
|
29
|
+
class HttpError extends Error {
|
|
30
|
+
constructor(status, statusText, body) {
|
|
31
|
+
super(`${status} - ${statusText}: ${body}`);
|
|
32
|
+
this.status = status;
|
|
33
|
+
this.statusText = statusText;
|
|
34
|
+
this.body = body;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.HttpError = HttpError;
|
|
29
38
|
function handleError(response) {
|
|
30
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31
40
|
if (!response.ok) {
|
|
32
|
-
throw new
|
|
41
|
+
throw new HttpError(response.status, response.statusText, yield response.text());
|
|
33
42
|
}
|
|
34
43
|
return response;
|
|
35
44
|
});
|
|
@@ -107,15 +116,6 @@ class FluidTopicsApi {
|
|
|
107
116
|
getCollectionDocuments(userId, collectionId) {
|
|
108
117
|
return this.get(`/api/users/${userId}/collections/${collectionId}/documents`);
|
|
109
118
|
}
|
|
110
|
-
getSuggestions(request) {
|
|
111
|
-
return this.post("/api/khub/suggest", request);
|
|
112
|
-
}
|
|
113
|
-
search(request) {
|
|
114
|
-
return this.post("/api/khub/clustered-search", request);
|
|
115
|
-
}
|
|
116
|
-
getAvailableSearchLocales() {
|
|
117
|
-
return this.get("/api/khub/locales");
|
|
118
|
-
}
|
|
119
119
|
get(endpoint) {
|
|
120
120
|
return this.makeRequest("GET", endpoint);
|
|
121
121
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isFtAuthenticationIdentifier = exports.
|
|
3
|
+
exports.isFtAuthenticationIdentifier = exports.isFtSearchResultType = exports.FtSearchResultType = exports.isFtOpenMode = exports.FtOpenMode = exports.isFtEditorialType = exports.FtEditorialType = exports.isFtMapResource = exports.isFtMetadata = exports.isFtTopicContentTarget = exports.FtTopicContentTarget = exports.isFtUnstructuredDocument = exports.isFtTopic = exports.isFtTocNode = exports.isFtMap = exports.isFtCollectionDocument = exports.isFtCredentials = void 0;
|
|
4
4
|
const isObject = (o) => typeof o === "object" && o != null;
|
|
5
5
|
const isBoolean = (o) => typeof o === "boolean";
|
|
6
6
|
const isNumber = (o) => typeof o === "number";
|
|
@@ -99,19 +99,6 @@ const isFtTopicContentTarget = (o) => {
|
|
|
99
99
|
return ["THIRD_PARTY", "OFF_THE_GRID"].includes(o);
|
|
100
100
|
};
|
|
101
101
|
exports.isFtTopicContentTarget = isFtTopicContentTarget;
|
|
102
|
-
const isFtSearchLocale = (o) => {
|
|
103
|
-
return isObject(o)
|
|
104
|
-
&& (isNumber(o.count))
|
|
105
|
-
&& (isString(o.label))
|
|
106
|
-
&& (isString(o.lang));
|
|
107
|
-
};
|
|
108
|
-
exports.isFtSearchLocale = isFtSearchLocale;
|
|
109
|
-
const isFtSearchLocales = (o) => {
|
|
110
|
-
return isObject(o)
|
|
111
|
-
&& ((Array.isArray(o.contentLocales)
|
|
112
|
-
&& o.contentLocales.every((v) => (0, exports.isFtSearchLocale)(v))));
|
|
113
|
-
};
|
|
114
|
-
exports.isFtSearchLocales = isFtSearchLocales;
|
|
115
102
|
const isFtMetadata = (o) => {
|
|
116
103
|
return isObject(o)
|
|
117
104
|
&& ((Array.isArray(o.values)
|
|
@@ -128,14 +115,6 @@ const isFtMapResource = (o) => {
|
|
|
128
115
|
&& (isString(o.mimeType));
|
|
129
116
|
};
|
|
130
117
|
exports.isFtMapResource = isFtMapResource;
|
|
131
|
-
const isFtSearchFilter = (o) => {
|
|
132
|
-
return isObject(o)
|
|
133
|
-
&& (isBoolean(o.negative))
|
|
134
|
-
&& ((Array.isArray(o.values)
|
|
135
|
-
&& o.values.every((v) => isString(v))))
|
|
136
|
-
&& (isString(o.key));
|
|
137
|
-
};
|
|
138
|
-
exports.isFtSearchFilter = isFtSearchFilter;
|
|
139
118
|
// From: WsEditorialType
|
|
140
119
|
var FtEditorialType;
|
|
141
120
|
(function (FtEditorialType) {
|
|
@@ -156,109 +135,6 @@ const isFtOpenMode = (o) => {
|
|
|
156
135
|
return ["FLUIDTOPICS", "EXTERNAL"].includes(o);
|
|
157
136
|
};
|
|
158
137
|
exports.isFtOpenMode = isFtOpenMode;
|
|
159
|
-
const isFtPageRequest = (o) => {
|
|
160
|
-
return isObject(o)
|
|
161
|
-
&& (o.perPage == null || isNumber(o.perPage))
|
|
162
|
-
&& (isNumber(o.page));
|
|
163
|
-
};
|
|
164
|
-
exports.isFtPageRequest = isFtPageRequest;
|
|
165
|
-
const isFtSearchResults = (o) => {
|
|
166
|
-
return isObject(o)
|
|
167
|
-
&& (o.spellcheck == null || (0, exports.isFtSpellcheck)(o.spellcheck))
|
|
168
|
-
&& ((Array.isArray(o.results)
|
|
169
|
-
&& o.results.every((v) => (0, exports.isFtSearchResultCluster)(v))))
|
|
170
|
-
&& ((Array.isArray(o.facets)
|
|
171
|
-
&& o.facets.every((v) => (0, exports.isFtSearchFacet)(v))));
|
|
172
|
-
};
|
|
173
|
-
exports.isFtSearchResults = isFtSearchResults;
|
|
174
|
-
const isFtSearchRequest = (o) => {
|
|
175
|
-
return isObject(o)
|
|
176
|
-
&& (isString(o.query))
|
|
177
|
-
&& ((0, exports.isFtPageRequest)(o.paging))
|
|
178
|
-
&& ((Array.isArray(o.filters)
|
|
179
|
-
&& o.filters.every((v) => (0, exports.isFtSearchFilter)(v))))
|
|
180
|
-
&& ((Array.isArray(o.sort)
|
|
181
|
-
&& o.sort.every((v) => (0, exports.isFtSearchSortCriterion)(v))))
|
|
182
|
-
&& (o.uiLocale == null || isString(o.uiLocale))
|
|
183
|
-
&& (o.contentLocale == null || isString(o.contentLocale))
|
|
184
|
-
&& ((Array.isArray(o.facets)
|
|
185
|
-
&& o.facets.every((v) => (0, exports.isFtSearchFacetConf)(v))));
|
|
186
|
-
};
|
|
187
|
-
exports.isFtSearchRequest = isFtSearchRequest;
|
|
188
|
-
const isFtSearchResultCluster = (o) => {
|
|
189
|
-
return isObject(o)
|
|
190
|
-
&& ((Array.isArray(o.entries)
|
|
191
|
-
&& o.entries.every((v) => (0, exports.isFtSearchResultClusterEntry)(v))))
|
|
192
|
-
&& (o.metadataVariableAxis == null || isString(o.metadataVariableAxis));
|
|
193
|
-
};
|
|
194
|
-
exports.isFtSearchResultCluster = isFtSearchResultCluster;
|
|
195
|
-
const isFtSearchResultClusterEntry = (o) => {
|
|
196
|
-
return isObject(o)
|
|
197
|
-
&& (o.document == null || (0, exports.isFtSearchResultUnstructuredDocument)(o.document))
|
|
198
|
-
&& (o.topic == null || (0, exports.isFtSearchResultTopic)(o.topic))
|
|
199
|
-
&& ((0, exports.isFtSearchResultType)(o.type))
|
|
200
|
-
&& (o.map == null || (0, exports.isFtSearchResultMap)(o.map));
|
|
201
|
-
};
|
|
202
|
-
exports.isFtSearchResultClusterEntry = isFtSearchResultClusterEntry;
|
|
203
|
-
const isFtSearchResultUnstructuredDocument = (o) => {
|
|
204
|
-
return isObject(o)
|
|
205
|
-
&& ((Array.isArray(o.metadata)
|
|
206
|
-
&& o.metadata.every((v) => (0, exports.isFtMetadata)(v))))
|
|
207
|
-
&& ((0, exports.isFtOpenMode)(o.openMode))
|
|
208
|
-
&& (isString(o.documentUrl))
|
|
209
|
-
&& (isString(o.mimeType))
|
|
210
|
-
&& (isString(o.title))
|
|
211
|
-
&& (o.lastPublicationDate == null || isString(o.lastPublicationDate))
|
|
212
|
-
&& (isString(o.viewerUrl))
|
|
213
|
-
&& (isString(o.contentUrl))
|
|
214
|
-
&& (isString(o.filename))
|
|
215
|
-
&& (isString(o.htmlTitle))
|
|
216
|
-
&& (o.originUrl == null || isString(o.originUrl))
|
|
217
|
-
&& (isString(o.documentId))
|
|
218
|
-
&& (isString(o.lastEditionDate))
|
|
219
|
-
&& (isString(o.htmlExcerpt));
|
|
220
|
-
};
|
|
221
|
-
exports.isFtSearchResultUnstructuredDocument = isFtSearchResultUnstructuredDocument;
|
|
222
|
-
const isFtSearchResultMap = (o) => {
|
|
223
|
-
return isObject(o)
|
|
224
|
-
&& ((Array.isArray(o.metadata)
|
|
225
|
-
&& o.metadata.every((v) => (0, exports.isFtMetadata)(v))))
|
|
226
|
-
&& ((0, exports.isFtOpenMode)(o.openMode))
|
|
227
|
-
&& ((0, exports.isFtEditorialType)(o.editorialType))
|
|
228
|
-
&& (isString(o.title))
|
|
229
|
-
&& (o.lastPublicationDate == null || isString(o.lastPublicationDate))
|
|
230
|
-
&& (isString(o.htmlTitle))
|
|
231
|
-
&& (o.originUrl == null || isString(o.originUrl))
|
|
232
|
-
&& (isString(o.mapUrl))
|
|
233
|
-
&& (isString(o.readerUrl))
|
|
234
|
-
&& (isString(o.mapId))
|
|
235
|
-
&& (o.lastEditionDate == null || isString(o.lastEditionDate))
|
|
236
|
-
&& (isString(o.htmlExcerpt));
|
|
237
|
-
};
|
|
238
|
-
exports.isFtSearchResultMap = isFtSearchResultMap;
|
|
239
|
-
const isFtSearchResultTopic = (o) => {
|
|
240
|
-
return isObject(o)
|
|
241
|
-
&& ((Array.isArray(o.metadata)
|
|
242
|
-
&& o.metadata.every((v) => (0, exports.isFtMetadata)(v))))
|
|
243
|
-
&& ((0, exports.isFtOpenMode)(o.openMode))
|
|
244
|
-
&& (isString(o.contentId))
|
|
245
|
-
&& ((Array.isArray(o.resources)
|
|
246
|
-
&& o.resources.every((v) => (0, exports.isFtTopicResource)(v))))
|
|
247
|
-
&& (isString(o.title))
|
|
248
|
-
&& (isString(o.mapTitle))
|
|
249
|
-
&& (isString(o.topicUrl))
|
|
250
|
-
&& (isString(o.contentUrl))
|
|
251
|
-
&& (isString(o.htmlTitle))
|
|
252
|
-
&& ((Array.isArray(o.breadcrumb)
|
|
253
|
-
&& o.breadcrumb.every((v) => isString(v))))
|
|
254
|
-
&& (isString(o.tocId))
|
|
255
|
-
&& (o.originUrl == null || isString(o.originUrl))
|
|
256
|
-
&& (isString(o.readerUrl))
|
|
257
|
-
&& (isString(o.mapId))
|
|
258
|
-
&& (o.lastEditionDate == null || isString(o.lastEditionDate))
|
|
259
|
-
&& (isString(o.htmlExcerpt));
|
|
260
|
-
};
|
|
261
|
-
exports.isFtSearchResultTopic = isFtSearchResultTopic;
|
|
262
138
|
// From: WsPublicSearchResultType
|
|
263
139
|
var FtSearchResultType;
|
|
264
140
|
(function (FtSearchResultType) {
|
|
@@ -270,80 +146,6 @@ const isFtSearchResultType = (o) => {
|
|
|
270
146
|
return ["MAP", "DOCUMENT", "TOPIC"].includes(o);
|
|
271
147
|
};
|
|
272
148
|
exports.isFtSearchResultType = isFtSearchResultType;
|
|
273
|
-
const isFtSearchFacet = (o) => {
|
|
274
|
-
return isObject(o)
|
|
275
|
-
&& (isBoolean(o.hierarchical))
|
|
276
|
-
&& (isString(o.label))
|
|
277
|
-
&& (isBoolean(o.multiSelectionable))
|
|
278
|
-
&& (isString(o.key))
|
|
279
|
-
&& ((Array.isArray(o.rootNodes)
|
|
280
|
-
&& o.rootNodes.every((v) => (0, exports.isFtSearchFacetEntry)(v))));
|
|
281
|
-
};
|
|
282
|
-
exports.isFtSearchFacet = isFtSearchFacet;
|
|
283
|
-
const isFtSearchFacetConf = (o) => {
|
|
284
|
-
return isObject(o)
|
|
285
|
-
&& (o.maxDepth == null || isNumber(o.maxDepth))
|
|
286
|
-
&& (isString(o.id));
|
|
287
|
-
};
|
|
288
|
-
exports.isFtSearchFacetConf = isFtSearchFacetConf;
|
|
289
|
-
const isFtSearchFacetEntry = (o) => {
|
|
290
|
-
return isObject(o)
|
|
291
|
-
&& (isNumber(o.totalResultsCount))
|
|
292
|
-
&& (isBoolean(o.descendantSelected))
|
|
293
|
-
&& ((Array.isArray(o.childNodes)
|
|
294
|
-
&& o.childNodes.every((v) => (0, exports.isFtSearchFacetEntry)(v))))
|
|
295
|
-
&& (isString(o.label))
|
|
296
|
-
&& (isString(o.value))
|
|
297
|
-
&& (isBoolean(o.selected));
|
|
298
|
-
};
|
|
299
|
-
exports.isFtSearchFacetEntry = isFtSearchFacetEntry;
|
|
300
|
-
const isFtSearchSortCriterion = (o) => {
|
|
301
|
-
return isObject(o)
|
|
302
|
-
&& (isString(o.key));
|
|
303
|
-
};
|
|
304
|
-
exports.isFtSearchSortCriterion = isFtSearchSortCriterion;
|
|
305
|
-
const isFtSpellcheck = (o) => {
|
|
306
|
-
return isObject(o)
|
|
307
|
-
&& (isString(o.suggestedQuery))
|
|
308
|
-
&& (isString(o.htmlSuggestedQuery));
|
|
309
|
-
};
|
|
310
|
-
exports.isFtSpellcheck = isFtSpellcheck;
|
|
311
|
-
const isFtTopicResource = (o) => {
|
|
312
|
-
return isObject(o)
|
|
313
|
-
&& (isString(o.filename))
|
|
314
|
-
&& (isString(o.resourceUrl))
|
|
315
|
-
&& (isString(o.id))
|
|
316
|
-
&& (isString(o.mimeType))
|
|
317
|
-
&& (isString(o.resourceContentUrl))
|
|
318
|
-
&& (isString(o.viewerUrl));
|
|
319
|
-
};
|
|
320
|
-
exports.isFtTopicResource = isFtTopicResource;
|
|
321
|
-
const isFtSuggestRequest = (o) => {
|
|
322
|
-
return isObject(o)
|
|
323
|
-
&& (isString(o.input))
|
|
324
|
-
&& ((Array.isArray(o.filters)
|
|
325
|
-
&& o.filters.every((v) => (0, exports.isFtSearchFilter)(v))))
|
|
326
|
-
&& ((Array.isArray(o.sort)
|
|
327
|
-
&& o.sort.every((v) => (0, exports.isFtSearchSortCriterion)(v))))
|
|
328
|
-
&& (o.maxCount == null || isNumber(o.maxCount))
|
|
329
|
-
&& (o.contentLocale == null || isString(o.contentLocale));
|
|
330
|
-
};
|
|
331
|
-
exports.isFtSuggestRequest = isFtSuggestRequest;
|
|
332
|
-
const isFtSuggestResult = (o) => {
|
|
333
|
-
return isObject(o)
|
|
334
|
-
&& (o.filenameExtension == null || isString(o.filenameExtension))
|
|
335
|
-
&& (o.editorialType == null || (0, exports.isFtEditorialType)(o.editorialType))
|
|
336
|
-
&& (o.mimeType == null || isString(o.mimeType))
|
|
337
|
-
&& ((0, exports.isFtSearchResultType)(o.type))
|
|
338
|
-
&& (isString(o.value));
|
|
339
|
-
};
|
|
340
|
-
exports.isFtSuggestResult = isFtSuggestResult;
|
|
341
|
-
const isFtSuggestResults = (o) => {
|
|
342
|
-
return isObject(o)
|
|
343
|
-
&& ((Array.isArray(o.suggestions)
|
|
344
|
-
&& o.suggestions.every((v) => (0, exports.isFtSuggestResult)(v))));
|
|
345
|
-
};
|
|
346
|
-
exports.isFtSuggestResults = isFtSuggestResults;
|
|
347
149
|
const isFtAuthenticationIdentifier = (o) => {
|
|
348
150
|
return isObject(o)
|
|
349
151
|
&& (isString(o.identifier))
|
package/dist/fluidtopics.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).fluidtopics={})}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r={exports:{}},i={exports:{}};!function(e,t){var r=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==r)return r;throw new Error("unable to locate global object")}();e.exports=t=r.fetch,r.fetch&&(t.default=r.fetch.bind(r)),t.Headers=r.Headers,t.Request=r.Request,t.Response=r.Response}(i,i.exports),function(e,t){const r=i.exports,a=r.default||r,n=function(e,t){return/^\/\//.test(e)&&(e="https:"+e),a.call(this,e,t)};n.ponyfill=!0,e.exports=t=n,t.fetch=n,t.Headers=r.Headers,t.Request=r.Request,t.Response=r.Response,t.default=n}(r,r.exports);const a=r.exports,n=a.fetch.bind({});n.polyfill=!0,t.fetch||(t.fetch=n,t.Response=a.Response,t.Headers=a.Headers,t.Request=a.Request);const s=e=>"object"==typeof e&&null!=e,l=e=>"boolean"==typeof e,o=e=>"number"==typeof e,u=e=>"string"==typeof e,c=e=>s(e)&&u(e.tocId)&&Array.isArray(e.children)&&e.children.every((e=>c(e)))&&u(e.contentId)&&u(e.title);var p;e.FtTopicContentTarget=void 0,(p=e.FtTopicContentTarget||(e.FtTopicContentTarget={})).THIRD_PARTY="THIRD_PARTY",p.OFF_THE_GRID="OFF_THE_GRID";const d=e=>s(e)&&o(e.count)&&u(e.label)&&u(e.lang),h=e=>s(e)&&Array.isArray(e.values)&&e.values.every((e=>u(e)))&&u(e.label)&&u(e.key),y=e=>s(e)&&l(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>u(e)))&&u(e.key);var f;e.FtEditorialType=void 0,(f=e.FtEditorialType||(e.FtEditorialType={})).ARTICLE="ARTICLE",f.BOOK="BOOK";const m=e=>["ARTICLE","BOOK"].includes(e);var g;e.FtOpenMode=void 0,(g=e.FtOpenMode||(e.FtOpenMode={})).FLUIDTOPICS="FLUIDTOPICS",g.EXTERNAL="EXTERNAL";const A=e=>["FLUIDTOPICS","EXTERNAL"].includes(e),T=e=>s(e)&&(null==e.perPage||o(e.perPage))&&o(e.page),b=e=>s(e)&&Array.isArray(e.entries)&&e.entries.every((e=>F(e)))&&(null==e.metadataVariableAxis||u(e.metadataVariableAxis)),F=e=>s(e)&&(null==e.document||R(e.document))&&(null==e.topic||v(e.topic))&&C(e.type)&&(null==e.map||U(e.map)),R=e=>s(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>h(e)))&&A(e.openMode)&&u(e.documentUrl)&&u(e.mimeType)&&u(e.title)&&(null==e.lastPublicationDate||u(e.lastPublicationDate))&&u(e.viewerUrl)&&u(e.contentUrl)&&u(e.filename)&&u(e.htmlTitle)&&(null==e.originUrl||u(e.originUrl))&&u(e.documentId)&&u(e.lastEditionDate)&&u(e.htmlExcerpt),U=e=>s(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>h(e)))&&A(e.openMode)&&m(e.editorialType)&&u(e.title)&&(null==e.lastPublicationDate||u(e.lastPublicationDate))&&u(e.htmlTitle)&&(null==e.originUrl||u(e.originUrl))&&u(e.mapUrl)&&u(e.readerUrl)&&u(e.mapId)&&(null==e.lastEditionDate||u(e.lastEditionDate))&&u(e.htmlExcerpt),v=e=>s(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>h(e)))&&A(e.openMode)&&u(e.contentId)&&Array.isArray(e.resources)&&e.resources.every((e=>x(e)))&&u(e.title)&&u(e.mapTitle)&&u(e.topicUrl)&&u(e.contentUrl)&&u(e.htmlTitle)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>u(e)))&&u(e.tocId)&&(null==e.originUrl||u(e.originUrl))&&u(e.readerUrl)&&u(e.mapId)&&(null==e.lastEditionDate||u(e.lastEditionDate))&&u(e.htmlExcerpt);var E;e.FtSearchResultType=void 0,(E=e.FtSearchResultType||(e.FtSearchResultType={})).MAP="MAP",E.DOCUMENT="DOCUMENT",E.TOPIC="TOPIC";const C=e=>["MAP","DOCUMENT","TOPIC"].includes(e),I=e=>s(e)&&l(e.hierarchical)&&u(e.label)&&l(e.multiSelectionable)&&u(e.key)&&Array.isArray(e.rootNodes)&&e.rootNodes.every((e=>S(e))),D=e=>s(e)&&(null==e.maxDepth||o(e.maxDepth))&&u(e.id),S=e=>s(e)&&o(e.totalResultsCount)&&l(e.descendantSelected)&&Array.isArray(e.childNodes)&&e.childNodes.every((e=>S(e)))&&u(e.label)&&u(e.value)&&l(e.selected),k=e=>s(e)&&u(e.key),w=e=>s(e)&&u(e.suggestedQuery)&&u(e.htmlSuggestedQuery),x=e=>s(e)&&u(e.filename)&&u(e.resourceUrl)&&u(e.id)&&u(e.mimeType)&&u(e.resourceContentUrl)&&u(e.viewerUrl),M=e=>s(e)&&(null==e.filenameExtension||u(e.filenameExtension))&&(null==e.editorialType||m(e.editorialType))&&(null==e.mimeType||u(e.mimeType))&&C(e.type)&&u(e.value),P=e=>"object"==typeof e&&null!=e,O=e=>"string"==typeof e,$=e=>P(e)&&(null==e.emailAddress||O(e.emailAddress))&&(null==e.displayName||O(e.displayName))&&Array.isArray(e.roles)&&O(e.userId);async function L(e){if(!e.ok)throw new Error(`${e.status} - ${e.statusText}: ${await e.text()}`);return e}function H(e){return"application/json"===e.headers.get("Content-Type")?e.json():e.text()}class q{tenantBaseUrl;ftCallingApp;authorization={};get defaultHeaders(){return{...this.authorization,"Ft-Calling-App":this.ftCallingApp}}constructor(e,t){this.tenantBaseUrl=e.trim().replace(/\/$/,""),this.ftCallingApp=`ft-public-api/${t}`}setApiKey(e){this.authorization={Authorization:"Bearer "+e}}setCredentials(e,t){var r;this.authorization={Authorization:"Basic "+(r=`${e}:${t}`,"undefined"!=typeof Buffer?Buffer.from(r).toString("base64"):btoa(r))}}clearAuthentication(){this.authorization={}}login(e,t){let r={login:e,password:t,rememberMe:!0};return this.post("/api/authentication/login",r).then((r=>(this.setCredentials(e,t),r)))}logout(){return this.post("/api/authentication/logout").then((()=>this.clearAuthentication()))}getMap(e){return this.get(`/api/khub/maps/${e}`)}getTableOfContent(e){return this.get(`/api/khub/maps/${e}/toc`)}getTopic(e,t){return this.get(`/api/khub/maps/${e}/topics/${t}`)}getTopicHTMLContent(e,t,r){return this.get(`/api/khub/maps/${e}/topics/${t}/content${r?"?target="+r:""}`)}getMapAttachments(e){return this.get(`/api/khub/maps/${e}/attachments`)}getMapAttachmentContent(e,t){return this.fetchRawData(`/api/khub/maps/${e}/attachments/${t}/content`)}getMapResources(e){return this.get(`/api/khub/maps/${e}/resources`)}getMapResourceContent(e,t){return this.fetchRawData(`/api/khub/maps/${e}/resources/${t}/content`)}getUnstructuredDocument(e){return this.get(`/api/khub/documents/${e}`)}getUnstructuredDocumentContent(e){return this.fetchRawData(`/api/khub/documents/${e}/content`)}getUnstructuredDocumentTextContent(e){return this.get(`/api/khub/documents/${e}/content/text`)}getCollectionDocuments(e,t){return this.get(`/api/users/${e}/collections/${t}/documents`)}getSuggestions(e){return this.post("/api/khub/suggest",e)}search(e){return this.post("/api/khub/clustered-search",e)}getAvailableSearchLocales(){return this.get("/api/khub/locales")}get(e){return this.makeRequest("GET",e)}post(e,t){return this.makeRequest("POST",e,t)}put(e,t){return this.makeRequest("PUT",e,t)}delete(e){return this.makeRequest("DELETE",e)}async fetch(e,t){const r=t;return e.startsWith("/")||(e="/"+e),await fetch(this.tenantBaseUrl+e,{...r??{},headers:{...this.defaultHeaders,...r?.headers??{}}})}makeRequest(e,t,r){return this.fetch(t,{method:e,headers:{...null!=r?{"Content-Type":"application/json"}:{}},body:null!=r?JSON.stringify(r):void 0}).then(L).then(H)}fetchRawData(e){return fetch(this.tenantBaseUrl+e,{headers:this.defaultHeaders}).then(L).then((e=>e.arrayBuffer()))}}e.FluidTopicsApi=q,e.default=q,e.isFtAuthenticatedSession=e=>P(e)&&$(e.profile),e.isFtAuthenticationIdentifier=e=>s(e)&&u(e.identifier)&&u(e.realm),e.isFtCollectionDocument=e=>s(e)&&l(e.deleted)&&(null==e.apiUrl||u(e.apiUrl))&&(null==e.portalUrl||u(e.portalUrl))&&u(e.id)&&u(e.title)&&C(e.type),e.isFtCredentials=e=>s(e)&&u(e.password)&&(null==e.newPassword||u(e.newPassword))&&l(e.rememberMe)&&u(e.login),e.isFtEditorialType=m,e.isFtMap=e=>s(e)&&(null==e.prettyUrl||u(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>h(e)))&&A(e.openMode)&&u(e.topicsApiEndpoint)&&(null==e.description||u(e.description))&&u(e.attachmentsApiEndpoint)&&m(e.editorialType)&&u(e.baseId)&&u(e.clusterId)&&u(e.title)&&u(e.lastPublication)&&u(e.lastEdition)&&u(e.originId)&&u(e.rightsApiEndpoint)&&(null==e.originUrl||u(e.originUrl))&&u(e.readerUrl)&&(null==e.khubVersion||u(e.khubVersion))&&u(e.id)&&(null==e.lang||u(e.lang)),e.isFtMapAttachment=e=>P(e)&&O(e.file)&&(null==e.size||(e=>"number"==typeof e)(e.size))&&(e=>"boolean"==typeof e)(e.externalLink)&&O(e.name)&&O(e.id)&&(null==e.mimeType||O(e.mimeType))&&(null==e.viewerUrl||O(e.viewerUrl)),e.isFtMapResource=e=>s(e)&&u(e.contentUrl)&&u(e.filename)&&u(e.id)&&u(e.mimeType),e.isFtMetadata=h,e.isFtOpenMode=A,e.isFtPageRequest=T,e.isFtSearchFacet=I,e.isFtSearchFacetConf=D,e.isFtSearchFacetEntry=S,e.isFtSearchFilter=y,e.isFtSearchLocale=d,e.isFtSearchLocales=e=>s(e)&&Array.isArray(e.contentLocales)&&e.contentLocales.every((e=>d(e))),e.isFtSearchRequest=e=>s(e)&&u(e.query)&&T(e.paging)&&Array.isArray(e.filters)&&e.filters.every((e=>y(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>k(e)))&&(null==e.uiLocale||u(e.uiLocale))&&(null==e.contentLocale||u(e.contentLocale))&&Array.isArray(e.facets)&&e.facets.every((e=>D(e))),e.isFtSearchResultCluster=b,e.isFtSearchResultClusterEntry=F,e.isFtSearchResultMap=U,e.isFtSearchResultTopic=v,e.isFtSearchResultType=C,e.isFtSearchResultUnstructuredDocument=R,e.isFtSearchResults=e=>s(e)&&(null==e.spellcheck||w(e.spellcheck))&&Array.isArray(e.results)&&e.results.every((e=>b(e)))&&Array.isArray(e.facets)&&e.facets.every((e=>I(e))),e.isFtSearchSortCriterion=k,e.isFtSpellcheck=w,e.isFtSuggestRequest=e=>s(e)&&u(e.input)&&Array.isArray(e.filters)&&e.filters.every((e=>y(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>k(e)))&&(null==e.maxCount||o(e.maxCount))&&(null==e.contentLocale||u(e.contentLocale)),e.isFtSuggestResult=M,e.isFtSuggestResults=e=>s(e)&&Array.isArray(e.suggestions)&&e.suggestions.every((e=>M(e))),e.isFtTocNode=c,e.isFtTopic=e=>s(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>h(e)))&&u(e.id)&&u(e.contentApiEndpoint)&&u(e.title),e.isFtTopicContentTarget=e=>["THIRD_PARTY","OFF_THE_GRID"].includes(e),e.isFtTopicResource=x,e.isFtUnstructuredDocument=e=>s(e)&&(null==e.prettyUrl||u(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>h(e)))&&u(e.openMode)&&(null==e.description||u(e.description))&&u(e.mimeType)&&(null==e.baseId||u(e.baseId))&&(null==e.clusterId||u(e.clusterId))&&u(e.contentApiEndpoint)&&u(e.title)&&(null==e.lastPublication||u(e.lastPublication))&&u(e.viewerUrl)&&u(e.lastEdition)&&u(e.filename)&&(null==e.originId||u(e.originId))&&u(e.rightsApiEndpoint)&&(null==e.originUrl||u(e.originUrl))&&(null==e.khubVersion||u(e.khubVersion))&&u(e.id)&&(null==e.lang||u(e.lang)),e.isFtUserProfile=$}));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).fluidtopics={})}(this,(function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n={exports:{}},i={exports:{}};!function(t,e){var n=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==n)return n;throw new Error("unable to locate global object")}();t.exports=e=n.fetch,n.fetch&&(e.default=n.fetch.bind(n)),e.Headers=n.Headers,e.Request=n.Request,e.Response=n.Response}(i,i.exports),function(t,e){const n=i.exports,r=n.default||n,s=function(t,e){return/^\/\//.test(t)&&(t="https:"+t),r.call(this,t,e)};s.ponyfill=!0,t.exports=e=s,e.fetch=s,e.Headers=n.Headers,e.Request=n.Request,e.Response=n.Response,e.default=s}(n,n.exports);const r=n.exports,s=r.fetch.bind({});s.polyfill=!0,e.fetch||(e.fetch=s,e.Response=r.Response,e.Headers=r.Headers,e.Request=r.Request);const a=t=>"object"==typeof t&&null!=t,o=t=>"boolean"==typeof t,l=t=>"string"==typeof t,u=t=>a(t)&&l(t.tocId)&&Array.isArray(t.children)&&t.children.every((t=>u(t)))&&l(t.contentId)&&l(t.title);var p;t.FtTopicContentTarget=void 0,(p=t.FtTopicContentTarget||(t.FtTopicContentTarget={})).THIRD_PARTY="THIRD_PARTY",p.OFF_THE_GRID="OFF_THE_GRID";const d=t=>a(t)&&Array.isArray(t.values)&&t.values.every((t=>l(t)))&&l(t.label)&&l(t.key);var c;t.FtEditorialType=void 0,(c=t.FtEditorialType||(t.FtEditorialType={})).ARTICLE="ARTICLE",c.BOOK="BOOK";const h=t=>["ARTICLE","BOOK"].includes(t);var f;t.FtOpenMode=void 0,(f=t.FtOpenMode||(t.FtOpenMode={})).FLUIDTOPICS="FLUIDTOPICS",f.EXTERNAL="EXTERNAL";const y=t=>["FLUIDTOPICS","EXTERNAL"].includes(t);var T;t.FtSearchResultType=void 0,(T=t.FtSearchResultType||(t.FtSearchResultType={})).MAP="MAP",T.DOCUMENT="DOCUMENT",T.TOPIC="TOPIC";const g=t=>["MAP","DOCUMENT","TOPIC"].includes(t),m=t=>"object"==typeof t&&null!=t,b=t=>"string"==typeof t,A=t=>m(t)&&(null==t.emailAddress||b(t.emailAddress))&&(null==t.displayName||b(t.displayName))&&Array.isArray(t.roles)&&b(t.userId);class R extends Error{status;statusText;body;constructor(t,e,n){super(`${t} - ${e}: ${n}`),this.status=t,this.statusText=e,this.body=n}}async function F(t){if(!t.ok)throw new R(t.status,t.statusText,await t.text());return t}function E(t){return"application/json"===t.headers.get("Content-Type")?t.json():t.text()}class C{tenantBaseUrl;ftCallingApp;authorization={};get defaultHeaders(){return{...this.authorization,"Ft-Calling-App":this.ftCallingApp}}constructor(t,e){this.tenantBaseUrl=t.trim().replace(/\/$/,""),this.ftCallingApp=`ft-public-api/${e}`}setApiKey(t){this.authorization={Authorization:"Bearer "+t}}setCredentials(t,e){var n;this.authorization={Authorization:"Basic "+(n=`${t}:${e}`,"undefined"!=typeof Buffer?Buffer.from(n).toString("base64"):btoa(n))}}clearAuthentication(){this.authorization={}}login(t,e){let n={login:t,password:e,rememberMe:!0};return this.post("/api/authentication/login",n).then((n=>(this.setCredentials(t,e),n)))}logout(){return this.post("/api/authentication/logout").then((()=>this.clearAuthentication()))}getMap(t){return this.get(`/api/khub/maps/${t}`)}getTableOfContent(t){return this.get(`/api/khub/maps/${t}/toc`)}getTopic(t,e){return this.get(`/api/khub/maps/${t}/topics/${e}`)}getTopicHTMLContent(t,e,n){return this.get(`/api/khub/maps/${t}/topics/${e}/content${n?"?target="+n:""}`)}getMapAttachments(t){return this.get(`/api/khub/maps/${t}/attachments`)}getMapAttachmentContent(t,e){return this.fetchRawData(`/api/khub/maps/${t}/attachments/${e}/content`)}getMapResources(t){return this.get(`/api/khub/maps/${t}/resources`)}getMapResourceContent(t,e){return this.fetchRawData(`/api/khub/maps/${t}/resources/${e}/content`)}getUnstructuredDocument(t){return this.get(`/api/khub/documents/${t}`)}getUnstructuredDocumentContent(t){return this.fetchRawData(`/api/khub/documents/${t}/content`)}getUnstructuredDocumentTextContent(t){return this.get(`/api/khub/documents/${t}/content/text`)}getCollectionDocuments(t,e){return this.get(`/api/users/${t}/collections/${e}/documents`)}get(t){return this.makeRequest("GET",t)}post(t,e){return this.makeRequest("POST",t,e)}put(t,e){return this.makeRequest("PUT",t,e)}delete(t){return this.makeRequest("DELETE",t)}async fetch(t,e){const n=e;return t.startsWith("/")||(t="/"+t),await fetch(this.tenantBaseUrl+t,{...n??{},headers:{...this.defaultHeaders,...n?.headers??{}}})}makeRequest(t,e,n){return this.fetch(e,{method:t,headers:{...null!=n?{"Content-Type":"application/json"}:{}},body:null!=n?JSON.stringify(n):void 0}).then(F).then(E)}fetchRawData(t){return fetch(this.tenantBaseUrl+t,{headers:this.defaultHeaders}).then(F).then((t=>t.arrayBuffer()))}}t.FluidTopicsApi=C,t.HttpError=R,t.default=C,t.isFtAuthenticatedSession=t=>m(t)&&A(t.profile),t.isFtAuthenticationIdentifier=t=>a(t)&&l(t.identifier)&&l(t.realm),t.isFtCollectionDocument=t=>a(t)&&o(t.deleted)&&(null==t.apiUrl||l(t.apiUrl))&&(null==t.portalUrl||l(t.portalUrl))&&l(t.id)&&l(t.title)&&g(t.type),t.isFtCredentials=t=>a(t)&&l(t.password)&&(null==t.newPassword||l(t.newPassword))&&o(t.rememberMe)&&l(t.login),t.isFtEditorialType=h,t.isFtMap=t=>a(t)&&(null==t.prettyUrl||l(t.prettyUrl))&&Array.isArray(t.metadata)&&t.metadata.every((t=>d(t)))&&y(t.openMode)&&l(t.topicsApiEndpoint)&&(null==t.description||l(t.description))&&l(t.attachmentsApiEndpoint)&&h(t.editorialType)&&l(t.baseId)&&l(t.clusterId)&&l(t.title)&&l(t.lastPublication)&&l(t.lastEdition)&&l(t.originId)&&l(t.rightsApiEndpoint)&&(null==t.originUrl||l(t.originUrl))&&l(t.readerUrl)&&(null==t.khubVersion||l(t.khubVersion))&&l(t.id)&&(null==t.lang||l(t.lang)),t.isFtMapAttachment=t=>m(t)&&b(t.file)&&(null==t.size||(t=>"number"==typeof t)(t.size))&&(t=>"boolean"==typeof t)(t.externalLink)&&b(t.name)&&b(t.id)&&(null==t.mimeType||b(t.mimeType))&&(null==t.viewerUrl||b(t.viewerUrl)),t.isFtMapResource=t=>a(t)&&l(t.contentUrl)&&l(t.filename)&&l(t.id)&&l(t.mimeType),t.isFtMetadata=d,t.isFtOpenMode=y,t.isFtSearchResultType=g,t.isFtTocNode=u,t.isFtTopic=t=>a(t)&&Array.isArray(t.metadata)&&t.metadata.every((t=>d(t)))&&l(t.id)&&l(t.contentApiEndpoint)&&l(t.title),t.isFtTopicContentTarget=t=>["THIRD_PARTY","OFF_THE_GRID"].includes(t),t.isFtUnstructuredDocument=t=>a(t)&&(null==t.prettyUrl||l(t.prettyUrl))&&Array.isArray(t.metadata)&&t.metadata.every((t=>d(t)))&&l(t.openMode)&&(null==t.description||l(t.description))&&l(t.mimeType)&&(null==t.baseId||l(t.baseId))&&(null==t.clusterId||l(t.clusterId))&&l(t.contentApiEndpoint)&&l(t.title)&&(null==t.lastPublication||l(t.lastPublication))&&l(t.viewerUrl)&&l(t.lastEdition)&&l(t.filename)&&(null==t.originId||l(t.originId))&&l(t.rightsApiEndpoint)&&(null==t.originUrl||l(t.originUrl))&&(null==t.khubVersion||l(t.khubVersion))&&l(t.id)&&(null==t.lang||l(t.lang)),t.isFtUserProfile=A}));
|
package/dist/mjs/index.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import "cross-fetch/polyfill";
|
|
2
|
-
import { FtCollectionDocument, FtMap, FtMapResource,
|
|
2
|
+
import { FtCollectionDocument, FtMap, FtMapResource, FtTocNode, FtTopic, FtTopicContentTarget, FtUnstructuredDocument } from "./types/ft-common/public";
|
|
3
3
|
import { FtAuthenticatedSession, FtMapAttachment } from "./types/ft-server/public";
|
|
4
4
|
export * from "./types/ft-common/public";
|
|
5
5
|
export * from "./types/ft-server/public";
|
|
6
|
+
export declare class HttpError extends Error {
|
|
7
|
+
readonly status: number;
|
|
8
|
+
readonly statusText: string;
|
|
9
|
+
readonly body: string;
|
|
10
|
+
constructor(status: number, statusText: string, body: string);
|
|
11
|
+
}
|
|
6
12
|
export declare class FluidTopicsApi {
|
|
7
13
|
private readonly tenantBaseUrl;
|
|
8
14
|
private readonly ftCallingApp;
|
|
@@ -26,9 +32,6 @@ export declare class FluidTopicsApi {
|
|
|
26
32
|
getUnstructuredDocumentContent(documentId: string): Promise<ArrayBuffer>;
|
|
27
33
|
getUnstructuredDocumentTextContent(documentId: string): Promise<string>;
|
|
28
34
|
getCollectionDocuments(userId: string, collectionId: string): Promise<Array<FtCollectionDocument>>;
|
|
29
|
-
getSuggestions(request: FtSuggestRequest): Promise<FtSuggestResults>;
|
|
30
|
-
search(request: FtSearchRequest): Promise<FtSearchResults>;
|
|
31
|
-
getAvailableSearchLocales(): Promise<FtSearchLocales>;
|
|
32
35
|
get<T>(endpoint: string): Promise<T>;
|
|
33
36
|
post<T>(endpoint: string, data?: any): Promise<T>;
|
|
34
37
|
put<T>(endpoint: string, data?: any): Promise<T>;
|
package/dist/mjs/index.js
CHANGED
|
@@ -4,9 +4,20 @@ export * from "./types/ft-server/public";
|
|
|
4
4
|
function toBase64(s) {
|
|
5
5
|
return typeof Buffer !== "undefined" ? Buffer.from(s).toString("base64") : btoa(s);
|
|
6
6
|
}
|
|
7
|
+
export class HttpError extends Error {
|
|
8
|
+
status;
|
|
9
|
+
statusText;
|
|
10
|
+
body;
|
|
11
|
+
constructor(status, statusText, body) {
|
|
12
|
+
super(`${status} - ${statusText}: ${body}`);
|
|
13
|
+
this.status = status;
|
|
14
|
+
this.statusText = statusText;
|
|
15
|
+
this.body = body;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
7
18
|
async function handleError(response) {
|
|
8
19
|
if (!response.ok) {
|
|
9
|
-
throw new
|
|
20
|
+
throw new HttpError(response.status, response.statusText, await response.text());
|
|
10
21
|
}
|
|
11
22
|
return response;
|
|
12
23
|
}
|
|
@@ -88,15 +99,6 @@ export class FluidTopicsApi {
|
|
|
88
99
|
getCollectionDocuments(userId, collectionId) {
|
|
89
100
|
return this.get(`/api/users/${userId}/collections/${collectionId}/documents`);
|
|
90
101
|
}
|
|
91
|
-
getSuggestions(request) {
|
|
92
|
-
return this.post("/api/khub/suggest", request);
|
|
93
|
-
}
|
|
94
|
-
search(request) {
|
|
95
|
-
return this.post("/api/khub/clustered-search", request);
|
|
96
|
-
}
|
|
97
|
-
getAvailableSearchLocales() {
|
|
98
|
-
return this.get("/api/khub/locales");
|
|
99
|
-
}
|
|
100
102
|
get(endpoint) {
|
|
101
103
|
return this.makeRequest("GET", endpoint);
|
|
102
104
|
}
|
|
@@ -77,16 +77,6 @@ export declare enum FtTopicContentTarget {
|
|
|
77
77
|
OFF_THE_GRID = "OFF_THE_GRID"
|
|
78
78
|
}
|
|
79
79
|
export declare const isFtTopicContentTarget: (o: any) => o is FtTopicContentTarget;
|
|
80
|
-
export interface FtSearchLocale {
|
|
81
|
-
count: number;
|
|
82
|
-
label: string;
|
|
83
|
-
lang: string;
|
|
84
|
-
}
|
|
85
|
-
export declare const isFtSearchLocale: (o: any) => o is FtSearchLocale;
|
|
86
|
-
export interface FtSearchLocales {
|
|
87
|
-
contentLocales: Array<FtSearchLocale>;
|
|
88
|
-
}
|
|
89
|
-
export declare const isFtSearchLocales: (o: any) => o is FtSearchLocales;
|
|
90
80
|
export interface FtMetadata {
|
|
91
81
|
values: Array<string>;
|
|
92
82
|
label: string;
|
|
@@ -100,12 +90,6 @@ export interface FtMapResource {
|
|
|
100
90
|
mimeType: string;
|
|
101
91
|
}
|
|
102
92
|
export declare const isFtMapResource: (o: any) => o is FtMapResource;
|
|
103
|
-
export interface FtSearchFilter {
|
|
104
|
-
negative: boolean;
|
|
105
|
-
values: Array<string>;
|
|
106
|
-
key: string;
|
|
107
|
-
}
|
|
108
|
-
export declare const isFtSearchFilter: (o: any) => o is FtSearchFilter;
|
|
109
93
|
export declare enum FtEditorialType {
|
|
110
94
|
ARTICLE = "ARTICLE",
|
|
111
95
|
BOOK = "BOOK"
|
|
@@ -116,162 +100,12 @@ export declare enum FtOpenMode {
|
|
|
116
100
|
EXTERNAL = "EXTERNAL"
|
|
117
101
|
}
|
|
118
102
|
export declare const isFtOpenMode: (o: any) => o is FtOpenMode;
|
|
119
|
-
export interface FtPageRequest {
|
|
120
|
-
perPage?: number;
|
|
121
|
-
page: number;
|
|
122
|
-
}
|
|
123
|
-
export declare const isFtPageRequest: (o: any) => o is FtPageRequest;
|
|
124
|
-
export interface FtSearchResults {
|
|
125
|
-
spellcheck?: FtSpellcheck;
|
|
126
|
-
paging: any;
|
|
127
|
-
results: Array<FtSearchResultCluster>;
|
|
128
|
-
facets: Array<FtSearchFacet>;
|
|
129
|
-
}
|
|
130
|
-
export declare const isFtSearchResults: (o: any) => o is FtSearchResults;
|
|
131
|
-
export interface FtSearchRequest {
|
|
132
|
-
query: string;
|
|
133
|
-
paging: FtPageRequest;
|
|
134
|
-
filters: Array<FtSearchFilter>;
|
|
135
|
-
sort: Array<FtSearchSortCriterion>;
|
|
136
|
-
uiLocale?: string;
|
|
137
|
-
contentLocale?: string;
|
|
138
|
-
facets: Array<FtSearchFacetConf>;
|
|
139
|
-
}
|
|
140
|
-
export declare const isFtSearchRequest: (o: any) => o is FtSearchRequest;
|
|
141
|
-
export interface FtSearchResultCluster {
|
|
142
|
-
entries: Array<FtSearchResultClusterEntry>;
|
|
143
|
-
metadataVariableAxis?: string;
|
|
144
|
-
}
|
|
145
|
-
export declare const isFtSearchResultCluster: (o: any) => o is FtSearchResultCluster;
|
|
146
|
-
export interface FtSearchResultClusterEntry {
|
|
147
|
-
document?: FtSearchResultUnstructuredDocument;
|
|
148
|
-
topic?: FtSearchResultTopic;
|
|
149
|
-
type: FtSearchResultType;
|
|
150
|
-
map?: FtSearchResultMap;
|
|
151
|
-
}
|
|
152
|
-
export declare const isFtSearchResultClusterEntry: (o: any) => o is FtSearchResultClusterEntry;
|
|
153
|
-
export interface FtSearchResultUnstructuredDocument {
|
|
154
|
-
metadata: Array<FtMetadata>;
|
|
155
|
-
openMode: FtOpenMode;
|
|
156
|
-
documentUrl: string;
|
|
157
|
-
mimeType: string;
|
|
158
|
-
source: any;
|
|
159
|
-
title: string;
|
|
160
|
-
lastPublicationDate?: string;
|
|
161
|
-
viewerUrl: string;
|
|
162
|
-
contentUrl: string;
|
|
163
|
-
filename: string;
|
|
164
|
-
htmlTitle: string;
|
|
165
|
-
originUrl?: string;
|
|
166
|
-
documentId: string;
|
|
167
|
-
lastEditionDate: string;
|
|
168
|
-
htmlExcerpt: string;
|
|
169
|
-
}
|
|
170
|
-
export declare const isFtSearchResultUnstructuredDocument: (o: any) => o is FtSearchResultUnstructuredDocument;
|
|
171
|
-
export interface FtSearchResultMap {
|
|
172
|
-
metadata: Array<FtMetadata>;
|
|
173
|
-
openMode: FtOpenMode;
|
|
174
|
-
editorialType: FtEditorialType;
|
|
175
|
-
source?: any;
|
|
176
|
-
title: string;
|
|
177
|
-
lastPublicationDate?: string;
|
|
178
|
-
htmlTitle: string;
|
|
179
|
-
originUrl?: string;
|
|
180
|
-
mapUrl: string;
|
|
181
|
-
readerUrl: string;
|
|
182
|
-
mapId: string;
|
|
183
|
-
lastEditionDate?: string;
|
|
184
|
-
htmlExcerpt: string;
|
|
185
|
-
}
|
|
186
|
-
export declare const isFtSearchResultMap: (o: any) => o is FtSearchResultMap;
|
|
187
|
-
export interface FtSearchResultTopic {
|
|
188
|
-
metadata: Array<FtMetadata>;
|
|
189
|
-
openMode: FtOpenMode;
|
|
190
|
-
contentId: string;
|
|
191
|
-
resources: Array<FtTopicResource>;
|
|
192
|
-
source?: any;
|
|
193
|
-
title: string;
|
|
194
|
-
mapTitle: string;
|
|
195
|
-
topicUrl: string;
|
|
196
|
-
contentUrl: string;
|
|
197
|
-
htmlTitle: string;
|
|
198
|
-
breadcrumb: Array<string>;
|
|
199
|
-
tocId: string;
|
|
200
|
-
originUrl?: string;
|
|
201
|
-
readerUrl: string;
|
|
202
|
-
mapId: string;
|
|
203
|
-
lastEditionDate?: string;
|
|
204
|
-
htmlExcerpt: string;
|
|
205
|
-
}
|
|
206
|
-
export declare const isFtSearchResultTopic: (o: any) => o is FtSearchResultTopic;
|
|
207
103
|
export declare enum FtSearchResultType {
|
|
208
104
|
MAP = "MAP",
|
|
209
105
|
DOCUMENT = "DOCUMENT",
|
|
210
106
|
TOPIC = "TOPIC"
|
|
211
107
|
}
|
|
212
108
|
export declare const isFtSearchResultType: (o: any) => o is FtSearchResultType;
|
|
213
|
-
export interface FtSearchFacet {
|
|
214
|
-
hierarchical: boolean;
|
|
215
|
-
label: string;
|
|
216
|
-
multiSelectionable: boolean;
|
|
217
|
-
key: string;
|
|
218
|
-
rootNodes: Array<FtSearchFacetEntry>;
|
|
219
|
-
}
|
|
220
|
-
export declare const isFtSearchFacet: (o: any) => o is FtSearchFacet;
|
|
221
|
-
export interface FtSearchFacetConf {
|
|
222
|
-
maxDepth?: number;
|
|
223
|
-
id: string;
|
|
224
|
-
}
|
|
225
|
-
export declare const isFtSearchFacetConf: (o: any) => o is FtSearchFacetConf;
|
|
226
|
-
export interface FtSearchFacetEntry {
|
|
227
|
-
totalResultsCount: number;
|
|
228
|
-
descendantSelected: boolean;
|
|
229
|
-
childNodes: Array<FtSearchFacetEntry>;
|
|
230
|
-
label: string;
|
|
231
|
-
value: string;
|
|
232
|
-
selected: boolean;
|
|
233
|
-
}
|
|
234
|
-
export declare const isFtSearchFacetEntry: (o: any) => o is FtSearchFacetEntry;
|
|
235
|
-
export interface FtSearchSortCriterion {
|
|
236
|
-
type: any;
|
|
237
|
-
key: string;
|
|
238
|
-
order: any;
|
|
239
|
-
}
|
|
240
|
-
export declare const isFtSearchSortCriterion: (o: any) => o is FtSearchSortCriterion;
|
|
241
|
-
export interface FtSpellcheck {
|
|
242
|
-
suggestedQuery: string;
|
|
243
|
-
htmlSuggestedQuery: string;
|
|
244
|
-
}
|
|
245
|
-
export declare const isFtSpellcheck: (o: any) => o is FtSpellcheck;
|
|
246
|
-
export interface FtTopicResource {
|
|
247
|
-
filename: string;
|
|
248
|
-
resourceUrl: string;
|
|
249
|
-
id: string;
|
|
250
|
-
mimeType: string;
|
|
251
|
-
resourceContentUrl: string;
|
|
252
|
-
viewerUrl: string;
|
|
253
|
-
}
|
|
254
|
-
export declare const isFtTopicResource: (o: any) => o is FtTopicResource;
|
|
255
|
-
export interface FtSuggestRequest {
|
|
256
|
-
input: string;
|
|
257
|
-
filters: Array<FtSearchFilter>;
|
|
258
|
-
sort: Array<FtSearchSortCriterion>;
|
|
259
|
-
maxCount?: number;
|
|
260
|
-
contentLocale?: string;
|
|
261
|
-
}
|
|
262
|
-
export declare const isFtSuggestRequest: (o: any) => o is FtSuggestRequest;
|
|
263
|
-
export interface FtSuggestResult {
|
|
264
|
-
filenameExtension?: string;
|
|
265
|
-
editorialType?: FtEditorialType;
|
|
266
|
-
mimeType?: string;
|
|
267
|
-
type: FtSearchResultType;
|
|
268
|
-
value: string;
|
|
269
|
-
}
|
|
270
|
-
export declare const isFtSuggestResult: (o: any) => o is FtSuggestResult;
|
|
271
|
-
export interface FtSuggestResults {
|
|
272
|
-
suggestions: Array<FtSuggestResult>;
|
|
273
|
-
}
|
|
274
|
-
export declare const isFtSuggestResults: (o: any) => o is FtSuggestResults;
|
|
275
109
|
export interface FtAuthenticationIdentifier {
|
|
276
110
|
identifier: string;
|
|
277
111
|
realm: string;
|
|
@@ -89,17 +89,6 @@ export var FtTopicContentTarget;
|
|
|
89
89
|
export const isFtTopicContentTarget = (o) => {
|
|
90
90
|
return ["THIRD_PARTY", "OFF_THE_GRID"].includes(o);
|
|
91
91
|
};
|
|
92
|
-
export const isFtSearchLocale = (o) => {
|
|
93
|
-
return isObject(o)
|
|
94
|
-
&& (isNumber(o.count))
|
|
95
|
-
&& (isString(o.label))
|
|
96
|
-
&& (isString(o.lang));
|
|
97
|
-
};
|
|
98
|
-
export const isFtSearchLocales = (o) => {
|
|
99
|
-
return isObject(o)
|
|
100
|
-
&& ((Array.isArray(o.contentLocales)
|
|
101
|
-
&& o.contentLocales.every((v) => isFtSearchLocale(v))));
|
|
102
|
-
};
|
|
103
92
|
export const isFtMetadata = (o) => {
|
|
104
93
|
return isObject(o)
|
|
105
94
|
&& ((Array.isArray(o.values)
|
|
@@ -114,13 +103,6 @@ export const isFtMapResource = (o) => {
|
|
|
114
103
|
&& (isString(o.id))
|
|
115
104
|
&& (isString(o.mimeType));
|
|
116
105
|
};
|
|
117
|
-
export const isFtSearchFilter = (o) => {
|
|
118
|
-
return isObject(o)
|
|
119
|
-
&& (isBoolean(o.negative))
|
|
120
|
-
&& ((Array.isArray(o.values)
|
|
121
|
-
&& o.values.every((v) => isString(v))))
|
|
122
|
-
&& (isString(o.key));
|
|
123
|
-
};
|
|
124
106
|
// From: WsEditorialType
|
|
125
107
|
export var FtEditorialType;
|
|
126
108
|
(function (FtEditorialType) {
|
|
@@ -139,101 +121,6 @@ export var FtOpenMode;
|
|
|
139
121
|
export const isFtOpenMode = (o) => {
|
|
140
122
|
return ["FLUIDTOPICS", "EXTERNAL"].includes(o);
|
|
141
123
|
};
|
|
142
|
-
export const isFtPageRequest = (o) => {
|
|
143
|
-
return isObject(o)
|
|
144
|
-
&& (o.perPage == null || isNumber(o.perPage))
|
|
145
|
-
&& (isNumber(o.page));
|
|
146
|
-
};
|
|
147
|
-
export const isFtSearchResults = (o) => {
|
|
148
|
-
return isObject(o)
|
|
149
|
-
&& (o.spellcheck == null || isFtSpellcheck(o.spellcheck))
|
|
150
|
-
&& ((Array.isArray(o.results)
|
|
151
|
-
&& o.results.every((v) => isFtSearchResultCluster(v))))
|
|
152
|
-
&& ((Array.isArray(o.facets)
|
|
153
|
-
&& o.facets.every((v) => isFtSearchFacet(v))));
|
|
154
|
-
};
|
|
155
|
-
export const isFtSearchRequest = (o) => {
|
|
156
|
-
return isObject(o)
|
|
157
|
-
&& (isString(o.query))
|
|
158
|
-
&& (isFtPageRequest(o.paging))
|
|
159
|
-
&& ((Array.isArray(o.filters)
|
|
160
|
-
&& o.filters.every((v) => isFtSearchFilter(v))))
|
|
161
|
-
&& ((Array.isArray(o.sort)
|
|
162
|
-
&& o.sort.every((v) => isFtSearchSortCriterion(v))))
|
|
163
|
-
&& (o.uiLocale == null || isString(o.uiLocale))
|
|
164
|
-
&& (o.contentLocale == null || isString(o.contentLocale))
|
|
165
|
-
&& ((Array.isArray(o.facets)
|
|
166
|
-
&& o.facets.every((v) => isFtSearchFacetConf(v))));
|
|
167
|
-
};
|
|
168
|
-
export const isFtSearchResultCluster = (o) => {
|
|
169
|
-
return isObject(o)
|
|
170
|
-
&& ((Array.isArray(o.entries)
|
|
171
|
-
&& o.entries.every((v) => isFtSearchResultClusterEntry(v))))
|
|
172
|
-
&& (o.metadataVariableAxis == null || isString(o.metadataVariableAxis));
|
|
173
|
-
};
|
|
174
|
-
export const isFtSearchResultClusterEntry = (o) => {
|
|
175
|
-
return isObject(o)
|
|
176
|
-
&& (o.document == null || isFtSearchResultUnstructuredDocument(o.document))
|
|
177
|
-
&& (o.topic == null || isFtSearchResultTopic(o.topic))
|
|
178
|
-
&& (isFtSearchResultType(o.type))
|
|
179
|
-
&& (o.map == null || isFtSearchResultMap(o.map));
|
|
180
|
-
};
|
|
181
|
-
export const isFtSearchResultUnstructuredDocument = (o) => {
|
|
182
|
-
return isObject(o)
|
|
183
|
-
&& ((Array.isArray(o.metadata)
|
|
184
|
-
&& o.metadata.every((v) => isFtMetadata(v))))
|
|
185
|
-
&& (isFtOpenMode(o.openMode))
|
|
186
|
-
&& (isString(o.documentUrl))
|
|
187
|
-
&& (isString(o.mimeType))
|
|
188
|
-
&& (isString(o.title))
|
|
189
|
-
&& (o.lastPublicationDate == null || isString(o.lastPublicationDate))
|
|
190
|
-
&& (isString(o.viewerUrl))
|
|
191
|
-
&& (isString(o.contentUrl))
|
|
192
|
-
&& (isString(o.filename))
|
|
193
|
-
&& (isString(o.htmlTitle))
|
|
194
|
-
&& (o.originUrl == null || isString(o.originUrl))
|
|
195
|
-
&& (isString(o.documentId))
|
|
196
|
-
&& (isString(o.lastEditionDate))
|
|
197
|
-
&& (isString(o.htmlExcerpt));
|
|
198
|
-
};
|
|
199
|
-
export const isFtSearchResultMap = (o) => {
|
|
200
|
-
return isObject(o)
|
|
201
|
-
&& ((Array.isArray(o.metadata)
|
|
202
|
-
&& o.metadata.every((v) => isFtMetadata(v))))
|
|
203
|
-
&& (isFtOpenMode(o.openMode))
|
|
204
|
-
&& (isFtEditorialType(o.editorialType))
|
|
205
|
-
&& (isString(o.title))
|
|
206
|
-
&& (o.lastPublicationDate == null || isString(o.lastPublicationDate))
|
|
207
|
-
&& (isString(o.htmlTitle))
|
|
208
|
-
&& (o.originUrl == null || isString(o.originUrl))
|
|
209
|
-
&& (isString(o.mapUrl))
|
|
210
|
-
&& (isString(o.readerUrl))
|
|
211
|
-
&& (isString(o.mapId))
|
|
212
|
-
&& (o.lastEditionDate == null || isString(o.lastEditionDate))
|
|
213
|
-
&& (isString(o.htmlExcerpt));
|
|
214
|
-
};
|
|
215
|
-
export const isFtSearchResultTopic = (o) => {
|
|
216
|
-
return isObject(o)
|
|
217
|
-
&& ((Array.isArray(o.metadata)
|
|
218
|
-
&& o.metadata.every((v) => isFtMetadata(v))))
|
|
219
|
-
&& (isFtOpenMode(o.openMode))
|
|
220
|
-
&& (isString(o.contentId))
|
|
221
|
-
&& ((Array.isArray(o.resources)
|
|
222
|
-
&& o.resources.every((v) => isFtTopicResource(v))))
|
|
223
|
-
&& (isString(o.title))
|
|
224
|
-
&& (isString(o.mapTitle))
|
|
225
|
-
&& (isString(o.topicUrl))
|
|
226
|
-
&& (isString(o.contentUrl))
|
|
227
|
-
&& (isString(o.htmlTitle))
|
|
228
|
-
&& ((Array.isArray(o.breadcrumb)
|
|
229
|
-
&& o.breadcrumb.every((v) => isString(v))))
|
|
230
|
-
&& (isString(o.tocId))
|
|
231
|
-
&& (o.originUrl == null || isString(o.originUrl))
|
|
232
|
-
&& (isString(o.readerUrl))
|
|
233
|
-
&& (isString(o.mapId))
|
|
234
|
-
&& (o.lastEditionDate == null || isString(o.lastEditionDate))
|
|
235
|
-
&& (isString(o.htmlExcerpt));
|
|
236
|
-
};
|
|
237
124
|
// From: WsPublicSearchResultType
|
|
238
125
|
export var FtSearchResultType;
|
|
239
126
|
(function (FtSearchResultType) {
|
|
@@ -244,71 +131,6 @@ export var FtSearchResultType;
|
|
|
244
131
|
export const isFtSearchResultType = (o) => {
|
|
245
132
|
return ["MAP", "DOCUMENT", "TOPIC"].includes(o);
|
|
246
133
|
};
|
|
247
|
-
export const isFtSearchFacet = (o) => {
|
|
248
|
-
return isObject(o)
|
|
249
|
-
&& (isBoolean(o.hierarchical))
|
|
250
|
-
&& (isString(o.label))
|
|
251
|
-
&& (isBoolean(o.multiSelectionable))
|
|
252
|
-
&& (isString(o.key))
|
|
253
|
-
&& ((Array.isArray(o.rootNodes)
|
|
254
|
-
&& o.rootNodes.every((v) => isFtSearchFacetEntry(v))));
|
|
255
|
-
};
|
|
256
|
-
export const isFtSearchFacetConf = (o) => {
|
|
257
|
-
return isObject(o)
|
|
258
|
-
&& (o.maxDepth == null || isNumber(o.maxDepth))
|
|
259
|
-
&& (isString(o.id));
|
|
260
|
-
};
|
|
261
|
-
export const isFtSearchFacetEntry = (o) => {
|
|
262
|
-
return isObject(o)
|
|
263
|
-
&& (isNumber(o.totalResultsCount))
|
|
264
|
-
&& (isBoolean(o.descendantSelected))
|
|
265
|
-
&& ((Array.isArray(o.childNodes)
|
|
266
|
-
&& o.childNodes.every((v) => isFtSearchFacetEntry(v))))
|
|
267
|
-
&& (isString(o.label))
|
|
268
|
-
&& (isString(o.value))
|
|
269
|
-
&& (isBoolean(o.selected));
|
|
270
|
-
};
|
|
271
|
-
export const isFtSearchSortCriterion = (o) => {
|
|
272
|
-
return isObject(o)
|
|
273
|
-
&& (isString(o.key));
|
|
274
|
-
};
|
|
275
|
-
export const isFtSpellcheck = (o) => {
|
|
276
|
-
return isObject(o)
|
|
277
|
-
&& (isString(o.suggestedQuery))
|
|
278
|
-
&& (isString(o.htmlSuggestedQuery));
|
|
279
|
-
};
|
|
280
|
-
export const isFtTopicResource = (o) => {
|
|
281
|
-
return isObject(o)
|
|
282
|
-
&& (isString(o.filename))
|
|
283
|
-
&& (isString(o.resourceUrl))
|
|
284
|
-
&& (isString(o.id))
|
|
285
|
-
&& (isString(o.mimeType))
|
|
286
|
-
&& (isString(o.resourceContentUrl))
|
|
287
|
-
&& (isString(o.viewerUrl));
|
|
288
|
-
};
|
|
289
|
-
export const isFtSuggestRequest = (o) => {
|
|
290
|
-
return isObject(o)
|
|
291
|
-
&& (isString(o.input))
|
|
292
|
-
&& ((Array.isArray(o.filters)
|
|
293
|
-
&& o.filters.every((v) => isFtSearchFilter(v))))
|
|
294
|
-
&& ((Array.isArray(o.sort)
|
|
295
|
-
&& o.sort.every((v) => isFtSearchSortCriterion(v))))
|
|
296
|
-
&& (o.maxCount == null || isNumber(o.maxCount))
|
|
297
|
-
&& (o.contentLocale == null || isString(o.contentLocale));
|
|
298
|
-
};
|
|
299
|
-
export const isFtSuggestResult = (o) => {
|
|
300
|
-
return isObject(o)
|
|
301
|
-
&& (o.filenameExtension == null || isString(o.filenameExtension))
|
|
302
|
-
&& (o.editorialType == null || isFtEditorialType(o.editorialType))
|
|
303
|
-
&& (o.mimeType == null || isString(o.mimeType))
|
|
304
|
-
&& (isFtSearchResultType(o.type))
|
|
305
|
-
&& (isString(o.value));
|
|
306
|
-
};
|
|
307
|
-
export const isFtSuggestResults = (o) => {
|
|
308
|
-
return isObject(o)
|
|
309
|
-
&& ((Array.isArray(o.suggestions)
|
|
310
|
-
&& o.suggestions.every((v) => isFtSuggestResult(v))));
|
|
311
|
-
};
|
|
312
134
|
export const isFtAuthenticationIdentifier = (o) => {
|
|
313
135
|
return isObject(o)
|
|
314
136
|
&& (isString(o.identifier))
|