@fencyai/js 0.1.60 → 0.1.61
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/lib/api/listFiles.d.ts +16 -0
- package/lib/api/listFiles.js +44 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +2 -0
- package/lib/openapi/index.d.ts +3 -0
- package/lib/openapi/models/ListFilesResponse.d.ts +6 -0
- package/lib/openapi/models/ListFilesResponse.js +1 -0
- package/lib/openapi/models/PaginationDto.d.ts +4 -0
- package/lib/openapi/models/PaginationDto.js +1 -0
- package/lib/openapi/models/PubFileListDto.d.ts +8 -0
- package/lib/openapi/models/PubFileListDto.js +1 -0
- package/lib/openapi/services/PubService.d.ts +10 -0
- package/lib/openapi/services/PubService.js +19 -0
- package/lib/types/FencyListFile.d.ts +8 -0
- package/lib/types/FencyListFile.js +1 -0
- package/lib/types/ListFilesRequest.d.ts +6 -0
- package/lib/types/ListFilesRequest.js +1 -0
- package/lib/types/ListFilesResponse.d.ts +11 -0
- package/lib/types/ListFilesResponse.js +1 -0
- package/lib/utils/version.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,16 @@
|
|
|
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>;
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
files: response.items.map((item) => ({
|
|
25
|
+
id: item.id,
|
|
26
|
+
createdAt: item.createdAt,
|
|
27
|
+
size: item.size,
|
|
28
|
+
type: item.type,
|
|
29
|
+
name: item.name,
|
|
30
|
+
tags: item.tags,
|
|
31
|
+
})),
|
|
32
|
+
pagination: response.pagination,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
return {
|
|
37
|
+
type: 'error',
|
|
38
|
+
error: {
|
|
39
|
+
code: 'UNKNOWN_ERROR',
|
|
40
|
+
message: `Unknown error!\n${error ? `Error: ${error}\n` : ''}`.trim(),
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
package/lib/index.d.ts
CHANGED
|
@@ -31,6 +31,9 @@ export type { CreateFileRequest } from './types/CreateFileRequest';
|
|
|
31
31
|
export type { CreateFileResponse } from './types/CreateFileResponse';
|
|
32
32
|
export { createStream } from './api/createStream';
|
|
33
33
|
export type { ChatCompletionStreamCompletedEventDto, FileTextContentReadyEventDto, FileUploadCompletedEventDto, NewChatCompletionStreamChunkEventDto, StreamNotFoundEventDto, StreamTimeoutEventDto, WebsiteHtmlContentReadyEventDto, WebsiteTextContentReadyEventDto, } from './openapi';
|
|
34
|
+
export { listFiles } from './api/listFiles';
|
|
35
|
+
export type { ListFilesRequest } from './types/ListFilesRequest';
|
|
36
|
+
export type { ListFilesResponse } from './types/ListFilesResponse';
|
|
34
37
|
export { createWebsite } from './api/createWebsite';
|
|
35
38
|
export type { CreateWebsiteResponse } from './types/CreateWebsiteResponse';
|
|
36
39
|
export { loadFency } from './loadFency';
|
package/lib/index.js
CHANGED
|
@@ -12,6 +12,8 @@ export { searchFiles } from './api/searchFiles';
|
|
|
12
12
|
export { createFile } from './api/createFile';
|
|
13
13
|
// create chat completion stre am
|
|
14
14
|
export { createStream } from './api/createStream';
|
|
15
|
+
// list files
|
|
16
|
+
export { listFiles } from './api/listFiles';
|
|
15
17
|
// create website
|
|
16
18
|
export { createWebsite } from './api/createWebsite';
|
|
17
19
|
// load fency
|
package/lib/openapi/index.d.ts
CHANGED
|
@@ -19,9 +19,12 @@ export type { FileSearchItem } from './models/FileSearchItem';
|
|
|
19
19
|
export type { FileSearchResponse } from './models/FileSearchResponse';
|
|
20
20
|
export type { FileTextContentReadyEventDto } from './models/FileTextContentReadyEventDto';
|
|
21
21
|
export type { FileUploadCompletedEventDto } from './models/FileUploadCompletedEventDto';
|
|
22
|
+
export type { ListFilesResponse } from './models/ListFilesResponse';
|
|
22
23
|
export type { NewChatCompletionStreamChunkEventDto } from './models/NewChatCompletionStreamChunkEventDto';
|
|
24
|
+
export type { PaginationDto } from './models/PaginationDto';
|
|
23
25
|
export type { PubCreateFileRequest } from './models/PubCreateFileRequest';
|
|
24
26
|
export type { PubFileDto } from './models/PubFileDto';
|
|
27
|
+
export type { PubFileListDto } from './models/PubFileListDto';
|
|
25
28
|
export type { PubWebsiteDto } from './models/PubWebsiteDto';
|
|
26
29
|
export type { S3PostRequestDto } from './models/S3PostRequestDto';
|
|
27
30
|
export type { StreamDto } from './models/StreamDto';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -6,6 +6,7 @@ import type { CreateWebsiteRequest } from '../models/CreateWebsiteRequest';
|
|
|
6
6
|
import type { FileSearchResponse } from '../models/FileSearchResponse';
|
|
7
7
|
import type { FileTextContentReadyEventDto } from '../models/FileTextContentReadyEventDto';
|
|
8
8
|
import type { FileUploadCompletedEventDto } from '../models/FileUploadCompletedEventDto';
|
|
9
|
+
import type { ListFilesResponse } from '../models/ListFilesResponse';
|
|
9
10
|
import type { NewChatCompletionStreamChunkEventDto } from '../models/NewChatCompletionStreamChunkEventDto';
|
|
10
11
|
import type { PubCreateFileRequest } from '../models/PubCreateFileRequest';
|
|
11
12
|
import type { PubFileDto } from '../models/PubFileDto';
|
|
@@ -24,6 +25,15 @@ export declare class PubService {
|
|
|
24
25
|
* @throws ApiError
|
|
25
26
|
*/
|
|
26
27
|
static createChatCompletion(requestBody: CreateChatCompletionRequest): CancelablePromise<ChatCompletionDto>;
|
|
28
|
+
/**
|
|
29
|
+
* List files
|
|
30
|
+
* @param nextPageToken
|
|
31
|
+
* @param previousPageToken
|
|
32
|
+
* @param limit
|
|
33
|
+
* @returns ListFilesResponse OK
|
|
34
|
+
* @throws ApiError
|
|
35
|
+
*/
|
|
36
|
+
static listFiles(nextPageToken?: string, previousPageToken?: string, limit?: number): CancelablePromise<ListFilesResponse>;
|
|
27
37
|
/**
|
|
28
38
|
* Create File
|
|
29
39
|
* @param requestBody
|
|
@@ -15,6 +15,25 @@ export class PubService {
|
|
|
15
15
|
mediaType: 'application/json',
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* List files
|
|
20
|
+
* @param nextPageToken
|
|
21
|
+
* @param previousPageToken
|
|
22
|
+
* @param limit
|
|
23
|
+
* @returns ListFilesResponse OK
|
|
24
|
+
* @throws ApiError
|
|
25
|
+
*/
|
|
26
|
+
static listFiles(nextPageToken, previousPageToken, limit) {
|
|
27
|
+
return __request(OpenAPI, {
|
|
28
|
+
method: 'GET',
|
|
29
|
+
url: '/v1/pub/files',
|
|
30
|
+
query: {
|
|
31
|
+
'nextPageToken': nextPageToken,
|
|
32
|
+
'previousPageToken': previousPageToken,
|
|
33
|
+
'limit': limit,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
}
|
|
18
37
|
/**
|
|
19
38
|
* Create File
|
|
20
39
|
* @param requestBody
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PaginationDto } from '../openapi';
|
|
2
|
+
import { ApiError } from './ApiError';
|
|
3
|
+
import { FencyListFile } from './FencyListFile';
|
|
4
|
+
export type ListFilesResponse = {
|
|
5
|
+
type: 'success';
|
|
6
|
+
files: FencyListFile[];
|
|
7
|
+
pagination: PaginationDto;
|
|
8
|
+
} | {
|
|
9
|
+
type: 'error';
|
|
10
|
+
error: ApiError;
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/utils/version.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Browser-compatible version utility
|
|
2
2
|
// The version is set at build time and can be overridden if needed
|
|
3
3
|
// Build-time version constant - this should be updated during the build process
|
|
4
|
-
const SDK_VERSION = '0.1.
|
|
4
|
+
const SDK_VERSION = '0.1.59';
|
|
5
5
|
// Allow runtime override if needed
|
|
6
6
|
let versionOverride = null;
|
|
7
7
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fencyai/js",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.61",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "staklau <steinaageklaussen@gmail.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"ts-jest": "^29.1.1",
|
|
43
43
|
"typescript": "^5.3.3"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "2846bdcfc0d8b16c5d1857fd4d1f63d3a584b737"
|
|
46
46
|
}
|