@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.
- package/dist/cjs/index.js +7 -7
- package/dist/cjs/roles/roles.js +7 -7
- package/dist/mjs/index.d.ts +7 -7
- package/dist/mjs/index.js +5 -5
- package/dist/mjs/preferences/unauthenticated-preferences.d.ts +1 -1
- package/dist/mjs/roles/roles.d.ts +1 -1
- package/dist/mjs/roles/roles.js +1 -1
- package/package.json +1 -1
- package/build/cjs/helpers/GenAIChunkReader.js +0 -66
- package/build/cjs/index.js +0 -476
- package/build/cjs/preferences/unauthenticated-preferences.js +0 -67
- package/build/cjs/roles/roles.js +0 -31
- package/build/cjs/types/ft-common/public.js +0 -848
- package/build/cjs/types/ft-server/public.js +0 -146
- package/build/mjs/helpers/GenAIChunkReader.d.ts +0 -19
- package/build/mjs/helpers/GenAIChunkReader.js +0 -37
- package/build/mjs/index.d.ts +0 -190
- package/build/mjs/index.js +0 -432
- package/build/mjs/preferences/unauthenticated-preferences.d.ts +0 -9
- package/build/mjs/preferences/unauthenticated-preferences.js +0 -61
- package/build/mjs/roles/roles.d.ts +0 -2
- package/build/mjs/roles/roles.js +0 -25
- package/build/mjs/types/ft-common/public.d.ts +0 -657
- package/build/mjs/types/ft-common/public.js +0 -762
- package/build/mjs/types/ft-server/public.d.ts +0 -104
- package/build/mjs/types/ft-server/public.js +0 -127
- package/build/rollup/fluidtopics.min.js +0 -1
- package/build/test-results/public-api.xml +0 -18
- package/build/test-results/web-components.xml +0 -12
- package/packages/cjs/package.json +0 -3
- package/packages/mjs/package.json +0 -3
- package/test-browser/helpers/GenAIChunkReader.test.ts +0 -54
- package/vite-plugin.mjs +0 -95
- 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
|
|
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
|
|
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
|
|
394
|
+
const reader = new GenAIChunkReader_js_1.GenAIChunkReader(response.body.getReader());
|
|
395
395
|
yield __await(yield* __asyncDelegator(__asyncValues(reader.read())));
|
|
396
396
|
});
|
|
397
397
|
}
|
package/dist/cjs/roles/roles.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.userHasRole = void 0;
|
|
4
|
-
const
|
|
4
|
+
const public_js_1 = require("../types/ft-common/public.js");
|
|
5
5
|
const rolesInheritance = {
|
|
6
|
-
[
|
|
7
|
-
[
|
|
8
|
-
[
|
|
9
|
-
[
|
|
10
|
-
[
|
|
11
|
-
[
|
|
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;
|
package/dist/mjs/index.d.ts
CHANGED
|
@@ -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;
|
package/dist/mjs/roles/roles.js
CHANGED
|
@@ -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,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;
|