@fencyai/js 0.1.83 → 0.1.85

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 (87) hide show
  1. package/lib/api/createChatCompletion.d.ts +1 -18
  2. package/lib/api/createStream.d.ts +0 -8
  3. package/lib/api/createStream.js +0 -8
  4. package/lib/api/listMemories.d.ts +8 -0
  5. package/lib/api/listMemories.js +54 -0
  6. package/lib/api/listMemoryTypes.d.ts +6 -0
  7. package/lib/api/{searchFiles.js → listMemoryTypes.js} +5 -13
  8. package/lib/index.d.ts +4 -18
  9. package/lib/index.js +4 -24
  10. package/lib/loadFency.d.ts +1 -1
  11. package/lib/openapi/index.d.ts +6 -14
  12. package/lib/openapi/models/ListMemoriesResponse.d.ts +6 -0
  13. package/lib/openapi/models/ListMemoryTypesResponse.d.ts +6 -0
  14. package/lib/openapi/models/{ChatCompletionDto.d.ts → PubChatCompletionDto.d.ts} +1 -1
  15. package/lib/openapi/models/{CreateChatCompletionRequest.d.ts → PubCreateChatCompletionRequest.d.ts} +1 -1
  16. package/lib/openapi/models/PubMemoryDto.d.ts +5 -0
  17. package/lib/openapi/models/PubMemoryTypeDto.d.ts +5 -0
  18. package/lib/openapi/services/PubService.d.ts +16 -32
  19. package/lib/openapi/services/PubService.js +16 -40
  20. package/lib/types/CreateChatCompletionResponse.d.ts +9 -0
  21. package/lib/types/FencyInstance.d.ts +4 -0
  22. package/lib/types/FencyOptions.d.ts +6 -0
  23. package/lib/types/ListMemoriesRequest.d.ts +8 -0
  24. package/lib/types/ListMemoriesResponse.d.ts +10 -0
  25. package/lib/types/ListMemoryTypesResponse.d.ts +10 -0
  26. package/lib/types/index.d.ts +7 -13
  27. package/lib/utils/version.js +1 -1
  28. package/package.json +2 -2
  29. package/lib/api/createFile.d.ts +0 -16
  30. package/lib/api/createFile.js +0 -67
  31. package/lib/api/createWebsite.d.ts +0 -16
  32. package/lib/api/createWebsite.js +0 -46
  33. package/lib/api/listFiles.d.ts +0 -16
  34. package/lib/api/listFiles.js +0 -47
  35. package/lib/api/searchFiles.d.ts +0 -16
  36. package/lib/openapi/models/CreateFileFromPostRequestParams.d.ts +0 -5
  37. package/lib/openapi/models/CreateFileFromUrlParams.d.ts +0 -3
  38. package/lib/openapi/models/CreateWebsiteRequest.d.ts +0 -6
  39. package/lib/openapi/models/FileMatchingChunk.d.ts +0 -5
  40. package/lib/openapi/models/FileSearchItem.d.ts +0 -9
  41. package/lib/openapi/models/FileSearchResponse.d.ts +0 -4
  42. package/lib/openapi/models/ListFilesResponse.d.ts +0 -6
  43. package/lib/openapi/models/PubCreateFileRequest.d.ts +0 -8
  44. package/lib/openapi/models/PubFileDto.d.ts +0 -9
  45. package/lib/openapi/models/PubFileListDto.d.ts +0 -11
  46. package/lib/openapi/models/PubWebsiteDto.d.ts +0 -5
  47. package/lib/openapi/models/PubWebsiteDto.js +0 -1
  48. package/lib/openapi/models/S3PostRequestDto.d.ts +0 -10
  49. package/lib/openapi/models/S3PostRequestDto.js +0 -1
  50. package/lib/types/CreateFileRequest.d.ts +0 -8
  51. package/lib/types/CreateFileRequest.js +0 -1
  52. package/lib/types/CreateFileResponse.d.ts +0 -9
  53. package/lib/types/CreateFileResponse.js +0 -1
  54. package/lib/types/CreateWebsiteRequest.d.ts +0 -6
  55. package/lib/types/CreateWebsiteRequest.js +0 -1
  56. package/lib/types/CreateWebsiteResponse.d.ts +0 -9
  57. package/lib/types/CreateWebsiteResponse.js +0 -1
  58. package/lib/types/FencyFile.d.ts +0 -11
  59. package/lib/types/FencyFile.js +0 -1
  60. package/lib/types/FencyListFileItem.d.ts +0 -11
  61. package/lib/types/FencyListFileItem.js +0 -1
  62. package/lib/types/FileSearchItem.d.ts +0 -8
  63. package/lib/types/FileSearchItem.js +0 -1
  64. package/lib/types/ListFilesRequest.d.ts +0 -6
  65. package/lib/types/ListFilesRequest.js +0 -1
  66. package/lib/types/ListFilesResponse.d.ts +0 -11
  67. package/lib/types/ListFilesResponse.js +0 -1
  68. package/lib/types/SearchFilesRequest.d.ts +0 -4
  69. package/lib/types/SearchFilesRequest.js +0 -1
  70. package/lib/types/SearchFilesResponse.d.ts +0 -9
  71. package/lib/types/SearchFilesResponse.js +0 -1
  72. package/lib/types/Website.d.ts +0 -7
  73. package/lib/types/Website.js +0 -1
  74. package/lib/types.d.ts +0 -17
  75. package/lib/types.js +0 -1
  76. /package/lib/openapi/models/{ChatCompletionDto.js → ListMemoriesResponse.js} +0 -0
  77. /package/lib/openapi/models/{CreateChatCompletionRequest.js → ListMemoryTypesResponse.js} +0 -0
  78. /package/lib/openapi/models/{CreateFileFromPostRequestParams.js → PubChatCompletionDto.js} +0 -0
  79. /package/lib/openapi/models/{CreateFileFromUrlParams.js → PubCreateChatCompletionRequest.js} +0 -0
  80. /package/lib/openapi/models/{CreateWebsiteRequest.js → PubMemoryDto.js} +0 -0
  81. /package/lib/openapi/models/{FileMatchingChunk.js → PubMemoryTypeDto.js} +0 -0
  82. /package/lib/{openapi/models/FileSearchItem.js → types/CreateChatCompletionResponse.js} +0 -0
  83. /package/lib/{openapi/models/FileSearchResponse.js → types/FencyInstance.js} +0 -0
  84. /package/lib/{openapi/models/ListFilesResponse.js → types/FencyOptions.js} +0 -0
  85. /package/lib/{openapi/models/PubCreateFileRequest.js → types/ListMemoriesRequest.js} +0 -0
  86. /package/lib/{openapi/models/PubFileDto.js → types/ListMemoriesResponse.js} +0 -0
  87. /package/lib/{openapi/models/PubFileListDto.js → types/ListMemoryTypesResponse.js} +0 -0
@@ -1,67 +0,0 @@
1
- import { OpenAPI, PubService } from '../openapi';
2
- import { getPackageVersion } from '../utils/version';
3
- /**
4
- * Creates a website by making a POST request to the Fency API.
5
- *
6
- * @param pk - The publishable key (used as Bearer token)
7
- * @param request - The request body
8
- * @param options - Optional configuration (apiUrl, request overrides)
9
- * @returns A promise that resolves to a CreateWebsiteResponse
10
- * @throws Error if the request fails or the response is invalid
11
- */
12
- export async function createFile(params) {
13
- try {
14
- OpenAPI.BASE = params.baseUrl;
15
- OpenAPI.HEADERS = {
16
- 'Content-Type': 'application/json',
17
- Authorization: `Bearer ${params.pk}`,
18
- 'X-Fency-Sdk-Version': getPackageVersion(),
19
- ...(params.request.clientSecret
20
- ? { 'X-Fency-Client-Secret': params.request.clientSecret }
21
- : {}),
22
- };
23
- const response = await PubService.createFile({
24
- streamId: params.request.streamId,
25
- createFromPostRequestParams: {
26
- fileName: params.request.fileName,
27
- mimeType: params.request.fileType,
28
- fileSize: params.request.fileSize,
29
- },
30
- extractTextContent: params.request.extractTextContent,
31
- });
32
- if (!response.s3PostRequest) {
33
- throw new Error('S3 post request not found');
34
- }
35
- return {
36
- type: 'success',
37
- file: {
38
- id: response.id,
39
- createdAt: response.createdAt,
40
- size: response.size ?? null,
41
- type: response.type ?? null,
42
- name: response.name ?? null,
43
- content: null,
44
- text: null,
45
- s3PostRequest: {
46
- xAmzDate: response.s3PostRequest.amzDate,
47
- xAmzSignature: response.s3PostRequest.amzSignature,
48
- xAmzAlgorithm: response.s3PostRequest.amzAlgorithm,
49
- xAmzCredential: response.s3PostRequest.amzCredential,
50
- policy: response.s3PostRequest.policy,
51
- key: response.s3PostRequest.key,
52
- uploadUrl: response.s3PostRequest.uploadUrl,
53
- sessionToken: response.s3PostRequest.sessionToken,
54
- },
55
- },
56
- };
57
- }
58
- catch (error) {
59
- return {
60
- type: 'error',
61
- error: {
62
- code: 'UnknownError',
63
- message: `Unknown error!\n${error ? `Error: ${error}\n` : ''}`.trim(),
64
- },
65
- };
66
- }
67
- }
@@ -1,16 +0,0 @@
1
- import { CreateWebsiteRequest } from '../types/CreateWebsiteRequest';
2
- import { CreateWebsiteResponse } from '../types/CreateWebsiteResponse';
3
- /**
4
- * Creates a website by making a POST request to the Fency API.
5
- *
6
- * @param pk - The publishable key (used as Bearer token)
7
- * @param request - The request body
8
- * @param options - Optional configuration (apiUrl, request overrides)
9
- * @returns A promise that resolves to a CreateWebsiteResponse
10
- * @throws Error if the request fails or the response is invalid
11
- */
12
- export declare function createWebsite(params: {
13
- pk: string;
14
- request: CreateWebsiteRequest;
15
- baseUrl: string;
16
- }): Promise<CreateWebsiteResponse>;
@@ -1,46 +0,0 @@
1
- import { OpenAPI, PubService } from '../openapi';
2
- import { getPackageVersion } from '../utils/version';
3
- /**
4
- * Creates a website by making a POST request to the Fency API.
5
- *
6
- * @param pk - The publishable key (used as Bearer token)
7
- * @param request - The request body
8
- * @param options - Optional configuration (apiUrl, request overrides)
9
- * @returns A promise that resolves to a CreateWebsiteResponse
10
- * @throws Error if the request fails or the response is invalid
11
- */
12
- export async function createWebsite(params) {
13
- try {
14
- OpenAPI.BASE = params.baseUrl;
15
- OpenAPI.HEADERS = {
16
- 'Content-Type': 'application/json',
17
- Authorization: `Bearer ${params.pk}`,
18
- 'X-Fency-Sdk-Version': getPackageVersion(),
19
- };
20
- const response = await PubService.createWebsite({
21
- url: params.request.url,
22
- streamId: params.request.streamId,
23
- extractHtmlContent: params.request.extractHtmlContent,
24
- extractTextContent: params.request.extractTextContent,
25
- });
26
- return {
27
- type: 'success',
28
- website: {
29
- id: response.id,
30
- createdAt: response.createdAt,
31
- url: response.url,
32
- content: null,
33
- text: null,
34
- },
35
- };
36
- }
37
- catch (error) {
38
- return {
39
- type: 'error',
40
- error: {
41
- code: 'UnknownError',
42
- message: `Unknown error!\n${error ? `Error: ${error}\n` : ''}`.trim(),
43
- },
44
- };
45
- }
46
- }
@@ -1,16 +0,0 @@
1
- import { ListFilesRequest } from '../types/ListFilesRequest';
2
- import { ListFilesResponse } from '../types/ListFilesResponse';
3
- /**
4
- * Creates a website by making a POST request to the Fency API.
5
- *
6
- * @param pk - The publishable key (used as Bearer token)
7
- * @param request - The request body
8
- * @param options - Optional configuration (apiUrl, request overrides)
9
- * @returns A promise that resolves to a CreateWebsiteResponse
10
- * @throws Error if the request fails or the response is invalid
11
- */
12
- export declare function listFiles(params: {
13
- pk: string;
14
- request: ListFilesRequest;
15
- baseUrl: string;
16
- }): Promise<ListFilesResponse>;
@@ -1,47 +0,0 @@
1
- import { OpenAPI, PubService } from '../openapi';
2
- import { getPackageVersion } from '../utils/version';
3
- /**
4
- * Creates a website by making a POST request to the Fency API.
5
- *
6
- * @param pk - The publishable key (used as Bearer token)
7
- * @param request - The request body
8
- * @param options - Optional configuration (apiUrl, request overrides)
9
- * @returns A promise that resolves to a CreateWebsiteResponse
10
- * @throws Error if the request fails or the response is invalid
11
- */
12
- export async function listFiles(params) {
13
- try {
14
- OpenAPI.BASE = params.baseUrl;
15
- OpenAPI.HEADERS = {
16
- 'Content-Type': 'application/json',
17
- Authorization: `Bearer ${params.pk}`,
18
- 'X-Fency-Sdk-Version': getPackageVersion(),
19
- 'X-Fency-Client-Secret': params.request.clientSecret,
20
- };
21
- const response = await PubService.listFiles(params.request.pagination?.nextPageToken ?? undefined, params.request.pagination?.previousPageToken ?? undefined, params.request.limit);
22
- return {
23
- type: 'success',
24
- items: response.items.map((item) => ({
25
- id: item.id,
26
- createdAt: item.createdAt,
27
- size: item.size ?? null,
28
- type: item.type ?? null,
29
- name: item.name ?? null,
30
- tags: item.tags,
31
- contentReady: item.contentReady,
32
- textReady: item.textReady,
33
- searchIndexReady: item.searchIndexReady,
34
- })),
35
- pagination: response.pagination,
36
- };
37
- }
38
- catch (error) {
39
- return {
40
- type: 'error',
41
- error: {
42
- code: 'UNKNOWN_ERROR',
43
- message: `Unknown error!\n${error ? `Error: ${error}\n` : ''}`.trim(),
44
- },
45
- };
46
- }
47
- }
@@ -1,16 +0,0 @@
1
- import { SearchFilesRequest } from '../types/SearchFilesRequest';
2
- import { SearchFilesResponse } from '../types/SearchFilesResponse';
3
- /**
4
- * Creates a website by making a POST request to the Fency API.
5
- *
6
- * @param pk - The publishable key (used as Bearer token)
7
- * @param request - The request body
8
- * @param options - Optional configuration (apiUrl, request overrides)
9
- * @returns A promise that resolves to a CreateWebsiteResponse
10
- * @throws Error if the request fails or the response is invalid
11
- */
12
- export declare function searchFiles(params: {
13
- pk: string;
14
- request: SearchFilesRequest;
15
- baseUrl: string;
16
- }): Promise<SearchFilesResponse>;
@@ -1,5 +0,0 @@
1
- export type CreateFileFromPostRequestParams = {
2
- fileName: string;
3
- mimeType: string;
4
- fileSize: number;
5
- };
@@ -1,3 +0,0 @@
1
- export type CreateFileFromUrlParams = {
2
- url: string;
3
- };
@@ -1,6 +0,0 @@
1
- export type CreateWebsiteRequest = {
2
- url: string;
3
- streamId: string;
4
- extractHtmlContent: boolean;
5
- extractTextContent: boolean;
6
- };
@@ -1,5 +0,0 @@
1
- export type FileMatchingChunk = {
2
- pageNumbers: Array<number>;
3
- score: number;
4
- text: string;
5
- };
@@ -1,9 +0,0 @@
1
- import type { FileMatchingChunk } from './FileMatchingChunk';
2
- export type FileSearchItem = {
3
- fileId: string;
4
- fileName?: string | null;
5
- fileType?: string | null;
6
- fileSize?: number | null;
7
- matchingChunks: Array<FileMatchingChunk>;
8
- highestChunkScore: number;
9
- };
@@ -1,4 +0,0 @@
1
- import type { FileSearchItem } from './FileSearchItem';
2
- export type FileSearchResponse = {
3
- results: Array<FileSearchItem>;
4
- };
@@ -1,6 +0,0 @@
1
- import type { PaginationDto } from './PaginationDto';
2
- import type { PubFileListDto } from './PubFileListDto';
3
- export type ListFilesResponse = {
4
- items: Array<PubFileListDto>;
5
- pagination: PaginationDto;
6
- };
@@ -1,8 +0,0 @@
1
- import type { CreateFileFromPostRequestParams } from './CreateFileFromPostRequestParams';
2
- import type { CreateFileFromUrlParams } from './CreateFileFromUrlParams';
3
- export type PubCreateFileRequest = {
4
- streamId: string;
5
- createFromPostRequestParams?: CreateFileFromPostRequestParams;
6
- createFromUrlParams?: CreateFileFromUrlParams;
7
- extractTextContent: boolean;
8
- };
@@ -1,9 +0,0 @@
1
- import type { S3PostRequestDto } from './S3PostRequestDto';
2
- export type PubFileDto = {
3
- id: string;
4
- createdAt: string;
5
- size?: number | null;
6
- type?: string | null;
7
- name?: string | null;
8
- s3PostRequest?: S3PostRequestDto;
9
- };
@@ -1,11 +0,0 @@
1
- export type PubFileListDto = {
2
- id: string;
3
- createdAt: string;
4
- size?: number | null;
5
- type?: string | null;
6
- name?: string | null;
7
- tags: Array<string>;
8
- contentReady: boolean;
9
- textReady: boolean;
10
- searchIndexReady: boolean;
11
- };
@@ -1,5 +0,0 @@
1
- export type PubWebsiteDto = {
2
- id: string;
3
- createdAt: string;
4
- url: string;
5
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,10 +0,0 @@
1
- export type S3PostRequestDto = {
2
- amzDate: string;
3
- amzSignature: string;
4
- amzAlgorithm: string;
5
- amzCredential: string;
6
- policy: string;
7
- key: string;
8
- uploadUrl: string;
9
- sessionToken: string;
10
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,8 +0,0 @@
1
- export interface CreateFileRequest {
2
- streamId: string;
3
- fileName: string;
4
- fileType: string;
5
- fileSize: number;
6
- extractTextContent: boolean;
7
- clientSecret?: string;
8
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,9 +0,0 @@
1
- import { ApiError } from './ApiError';
2
- import { FencyFile } from './FencyFile';
3
- export type CreateFileResponse = {
4
- type: 'success';
5
- file: FencyFile;
6
- } | {
7
- type: 'error';
8
- error: ApiError;
9
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- export interface CreateWebsiteRequest {
2
- url: string;
3
- streamId: string;
4
- extractHtmlContent: boolean;
5
- extractTextContent: boolean;
6
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,9 +0,0 @@
1
- import { ApiError } from './ApiError';
2
- import { Website } from './Website';
3
- export type CreateWebsiteResponse = {
4
- type: 'success';
5
- website: Website;
6
- } | {
7
- type: 'error';
8
- error: ApiError;
9
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,11 +0,0 @@
1
- import { S3PostRequest } from "./S3PostRequest";
2
- export interface FencyFile {
3
- id: string;
4
- createdAt: string;
5
- size: number | null;
6
- type: string | null;
7
- name: string | null;
8
- content: string | null;
9
- text: string | null;
10
- s3PostRequest: S3PostRequest;
11
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,11 +0,0 @@
1
- export interface FencyListFileItem {
2
- id: string;
3
- createdAt: string;
4
- size: number | null;
5
- type: string | null;
6
- name: string | null;
7
- tags: string[];
8
- contentReady: boolean;
9
- textReady: boolean;
10
- searchIndexReady: boolean;
11
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,8 +0,0 @@
1
- export interface FileSearchItem {
2
- id: string;
3
- createdAt: string;
4
- fileName: string;
5
- mimeType: string;
6
- fileSize: number;
7
- text: string | null;
8
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- import { PaginationDto } from "../openapi";
2
- export interface ListFilesRequest {
3
- pagination?: PaginationDto;
4
- limit: number;
5
- clientSecret: string;
6
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,11 +0,0 @@
1
- import { PaginationDto } from '../openapi';
2
- import { ApiError } from './ApiError';
3
- import { FencyListFileItem } from './FencyListFileItem';
4
- export type ListFilesResponse = {
5
- type: 'success';
6
- items: FencyListFileItem[];
7
- pagination: PaginationDto;
8
- } | {
9
- type: 'error';
10
- error: ApiError;
11
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,4 +0,0 @@
1
- export interface SearchFilesRequest {
2
- text: string;
3
- clientSecret: string;
4
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,9 +0,0 @@
1
- import { FileSearchItem } from '../openapi';
2
- import { ApiError } from './ApiError';
3
- export type SearchFilesResponse = {
4
- type: 'success';
5
- results: FileSearchItem[];
6
- } | {
7
- type: 'error';
8
- error: ApiError;
9
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,7 +0,0 @@
1
- export type Website = {
2
- id: string;
3
- createdAt: string;
4
- url: string;
5
- content: string | null;
6
- text: string | null;
7
- };
@@ -1 +0,0 @@
1
- export {};
package/lib/types.d.ts DELETED
@@ -1,17 +0,0 @@
1
- /**
2
- * Configuration options for Fency
3
- */
4
- export interface FencyOptions {
5
- /** Your Fency publishable key */
6
- publishableKey: string;
7
- /** Optional configuration for the Fency instance */
8
- baseUrl?: string;
9
- }
10
- /**
11
- * Fency instance interface
12
- */
13
- export interface FencyInstance {
14
- /** The publishable key used to initialize this instance */
15
- publishableKey: string;
16
- baseUrl: string;
17
- }
package/lib/types.js DELETED
@@ -1 +0,0 @@
1
- export {};