@fluid-topics/public-api 1.0.75 → 1.0.76-alpha

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.
Files changed (34) hide show
  1. package/dist/cjs/index.js +7 -7
  2. package/dist/cjs/roles/roles.js +7 -7
  3. package/dist/mjs/index.d.ts +7 -7
  4. package/dist/mjs/index.js +5 -5
  5. package/dist/mjs/preferences/unauthenticated-preferences.d.ts +1 -1
  6. package/dist/mjs/roles/roles.d.ts +1 -1
  7. package/dist/mjs/roles/roles.js +1 -1
  8. package/package.json +1 -1
  9. package/build/cjs/helpers/GenAIChunkReader.js +0 -66
  10. package/build/cjs/index.js +0 -476
  11. package/build/cjs/preferences/unauthenticated-preferences.js +0 -67
  12. package/build/cjs/roles/roles.js +0 -31
  13. package/build/cjs/types/ft-common/public.js +0 -848
  14. package/build/cjs/types/ft-server/public.js +0 -146
  15. package/build/mjs/helpers/GenAIChunkReader.d.ts +0 -19
  16. package/build/mjs/helpers/GenAIChunkReader.js +0 -37
  17. package/build/mjs/index.d.ts +0 -190
  18. package/build/mjs/index.js +0 -432
  19. package/build/mjs/preferences/unauthenticated-preferences.d.ts +0 -9
  20. package/build/mjs/preferences/unauthenticated-preferences.js +0 -61
  21. package/build/mjs/roles/roles.d.ts +0 -2
  22. package/build/mjs/roles/roles.js +0 -25
  23. package/build/mjs/types/ft-common/public.d.ts +0 -657
  24. package/build/mjs/types/ft-common/public.js +0 -762
  25. package/build/mjs/types/ft-server/public.d.ts +0 -104
  26. package/build/mjs/types/ft-server/public.js +0 -127
  27. package/build/rollup/fluidtopics.min.js +0 -1
  28. package/build/test-results/public-api.xml +0 -18
  29. package/build/test-results/web-components.xml +0 -12
  30. package/packages/cjs/package.json +0 -3
  31. package/packages/mjs/package.json +0 -3
  32. package/test-browser/helpers/GenAIChunkReader.test.ts +0 -54
  33. package/vite-plugin.mjs +0 -95
  34. package/web-test-runner.config.mjs +0 -58
package/dist/cjs/index.js CHANGED
@@ -52,12 +52,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
52
52
  Object.defineProperty(exports, "__esModule", { value: true });
53
53
  exports.FluidTopicsApi = exports.HttpErrorEvent = exports.HttpError = void 0;
54
54
  const cross_fetch_1 = __importDefault(require("cross-fetch"));
55
- const GenAIChunkReader_1 = require("./helpers/GenAIChunkReader");
55
+ const GenAIChunkReader_js_1 = require("./helpers/GenAIChunkReader.js");
56
56
  const wnd = (typeof window === "undefined" ? globalThis : window);
57
- __exportStar(require("./types/ft-common/public"), exports);
58
- __exportStar(require("./types/ft-server/public"), exports);
59
- __exportStar(require("./roles/roles"), exports);
60
- __exportStar(require("./preferences/unauthenticated-preferences"), exports);
57
+ __exportStar(require("./types/ft-common/public.js"), exports);
58
+ __exportStar(require("./types/ft-server/public.js"), exports);
59
+ __exportStar(require("./roles/roles.js"), exports);
60
+ __exportStar(require("./preferences/unauthenticated-preferences.js"), exports);
61
61
  function toBase64(s) {
62
62
  return typeof Buffer !== "undefined" ? Buffer.from(s).toString("base64") : btoa(s);
63
63
  }
@@ -376,7 +376,7 @@ class FluidTopicsApi {
376
376
  credentials: this.authorization == null ? "include" : undefined
377
377
  }));
378
378
  yield __await(handleError("POST", this.endpoints.ai.generate, response));
379
- const reader = new GenAIChunkReader_1.GenAIChunkReader(response.body.getReader());
379
+ const reader = new GenAIChunkReader_js_1.GenAIChunkReader(response.body.getReader());
380
380
  yield __await(yield* __asyncDelegator(__asyncValues(reader.read())));
381
381
  });
382
382
  }
@@ -391,7 +391,7 @@ class FluidTopicsApi {
391
391
  credentials: this.authorization == null ? "include" : undefined
392
392
  }));
393
393
  yield __await(handleError("POST", this.endpoints.ai.chat, response));
394
- const reader = new GenAIChunkReader_1.GenAIChunkReader(response.body.getReader());
394
+ const reader = new GenAIChunkReader_js_1.GenAIChunkReader(response.body.getReader());
395
395
  yield __await(yield* __asyncDelegator(__asyncValues(reader.read())));
396
396
  });
397
397
  }
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.userHasRole = void 0;
4
- const public_1 = require("../types/ft-common/public");
4
+ const public_js_1 = require("../types/ft-common/public.js");
5
5
  const rolesInheritance = {
6
- [public_1.FtUserRole.PERSONAL_BOOK_SHARE_USER]: [public_1.FtUserRole.PERSONAL_BOOK_USER],
7
- [public_1.FtUserRole.HTML_EXPORT_USER]: [public_1.FtUserRole.PERSONAL_BOOK_USER],
8
- [public_1.FtUserRole.PDF_EXPORT_USER]: [public_1.FtUserRole.PERSONAL_BOOK_USER],
9
- [public_1.FtUserRole.KHUB_ADMIN]: [public_1.FtUserRole.CONTENT_PUBLISHER],
10
- [public_1.FtUserRole.ADMIN]: [public_1.FtUserRole.KHUB_ADMIN, public_1.FtUserRole.USERS_ADMIN, public_1.FtUserRole.PORTAL_ADMIN],
11
- [public_1.FtUserRole.DEVELOPER]: [public_1.FtUserRole.BETA_USER, public_1.FtUserRole.DEBUG_USER],
6
+ [public_js_1.FtUserRole.PERSONAL_BOOK_SHARE_USER]: [public_js_1.FtUserRole.PERSONAL_BOOK_USER],
7
+ [public_js_1.FtUserRole.HTML_EXPORT_USER]: [public_js_1.FtUserRole.PERSONAL_BOOK_USER],
8
+ [public_js_1.FtUserRole.PDF_EXPORT_USER]: [public_js_1.FtUserRole.PERSONAL_BOOK_USER],
9
+ [public_js_1.FtUserRole.KHUB_ADMIN]: [public_js_1.FtUserRole.CONTENT_PUBLISHER],
10
+ [public_js_1.FtUserRole.ADMIN]: [public_js_1.FtUserRole.KHUB_ADMIN, public_js_1.FtUserRole.USERS_ADMIN, public_js_1.FtUserRole.PORTAL_ADMIN],
11
+ [public_js_1.FtUserRole.DEVELOPER]: [public_js_1.FtUserRole.BETA_USER, public_js_1.FtUserRole.DEBUG_USER],
12
12
  };
13
13
  function roleMatches(actual, expected) {
14
14
  var _a;
@@ -1,10 +1,10 @@
1
- import { FtAuthenticatedSession, FtBookmark, FtCollectionDocument, FtHttpErrorDetails, FtMap, FtMapResource, FtMessageContext, FtMetadataConfiguration, FtMySearch, FtRatingSummary, FtRatingType, FtRatingTypeKeys, FtSearchLocales, FtSearchRequest, FtSearchResults, FtSession, FtSuggestRequest, FtSuggestResults, FtTocNode, FtTopic, FtTopicContentTarget, FtTopicContentTargetKeys, FtUiLocale, FtUnstructuredDocument } from "./types/ft-common/public";
2
- import { FtClusteredSemanticSearchReply, FtGenAIRating, FtMapAttachment, FtPaginatedToc, FtRagInput, FtReaderConfiguration, FtSemanticSearchRequest, FtSemanticSearchResponseItem } from "./types/ft-server/public";
3
- import { GenAIChunk } from "./helpers/GenAIChunkReader";
4
- export * from "./types/ft-common/public";
5
- export * from "./types/ft-server/public";
6
- export * from "./roles/roles";
7
- export * from "./preferences/unauthenticated-preferences";
1
+ import { FtAuthenticatedSession, FtBookmark, FtCollectionDocument, FtHttpErrorDetails, FtMap, FtMapResource, FtMessageContext, FtMetadataConfiguration, FtMySearch, FtRatingSummary, FtRatingType, FtRatingTypeKeys, FtSearchLocales, FtSearchRequest, FtSearchResults, FtSession, FtSuggestRequest, FtSuggestResults, FtTocNode, FtTopic, FtTopicContentTarget, FtTopicContentTargetKeys, FtUiLocale, FtUnstructuredDocument } from "./types/ft-common/public.js";
2
+ import { FtClusteredSemanticSearchReply, FtGenAIRating, FtMapAttachment, FtPaginatedToc, FtRagInput, FtReaderConfiguration, FtSemanticSearchRequest, FtSemanticSearchResponseItem } from "./types/ft-server/public.js";
3
+ import { GenAIChunk } from "./helpers/GenAIChunkReader.js";
4
+ export * from "./types/ft-common/public.js";
5
+ export * from "./types/ft-server/public.js";
6
+ export * from "./roles/roles.js";
7
+ export * from "./preferences/unauthenticated-preferences.js";
8
8
  export declare class HttpError extends Error {
9
9
  readonly method: string;
10
10
  readonly endpoint: string;
package/dist/mjs/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import fetch from "cross-fetch";
2
- import { GenAIChunkReader } from "./helpers/GenAIChunkReader";
2
+ import { GenAIChunkReader } from "./helpers/GenAIChunkReader.js";
3
3
  const wnd = (typeof window === "undefined" ? globalThis : window);
4
- export * from "./types/ft-common/public";
5
- export * from "./types/ft-server/public";
6
- export * from "./roles/roles";
7
- export * from "./preferences/unauthenticated-preferences";
4
+ export * from "./types/ft-common/public.js";
5
+ export * from "./types/ft-server/public.js";
6
+ export * from "./roles/roles.js";
7
+ export * from "./preferences/unauthenticated-preferences.js";
8
8
  function toBase64(s) {
9
9
  return typeof Buffer !== "undefined" ? Buffer.from(s).toString("base64") : btoa(s);
10
10
  }
@@ -1,4 +1,4 @@
1
- import { FtMetadataPreferenceConfiguration, FtSearchPreferencesConfiguration } from "../types/ft-common/public";
1
+ import { FtMetadataPreferenceConfiguration, FtSearchPreferencesConfiguration } from "../types/ft-common/public.js";
2
2
  export declare function setUnauthenticatedUserSearchPreferences(tenantBaseUrl: string, input: FtSearchPreferencesConfiguration): {
3
3
  metadata: Record<string, FtMetadataPreferenceConfiguration>;
4
4
  };
@@ -1,2 +1,2 @@
1
- import { FtSession, FtUserProfile, FtUserRole, FtUserRoleKeys } from "../types/ft-common/public";
1
+ import { FtSession, FtUserProfile, FtUserRole, FtUserRoleKeys } from "../types/ft-common/public.js";
2
2
  export declare function userHasRole(sessionOrProfileOrRoles: FtSession | FtUserProfile | Array<FtUserRole | FtUserRoleKeys> | undefined, expectedRole: FtUserRole | FtUserRoleKeys): boolean;
@@ -1,4 +1,4 @@
1
- import { FtUserRole } from "../types/ft-common/public";
1
+ import { FtUserRole } from "../types/ft-common/public.js";
2
2
  const rolesInheritance = {
3
3
  [FtUserRole.PERSONAL_BOOK_SHARE_USER]: [FtUserRole.PERSONAL_BOOK_USER],
4
4
  [FtUserRole.HTML_EXPORT_USER]: [FtUserRole.PERSONAL_BOOK_USER],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/public-api",
3
- "version": "1.0.75",
3
+ "version": "1.0.76-alpha",
4
4
  "description": "Fluid Topics Public API",
5
5
  "author": "Fluid Topics dev team <opensource@antidot.net>",
6
6
  "license": "LGPL-3.0-only",
@@ -1,66 +0,0 @@
1
- "use strict";
2
- var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
3
- var __asyncValues = (this && this.__asyncValues) || function (o) {
4
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
5
- var m = o[Symbol.asyncIterator], i;
6
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
7
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
8
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
9
- };
10
- var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {
11
- var i, p;
12
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
13
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
14
- };
15
- var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
16
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
17
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
18
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
19
- function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
20
- function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
21
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
22
- function fulfill(value) { resume("next", value); }
23
- function reject(value) { resume("throw", value); }
24
- function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
25
- };
26
- Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.GenAIChunkReader = void 0;
28
- class GenAIChunkReader {
29
- constructor(reader) {
30
- this.reader = reader;
31
- this.decoder = new TextDecoder();
32
- this.partialChunk = "";
33
- }
34
- read() {
35
- return __asyncGenerator(this, arguments, function* read_1() {
36
- while (true) {
37
- const { done, value } = yield __await(this.reader.read());
38
- if (done) {
39
- yield __await(yield* __asyncDelegator(__asyncValues(this.readRemainingChunks())));
40
- return yield __await(void 0);
41
- }
42
- else {
43
- yield __await(yield* __asyncDelegator(__asyncValues(this.readChunksFromValue(value))));
44
- }
45
- }
46
- });
47
- }
48
- *readRemainingChunks() {
49
- yield* this.parseLine(this.partialChunk);
50
- }
51
- *readChunksFromValue(value) {
52
- const text = this.partialChunk + this.decoder.decode(value);
53
- const lines = text.split("\n");
54
- this.partialChunk = lines.pop();
55
- for (let line of lines) {
56
- yield* this.parseLine(line);
57
- }
58
- }
59
- *parseLine(line) {
60
- const [type, content] = line.split(/:(.*)/);
61
- if (type == "data" && content.length > 0) {
62
- yield JSON.parse(content);
63
- }
64
- }
65
- }
66
- exports.GenAIChunkReader = GenAIChunkReader;