@fluid-topics/public-api 1.0.13 → 1.0.14

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.
@@ -0,0 +1,336 @@
1
+ const isObject = (o) => typeof o === "object" && o != null;
2
+ const isBoolean = (o) => typeof o === "boolean";
3
+ const isNumber = (o) => typeof o === "number";
4
+ const isString = (o) => typeof o === "string";
5
+ export const isFtCredentials = (o) => {
6
+ return isObject(o)
7
+ && (isString(o.password))
8
+ && (o.newPassword == null || isString(o.newPassword))
9
+ && (isBoolean(o.rememberMe))
10
+ && (isString(o.login));
11
+ };
12
+ export const isFtCollectionDocument = (o) => {
13
+ return isObject(o)
14
+ && (isBoolean(o.deleted))
15
+ && (o.apiUrl == null || isString(o.apiUrl))
16
+ && (o.portalUrl == null || isString(o.portalUrl))
17
+ && (isString(o.id))
18
+ && (isString(o.title))
19
+ && (isFtCollectionDocumentType(o.type));
20
+ };
21
+ export const isFtMap = (o) => {
22
+ return isObject(o)
23
+ && (o.prettyUrl == null || isString(o.prettyUrl))
24
+ && ((Array.isArray(o.metadata)
25
+ && o.metadata.every((v) => isFtMetadata(v))))
26
+ && (isFtOpenMode(o.openMode))
27
+ && (isString(o.topicsApiEndpoint))
28
+ && (o.description == null || isString(o.description))
29
+ && (isString(o.attachmentsApiEndpoint))
30
+ && (isFtEditorialType(o.editorialType))
31
+ && (isString(o.baseId))
32
+ && (isString(o.clusterId))
33
+ && (isString(o.title))
34
+ && (isString(o.lastPublication))
35
+ && (isString(o.lastEdition))
36
+ && (isString(o.originId))
37
+ && (isString(o.rightsApiEndpoint))
38
+ && (o.originUrl == null || isString(o.originUrl))
39
+ && (isString(o.readerUrl))
40
+ && (o.khubVersion == null || isString(o.khubVersion))
41
+ && (isString(o.id))
42
+ && (o.lang == null || isString(o.lang));
43
+ };
44
+ export const isFtTocNode = (o) => {
45
+ return isObject(o)
46
+ && (isString(o.tocId))
47
+ && ((Array.isArray(o.children)
48
+ && o.children.every((v) => isFtTocNode(v))))
49
+ && (isString(o.contentId))
50
+ && (isString(o.title));
51
+ };
52
+ export const isFtTopic = (o) => {
53
+ return isObject(o)
54
+ && ((Array.isArray(o.metadata)
55
+ && o.metadata.every((v) => isFtMetadata(v))))
56
+ && (isString(o.id))
57
+ && (isString(o.contentApiEndpoint))
58
+ && (isString(o.title));
59
+ };
60
+ export const isFtUnstructuredDocument = (o) => {
61
+ return isObject(o)
62
+ && (o.prettyUrl == null || isString(o.prettyUrl))
63
+ && ((Array.isArray(o.metadata)
64
+ && o.metadata.every((v) => isFtMetadata(v))))
65
+ && (isString(o.openMode))
66
+ && (o.description == null || isString(o.description))
67
+ && (isString(o.mimeType))
68
+ && (o.baseId == null || isString(o.baseId))
69
+ && (o.clusterId == null || isString(o.clusterId))
70
+ && (isString(o.contentApiEndpoint))
71
+ && (isString(o.title))
72
+ && (o.lastPublication == null || isString(o.lastPublication))
73
+ && (isString(o.viewerUrl))
74
+ && (isString(o.lastEdition))
75
+ && (isString(o.filename))
76
+ && (o.originId == null || isString(o.originId))
77
+ && (isString(o.rightsApiEndpoint))
78
+ && (o.originUrl == null || isString(o.originUrl))
79
+ && (o.khubVersion == null || isString(o.khubVersion))
80
+ && (isString(o.id))
81
+ && (o.lang == null || isString(o.lang));
82
+ };
83
+ // From: WsTopicContentTarget
84
+ export var FtTopicContentTarget;
85
+ (function (FtTopicContentTarget) {
86
+ FtTopicContentTarget["THIRD_PARTY"] = "THIRD_PARTY";
87
+ FtTopicContentTarget["OFF_THE_GRID"] = "OFF_THE_GRID";
88
+ })(FtTopicContentTarget || (FtTopicContentTarget = {}));
89
+ export const isFtTopicContentTarget = (o) => {
90
+ return ["THIRD_PARTY", "OFF_THE_GRID"].includes(o);
91
+ };
92
+ export const isFtSearchLocale = (o) => {
93
+ return isObject(o)
94
+ && (isNumber(o.count))
95
+ && (isString(o.label))
96
+ && (o.lang == null || 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
+ export const isFtMetadata = (o) => {
104
+ return isObject(o)
105
+ && ((Array.isArray(o.values)
106
+ && o.values.every((v) => isString(v))))
107
+ && (isString(o.label))
108
+ && (isString(o.key));
109
+ };
110
+ export const isFtMapResource = (o) => {
111
+ return isObject(o)
112
+ && (isString(o.contentUrl))
113
+ && (isString(o.filename))
114
+ && (isString(o.id))
115
+ && (isString(o.mimeType));
116
+ };
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
+ export const isFtSearchResultsPageInfo = (o) => {
125
+ return isObject(o)
126
+ && (isNumber(o.totalResultsCount))
127
+ && (isBoolean(o.lastPage))
128
+ && (isNumber(o.currentPage))
129
+ && (isNumber(o.totalClustersCount));
130
+ };
131
+ // From: WsEditorialType
132
+ export var FtEditorialType;
133
+ (function (FtEditorialType) {
134
+ FtEditorialType["ARTICLE"] = "ARTICLE";
135
+ FtEditorialType["BOOK"] = "BOOK";
136
+ })(FtEditorialType || (FtEditorialType = {}));
137
+ export const isFtEditorialType = (o) => {
138
+ return ["ARTICLE", "BOOK"].includes(o);
139
+ };
140
+ // From: WsOpenMode
141
+ export var FtOpenMode;
142
+ (function (FtOpenMode) {
143
+ FtOpenMode["FLUIDTOPICS"] = "FLUIDTOPICS";
144
+ FtOpenMode["EXTERNAL"] = "EXTERNAL";
145
+ })(FtOpenMode || (FtOpenMode = {}));
146
+ export const isFtOpenMode = (o) => {
147
+ return ["FLUIDTOPICS", "EXTERNAL"].includes(o);
148
+ };
149
+ export const isFtPageRequest = (o) => {
150
+ return isObject(o)
151
+ && (o.perPage == null || isNumber(o.perPage))
152
+ && (isNumber(o.page));
153
+ };
154
+ // From: WsPublicCollectionDocumentType
155
+ export var FtCollectionDocumentType;
156
+ (function (FtCollectionDocumentType) {
157
+ FtCollectionDocumentType["MAP"] = "MAP";
158
+ FtCollectionDocumentType["DOCUMENT"] = "DOCUMENT";
159
+ FtCollectionDocumentType["TOPIC"] = "TOPIC";
160
+ FtCollectionDocumentType["PERSONAL_BOOK"] = "PERSONAL_BOOK";
161
+ FtCollectionDocumentType["SHARED_BOOK"] = "SHARED_BOOK";
162
+ })(FtCollectionDocumentType || (FtCollectionDocumentType = {}));
163
+ export const isFtCollectionDocumentType = (o) => {
164
+ return ["MAP", "DOCUMENT", "TOPIC", "PERSONAL_BOOK", "SHARED_BOOK"].includes(o);
165
+ };
166
+ export const isFtSearchResults = (o) => {
167
+ return isObject(o)
168
+ && (o.spellcheck == null || isFtSpellcheck(o.spellcheck))
169
+ && (isFtSearchResultsPageInfo(o.paging))
170
+ && ((Array.isArray(o.results)
171
+ && o.results.every((v) => isFtSearchResultCluster(v))))
172
+ && ((Array.isArray(o.facets)
173
+ && o.facets.every((v) => isFtSearchFacet(v))));
174
+ };
175
+ export const isFtSearchRequest = (o) => {
176
+ return isObject(o)
177
+ && (isString(o.query))
178
+ && (isFtPageRequest(o.paging))
179
+ && ((Array.isArray(o.filters)
180
+ && o.filters.every((v) => isFtSearchFilter(v))))
181
+ && ((Array.isArray(o.sort)
182
+ && o.sort.every((v) => isFtSearchSortCriterion(v))))
183
+ && (o.uiLocale == null || isString(o.uiLocale))
184
+ && (o.contentLocale == null || isString(o.contentLocale))
185
+ && ((Array.isArray(o.facets)
186
+ && o.facets.every((v) => isFtSearchFacetConf(v))));
187
+ };
188
+ export const isFtSearchResultCluster = (o) => {
189
+ return isObject(o)
190
+ && ((Array.isArray(o.entries)
191
+ && o.entries.every((v) => isFtSearchResultClusterEntry(v))))
192
+ && (o.metadataVariableAxis == null || isString(o.metadataVariableAxis));
193
+ };
194
+ export const isFtSearchResultClusterEntry = (o) => {
195
+ return isObject(o)
196
+ && (o.document == null || isFtSearchResultUnstructuredDocument(o.document))
197
+ && (o.topic == null || isFtSearchResultTopic(o.topic))
198
+ && (isFtSearchResultType(o.type))
199
+ && (o.map == null || isFtSearchResultMap(o.map));
200
+ };
201
+ export const isFtSearchResultUnstructuredDocument = (o) => {
202
+ return isObject(o)
203
+ && ((Array.isArray(o.metadata)
204
+ && o.metadata.every((v) => isFtMetadata(v))))
205
+ && (isFtOpenMode(o.openMode))
206
+ && (isString(o.documentUrl))
207
+ && (isString(o.mimeType))
208
+ && (isString(o.title))
209
+ && (o.lastPublicationDate == null || isString(o.lastPublicationDate))
210
+ && (isString(o.viewerUrl))
211
+ && (isString(o.contentUrl))
212
+ && (isString(o.filename))
213
+ && (isString(o.htmlTitle))
214
+ && (o.originUrl == null || isString(o.originUrl))
215
+ && (isString(o.documentId))
216
+ && (isString(o.lastEditionDate))
217
+ && (isString(o.htmlExcerpt));
218
+ };
219
+ export const isFtSearchResultMap = (o) => {
220
+ return isObject(o)
221
+ && ((Array.isArray(o.metadata)
222
+ && o.metadata.every((v) => isFtMetadata(v))))
223
+ && (isFtOpenMode(o.openMode))
224
+ && (isFtEditorialType(o.editorialType))
225
+ && (isString(o.title))
226
+ && (o.lastPublicationDate == null || isString(o.lastPublicationDate))
227
+ && (isString(o.htmlTitle))
228
+ && (o.originUrl == null || isString(o.originUrl))
229
+ && (isString(o.mapUrl))
230
+ && (isString(o.readerUrl))
231
+ && (isString(o.mapId))
232
+ && (o.lastEditionDate == null || isString(o.lastEditionDate))
233
+ && (isString(o.htmlExcerpt));
234
+ };
235
+ export const isFtSearchResultTopic = (o) => {
236
+ return isObject(o)
237
+ && ((Array.isArray(o.metadata)
238
+ && o.metadata.every((v) => isFtMetadata(v))))
239
+ && (isFtOpenMode(o.openMode))
240
+ && (isString(o.contentId))
241
+ && ((Array.isArray(o.resources)
242
+ && o.resources.every((v) => isFtTopicResource(v))))
243
+ && (isString(o.title))
244
+ && (isString(o.mapTitle))
245
+ && (isString(o.topicUrl))
246
+ && (isString(o.contentUrl))
247
+ && (isString(o.htmlTitle))
248
+ && ((Array.isArray(o.breadcrumb)
249
+ && o.breadcrumb.every((v) => isString(v))))
250
+ && (isString(o.tocId))
251
+ && (o.originUrl == null || isString(o.originUrl))
252
+ && (isString(o.readerUrl))
253
+ && (isString(o.mapId))
254
+ && (o.lastEditionDate == null || isString(o.lastEditionDate))
255
+ && (isString(o.htmlExcerpt));
256
+ };
257
+ // From: WsPublicSearchResultType
258
+ export var FtSearchResultType;
259
+ (function (FtSearchResultType) {
260
+ FtSearchResultType["MAP"] = "MAP";
261
+ FtSearchResultType["DOCUMENT"] = "DOCUMENT";
262
+ FtSearchResultType["TOPIC"] = "TOPIC";
263
+ })(FtSearchResultType || (FtSearchResultType = {}));
264
+ export const isFtSearchResultType = (o) => {
265
+ return ["MAP", "DOCUMENT", "TOPIC"].includes(o);
266
+ };
267
+ export const isFtSearchFacet = (o) => {
268
+ return isObject(o)
269
+ && (isBoolean(o.hierarchical))
270
+ && (isString(o.label))
271
+ && (isBoolean(o.multiSelectionable))
272
+ && (isString(o.key))
273
+ && ((Array.isArray(o.rootNodes)
274
+ && o.rootNodes.every((v) => isFtSearchFacetEntry(v))));
275
+ };
276
+ export const isFtSearchFacetConf = (o) => {
277
+ return isObject(o)
278
+ && (o.maxDepth == null || isNumber(o.maxDepth))
279
+ && (isString(o.id));
280
+ };
281
+ export const isFtSearchFacetEntry = (o) => {
282
+ return isObject(o)
283
+ && (isNumber(o.totalResultsCount))
284
+ && (isBoolean(o.descendantSelected))
285
+ && ((Array.isArray(o.childNodes)
286
+ && o.childNodes.every((v) => isFtSearchFacetEntry(v))))
287
+ && (isString(o.label))
288
+ && (isString(o.value))
289
+ && (isBoolean(o.selected));
290
+ };
291
+ export const isFtSearchSortCriterion = (o) => {
292
+ return isObject(o)
293
+ && (isString(o.key));
294
+ };
295
+ export const isFtSpellcheck = (o) => {
296
+ return isObject(o)
297
+ && (isString(o.suggestedQuery))
298
+ && (isString(o.htmlSuggestedQuery));
299
+ };
300
+ export const isFtTopicResource = (o) => {
301
+ return isObject(o)
302
+ && (isString(o.filename))
303
+ && (isString(o.resourceUrl))
304
+ && (isString(o.id))
305
+ && (isString(o.mimeType))
306
+ && (isString(o.resourceContentUrl))
307
+ && (isString(o.viewerUrl));
308
+ };
309
+ export const isFtSuggestRequest = (o) => {
310
+ return isObject(o)
311
+ && (isString(o.input))
312
+ && ((Array.isArray(o.filters)
313
+ && o.filters.every((v) => isFtSearchFilter(v))))
314
+ && ((Array.isArray(o.sort)
315
+ && o.sort.every((v) => isFtSearchSortCriterion(v))))
316
+ && (o.maxCount == null || isNumber(o.maxCount))
317
+ && (o.contentLocale == null || isString(o.contentLocale));
318
+ };
319
+ export const isFtSuggestResult = (o) => {
320
+ return isObject(o)
321
+ && (o.filenameExtension == null || isString(o.filenameExtension))
322
+ && (o.editorialType == null || isFtEditorialType(o.editorialType))
323
+ && (o.mimeType == null || isString(o.mimeType))
324
+ && (isFtSearchResultType(o.type))
325
+ && (isString(o.value));
326
+ };
327
+ export const isFtSuggestResults = (o) => {
328
+ return isObject(o)
329
+ && ((Array.isArray(o.suggestions)
330
+ && o.suggestions.every((v) => isFtSuggestResult(v))));
331
+ };
332
+ export const isFtAuthenticationIdentifier = (o) => {
333
+ return isObject(o)
334
+ && (isString(o.identifier))
335
+ && (isString(o.realm));
336
+ };
@@ -0,0 +1,25 @@
1
+ const isObject = (o) => typeof o === "object" && o != null;
2
+ const isBoolean = (o) => typeof o === "boolean";
3
+ const isNumber = (o) => typeof o === "number";
4
+ const isString = (o) => typeof o === "string";
5
+ export const isFtAuthenticatedSession = (o) => {
6
+ return isObject(o)
7
+ && (isFtUserProfile(o.profile));
8
+ };
9
+ export const isFtUserProfile = (o) => {
10
+ return isObject(o)
11
+ && (o.emailAddress == null || isString(o.emailAddress))
12
+ && (o.displayName == null || isString(o.displayName))
13
+ && ((Array.isArray(o.roles)))
14
+ && (isString(o.userId));
15
+ };
16
+ export const isFtMapAttachment = (o) => {
17
+ return isObject(o)
18
+ && (isString(o.file))
19
+ && (o.size == null || isNumber(o.size))
20
+ && (isBoolean(o.externalLink))
21
+ && (isString(o.name))
22
+ && (isString(o.id))
23
+ && (o.mimeType == null || isString(o.mimeType))
24
+ && (o.viewerUrl == null || isString(o.viewerUrl));
25
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/public-api",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "Fluid Topics Public API",
5
5
  "author": "Fluid Topics dev team <opensource@antidot.net>",
6
6
  "license": "LGPLv3",