@onlive.ai/common-121 0.2.66 → 0.2.163
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/README.md +0 -1
- package/components/asset/asset-modal-portal.cjs +550 -0
- package/components/asset/asset-modal-portal.d.cts +22 -0
- package/components/asset/asset-modal-portal.d.ts +22 -0
- package/components/asset/asset-modal-portal.js +550 -0
- package/components/asset/asset.cjs +3536 -0
- package/components/asset/asset.d.cts +37 -0
- package/components/asset/asset.d.ts +37 -0
- package/components/asset/asset.js +3536 -0
- package/components/asset/asset.loaders.cjs +2 -0
- package/components/asset/asset.loaders.d.cts +17 -0
- package/components/asset/asset.loaders.d.ts +17 -0
- package/components/asset/asset.loaders.js +2 -0
- package/components/asset/asset.renderer.cjs +2292 -0
- package/components/asset/asset.renderer.d.cts +29 -0
- package/components/asset/asset.renderer.d.ts +29 -0
- package/components/asset/asset.renderer.js +2292 -0
- package/components/asset/asset.styles.cjs +683 -0
- package/components/asset/asset.styles.d.cts +6 -0
- package/components/asset/asset.styles.d.ts +6 -0
- package/components/asset/asset.styles.js +683 -0
- package/components/asset/asset.types.cjs +2 -0
- package/components/asset/asset.types.d.cts +103 -0
- package/components/asset/asset.types.d.ts +103 -0
- package/components/asset/asset.types.js +1 -0
- package/components/asset/index.cjs +3536 -0
- package/components/asset/index.d.cts +8 -0
- package/components/asset/index.d.ts +8 -0
- package/components/asset/index.js +3536 -0
- package/components/player/player.cjs +2044 -0
- package/components/player/player.d.cts +25 -0
- package/components/player/player.d.ts +25 -0
- package/components/player/player.js +2044 -0
- package/components/player/player.styles.cjs +16 -0
- package/components/player/player.styles.d.cts +6 -0
- package/components/player/player.styles.d.ts +6 -0
- package/components/player/player.styles.js +16 -0
- package/components/side-bar/index.cjs +3185 -0
- package/components/side-bar/index.d.cts +11 -0
- package/components/side-bar/index.d.ts +11 -0
- package/components/side-bar/index.js +3185 -0
- package/components/side-bar/side-bar.cjs +3185 -0
- package/components/side-bar/side-bar.d.cts +83 -0
- package/components/side-bar/side-bar.d.ts +83 -0
- package/components/side-bar/side-bar.js +3185 -0
- package/components/side-bar/side-bar.styles.cjs +801 -0
- package/components/side-bar/side-bar.styles.d.cts +6 -0
- package/components/side-bar/side-bar.styles.d.ts +6 -0
- package/components/side-bar/side-bar.styles.js +801 -0
- package/components/side-bar/side-bar.types.cjs +2 -0
- package/components/side-bar/side-bar.types.d.cts +105 -0
- package/components/side-bar/side-bar.types.d.ts +105 -0
- package/components/side-bar/side-bar.types.js +2 -0
- package/components/upload/index.cjs +83 -0
- package/components/upload/index.d.cts +4 -0
- package/components/upload/index.d.ts +4 -0
- package/components/upload/index.js +83 -0
- package/components/upload/upload.cjs +83 -0
- package/components/upload/upload.d.cts +28 -0
- package/components/upload/upload.d.ts +28 -0
- package/components/upload/upload.js +83 -0
- package/components/upload/upload.styles.cjs +65 -0
- package/components/upload/upload.styles.d.cts +6 -0
- package/components/upload/upload.styles.d.ts +6 -0
- package/components/upload/upload.styles.js +65 -0
- package/components/upload/upload.types.cjs +2 -0
- package/components/upload/upload.types.d.cts +16 -0
- package/components/upload/upload.types.d.ts +16 -0
- package/components/upload/upload.types.js +1 -0
- package/index.cjs +4677 -0
- package/index.d.cts +338 -0
- package/index.d.ts +338 -0
- package/index.js +4677 -0
- package/package.json +32 -11
- package/react/components/asset/Asset.cjs +2 -0
- package/react/components/asset/Asset.d.cts +33 -0
- package/react/components/asset/Asset.d.ts +33 -0
- package/react/components/asset/Asset.jsx +2 -0
- package/react/components/side-bar/SideBar.cjs +2 -0
- package/react/components/side-bar/SideBar.d.cts +37 -0
- package/react/components/side-bar/SideBar.d.ts +37 -0
- package/react/components/side-bar/SideBar.jsx +2 -0
- package/react/components/upload/Upload.cjs +2 -0
- package/react/components/upload/Upload.d.cts +23 -0
- package/react/components/upload/Upload.d.ts +23 -0
- package/react/components/upload/Upload.jsx +2 -0
- package/services/audio.service.cjs +2 -2
- package/services/audio.service.d.cts +1 -0
- package/services/audio.service.d.ts +1 -0
- package/services/audio.service.js +2 -2
- package/services/conversation/conversation.service.cjs +2 -0
- package/services/conversation/conversation.service.d.cts +533 -0
- package/services/conversation/conversation.service.d.ts +533 -0
- package/services/conversation/conversation.service.js +2 -0
- package/services/conversation/conversation.types.cjs +2 -0
- package/services/conversation/conversation.types.d.cts +519 -0
- package/services/conversation/conversation.types.d.ts +519 -0
- package/services/conversation/conversation.types.js +2 -0
- package/services/conversation/index.cjs +2 -0
- package/services/conversation/index.d.cts +7 -0
- package/services/conversation/index.d.ts +7 -0
- package/services/conversation/index.js +2 -0
- package/services/faqs/faqs.service.cjs +2 -0
- package/services/faqs/faqs.service.d.cts +16 -0
- package/services/faqs/faqs.service.d.ts +16 -0
- package/services/faqs/faqs.service.js +2 -0
- package/services/faqs/faqs.types.cjs +2 -0
- package/services/faqs/faqs.types.d.cts +60 -0
- package/services/faqs/faqs.types.d.ts +60 -0
- package/services/faqs/faqs.types.js +1 -0
- package/services/faqs/index.cjs +2 -0
- package/services/faqs/index.d.cts +3 -0
- package/services/faqs/index.d.ts +3 -0
- package/services/faqs/index.js +2 -0
- package/services/file/file.service.cjs +2 -0
- package/services/file/file.service.d.cts +66 -0
- package/services/file/file.service.d.ts +66 -0
- package/services/file/file.service.js +2 -0
- package/services/file/file.types.cjs +2 -0
- package/services/file/file.types.d.cts +72 -0
- package/services/file/file.types.d.ts +72 -0
- package/services/file/file.types.js +1 -0
- package/services/file/index.cjs +2 -0
- package/services/file/index.d.cts +3 -0
- package/services/file/index.d.ts +3 -0
- package/services/file/index.js +2 -0
- package/services/firebase/firebase-api.cjs +2 -2
- package/services/firebase/firebase-api.d.cts +25 -9
- package/services/firebase/firebase-api.d.ts +25 -9
- package/services/firebase/firebase-api.js +2 -2
- package/services/multimedia/config.example.cjs +2 -0
- package/services/multimedia/config.example.d.cts +13 -0
- package/services/multimedia/config.example.d.ts +13 -0
- package/services/multimedia/config.example.js +2 -0
- package/services/multimedia/index.cjs +2 -0
- package/services/multimedia/index.d.cts +3 -0
- package/services/multimedia/index.d.ts +3 -0
- package/services/multimedia/index.js +2 -0
- package/services/multimedia/multimedia.service.cjs +2 -0
- package/services/multimedia/multimedia.service.d.cts +28 -0
- package/services/multimedia/multimedia.service.d.ts +28 -0
- package/services/multimedia/multimedia.service.js +2 -0
- package/services/multimedia/multimedia.types.cjs +2 -0
- package/services/multimedia/multimedia.types.d.cts +65 -0
- package/services/multimedia/multimedia.types.d.ts +65 -0
- package/services/multimedia/multimedia.types.js +1 -0
- package/services/product/index.cjs +2 -0
- package/services/product/index.d.cts +3 -0
- package/services/product/index.d.ts +3 -0
- package/services/product/index.js +2 -0
- package/services/product/product.service.cjs +2 -0
- package/services/product/product.service.d.cts +19 -0
- package/services/product/product.service.d.ts +19 -0
- package/services/product/product.service.js +2 -0
- package/services/product/product.types.cjs +2 -0
- package/services/product/product.types.d.cts +78 -0
- package/services/product/product.types.d.ts +78 -0
- package/services/product/product.types.js +1 -0
- package/services/request.provider.cjs +1 -1
- package/services/request.provider.d.cts +1 -0
- package/services/request.provider.d.ts +1 -0
- package/services/request.provider.js +1 -1
- package/services/session.service.cjs +2 -0
- package/services/session.service.d.cts +70 -0
- package/services/session.service.d.ts +70 -0
- package/services/session.service.js +2 -0
- package/services/upload/index.cjs +2 -0
- package/services/upload/index.d.cts +2 -0
- package/services/upload/index.d.ts +2 -0
- package/services/upload/index.js +2 -0
- package/services/upload/upload.service.cjs +2 -0
- package/services/upload/upload.service.d.cts +81 -0
- package/services/upload/upload.service.d.ts +81 -0
- package/services/upload/upload.service.js +2 -0
- package/themes/dark.cjs +4 -1
- package/themes/dark.d.cts +1 -0
- package/themes/dark.d.ts +1 -0
- package/themes/dark.js +4 -1
- package/themes/light.cjs +1 -1
- package/themes/light.d.cts +1 -0
- package/themes/light.d.ts +1 -0
- package/themes/light.js +1 -1
- package/types/globals.cjs +2 -0
- package/types/globals.d.cts +39 -0
- package/types/globals.d.ts +39 -0
- package/types/globals.js +1 -0
- package/types/tracking-options.cjs +2 -2
- package/types/tracking-options.d.cts +8 -6
- package/types/tracking-options.d.ts +8 -6
- package/types/tracking-options.js +1 -1
- package/utils/adopt-styles.cjs +2 -2
- package/utils/adopt-styles.d.cts +1 -0
- package/utils/adopt-styles.d.ts +1 -0
- package/utils/adopt-styles.js +2 -2
- package/utils/browser-preferences.cjs +2 -2
- package/utils/browser-preferences.d.cts +1 -0
- package/utils/browser-preferences.d.ts +1 -0
- package/utils/browser-preferences.js +2 -2
- package/utils/classify-media.cjs +1 -1
- package/utils/classify-media.d.cts +1 -0
- package/utils/classify-media.d.ts +1 -0
- package/utils/classify-media.js +1 -1
- package/utils/decorators.cjs +1 -1
- package/utils/decorators.d.cts +1 -0
- package/utils/decorators.d.ts +1 -0
- package/utils/decorators.js +1 -1
- package/utils/detected-lang.cjs +2 -2
- package/utils/detected-lang.d.cts +1 -0
- package/utils/detected-lang.d.ts +1 -0
- package/utils/detected-lang.js +2 -2
- package/utils/fullscreen.cjs +2 -2
- package/utils/fullscreen.d.cts +6 -5
- package/utils/fullscreen.d.ts +6 -5
- package/utils/fullscreen.js +2 -2
- package/utils/insert-script.cjs +1 -1
- package/utils/insert-script.d.cts +1 -0
- package/utils/insert-script.d.ts +1 -0
- package/utils/insert-script.js +1 -1
- package/utils/is-map-compatible.cjs +1 -1
- package/utils/is-map-compatible.d.cts +1 -0
- package/utils/is-map-compatible.d.ts +1 -0
- package/utils/is-map-compatible.js +1 -1
- package/utils/markdown.cjs +2 -2
- package/utils/markdown.d.cts +1 -0
- package/utils/markdown.d.ts +1 -0
- package/utils/markdown.js +2 -2
- package/utils/merge.cjs +2 -2
- package/utils/merge.d.cts +2 -1
- package/utils/merge.d.ts +2 -1
- package/utils/merge.js +2 -2
- package/utils/multiband-track-volume.cjs +2 -2
- package/utils/multiband-track-volume.d.cts +1 -0
- package/utils/multiband-track-volume.d.ts +1 -0
- package/utils/multiband-track-volume.js +2 -2
- package/utils/onlive-url-params.cjs +1 -1
- package/utils/onlive-url-params.d.cts +1 -0
- package/utils/onlive-url-params.d.ts +1 -0
- package/utils/onlive-url-params.js +1 -1
- package/utils/pretty-distance.cjs +2 -2
- package/utils/pretty-distance.d.cts +2 -1
- package/utils/pretty-distance.d.ts +2 -1
- package/utils/pretty-distance.js +2 -2
- package/utils/pretty-time.cjs +2 -0
- package/utils/pretty-time.d.cts +16 -0
- package/utils/pretty-time.d.ts +16 -0
- package/utils/pretty-time.js +2 -0
- package/utils/random-string.cjs +1 -1
- package/utils/random-string.d.cts +1 -0
- package/utils/random-string.d.ts +1 -0
- package/utils/random-string.js +1 -1
- package/utils/resource-type.cjs +1 -1
- package/utils/resource-type.d.cts +1 -0
- package/utils/resource-type.d.ts +1 -0
- package/utils/resource-type.js +1 -1
- package/utils/round-number.cjs +2 -0
- package/utils/round-number.d.cts +30 -0
- package/utils/round-number.d.ts +30 -0
- package/utils/round-number.js +2 -0
- package/utils/safe-html.cjs +2 -2
- package/utils/safe-html.d.cts +4 -3
- package/utils/safe-html.d.ts +4 -3
- package/utils/safe-html.js +2 -2
- package/utils/sanitize.cjs +2 -2
- package/utils/sanitize.d.cts +1 -0
- package/utils/sanitize.d.ts +1 -0
- package/utils/sanitize.js +2 -2
- package/utils/spread.cjs +2 -2
- package/utils/spread.d.cts +1 -0
- package/utils/spread.d.ts +1 -0
- package/utils/spread.js +2 -2
- package/utils/watch.cjs +1 -1
- package/utils/watch.d.cts +1 -0
- package/utils/watch.d.ts +1 -0
- package/utils/watch.js +1 -1
- package/services/firebase/firebase.service.cjs +0 -2
- package/services/firebase/firebase.service.d.cts +0 -40
- package/services/firebase/firebase.service.d.ts +0 -40
- package/services/firebase/firebase.service.js +0 -2
- package/services/livekit.service.cjs +0 -2
- package/services/livekit.service.d.cts +0 -217
- package/services/livekit.service.d.ts +0 -217
- package/services/livekit.service.js +0 -2
- package/types/window-context.cjs +0 -2
- package/types/window-context.d.cts +0 -8
- package/types/window-context.d.ts +0 -8
- package/types/window-context.js +0 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
import { FaqsServiceConfig, SettingsResponse, FaqsSearchParams, FaqsApiResponse, FaqItem } from './faqs.types.js';
|
|
3
|
+
|
|
4
|
+
declare class FaqsService {
|
|
5
|
+
private config;
|
|
6
|
+
constructor(config: FaqsServiceConfig);
|
|
7
|
+
static initialize(config: FaqsServiceConfig): FaqsService;
|
|
8
|
+
private getBaseUrl;
|
|
9
|
+
private getHeaders;
|
|
10
|
+
private makeRequest;
|
|
11
|
+
getSettingsByOrganization(organizationId: string, userGroupId?: string): Promise<SettingsResponse | null>;
|
|
12
|
+
getFaqs(params?: FaqsSearchParams): Promise<FaqsApiResponse>;
|
|
13
|
+
getFaqById(id: string): Promise<FaqItem>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { FaqsService };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
var o=class a{constructor(e){this.config=e}static initialize(e){return new a(e)}getBaseUrl(){return`${this.config.baseUrl}`}getHeaders(){return{"Content-Type":"application/json"}}async makeRequest(e,t={}){let i=`${this.getBaseUrl()}${e}`,s=await fetch(i,{...t,headers:{...this.getHeaders(),...t.headers}});if(!s.ok)throw new Error(`FAQs API error: ${s.status} ${s.statusText}`);return s.json()}async getSettingsByOrganization(e,t){try{let i=new URLSearchParams;t&&i.append("userGroupId",t);let s=i.toString(),n=`${this.getBaseUrl()}/settings/organization/${e}${s?`?${s}`:""}`,r=await fetch(n,{method:"GET",headers:this.getHeaders(),credentials:"include"});if(r.status===404)return null;if(!r.ok)throw new Error(`Failed to fetch settings: ${r.statusText}`);return await r.json()}catch(i){return console.error("Error fetching settings:",i),null}}async getFaqs(e={}){let t=new URLSearchParams;if(e.search&&t.append("search",e.search),e.organizationId&&t.append("organizationId",e.organizationId),e.groupId&&t.append("groupId",e.groupId),e.isActive!==void 0&&t.append("isActive",e.isActive.toString()),e.page&&t.append("page",e.page.toString()),e.limit&&t.append("limit",e.limit.toString()),e.sortBy&&t.append("sortBy",e.sortBy),e.sortOrder&&t.append("sortOrder",e.sortOrder),e.extraFilters){for(let[n,r]of Object.entries(e.extraFilters))if(r&&(Array.isArray(r)?r.length>0:r.toString().trim()!=="")){let g=Array.isArray(r)?r.join(","):r.toString();t.append(`extra_${n}`,g)}}let i=t.toString(),s=`/faqs${i?`?${i}`:""}`;return this.makeRequest(s)}async getFaqById(e){return this.makeRequest(`/faqs/${e}`,{})}};export{o as FaqsService};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
"use strict";var n=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var l=(e,t,a,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of o(t))!g.call(e,r)&&r!==a&&n(e,r,{get:()=>t[r],enumerable:!(i=s(t,r))||i.enumerable});return e};var p=e=>l(n({},"__esModule",{value:!0}),e);var d={};module.exports=p(d);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
interface FaqsServiceConfig {
|
|
3
|
+
baseUrl: string;
|
|
4
|
+
organizationId: string;
|
|
5
|
+
}
|
|
6
|
+
interface FaqItem {
|
|
7
|
+
id: string;
|
|
8
|
+
question: string;
|
|
9
|
+
answer: string;
|
|
10
|
+
organizationId: string;
|
|
11
|
+
groupId?: string | null;
|
|
12
|
+
priority: number;
|
|
13
|
+
isActive: boolean;
|
|
14
|
+
metadata?: any | null;
|
|
15
|
+
createdAt: string;
|
|
16
|
+
updatedAt: string;
|
|
17
|
+
createdBy?: string | null;
|
|
18
|
+
}
|
|
19
|
+
interface FaqsApiResponse {
|
|
20
|
+
data: FaqItem[];
|
|
21
|
+
total: number;
|
|
22
|
+
page: number;
|
|
23
|
+
limit: number;
|
|
24
|
+
totalPages: number;
|
|
25
|
+
hasNext: boolean;
|
|
26
|
+
hasPrev: boolean;
|
|
27
|
+
}
|
|
28
|
+
interface FaqsSearchParams {
|
|
29
|
+
search?: string;
|
|
30
|
+
organizationId?: string;
|
|
31
|
+
groupId?: string;
|
|
32
|
+
isActive?: boolean;
|
|
33
|
+
page?: number;
|
|
34
|
+
limit?: number;
|
|
35
|
+
sortBy?: string;
|
|
36
|
+
sortOrder?: "asc" | "desc";
|
|
37
|
+
extraFilters?: Record<string, string | string[]>;
|
|
38
|
+
}
|
|
39
|
+
type ExtraFilterType = "select" | "multiselect" | "text";
|
|
40
|
+
type ExtraFilterEntity = "all" | "assets" | "faqs" | "products" | "videos" | "images" | "presentations";
|
|
41
|
+
interface ExtraFilterConfig {
|
|
42
|
+
name: string;
|
|
43
|
+
type: ExtraFilterType;
|
|
44
|
+
label: string;
|
|
45
|
+
order: number;
|
|
46
|
+
entity: ExtraFilterEntity;
|
|
47
|
+
values?: string[];
|
|
48
|
+
enabled: boolean;
|
|
49
|
+
placeholder?: string;
|
|
50
|
+
}
|
|
51
|
+
interface SettingsResponse {
|
|
52
|
+
id: string;
|
|
53
|
+
organizationId: string;
|
|
54
|
+
userGroupId?: string | null;
|
|
55
|
+
extraFilters: ExtraFilterConfig[];
|
|
56
|
+
createdAt: string;
|
|
57
|
+
updatedAt: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export type { ExtraFilterConfig, ExtraFilterEntity, ExtraFilterType, FaqItem, FaqsApiResponse, FaqsSearchParams, FaqsServiceConfig, SettingsResponse };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
interface FaqsServiceConfig {
|
|
3
|
+
baseUrl: string;
|
|
4
|
+
organizationId: string;
|
|
5
|
+
}
|
|
6
|
+
interface FaqItem {
|
|
7
|
+
id: string;
|
|
8
|
+
question: string;
|
|
9
|
+
answer: string;
|
|
10
|
+
organizationId: string;
|
|
11
|
+
groupId?: string | null;
|
|
12
|
+
priority: number;
|
|
13
|
+
isActive: boolean;
|
|
14
|
+
metadata?: any | null;
|
|
15
|
+
createdAt: string;
|
|
16
|
+
updatedAt: string;
|
|
17
|
+
createdBy?: string | null;
|
|
18
|
+
}
|
|
19
|
+
interface FaqsApiResponse {
|
|
20
|
+
data: FaqItem[];
|
|
21
|
+
total: number;
|
|
22
|
+
page: number;
|
|
23
|
+
limit: number;
|
|
24
|
+
totalPages: number;
|
|
25
|
+
hasNext: boolean;
|
|
26
|
+
hasPrev: boolean;
|
|
27
|
+
}
|
|
28
|
+
interface FaqsSearchParams {
|
|
29
|
+
search?: string;
|
|
30
|
+
organizationId?: string;
|
|
31
|
+
groupId?: string;
|
|
32
|
+
isActive?: boolean;
|
|
33
|
+
page?: number;
|
|
34
|
+
limit?: number;
|
|
35
|
+
sortBy?: string;
|
|
36
|
+
sortOrder?: "asc" | "desc";
|
|
37
|
+
extraFilters?: Record<string, string | string[]>;
|
|
38
|
+
}
|
|
39
|
+
type ExtraFilterType = "select" | "multiselect" | "text";
|
|
40
|
+
type ExtraFilterEntity = "all" | "assets" | "faqs" | "products" | "videos" | "images" | "presentations";
|
|
41
|
+
interface ExtraFilterConfig {
|
|
42
|
+
name: string;
|
|
43
|
+
type: ExtraFilterType;
|
|
44
|
+
label: string;
|
|
45
|
+
order: number;
|
|
46
|
+
entity: ExtraFilterEntity;
|
|
47
|
+
values?: string[];
|
|
48
|
+
enabled: boolean;
|
|
49
|
+
placeholder?: string;
|
|
50
|
+
}
|
|
51
|
+
interface SettingsResponse {
|
|
52
|
+
id: string;
|
|
53
|
+
organizationId: string;
|
|
54
|
+
userGroupId?: string | null;
|
|
55
|
+
extraFilters: ExtraFilterConfig[];
|
|
56
|
+
createdAt: string;
|
|
57
|
+
updatedAt: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export type { ExtraFilterConfig, ExtraFilterEntity, ExtraFilterType, FaqItem, FaqsApiResponse, FaqsSearchParams, FaqsServiceConfig, SettingsResponse };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
"use strict";var c=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var u=(n,e)=>{for(var t in e)c(n,t,{get:e[t],enumerable:!0})},h=(n,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of f(e))!d.call(n,r)&&r!==t&&c(n,r,{get:()=>e[r],enumerable:!(s=p(e,r))||s.enumerable});return n};var q=n=>h(c({},"__esModule",{value:!0}),n);var l={};u(l,{FaqsService:()=>o});module.exports=q(l);var o=class n{constructor(e){this.config=e}static initialize(e){return new n(e)}getBaseUrl(){return`${this.config.baseUrl}`}getHeaders(){return{"Content-Type":"application/json"}}async makeRequest(e,t={}){let s=`${this.getBaseUrl()}${e}`,r=await fetch(s,{...t,headers:{...this.getHeaders(),...t.headers}});if(!r.ok)throw new Error(`FAQs API error: ${r.status} ${r.statusText}`);return r.json()}async getSettingsByOrganization(e,t){try{let s=new URLSearchParams;t&&s.append("userGroupId",t);let r=s.toString(),a=`${this.getBaseUrl()}/settings/organization/${e}${r?`?${r}`:""}`,i=await fetch(a,{method:"GET",headers:this.getHeaders(),credentials:"include"});if(i.status===404)return null;if(!i.ok)throw new Error(`Failed to fetch settings: ${i.statusText}`);return await i.json()}catch(s){return console.error("Error fetching settings:",s),null}}async getFaqs(e={}){let t=new URLSearchParams;if(e.search&&t.append("search",e.search),e.organizationId&&t.append("organizationId",e.organizationId),e.groupId&&t.append("groupId",e.groupId),e.isActive!==void 0&&t.append("isActive",e.isActive.toString()),e.page&&t.append("page",e.page.toString()),e.limit&&t.append("limit",e.limit.toString()),e.sortBy&&t.append("sortBy",e.sortBy),e.sortOrder&&t.append("sortOrder",e.sortOrder),e.extraFilters){for(let[a,i]of Object.entries(e.extraFilters))if(i&&(Array.isArray(i)?i.length>0:i.toString().trim()!=="")){let g=Array.isArray(i)?i.join(","):i.toString();t.append(`extra_${a}`,g)}}let s=t.toString(),r=`/faqs${s?`?${s}`:""}`;return this.makeRequest(r)}async getFaqById(e){return this.makeRequest(`/faqs/${e}`,{})}};0&&(module.exports={FaqsService});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
var o=class a{constructor(e){this.config=e}static initialize(e){return new a(e)}getBaseUrl(){return`${this.config.baseUrl}`}getHeaders(){return{"Content-Type":"application/json"}}async makeRequest(e,t={}){let s=`${this.getBaseUrl()}${e}`,i=await fetch(s,{...t,headers:{...this.getHeaders(),...t.headers}});if(!i.ok)throw new Error(`FAQs API error: ${i.status} ${i.statusText}`);return i.json()}async getSettingsByOrganization(e,t){try{let s=new URLSearchParams;t&&s.append("userGroupId",t);let i=s.toString(),n=`${this.getBaseUrl()}/settings/organization/${e}${i?`?${i}`:""}`,r=await fetch(n,{method:"GET",headers:this.getHeaders(),credentials:"include"});if(r.status===404)return null;if(!r.ok)throw new Error(`Failed to fetch settings: ${r.statusText}`);return await r.json()}catch(s){return console.error("Error fetching settings:",s),null}}async getFaqs(e={}){let t=new URLSearchParams;if(e.search&&t.append("search",e.search),e.organizationId&&t.append("organizationId",e.organizationId),e.groupId&&t.append("groupId",e.groupId),e.isActive!==void 0&&t.append("isActive",e.isActive.toString()),e.page&&t.append("page",e.page.toString()),e.limit&&t.append("limit",e.limit.toString()),e.sortBy&&t.append("sortBy",e.sortBy),e.sortOrder&&t.append("sortOrder",e.sortOrder),e.extraFilters){for(let[n,r]of Object.entries(e.extraFilters))if(r&&(Array.isArray(r)?r.length>0:r.toString().trim()!=="")){let c=Array.isArray(r)?r.join(","):r.toString();t.append(`extra_${n}`,c)}}let s=t.toString(),i=`/faqs${s?`?${s}`:""}`;return this.makeRequest(i)}async getFaqById(e){return this.makeRequest(`/faqs/${e}`,{})}};export{o as FaqsService};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
"use strict";var l=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var h=(i,e)=>{for(var t in e)l(i,t,{get:e[t],enumerable:!0})},U=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of f(e))!g.call(i,s)&&s!==t&&l(i,s,{get:()=>e[s],enumerable:!(r=d(e,s))||r.enumerable});return i};var m=i=>U(l({},"__esModule",{value:!0}),i);var y={};h(y,{FileService:()=>a,getFileService:()=>F});module.exports=m(y);var c=async(i,e)=>{let t=await fetch(i,e);if(!t.ok){let r=await t.json().catch(()=>({}));throw new Error(JSON.stringify({status:t.status,statusText:t.statusText,...r}))}return t&&t.json()};var a=class i{constructor(e){this.config=e,this.enableUpload=e.enableUpload||!1}static getInstance(e){if(!i.instance&&e&&(i.instance=new i(e)),!i.instance)throw new Error("FileService must be initialized with config first");return i.instance}static initialize(e){return i.instance=new i(e),i.instance}async uploadFile(e,t={}){try{let r=await this.requestSignedUrl({filename:e.name,description:t.description,loadDirection:"up",bucketType:t.bucketType||"conversations",path:t.path||".temp",mimeType:e.type});return await this.uploadToSignedUrl(r.data.signedUrlData.signedUrl,e),{success:!0,id:r.data.file.id,name:r.data.file.name,url:r.data.file.url,type:r.data.file.type}}catch(r){return console.error("Error uploading file:",r),{success:!1,error:r instanceof Error?r.message:"Unknown error"}}}async requestSignedUrl(e){let t=`${this.config.baseUrl}/files/upload-url`;return this.makeRequest(t,{method:"POST",body:JSON.stringify(e)})}async uploadToSignedUrl(e,t){let r=await fetch(e,{method:"PUT",body:t,headers:{"Content-Type":t.type}});if(!r.ok){let s=await r.text().catch(()=>"No response");throw new Error(`Upload failed with status: ${r.status}. Response: ${s}`)}}async uploadFileWithRetry(e,t={}){let r=t.maxRetries||3,s=null;for(let o=1;o<=r;o++)try{let n=await this.uploadFile(e,t);if(n.success)return n;throw new Error(n.error||"Upload failed")}catch(n){if(s=n instanceof Error?n:new Error("Unknown error"),o===r)break;let p=2**o*1e3;await new Promise(u=>setTimeout(u,p))}return{success:!1,error:s?.message||"Upload failed after retries"}}async getFileById(e){let t=`${this.config.baseUrl}/files/${e}`,r=await this.makeRequest(t);if(!r.success)throw new Error("Failed to get file");return r.data}async makeRequest(e,t){let r={"Content-Type":"application/json"};return this.config.organizationId&&(r["X-Onlive-Organization-Id"]=this.config.organizationId),t?.headers&&Object.assign(r,t.headers),c(e,{...t,headers:r})}updateConfig(e){this.config={...this.config,...e}}getConfig(){return{...this.config}}},F=()=>a.getInstance();0&&(module.exports={FileService,getFileService});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
import { FileServiceConfig, FileUploadOptions, FileUploadResult, FileResponse } from './file.types.cjs';
|
|
3
|
+
|
|
4
|
+
declare class FileService {
|
|
5
|
+
private static instance;
|
|
6
|
+
private config;
|
|
7
|
+
enableUpload: boolean;
|
|
8
|
+
private constructor();
|
|
9
|
+
static getInstance(config?: FileServiceConfig): FileService;
|
|
10
|
+
static initialize(config: FileServiceConfig): FileService;
|
|
11
|
+
/**
|
|
12
|
+
* Upload a file using the signed URL approach
|
|
13
|
+
* @param file - File to upload
|
|
14
|
+
* @param options - Upload options
|
|
15
|
+
* @returns Upload result with file information
|
|
16
|
+
*/
|
|
17
|
+
uploadFile(file: File, options?: FileUploadOptions): Promise<FileUploadResult>;
|
|
18
|
+
/**
|
|
19
|
+
* Step 1: Request signed URL from backend
|
|
20
|
+
* @param payload - Upload URL request payload
|
|
21
|
+
* @returns Upload URL response with signed URL and file info
|
|
22
|
+
*/
|
|
23
|
+
private requestSignedUrl;
|
|
24
|
+
/**
|
|
25
|
+
* Step 2: Upload file to signed URL
|
|
26
|
+
* @param signedUrl - Signed URL from backend
|
|
27
|
+
* @param file - File to upload
|
|
28
|
+
* @param onProgress - Progress callback (optional, uses XHR if provided)
|
|
29
|
+
*/
|
|
30
|
+
private uploadToSignedUrl;
|
|
31
|
+
/**
|
|
32
|
+
* Upload file with retry logic
|
|
33
|
+
* @param file - File to upload
|
|
34
|
+
* @param options - Upload options with max retries
|
|
35
|
+
* @returns Upload result
|
|
36
|
+
*/
|
|
37
|
+
uploadFileWithRetry(file: File, options?: FileUploadOptions & {
|
|
38
|
+
maxRetries?: number;
|
|
39
|
+
}): Promise<FileUploadResult>;
|
|
40
|
+
/**
|
|
41
|
+
* Get file by ID (if backend provides this endpoint)
|
|
42
|
+
* @param fileId - File ID
|
|
43
|
+
* @returns File information
|
|
44
|
+
*/
|
|
45
|
+
getFileById(fileId: string): Promise<FileResponse>;
|
|
46
|
+
/**
|
|
47
|
+
* Make HTTP request with proper headers
|
|
48
|
+
* @param url - Request URL
|
|
49
|
+
* @param init - Request init options
|
|
50
|
+
* @returns Promise with response data
|
|
51
|
+
*/
|
|
52
|
+
private makeRequest;
|
|
53
|
+
/**
|
|
54
|
+
* Update configuration
|
|
55
|
+
* @param config - Partial configuration to update
|
|
56
|
+
*/
|
|
57
|
+
updateConfig(config: Partial<FileServiceConfig>): void;
|
|
58
|
+
/**
|
|
59
|
+
* Get current configuration
|
|
60
|
+
* @returns Current configuration
|
|
61
|
+
*/
|
|
62
|
+
getConfig(): FileServiceConfig;
|
|
63
|
+
}
|
|
64
|
+
declare const getFileService: () => FileService;
|
|
65
|
+
|
|
66
|
+
export { FileService, getFileService };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
import { FileServiceConfig, FileUploadOptions, FileUploadResult, FileResponse } from './file.types.js';
|
|
3
|
+
|
|
4
|
+
declare class FileService {
|
|
5
|
+
private static instance;
|
|
6
|
+
private config;
|
|
7
|
+
enableUpload: boolean;
|
|
8
|
+
private constructor();
|
|
9
|
+
static getInstance(config?: FileServiceConfig): FileService;
|
|
10
|
+
static initialize(config: FileServiceConfig): FileService;
|
|
11
|
+
/**
|
|
12
|
+
* Upload a file using the signed URL approach
|
|
13
|
+
* @param file - File to upload
|
|
14
|
+
* @param options - Upload options
|
|
15
|
+
* @returns Upload result with file information
|
|
16
|
+
*/
|
|
17
|
+
uploadFile(file: File, options?: FileUploadOptions): Promise<FileUploadResult>;
|
|
18
|
+
/**
|
|
19
|
+
* Step 1: Request signed URL from backend
|
|
20
|
+
* @param payload - Upload URL request payload
|
|
21
|
+
* @returns Upload URL response with signed URL and file info
|
|
22
|
+
*/
|
|
23
|
+
private requestSignedUrl;
|
|
24
|
+
/**
|
|
25
|
+
* Step 2: Upload file to signed URL
|
|
26
|
+
* @param signedUrl - Signed URL from backend
|
|
27
|
+
* @param file - File to upload
|
|
28
|
+
* @param onProgress - Progress callback (optional, uses XHR if provided)
|
|
29
|
+
*/
|
|
30
|
+
private uploadToSignedUrl;
|
|
31
|
+
/**
|
|
32
|
+
* Upload file with retry logic
|
|
33
|
+
* @param file - File to upload
|
|
34
|
+
* @param options - Upload options with max retries
|
|
35
|
+
* @returns Upload result
|
|
36
|
+
*/
|
|
37
|
+
uploadFileWithRetry(file: File, options?: FileUploadOptions & {
|
|
38
|
+
maxRetries?: number;
|
|
39
|
+
}): Promise<FileUploadResult>;
|
|
40
|
+
/**
|
|
41
|
+
* Get file by ID (if backend provides this endpoint)
|
|
42
|
+
* @param fileId - File ID
|
|
43
|
+
* @returns File information
|
|
44
|
+
*/
|
|
45
|
+
getFileById(fileId: string): Promise<FileResponse>;
|
|
46
|
+
/**
|
|
47
|
+
* Make HTTP request with proper headers
|
|
48
|
+
* @param url - Request URL
|
|
49
|
+
* @param init - Request init options
|
|
50
|
+
* @returns Promise with response data
|
|
51
|
+
*/
|
|
52
|
+
private makeRequest;
|
|
53
|
+
/**
|
|
54
|
+
* Update configuration
|
|
55
|
+
* @param config - Partial configuration to update
|
|
56
|
+
*/
|
|
57
|
+
updateConfig(config: Partial<FileServiceConfig>): void;
|
|
58
|
+
/**
|
|
59
|
+
* Get current configuration
|
|
60
|
+
* @returns Current configuration
|
|
61
|
+
*/
|
|
62
|
+
getConfig(): FileServiceConfig;
|
|
63
|
+
}
|
|
64
|
+
declare const getFileService: () => FileService;
|
|
65
|
+
|
|
66
|
+
export { FileService, getFileService };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
var l=async(i,e)=>{let r=await fetch(i,e);if(!r.ok){let t=await r.json().catch(()=>({}));throw new Error(JSON.stringify({status:r.status,statusText:r.statusText,...t}))}return r&&r.json()};var a=class i{constructor(e){this.config=e,this.enableUpload=e.enableUpload||!1}static getInstance(e){if(!i.instance&&e&&(i.instance=new i(e)),!i.instance)throw new Error("FileService must be initialized with config first");return i.instance}static initialize(e){return i.instance=new i(e),i.instance}async uploadFile(e,r={}){try{let t=await this.requestSignedUrl({filename:e.name,description:r.description,loadDirection:"up",bucketType:r.bucketType||"conversations",path:r.path||".temp",mimeType:e.type});return await this.uploadToSignedUrl(t.data.signedUrlData.signedUrl,e),{success:!0,id:t.data.file.id,name:t.data.file.name,url:t.data.file.url,type:t.data.file.type}}catch(t){return console.error("Error uploading file:",t),{success:!1,error:t instanceof Error?t.message:"Unknown error"}}}async requestSignedUrl(e){let r=`${this.config.baseUrl}/files/upload-url`;return this.makeRequest(r,{method:"POST",body:JSON.stringify(e)})}async uploadToSignedUrl(e,r){let t=await fetch(e,{method:"PUT",body:r,headers:{"Content-Type":r.type}});if(!t.ok){let n=await t.text().catch(()=>"No response");throw new Error(`Upload failed with status: ${t.status}. Response: ${n}`)}}async uploadFileWithRetry(e,r={}){let t=r.maxRetries||3,n=null;for(let o=1;o<=t;o++)try{let s=await this.uploadFile(e,r);if(s.success)return s;throw new Error(s.error||"Upload failed")}catch(s){if(n=s instanceof Error?s:new Error("Unknown error"),o===t)break;let c=2**o*1e3;await new Promise(p=>setTimeout(p,c))}return{success:!1,error:n?.message||"Upload failed after retries"}}async getFileById(e){let r=`${this.config.baseUrl}/files/${e}`,t=await this.makeRequest(r);if(!t.success)throw new Error("Failed to get file");return t.data}async makeRequest(e,r){let t={"Content-Type":"application/json"};return this.config.organizationId&&(t["X-Onlive-Organization-Id"]=this.config.organizationId),r?.headers&&Object.assign(t,r.headers),l(e,{...r,headers:t})}updateConfig(e){this.config={...this.config,...e}}getConfig(){return{...this.config}}},f=()=>a.getInstance();export{a as FileService,f as getFileService};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
"use strict";var n=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var p=(r,e,s,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of a(e))!g.call(r,i)&&i!==s&&n(r,i,{get:()=>e[i],enumerable:!(t=o(e,i))||t.enumerable});return r};var l=r=>p(n({},"__esModule",{value:!0}),r);var c={};module.exports=l(c);
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
interface FileServiceConfig {
|
|
3
|
+
baseUrl: string;
|
|
4
|
+
organizationId?: string;
|
|
5
|
+
enableUpload?: boolean;
|
|
6
|
+
}
|
|
7
|
+
interface UploadUrlRequest {
|
|
8
|
+
filename: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
loadDirection: "up" | "down";
|
|
11
|
+
bucketType: "immersive" | "resources" | "conversations";
|
|
12
|
+
path?: string;
|
|
13
|
+
mimeType: string;
|
|
14
|
+
}
|
|
15
|
+
interface FileResponse {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
url: string;
|
|
20
|
+
type: string;
|
|
21
|
+
metadata?: {
|
|
22
|
+
bucketType?: string;
|
|
23
|
+
path?: string;
|
|
24
|
+
loadDirection?: string;
|
|
25
|
+
size?: number;
|
|
26
|
+
bucketInfo?: {
|
|
27
|
+
bucket: string;
|
|
28
|
+
key: string;
|
|
29
|
+
region?: string;
|
|
30
|
+
};
|
|
31
|
+
uploadInfo?: {
|
|
32
|
+
signedUrl?: string;
|
|
33
|
+
expiresAt?: string;
|
|
34
|
+
};
|
|
35
|
+
originalName?: string;
|
|
36
|
+
checksum?: string;
|
|
37
|
+
};
|
|
38
|
+
createdAt: Date;
|
|
39
|
+
updatedAt: Date;
|
|
40
|
+
}
|
|
41
|
+
interface SignedUrlData {
|
|
42
|
+
signedUrl: string;
|
|
43
|
+
key: string;
|
|
44
|
+
url: string;
|
|
45
|
+
}
|
|
46
|
+
interface UploadUrlResponse {
|
|
47
|
+
success: boolean;
|
|
48
|
+
data: {
|
|
49
|
+
file: FileResponse;
|
|
50
|
+
signedUrlData: SignedUrlData;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
interface GetFileByIdResponse {
|
|
54
|
+
success: boolean;
|
|
55
|
+
data: FileResponse;
|
|
56
|
+
}
|
|
57
|
+
interface FileUploadOptions {
|
|
58
|
+
bucketType?: "immersive" | "resources" | "conversations";
|
|
59
|
+
path?: string;
|
|
60
|
+
description?: string;
|
|
61
|
+
onProgress?: (progress: number) => void;
|
|
62
|
+
}
|
|
63
|
+
interface FileUploadResult {
|
|
64
|
+
success: boolean;
|
|
65
|
+
id?: string;
|
|
66
|
+
name?: string;
|
|
67
|
+
url?: string;
|
|
68
|
+
type?: string;
|
|
69
|
+
error?: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export type { FileResponse, FileServiceConfig, FileUploadOptions, FileUploadResult, GetFileByIdResponse, SignedUrlData, UploadUrlRequest, UploadUrlResponse };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
interface FileServiceConfig {
|
|
3
|
+
baseUrl: string;
|
|
4
|
+
organizationId?: string;
|
|
5
|
+
enableUpload?: boolean;
|
|
6
|
+
}
|
|
7
|
+
interface UploadUrlRequest {
|
|
8
|
+
filename: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
loadDirection: "up" | "down";
|
|
11
|
+
bucketType: "immersive" | "resources" | "conversations";
|
|
12
|
+
path?: string;
|
|
13
|
+
mimeType: string;
|
|
14
|
+
}
|
|
15
|
+
interface FileResponse {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
url: string;
|
|
20
|
+
type: string;
|
|
21
|
+
metadata?: {
|
|
22
|
+
bucketType?: string;
|
|
23
|
+
path?: string;
|
|
24
|
+
loadDirection?: string;
|
|
25
|
+
size?: number;
|
|
26
|
+
bucketInfo?: {
|
|
27
|
+
bucket: string;
|
|
28
|
+
key: string;
|
|
29
|
+
region?: string;
|
|
30
|
+
};
|
|
31
|
+
uploadInfo?: {
|
|
32
|
+
signedUrl?: string;
|
|
33
|
+
expiresAt?: string;
|
|
34
|
+
};
|
|
35
|
+
originalName?: string;
|
|
36
|
+
checksum?: string;
|
|
37
|
+
};
|
|
38
|
+
createdAt: Date;
|
|
39
|
+
updatedAt: Date;
|
|
40
|
+
}
|
|
41
|
+
interface SignedUrlData {
|
|
42
|
+
signedUrl: string;
|
|
43
|
+
key: string;
|
|
44
|
+
url: string;
|
|
45
|
+
}
|
|
46
|
+
interface UploadUrlResponse {
|
|
47
|
+
success: boolean;
|
|
48
|
+
data: {
|
|
49
|
+
file: FileResponse;
|
|
50
|
+
signedUrlData: SignedUrlData;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
interface GetFileByIdResponse {
|
|
54
|
+
success: boolean;
|
|
55
|
+
data: FileResponse;
|
|
56
|
+
}
|
|
57
|
+
interface FileUploadOptions {
|
|
58
|
+
bucketType?: "immersive" | "resources" | "conversations";
|
|
59
|
+
path?: string;
|
|
60
|
+
description?: string;
|
|
61
|
+
onProgress?: (progress: number) => void;
|
|
62
|
+
}
|
|
63
|
+
interface FileUploadResult {
|
|
64
|
+
success: boolean;
|
|
65
|
+
id?: string;
|
|
66
|
+
name?: string;
|
|
67
|
+
url?: string;
|
|
68
|
+
type?: string;
|
|
69
|
+
error?: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export type { FileResponse, FileServiceConfig, FileUploadOptions, FileUploadResult, GetFileByIdResponse, SignedUrlData, UploadUrlRequest, UploadUrlResponse };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
"use strict";var l=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var h=(i,e)=>{for(var t in e)l(i,t,{get:e[t],enumerable:!0})},m=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of g(e))!U.call(i,s)&&s!==t&&l(i,s,{get:()=>e[s],enumerable:!(r=f(e,s))||r.enumerable});return i};var F=i=>m(l({},"__esModule",{value:!0}),i);var R={};h(R,{FileService:()=>n,getFileService:()=>p});module.exports=F(R);var c=async(i,e)=>{let t=await fetch(i,e);if(!t.ok){let r=await t.json().catch(()=>({}));throw new Error(JSON.stringify({status:t.status,statusText:t.statusText,...r}))}return t&&t.json()};var n=class i{constructor(e){this.config=e,this.enableUpload=e.enableUpload||!1}static getInstance(e){if(!i.instance&&e&&(i.instance=new i(e)),!i.instance)throw new Error("FileService must be initialized with config first");return i.instance}static initialize(e){return i.instance=new i(e),i.instance}async uploadFile(e,t={}){try{let r=await this.requestSignedUrl({filename:e.name,description:t.description,loadDirection:"up",bucketType:t.bucketType||"conversations",path:t.path||".temp",mimeType:e.type});return await this.uploadToSignedUrl(r.data.signedUrlData.signedUrl,e),{success:!0,id:r.data.file.id,name:r.data.file.name,url:r.data.file.url,type:r.data.file.type}}catch(r){return console.error("Error uploading file:",r),{success:!1,error:r instanceof Error?r.message:"Unknown error"}}}async requestSignedUrl(e){let t=`${this.config.baseUrl}/files/upload-url`;return this.makeRequest(t,{method:"POST",body:JSON.stringify(e)})}async uploadToSignedUrl(e,t){let r=await fetch(e,{method:"PUT",body:t,headers:{"Content-Type":t.type}});if(!r.ok){let s=await r.text().catch(()=>"No response");throw new Error(`Upload failed with status: ${r.status}. Response: ${s}`)}}async uploadFileWithRetry(e,t={}){let r=t.maxRetries||3,s=null;for(let a=1;a<=r;a++)try{let o=await this.uploadFile(e,t);if(o.success)return o;throw new Error(o.error||"Upload failed")}catch(o){if(s=o instanceof Error?o:new Error("Unknown error"),a===r)break;let u=2**a*1e3;await new Promise(d=>setTimeout(d,u))}return{success:!1,error:s?.message||"Upload failed after retries"}}async getFileById(e){let t=`${this.config.baseUrl}/files/${e}`,r=await this.makeRequest(t);if(!r.success)throw new Error("Failed to get file");return r.data}async makeRequest(e,t){let r={"Content-Type":"application/json"};return this.config.organizationId&&(r["X-Onlive-Organization-Id"]=this.config.organizationId),t?.headers&&Object.assign(r,t.headers),c(e,{...t,headers:r})}updateConfig(e){this.config={...this.config,...e}}getConfig(){return{...this.config}}},p=()=>n.getInstance();0&&(module.exports={FileService,getFileService});
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
export { FileService, getFileService } from './file.service.cjs';
|
|
3
|
+
export { FileResponse, FileServiceConfig, FileUploadOptions, FileUploadResult, SignedUrlData, UploadUrlRequest, UploadUrlResponse } from './file.types.cjs';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
export { FileService, getFileService } from './file.service.js';
|
|
3
|
+
export { FileResponse, FileServiceConfig, FileUploadOptions, FileUploadResult, SignedUrlData, UploadUrlRequest, UploadUrlResponse } from './file.types.js';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
var l=async(i,e)=>{let r=await fetch(i,e);if(!r.ok){let t=await r.json().catch(()=>({}));throw new Error(JSON.stringify({status:r.status,statusText:r.statusText,...t}))}return r&&r.json()};var a=class i{constructor(e){this.config=e,this.enableUpload=e.enableUpload||!1}static getInstance(e){if(!i.instance&&e&&(i.instance=new i(e)),!i.instance)throw new Error("FileService must be initialized with config first");return i.instance}static initialize(e){return i.instance=new i(e),i.instance}async uploadFile(e,r={}){try{let t=await this.requestSignedUrl({filename:e.name,description:r.description,loadDirection:"up",bucketType:r.bucketType||"conversations",path:r.path||".temp",mimeType:e.type});return await this.uploadToSignedUrl(t.data.signedUrlData.signedUrl,e),{success:!0,id:t.data.file.id,name:t.data.file.name,url:t.data.file.url,type:t.data.file.type}}catch(t){return console.error("Error uploading file:",t),{success:!1,error:t instanceof Error?t.message:"Unknown error"}}}async requestSignedUrl(e){let r=`${this.config.baseUrl}/files/upload-url`;return this.makeRequest(r,{method:"POST",body:JSON.stringify(e)})}async uploadToSignedUrl(e,r){let t=await fetch(e,{method:"PUT",body:r,headers:{"Content-Type":r.type}});if(!t.ok){let o=await t.text().catch(()=>"No response");throw new Error(`Upload failed with status: ${t.status}. Response: ${o}`)}}async uploadFileWithRetry(e,r={}){let t=r.maxRetries||3,o=null;for(let n=1;n<=t;n++)try{let s=await this.uploadFile(e,r);if(s.success)return s;throw new Error(s.error||"Upload failed")}catch(s){if(o=s instanceof Error?s:new Error("Unknown error"),n===t)break;let c=2**n*1e3;await new Promise(p=>setTimeout(p,c))}return{success:!1,error:o?.message||"Upload failed after retries"}}async getFileById(e){let r=`${this.config.baseUrl}/files/${e}`,t=await this.makeRequest(r);if(!t.success)throw new Error("Failed to get file");return t.data}async makeRequest(e,r){let t={"Content-Type":"application/json"};return this.config.organizationId&&(t["X-Onlive-Organization-Id"]=this.config.organizationId),r?.headers&&Object.assign(t,r.headers),l(e,{...r,headers:t})}updateConfig(e){this.config={...this.config,...e}}getConfig(){return{...this.config}}},u=()=>a.getInstance();export{a as FileService,u as getFileService};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! @onlive.ai/common-121 v0.2.
|
|
2
|
-
"use strict";var
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
"use strict";var s=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var y=(n,i)=>{for(var t in i)s(n,t,{get:i[t],enumerable:!0})},b=(n,i,t,e)=>{if(i&&typeof i=="object"||typeof i=="function")for(let a of d(i))!c.call(n,a)&&a!==t&&s(n,a,{get:()=>i[a],enumerable:!(e=u(i,a))||e.enumerable});return n};var T=n=>b(s({},"__esModule",{value:!0}),n);var g={};y(g,{FirebaseApi:()=>o});module.exports=T(g);var l=require("firebase/app"),r=require("firebase/database"),o=class{constructor(i){this.onChildChanged=(i,t)=>(0,r.onChildChanged)(this.ref(i),e=>t(e.key||"",e.val(),e));this.onChildRemoved=(i,t)=>(0,r.onChildRemoved)(this.ref(i),e=>t(e.key||"",e.val(),e));this.onChildChangedQuery=(i,t)=>(0,r.onChildChanged)(i,e=>t(e.key||"",e.val(),e));this.onChildRemovedQuery=(i,t)=>(0,r.onChildRemoved)(i,e=>t(e.key||"",e.val(),e));let t=(0,l.initializeApp)(i.config);this.db=(0,r.getDatabase)(t)}ref(i){return(0,r.ref)(this.db,i)}async getOnce(i){let t=await(0,r.get)(this.ref(i));return t.exists()?t.val():null}async getOnceQuery(i){let t=await(0,r.get)(i),e=[];return t.exists()&&t.forEach(a=>{e.push({key:a.key||"",value:a.val()})}),e}onValue(i,t){return(0,r.onValue)(this.ref(i),e=>t(e.key??"",e.val(),e),e=>console.error("onValue error",e))}onValueQuery(i,t){return(0,r.onValue)(i,e=>t(e.key??"",e.val(),e),e=>console.error("onValueQuery error",e))}onChildAdded(i,t){return(0,r.onChildAdded)(this.ref(i),e=>t(e.key||"",e.val(),e),e=>console.error("onChildAdded error",e))}onChildAddedQuery(i,t){return(0,r.onChildAdded)(i,e=>t(e.key||"",e.val(),e),e=>console.error("onChildAddedQuery error",e))}write(i,t){return(0,r.set)(this.ref(i),t)}update(i,t){return(0,r.update)(this.ref(i),t)}remove(i){return(0,r.remove)(this.ref(i))}async push(i,t){let e=(0,r.push)(this.ref(i));return await(0,r.set)(e,t),e.key}onDisconnectUpdate(i,t){return(0,r.onDisconnect)(this.ref(i)).update(t)}cancelOnDisconnect(i){return(0,r.onDisconnect)(this.ref(i)).cancel()}transaction(i,t){return(0,r.runTransaction)(this.ref(i),e=>t(e))}query(i,t={}){let e=this.ref(i);return t.orderBy==="child"&&t.childKey&&(e=(0,r.query)(e,(0,r.orderByChild)(t.childKey))),t.orderBy==="key"&&(e=(0,r.query)(e,(0,r.orderByKey)())),t.orderBy==="value"&&(e=(0,r.query)(e,(0,r.orderByValue)())),t.startAt!=null&&(e=(0,r.query)(e,(0,r.startAt)(t.startAt))),t.endAt!=null&&(e=(0,r.query)(e,(0,r.endAt)(t.endAt))),t.equalTo!=null&&(e=(0,r.query)(e,(0,r.equalTo)(t.equalTo))),t.limitFirst!=null&&(e=(0,r.query)(e,(0,r.limitToFirst)(t.limitFirst))),t.limitLast!=null&&(e=(0,r.query)(e,(0,r.limitToLast)(t.limitLast))),e}};0&&(module.exports={FirebaseApi});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/*! @onlive.ai/common-121 v0.2.163 | © 2026 Onlive.ai */
|
|
2
|
+
import { DatabaseReference, Query, DataSnapshot, Unsubscribe, TransactionResult } from 'firebase/database';
|
|
2
3
|
|
|
3
4
|
type FirebaseConfig = {
|
|
4
5
|
apiKey: string;
|
|
@@ -20,32 +21,47 @@ declare class FirebaseApi {
|
|
|
20
21
|
/** Get a DatabaseReference */
|
|
21
22
|
ref(path: string): DatabaseReference;
|
|
22
23
|
/** Read once */
|
|
23
|
-
getOnce<T =
|
|
24
|
+
getOnce<T = object>(path: string): Promise<T | null>;
|
|
25
|
+
/** Read once from a query */
|
|
26
|
+
getOnceQuery<T = object>(q: Query): Promise<Array<{
|
|
27
|
+
key: string;
|
|
28
|
+
value: T;
|
|
29
|
+
}>>;
|
|
24
30
|
/** Listen to value changes */
|
|
25
|
-
onValue<T =
|
|
31
|
+
onValue<T = object>(path: string, cb: Callback<T>): Unsubscribe;
|
|
32
|
+
/** Listen to value changes for a query */
|
|
33
|
+
onValueQuery<T = object>(q: Query, cb: Callback<T>): Unsubscribe;
|
|
26
34
|
/** Listen to child-added */
|
|
27
|
-
onChildAdded<T =
|
|
35
|
+
onChildAdded<T = object>(path: string, cb: Callback<T>): Unsubscribe;
|
|
36
|
+
/** Listen to child-added for a query */
|
|
37
|
+
onChildAddedQuery<T = object>(q: Query, cb: Callback<T>): Unsubscribe;
|
|
28
38
|
/** Other listeners... */
|
|
29
39
|
onChildChanged: <T>(path: string, cb: Callback<T>) => Unsubscribe;
|
|
30
40
|
onChildRemoved: <T>(path: string, cb: Callback<T>) => Unsubscribe;
|
|
41
|
+
/** Query variants for changed/removed */
|
|
42
|
+
onChildChangedQuery: <T>(q: Query, cb: Callback<T>) => Unsubscribe;
|
|
43
|
+
onChildRemovedQuery: <T>(q: Query, cb: Callback<T>) => Unsubscribe;
|
|
31
44
|
/** Write/overwrite a node */
|
|
32
|
-
write(path: string, data:
|
|
45
|
+
write(path: string, data: object): Promise<void>;
|
|
33
46
|
/** Update (merge) a node */
|
|
34
|
-
update(path: string, data: Partial<
|
|
47
|
+
update(path: string, data: Partial<object>): Promise<void>;
|
|
35
48
|
/** Remove a node */
|
|
36
49
|
remove(path: string): Promise<void>;
|
|
37
50
|
/** Push a child with generated key */
|
|
38
|
-
push<T =
|
|
51
|
+
push<T = object>(path: string, data: T): Promise<string>;
|
|
39
52
|
/** onDisconnect write */
|
|
40
|
-
onDisconnectUpdate(path: string, data:
|
|
53
|
+
onDisconnectUpdate(path: string, data: object): Promise<void>;
|
|
41
54
|
/** Cancel onDisconnect operations */
|
|
42
55
|
cancelOnDisconnect(path: string): Promise<void>;
|
|
43
56
|
/** Run a transaction */
|
|
44
|
-
transaction<T =
|
|
57
|
+
transaction<T = object>(path: string, updateFn: (cur: T | null) => T): Promise<TransactionResult>;
|
|
45
58
|
/** Build a query */
|
|
46
59
|
query(path: string, opts?: {
|
|
47
60
|
orderBy?: "child" | "key" | "value";
|
|
48
61
|
childKey?: string;
|
|
62
|
+
startAt?: string | number | boolean;
|
|
63
|
+
endAt?: string | number | boolean;
|
|
64
|
+
equalTo?: string | number | boolean;
|
|
49
65
|
limitFirst?: number;
|
|
50
66
|
limitLast?: number;
|
|
51
67
|
}): Query;
|