@fluid-topics/public-api 1.0.14 → 1.0.17
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 +78 -3
- package/dist/cjs/types/ft-common/public.js +37 -3
- package/dist/cjs/types/ft-server/public.js +8 -1
- package/dist/fluidtopics.min.js +1 -1
- package/dist/mjs/index.d.ts +9 -3
- package/dist/mjs/index.js +74 -2
- package/dist/mjs/types/ft-common/public.d.ts +24 -1
- package/dist/mjs/types/ft-common/public.js +32 -2
- package/dist/mjs/types/ft-server/public.d.ts +7 -0
- package/dist/mjs/types/ft-server/public.js +6 -0
- package/package.json +1 -1
- package/dist/cjs/index.cjs +0 -166
- package/dist/cjs/types/ft-common/public.cjs +0 -374
- package/dist/cjs/types/ft-server/public.cjs +0 -31
- package/dist/mjs/index.mjs +0 -153
- package/dist/mjs/types/ft-common/public.mjs +0 -336
- package/dist/mjs/types/ft-server/public.mjs +0 -25
package/dist/cjs/index.cjs
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.FluidTopicsApi = exports.HttpError = void 0;
|
|
23
|
-
require("cross-fetch/polyfill");
|
|
24
|
-
__exportStar(require("./types/ft-common/public"), exports);
|
|
25
|
-
__exportStar(require("./types/ft-server/public"), exports);
|
|
26
|
-
function toBase64(s) {
|
|
27
|
-
return typeof Buffer !== "undefined" ? Buffer.from(s).toString("base64") : btoa(s);
|
|
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;
|
|
38
|
-
function handleError(response) {
|
|
39
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
if (!response.ok) {
|
|
41
|
-
throw new HttpError(response.status, response.statusText, yield response.text());
|
|
42
|
-
}
|
|
43
|
-
return response;
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
function getBody(response) {
|
|
47
|
-
return response.headers.get("Content-Type") === "application/json" ? response.json() : response.text();
|
|
48
|
-
}
|
|
49
|
-
class FluidTopicsApi {
|
|
50
|
-
constructor(tenantBaseUrl, integrationIdentifier) {
|
|
51
|
-
this.authorization = {};
|
|
52
|
-
this.tenantBaseUrl = tenantBaseUrl.trim().replace(/\/$/, "");
|
|
53
|
-
this.ftCallingApp = `ft-public-api/${integrationIdentifier}`;
|
|
54
|
-
}
|
|
55
|
-
get defaultHeaders() {
|
|
56
|
-
return Object.assign(Object.assign({}, this.authorization), { "Ft-Calling-App": this.ftCallingApp });
|
|
57
|
-
}
|
|
58
|
-
setApiKey(apiKey) {
|
|
59
|
-
this.authorization = { "Authorization": "Bearer " + apiKey };
|
|
60
|
-
}
|
|
61
|
-
setCredentials(login, password) {
|
|
62
|
-
this.authorization = { "Authorization": "Basic " + toBase64(`${login}:${password}`) };
|
|
63
|
-
}
|
|
64
|
-
clearAuthentication() {
|
|
65
|
-
this.authorization = {};
|
|
66
|
-
}
|
|
67
|
-
login(login, password) {
|
|
68
|
-
let credentials = {
|
|
69
|
-
login: login,
|
|
70
|
-
password: password,
|
|
71
|
-
rememberMe: true
|
|
72
|
-
};
|
|
73
|
-
return this.post(`/api/authentication/login`, credentials)
|
|
74
|
-
.then(result => {
|
|
75
|
-
this.setCredentials(login, password);
|
|
76
|
-
return result;
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
logout() {
|
|
80
|
-
return this.post(`/api/authentication/logout`)
|
|
81
|
-
.then(() => this.clearAuthentication());
|
|
82
|
-
}
|
|
83
|
-
getMap(mapId) {
|
|
84
|
-
return this.get(`/api/khub/maps/${mapId}`);
|
|
85
|
-
}
|
|
86
|
-
getTableOfContent(mapId) {
|
|
87
|
-
return this.get(`/api/khub/maps/${mapId}/toc`);
|
|
88
|
-
}
|
|
89
|
-
getTopic(mapId, topicContentId) {
|
|
90
|
-
return this.get(`/api/khub/maps/${mapId}/topics/${topicContentId}`);
|
|
91
|
-
}
|
|
92
|
-
getTopicHTMLContent(mapId, topicContentId, target) {
|
|
93
|
-
return this.get(`/api/khub/maps/${mapId}/topics/${topicContentId}/content${target ? "?target=" + target : ""}`);
|
|
94
|
-
}
|
|
95
|
-
getMapAttachments(mapId) {
|
|
96
|
-
return this.get(`/api/khub/maps/${mapId}/attachments`);
|
|
97
|
-
}
|
|
98
|
-
getMapAttachmentContent(mapId, attachmentId) {
|
|
99
|
-
return this.fetchRawData(`/api/khub/maps/${mapId}/attachments/${attachmentId}/content`);
|
|
100
|
-
}
|
|
101
|
-
getMapResources(mapId) {
|
|
102
|
-
return this.get(`/api/khub/maps/${mapId}/resources`);
|
|
103
|
-
}
|
|
104
|
-
getMapResourceContent(mapId, resourceId) {
|
|
105
|
-
return this.fetchRawData(`/api/khub/maps/${mapId}/resources/${resourceId}/content`);
|
|
106
|
-
}
|
|
107
|
-
getUnstructuredDocument(documentId) {
|
|
108
|
-
return this.get(`/api/khub/documents/${documentId}`);
|
|
109
|
-
}
|
|
110
|
-
getUnstructuredDocumentContent(documentId) {
|
|
111
|
-
return this.fetchRawData(`/api/khub/documents/${documentId}/content`);
|
|
112
|
-
}
|
|
113
|
-
getUnstructuredDocumentTextContent(documentId) {
|
|
114
|
-
return this.get(`/api/khub/documents/${documentId}/content/text`);
|
|
115
|
-
}
|
|
116
|
-
getCollectionDocuments(userId, collectionId) {
|
|
117
|
-
return this.get(`/api/users/${userId}/collections/${collectionId}/documents`);
|
|
118
|
-
}
|
|
119
|
-
getSuggestions(request) {
|
|
120
|
-
return this.post("/api/khub/suggest", request);
|
|
121
|
-
}
|
|
122
|
-
search(request) {
|
|
123
|
-
return this.post("/api/khub/clustered-search", request);
|
|
124
|
-
}
|
|
125
|
-
getAvailableSearchLocales() {
|
|
126
|
-
return this.get("/api/khub/locales");
|
|
127
|
-
}
|
|
128
|
-
get(endpoint) {
|
|
129
|
-
return this.makeRequest("GET", endpoint);
|
|
130
|
-
}
|
|
131
|
-
post(endpoint, data) {
|
|
132
|
-
return this.makeRequest("POST", endpoint, data);
|
|
133
|
-
}
|
|
134
|
-
put(endpoint, data) {
|
|
135
|
-
return this.makeRequest("PUT", endpoint, data);
|
|
136
|
-
}
|
|
137
|
-
delete(endpoint) {
|
|
138
|
-
return this.makeRequest("DELETE", endpoint);
|
|
139
|
-
}
|
|
140
|
-
fetch(endpoint, init) {
|
|
141
|
-
var _a;
|
|
142
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
143
|
-
const requestInit = init;
|
|
144
|
-
if (!endpoint.startsWith("/")) {
|
|
145
|
-
endpoint = "/" + endpoint;
|
|
146
|
-
}
|
|
147
|
-
return yield fetch(this.tenantBaseUrl + endpoint, Object.assign(Object.assign({}, (requestInit !== null && requestInit !== void 0 ? requestInit : {})), { headers: Object.assign(Object.assign({}, this.defaultHeaders), ((_a = requestInit === null || requestInit === void 0 ? void 0 : requestInit.headers) !== null && _a !== void 0 ? _a : {})) }));
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
makeRequest(method, endpoint, data) {
|
|
151
|
-
return this.fetch(endpoint, {
|
|
152
|
-
method: method,
|
|
153
|
-
headers: Object.assign({}, (data != null ? { "Content-Type": "application/json" } : {})),
|
|
154
|
-
body: data != null ? JSON.stringify(data) : undefined
|
|
155
|
-
})
|
|
156
|
-
.then(handleError)
|
|
157
|
-
.then(getBody);
|
|
158
|
-
}
|
|
159
|
-
fetchRawData(endpoint) {
|
|
160
|
-
return fetch(this.tenantBaseUrl + endpoint, { headers: this.defaultHeaders })
|
|
161
|
-
.then(handleError)
|
|
162
|
-
.then(response => response.arrayBuffer());
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
exports.FluidTopicsApi = FluidTopicsApi;
|
|
166
|
-
exports.default = FluidTopicsApi;
|
|
@@ -1,374 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isFtAuthenticationIdentifier = 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.isFtSearchResults = exports.isFtCollectionDocumentType = exports.FtCollectionDocumentType = exports.isFtPageRequest = exports.isFtOpenMode = exports.FtOpenMode = exports.isFtEditorialType = exports.FtEditorialType = exports.isFtSearchResultsPageInfo = exports.isFtSearchFilter = exports.isFtMapResource = exports.isFtMetadata = exports.isFtSearchLocales = exports.isFtSearchLocale = exports.isFtTopicContentTarget = exports.FtTopicContentTarget = exports.isFtUnstructuredDocument = exports.isFtTopic = exports.isFtTocNode = exports.isFtMap = exports.isFtCollectionDocument = exports.isFtCredentials = void 0;
|
|
4
|
-
const isObject = (o) => typeof o === "object" && o != null;
|
|
5
|
-
const isBoolean = (o) => typeof o === "boolean";
|
|
6
|
-
const isNumber = (o) => typeof o === "number";
|
|
7
|
-
const isString = (o) => typeof o === "string";
|
|
8
|
-
const isFtCredentials = (o) => {
|
|
9
|
-
return isObject(o)
|
|
10
|
-
&& (isString(o.password))
|
|
11
|
-
&& (o.newPassword == null || isString(o.newPassword))
|
|
12
|
-
&& (isBoolean(o.rememberMe))
|
|
13
|
-
&& (isString(o.login));
|
|
14
|
-
};
|
|
15
|
-
exports.isFtCredentials = isFtCredentials;
|
|
16
|
-
const isFtCollectionDocument = (o) => {
|
|
17
|
-
return isObject(o)
|
|
18
|
-
&& (isBoolean(o.deleted))
|
|
19
|
-
&& (o.apiUrl == null || isString(o.apiUrl))
|
|
20
|
-
&& (o.portalUrl == null || isString(o.portalUrl))
|
|
21
|
-
&& (isString(o.id))
|
|
22
|
-
&& (isString(o.title))
|
|
23
|
-
&& ((0, exports.isFtCollectionDocumentType)(o.type));
|
|
24
|
-
};
|
|
25
|
-
exports.isFtCollectionDocument = isFtCollectionDocument;
|
|
26
|
-
const isFtMap = (o) => {
|
|
27
|
-
return isObject(o)
|
|
28
|
-
&& (o.prettyUrl == null || isString(o.prettyUrl))
|
|
29
|
-
&& ((Array.isArray(o.metadata)
|
|
30
|
-
&& o.metadata.every((v) => (0, exports.isFtMetadata)(v))))
|
|
31
|
-
&& ((0, exports.isFtOpenMode)(o.openMode))
|
|
32
|
-
&& (isString(o.topicsApiEndpoint))
|
|
33
|
-
&& (o.description == null || isString(o.description))
|
|
34
|
-
&& (isString(o.attachmentsApiEndpoint))
|
|
35
|
-
&& ((0, exports.isFtEditorialType)(o.editorialType))
|
|
36
|
-
&& (isString(o.baseId))
|
|
37
|
-
&& (isString(o.clusterId))
|
|
38
|
-
&& (isString(o.title))
|
|
39
|
-
&& (isString(o.lastPublication))
|
|
40
|
-
&& (isString(o.lastEdition))
|
|
41
|
-
&& (isString(o.originId))
|
|
42
|
-
&& (isString(o.rightsApiEndpoint))
|
|
43
|
-
&& (o.originUrl == null || isString(o.originUrl))
|
|
44
|
-
&& (isString(o.readerUrl))
|
|
45
|
-
&& (o.khubVersion == null || isString(o.khubVersion))
|
|
46
|
-
&& (isString(o.id))
|
|
47
|
-
&& (o.lang == null || isString(o.lang));
|
|
48
|
-
};
|
|
49
|
-
exports.isFtMap = isFtMap;
|
|
50
|
-
const isFtTocNode = (o) => {
|
|
51
|
-
return isObject(o)
|
|
52
|
-
&& (isString(o.tocId))
|
|
53
|
-
&& ((Array.isArray(o.children)
|
|
54
|
-
&& o.children.every((v) => (0, exports.isFtTocNode)(v))))
|
|
55
|
-
&& (isString(o.contentId))
|
|
56
|
-
&& (isString(o.title));
|
|
57
|
-
};
|
|
58
|
-
exports.isFtTocNode = isFtTocNode;
|
|
59
|
-
const isFtTopic = (o) => {
|
|
60
|
-
return isObject(o)
|
|
61
|
-
&& ((Array.isArray(o.metadata)
|
|
62
|
-
&& o.metadata.every((v) => (0, exports.isFtMetadata)(v))))
|
|
63
|
-
&& (isString(o.id))
|
|
64
|
-
&& (isString(o.contentApiEndpoint))
|
|
65
|
-
&& (isString(o.title));
|
|
66
|
-
};
|
|
67
|
-
exports.isFtTopic = isFtTopic;
|
|
68
|
-
const isFtUnstructuredDocument = (o) => {
|
|
69
|
-
return isObject(o)
|
|
70
|
-
&& (o.prettyUrl == null || isString(o.prettyUrl))
|
|
71
|
-
&& ((Array.isArray(o.metadata)
|
|
72
|
-
&& o.metadata.every((v) => (0, exports.isFtMetadata)(v))))
|
|
73
|
-
&& (isString(o.openMode))
|
|
74
|
-
&& (o.description == null || isString(o.description))
|
|
75
|
-
&& (isString(o.mimeType))
|
|
76
|
-
&& (o.baseId == null || isString(o.baseId))
|
|
77
|
-
&& (o.clusterId == null || isString(o.clusterId))
|
|
78
|
-
&& (isString(o.contentApiEndpoint))
|
|
79
|
-
&& (isString(o.title))
|
|
80
|
-
&& (o.lastPublication == null || isString(o.lastPublication))
|
|
81
|
-
&& (isString(o.viewerUrl))
|
|
82
|
-
&& (isString(o.lastEdition))
|
|
83
|
-
&& (isString(o.filename))
|
|
84
|
-
&& (o.originId == null || isString(o.originId))
|
|
85
|
-
&& (isString(o.rightsApiEndpoint))
|
|
86
|
-
&& (o.originUrl == null || isString(o.originUrl))
|
|
87
|
-
&& (o.khubVersion == null || isString(o.khubVersion))
|
|
88
|
-
&& (isString(o.id))
|
|
89
|
-
&& (o.lang == null || isString(o.lang));
|
|
90
|
-
};
|
|
91
|
-
exports.isFtUnstructuredDocument = isFtUnstructuredDocument;
|
|
92
|
-
// From: WsTopicContentTarget
|
|
93
|
-
var FtTopicContentTarget;
|
|
94
|
-
(function (FtTopicContentTarget) {
|
|
95
|
-
FtTopicContentTarget["THIRD_PARTY"] = "THIRD_PARTY";
|
|
96
|
-
FtTopicContentTarget["OFF_THE_GRID"] = "OFF_THE_GRID";
|
|
97
|
-
})(FtTopicContentTarget = exports.FtTopicContentTarget || (exports.FtTopicContentTarget = {}));
|
|
98
|
-
const isFtTopicContentTarget = (o) => {
|
|
99
|
-
return ["THIRD_PARTY", "OFF_THE_GRID"].includes(o);
|
|
100
|
-
};
|
|
101
|
-
exports.isFtTopicContentTarget = isFtTopicContentTarget;
|
|
102
|
-
const isFtSearchLocale = (o) => {
|
|
103
|
-
return isObject(o)
|
|
104
|
-
&& (isNumber(o.count))
|
|
105
|
-
&& (isString(o.label))
|
|
106
|
-
&& (o.lang == null || 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
|
-
const isFtMetadata = (o) => {
|
|
116
|
-
return isObject(o)
|
|
117
|
-
&& ((Array.isArray(o.values)
|
|
118
|
-
&& o.values.every((v) => isString(v))))
|
|
119
|
-
&& (isString(o.label))
|
|
120
|
-
&& (isString(o.key));
|
|
121
|
-
};
|
|
122
|
-
exports.isFtMetadata = isFtMetadata;
|
|
123
|
-
const isFtMapResource = (o) => {
|
|
124
|
-
return isObject(o)
|
|
125
|
-
&& (isString(o.contentUrl))
|
|
126
|
-
&& (isString(o.filename))
|
|
127
|
-
&& (isString(o.id))
|
|
128
|
-
&& (isString(o.mimeType));
|
|
129
|
-
};
|
|
130
|
-
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
|
-
const isFtSearchResultsPageInfo = (o) => {
|
|
140
|
-
return isObject(o)
|
|
141
|
-
&& (isNumber(o.totalResultsCount))
|
|
142
|
-
&& (isBoolean(o.lastPage))
|
|
143
|
-
&& (isNumber(o.currentPage))
|
|
144
|
-
&& (isNumber(o.totalClustersCount));
|
|
145
|
-
};
|
|
146
|
-
exports.isFtSearchResultsPageInfo = isFtSearchResultsPageInfo;
|
|
147
|
-
// From: WsEditorialType
|
|
148
|
-
var FtEditorialType;
|
|
149
|
-
(function (FtEditorialType) {
|
|
150
|
-
FtEditorialType["ARTICLE"] = "ARTICLE";
|
|
151
|
-
FtEditorialType["BOOK"] = "BOOK";
|
|
152
|
-
})(FtEditorialType = exports.FtEditorialType || (exports.FtEditorialType = {}));
|
|
153
|
-
const isFtEditorialType = (o) => {
|
|
154
|
-
return ["ARTICLE", "BOOK"].includes(o);
|
|
155
|
-
};
|
|
156
|
-
exports.isFtEditorialType = isFtEditorialType;
|
|
157
|
-
// From: WsOpenMode
|
|
158
|
-
var FtOpenMode;
|
|
159
|
-
(function (FtOpenMode) {
|
|
160
|
-
FtOpenMode["FLUIDTOPICS"] = "FLUIDTOPICS";
|
|
161
|
-
FtOpenMode["EXTERNAL"] = "EXTERNAL";
|
|
162
|
-
})(FtOpenMode = exports.FtOpenMode || (exports.FtOpenMode = {}));
|
|
163
|
-
const isFtOpenMode = (o) => {
|
|
164
|
-
return ["FLUIDTOPICS", "EXTERNAL"].includes(o);
|
|
165
|
-
};
|
|
166
|
-
exports.isFtOpenMode = isFtOpenMode;
|
|
167
|
-
const isFtPageRequest = (o) => {
|
|
168
|
-
return isObject(o)
|
|
169
|
-
&& (o.perPage == null || isNumber(o.perPage))
|
|
170
|
-
&& (isNumber(o.page));
|
|
171
|
-
};
|
|
172
|
-
exports.isFtPageRequest = isFtPageRequest;
|
|
173
|
-
// From: WsPublicCollectionDocumentType
|
|
174
|
-
var FtCollectionDocumentType;
|
|
175
|
-
(function (FtCollectionDocumentType) {
|
|
176
|
-
FtCollectionDocumentType["MAP"] = "MAP";
|
|
177
|
-
FtCollectionDocumentType["DOCUMENT"] = "DOCUMENT";
|
|
178
|
-
FtCollectionDocumentType["TOPIC"] = "TOPIC";
|
|
179
|
-
FtCollectionDocumentType["PERSONAL_BOOK"] = "PERSONAL_BOOK";
|
|
180
|
-
FtCollectionDocumentType["SHARED_BOOK"] = "SHARED_BOOK";
|
|
181
|
-
})(FtCollectionDocumentType = exports.FtCollectionDocumentType || (exports.FtCollectionDocumentType = {}));
|
|
182
|
-
const isFtCollectionDocumentType = (o) => {
|
|
183
|
-
return ["MAP", "DOCUMENT", "TOPIC", "PERSONAL_BOOK", "SHARED_BOOK"].includes(o);
|
|
184
|
-
};
|
|
185
|
-
exports.isFtCollectionDocumentType = isFtCollectionDocumentType;
|
|
186
|
-
const isFtSearchResults = (o) => {
|
|
187
|
-
return isObject(o)
|
|
188
|
-
&& (o.spellcheck == null || (0, exports.isFtSpellcheck)(o.spellcheck))
|
|
189
|
-
&& ((0, exports.isFtSearchResultsPageInfo)(o.paging))
|
|
190
|
-
&& ((Array.isArray(o.results)
|
|
191
|
-
&& o.results.every((v) => (0, exports.isFtSearchResultCluster)(v))))
|
|
192
|
-
&& ((Array.isArray(o.facets)
|
|
193
|
-
&& o.facets.every((v) => (0, exports.isFtSearchFacet)(v))));
|
|
194
|
-
};
|
|
195
|
-
exports.isFtSearchResults = isFtSearchResults;
|
|
196
|
-
const isFtSearchRequest = (o) => {
|
|
197
|
-
return isObject(o)
|
|
198
|
-
&& (isString(o.query))
|
|
199
|
-
&& ((0, exports.isFtPageRequest)(o.paging))
|
|
200
|
-
&& ((Array.isArray(o.filters)
|
|
201
|
-
&& o.filters.every((v) => (0, exports.isFtSearchFilter)(v))))
|
|
202
|
-
&& ((Array.isArray(o.sort)
|
|
203
|
-
&& o.sort.every((v) => (0, exports.isFtSearchSortCriterion)(v))))
|
|
204
|
-
&& (o.uiLocale == null || isString(o.uiLocale))
|
|
205
|
-
&& (o.contentLocale == null || isString(o.contentLocale))
|
|
206
|
-
&& ((Array.isArray(o.facets)
|
|
207
|
-
&& o.facets.every((v) => (0, exports.isFtSearchFacetConf)(v))));
|
|
208
|
-
};
|
|
209
|
-
exports.isFtSearchRequest = isFtSearchRequest;
|
|
210
|
-
const isFtSearchResultCluster = (o) => {
|
|
211
|
-
return isObject(o)
|
|
212
|
-
&& ((Array.isArray(o.entries)
|
|
213
|
-
&& o.entries.every((v) => (0, exports.isFtSearchResultClusterEntry)(v))))
|
|
214
|
-
&& (o.metadataVariableAxis == null || isString(o.metadataVariableAxis));
|
|
215
|
-
};
|
|
216
|
-
exports.isFtSearchResultCluster = isFtSearchResultCluster;
|
|
217
|
-
const isFtSearchResultClusterEntry = (o) => {
|
|
218
|
-
return isObject(o)
|
|
219
|
-
&& (o.document == null || (0, exports.isFtSearchResultUnstructuredDocument)(o.document))
|
|
220
|
-
&& (o.topic == null || (0, exports.isFtSearchResultTopic)(o.topic))
|
|
221
|
-
&& ((0, exports.isFtSearchResultType)(o.type))
|
|
222
|
-
&& (o.map == null || (0, exports.isFtSearchResultMap)(o.map));
|
|
223
|
-
};
|
|
224
|
-
exports.isFtSearchResultClusterEntry = isFtSearchResultClusterEntry;
|
|
225
|
-
const isFtSearchResultUnstructuredDocument = (o) => {
|
|
226
|
-
return isObject(o)
|
|
227
|
-
&& ((Array.isArray(o.metadata)
|
|
228
|
-
&& o.metadata.every((v) => (0, exports.isFtMetadata)(v))))
|
|
229
|
-
&& ((0, exports.isFtOpenMode)(o.openMode))
|
|
230
|
-
&& (isString(o.documentUrl))
|
|
231
|
-
&& (isString(o.mimeType))
|
|
232
|
-
&& (isString(o.title))
|
|
233
|
-
&& (o.lastPublicationDate == null || isString(o.lastPublicationDate))
|
|
234
|
-
&& (isString(o.viewerUrl))
|
|
235
|
-
&& (isString(o.contentUrl))
|
|
236
|
-
&& (isString(o.filename))
|
|
237
|
-
&& (isString(o.htmlTitle))
|
|
238
|
-
&& (o.originUrl == null || isString(o.originUrl))
|
|
239
|
-
&& (isString(o.documentId))
|
|
240
|
-
&& (isString(o.lastEditionDate))
|
|
241
|
-
&& (isString(o.htmlExcerpt));
|
|
242
|
-
};
|
|
243
|
-
exports.isFtSearchResultUnstructuredDocument = isFtSearchResultUnstructuredDocument;
|
|
244
|
-
const isFtSearchResultMap = (o) => {
|
|
245
|
-
return isObject(o)
|
|
246
|
-
&& ((Array.isArray(o.metadata)
|
|
247
|
-
&& o.metadata.every((v) => (0, exports.isFtMetadata)(v))))
|
|
248
|
-
&& ((0, exports.isFtOpenMode)(o.openMode))
|
|
249
|
-
&& ((0, exports.isFtEditorialType)(o.editorialType))
|
|
250
|
-
&& (isString(o.title))
|
|
251
|
-
&& (o.lastPublicationDate == null || isString(o.lastPublicationDate))
|
|
252
|
-
&& (isString(o.htmlTitle))
|
|
253
|
-
&& (o.originUrl == null || isString(o.originUrl))
|
|
254
|
-
&& (isString(o.mapUrl))
|
|
255
|
-
&& (isString(o.readerUrl))
|
|
256
|
-
&& (isString(o.mapId))
|
|
257
|
-
&& (o.lastEditionDate == null || isString(o.lastEditionDate))
|
|
258
|
-
&& (isString(o.htmlExcerpt));
|
|
259
|
-
};
|
|
260
|
-
exports.isFtSearchResultMap = isFtSearchResultMap;
|
|
261
|
-
const isFtSearchResultTopic = (o) => {
|
|
262
|
-
return isObject(o)
|
|
263
|
-
&& ((Array.isArray(o.metadata)
|
|
264
|
-
&& o.metadata.every((v) => (0, exports.isFtMetadata)(v))))
|
|
265
|
-
&& ((0, exports.isFtOpenMode)(o.openMode))
|
|
266
|
-
&& (isString(o.contentId))
|
|
267
|
-
&& ((Array.isArray(o.resources)
|
|
268
|
-
&& o.resources.every((v) => (0, exports.isFtTopicResource)(v))))
|
|
269
|
-
&& (isString(o.title))
|
|
270
|
-
&& (isString(o.mapTitle))
|
|
271
|
-
&& (isString(o.topicUrl))
|
|
272
|
-
&& (isString(o.contentUrl))
|
|
273
|
-
&& (isString(o.htmlTitle))
|
|
274
|
-
&& ((Array.isArray(o.breadcrumb)
|
|
275
|
-
&& o.breadcrumb.every((v) => isString(v))))
|
|
276
|
-
&& (isString(o.tocId))
|
|
277
|
-
&& (o.originUrl == null || isString(o.originUrl))
|
|
278
|
-
&& (isString(o.readerUrl))
|
|
279
|
-
&& (isString(o.mapId))
|
|
280
|
-
&& (o.lastEditionDate == null || isString(o.lastEditionDate))
|
|
281
|
-
&& (isString(o.htmlExcerpt));
|
|
282
|
-
};
|
|
283
|
-
exports.isFtSearchResultTopic = isFtSearchResultTopic;
|
|
284
|
-
// From: WsPublicSearchResultType
|
|
285
|
-
var FtSearchResultType;
|
|
286
|
-
(function (FtSearchResultType) {
|
|
287
|
-
FtSearchResultType["MAP"] = "MAP";
|
|
288
|
-
FtSearchResultType["DOCUMENT"] = "DOCUMENT";
|
|
289
|
-
FtSearchResultType["TOPIC"] = "TOPIC";
|
|
290
|
-
})(FtSearchResultType = exports.FtSearchResultType || (exports.FtSearchResultType = {}));
|
|
291
|
-
const isFtSearchResultType = (o) => {
|
|
292
|
-
return ["MAP", "DOCUMENT", "TOPIC"].includes(o);
|
|
293
|
-
};
|
|
294
|
-
exports.isFtSearchResultType = isFtSearchResultType;
|
|
295
|
-
const isFtSearchFacet = (o) => {
|
|
296
|
-
return isObject(o)
|
|
297
|
-
&& (isBoolean(o.hierarchical))
|
|
298
|
-
&& (isString(o.label))
|
|
299
|
-
&& (isBoolean(o.multiSelectionable))
|
|
300
|
-
&& (isString(o.key))
|
|
301
|
-
&& ((Array.isArray(o.rootNodes)
|
|
302
|
-
&& o.rootNodes.every((v) => (0, exports.isFtSearchFacetEntry)(v))));
|
|
303
|
-
};
|
|
304
|
-
exports.isFtSearchFacet = isFtSearchFacet;
|
|
305
|
-
const isFtSearchFacetConf = (o) => {
|
|
306
|
-
return isObject(o)
|
|
307
|
-
&& (o.maxDepth == null || isNumber(o.maxDepth))
|
|
308
|
-
&& (isString(o.id));
|
|
309
|
-
};
|
|
310
|
-
exports.isFtSearchFacetConf = isFtSearchFacetConf;
|
|
311
|
-
const isFtSearchFacetEntry = (o) => {
|
|
312
|
-
return isObject(o)
|
|
313
|
-
&& (isNumber(o.totalResultsCount))
|
|
314
|
-
&& (isBoolean(o.descendantSelected))
|
|
315
|
-
&& ((Array.isArray(o.childNodes)
|
|
316
|
-
&& o.childNodes.every((v) => (0, exports.isFtSearchFacetEntry)(v))))
|
|
317
|
-
&& (isString(o.label))
|
|
318
|
-
&& (isString(o.value))
|
|
319
|
-
&& (isBoolean(o.selected));
|
|
320
|
-
};
|
|
321
|
-
exports.isFtSearchFacetEntry = isFtSearchFacetEntry;
|
|
322
|
-
const isFtSearchSortCriterion = (o) => {
|
|
323
|
-
return isObject(o)
|
|
324
|
-
&& (isString(o.key));
|
|
325
|
-
};
|
|
326
|
-
exports.isFtSearchSortCriterion = isFtSearchSortCriterion;
|
|
327
|
-
const isFtSpellcheck = (o) => {
|
|
328
|
-
return isObject(o)
|
|
329
|
-
&& (isString(o.suggestedQuery))
|
|
330
|
-
&& (isString(o.htmlSuggestedQuery));
|
|
331
|
-
};
|
|
332
|
-
exports.isFtSpellcheck = isFtSpellcheck;
|
|
333
|
-
const isFtTopicResource = (o) => {
|
|
334
|
-
return isObject(o)
|
|
335
|
-
&& (isString(o.filename))
|
|
336
|
-
&& (isString(o.resourceUrl))
|
|
337
|
-
&& (isString(o.id))
|
|
338
|
-
&& (isString(o.mimeType))
|
|
339
|
-
&& (isString(o.resourceContentUrl))
|
|
340
|
-
&& (isString(o.viewerUrl));
|
|
341
|
-
};
|
|
342
|
-
exports.isFtTopicResource = isFtTopicResource;
|
|
343
|
-
const isFtSuggestRequest = (o) => {
|
|
344
|
-
return isObject(o)
|
|
345
|
-
&& (isString(o.input))
|
|
346
|
-
&& ((Array.isArray(o.filters)
|
|
347
|
-
&& o.filters.every((v) => (0, exports.isFtSearchFilter)(v))))
|
|
348
|
-
&& ((Array.isArray(o.sort)
|
|
349
|
-
&& o.sort.every((v) => (0, exports.isFtSearchSortCriterion)(v))))
|
|
350
|
-
&& (o.maxCount == null || isNumber(o.maxCount))
|
|
351
|
-
&& (o.contentLocale == null || isString(o.contentLocale));
|
|
352
|
-
};
|
|
353
|
-
exports.isFtSuggestRequest = isFtSuggestRequest;
|
|
354
|
-
const isFtSuggestResult = (o) => {
|
|
355
|
-
return isObject(o)
|
|
356
|
-
&& (o.filenameExtension == null || isString(o.filenameExtension))
|
|
357
|
-
&& (o.editorialType == null || (0, exports.isFtEditorialType)(o.editorialType))
|
|
358
|
-
&& (o.mimeType == null || isString(o.mimeType))
|
|
359
|
-
&& ((0, exports.isFtSearchResultType)(o.type))
|
|
360
|
-
&& (isString(o.value));
|
|
361
|
-
};
|
|
362
|
-
exports.isFtSuggestResult = isFtSuggestResult;
|
|
363
|
-
const isFtSuggestResults = (o) => {
|
|
364
|
-
return isObject(o)
|
|
365
|
-
&& ((Array.isArray(o.suggestions)
|
|
366
|
-
&& o.suggestions.every((v) => (0, exports.isFtSuggestResult)(v))));
|
|
367
|
-
};
|
|
368
|
-
exports.isFtSuggestResults = isFtSuggestResults;
|
|
369
|
-
const isFtAuthenticationIdentifier = (o) => {
|
|
370
|
-
return isObject(o)
|
|
371
|
-
&& (isString(o.identifier))
|
|
372
|
-
&& (isString(o.realm));
|
|
373
|
-
};
|
|
374
|
-
exports.isFtAuthenticationIdentifier = isFtAuthenticationIdentifier;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isFtMapAttachment = exports.isFtUserProfile = exports.isFtAuthenticatedSession = void 0;
|
|
4
|
-
const isObject = (o) => typeof o === "object" && o != null;
|
|
5
|
-
const isBoolean = (o) => typeof o === "boolean";
|
|
6
|
-
const isNumber = (o) => typeof o === "number";
|
|
7
|
-
const isString = (o) => typeof o === "string";
|
|
8
|
-
const isFtAuthenticatedSession = (o) => {
|
|
9
|
-
return isObject(o)
|
|
10
|
-
&& ((0, exports.isFtUserProfile)(o.profile));
|
|
11
|
-
};
|
|
12
|
-
exports.isFtAuthenticatedSession = isFtAuthenticatedSession;
|
|
13
|
-
const isFtUserProfile = (o) => {
|
|
14
|
-
return isObject(o)
|
|
15
|
-
&& (o.emailAddress == null || isString(o.emailAddress))
|
|
16
|
-
&& (o.displayName == null || isString(o.displayName))
|
|
17
|
-
&& ((Array.isArray(o.roles)))
|
|
18
|
-
&& (isString(o.userId));
|
|
19
|
-
};
|
|
20
|
-
exports.isFtUserProfile = isFtUserProfile;
|
|
21
|
-
const isFtMapAttachment = (o) => {
|
|
22
|
-
return isObject(o)
|
|
23
|
-
&& (isString(o.file))
|
|
24
|
-
&& (o.size == null || isNumber(o.size))
|
|
25
|
-
&& (isBoolean(o.externalLink))
|
|
26
|
-
&& (isString(o.name))
|
|
27
|
-
&& (isString(o.id))
|
|
28
|
-
&& (o.mimeType == null || isString(o.mimeType))
|
|
29
|
-
&& (o.viewerUrl == null || isString(o.viewerUrl));
|
|
30
|
-
};
|
|
31
|
-
exports.isFtMapAttachment = isFtMapAttachment;
|