@fencyai/react 0.1.83 → 0.1.84

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,2 @@
1
+ import { UseListMemoryTypes } from '../../types';
2
+ export declare function useListMemoryTypes(): UseListMemoryTypes;
@@ -0,0 +1,51 @@
1
+ import { ApiError } from '@fencyai/js';
2
+ import { PaginationDto } from '@fencyai/js/lib/openapi';
3
+ export interface PaginatedParams {
4
+ fetchClientSecret: () => Promise<{
5
+ clientSecret: string;
6
+ }>;
7
+ }
8
+ export interface PaginatedPage<TItem> {
9
+ items: TItem[];
10
+ hasNextPage: boolean;
11
+ hasPreviousPage: boolean;
12
+ pagination: PaginationDto;
13
+ }
14
+ export type PaginatedResult<TItem> = {
15
+ type: 'success';
16
+ page: PaginatedPage<TItem>;
17
+ } | {
18
+ type: 'error';
19
+ error: ApiError;
20
+ };
21
+ export interface UsePaginatedQueryProps {
22
+ pageSize?: number;
23
+ }
24
+ export interface UsePaginatedQuery<TItem, TParams extends PaginatedParams> {
25
+ fetchFirstPage: (params: TParams) => Promise<PaginatedResult<TItem>>;
26
+ fetchNextPage: (params: TParams) => Promise<PaginatedResult<TItem>>;
27
+ fetchPreviousPage: (params: TParams) => Promise<PaginatedResult<TItem>>;
28
+ refetchCurrentPage: () => Promise<PaginatedResult<TItem>>;
29
+ currentPage: PaginatedPage<TItem> | null;
30
+ }
31
+ export interface ApiResponse<TItem> {
32
+ type: 'success' | 'error';
33
+ items?: TItem[];
34
+ pagination?: PaginationDto;
35
+ error?: ApiError;
36
+ }
37
+ export interface FetchFunction<TItem> {
38
+ (options: {
39
+ pk: string;
40
+ clientSecret: string;
41
+ request: {
42
+ limit: number;
43
+ pagination: {
44
+ nextPageToken?: string;
45
+ previousPageToken?: string;
46
+ };
47
+ };
48
+ baseUrl?: string;
49
+ }): Promise<ApiResponse<TItem>>;
50
+ }
51
+ export declare function usePaginatedQuery<TItem, TParams extends PaginatedParams = PaginatedParams>(fetchFn: FetchFunction<TItem>, props?: UsePaginatedQueryProps): UsePaginatedQuery<TItem, TParams>;
package/dist/index.d.ts CHANGED
@@ -1,14 +1,12 @@
1
1
  export { useBasicChatCompletions } from './hooks/useBasicChatCompletions';
2
- export { useCreateFiles } from './hooks/useCreateFiles';
3
2
  export { useFencyEventSource } from './hooks/useFencyEventSource';
4
- export { useListFiles } from './hooks/useListFiles';
5
- export { useSearchFiles } from './hooks/useSearchFiles';
3
+ export { useListMemoryTypes } from './hooks/useListMemoryTypes';
4
+ export { usePaginatedQuery } from './hooks/usePaginatedQuery';
6
5
  export { useStream } from './hooks/useStream';
7
6
  export { useStreamingChatCompletions } from './hooks/useStreamingChatCompletions';
8
7
  export { useStructuredChatCompletions } from './hooks/useStructuredChatCompletions';
9
- export { useWebsites } from './hooks/useWebsites';
10
- export { ChatResponse } from './chat/ChatResponse';
11
8
  export { Chat } from './chat/Chat';
9
+ export { ChatResponse } from './chat/ChatResponse';
12
10
  export { MentionInput } from './chat/MentionInput';
13
11
  export { MentionPopover } from './chat/MentionPopover';
14
12
  export { FencyProvider } from './provider/FencyProvider';