@fencyai/js 0.1.58 → 0.1.60
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/createFile.js +3 -0
- package/lib/api/searchFiles.d.ts +16 -0
- package/lib/api/searchFiles.js +36 -0
- package/lib/index.d.ts +8 -3
- package/lib/index.js +3 -1
- package/lib/openapi/index.d.ts +2 -0
- package/lib/openapi/models/ApiDtoType.d.ts +1 -1
- package/lib/openapi/models/ApiDtoType.js +1 -1
- package/lib/openapi/models/FileSearchItem.d.ts +6 -0
- package/lib/openapi/models/FileSearchItem.js +1 -0
- package/lib/openapi/models/FileSearchResponse.d.ts +4 -0
- package/lib/openapi/models/FileSearchResponse.js +1 -0
- package/lib/openapi/services/PubService.d.ts +8 -0
- package/lib/openapi/services/PubService.js +15 -0
- package/lib/types/CreateFileRequest.d.ts +1 -0
- package/lib/types/FileSearchItem.d.ts +8 -0
- package/lib/types/FileSearchItem.js +1 -0
- package/lib/types/SearchFilesRequest.d.ts +4 -0
- package/lib/types/SearchFilesRequest.js +1 -0
- package/lib/types/SearchFilesResponse.d.ts +9 -0
- package/lib/types/SearchFilesResponse.js +1 -0
- package/lib/utils/version.js +1 -1
- package/package.json +4 -3
package/lib/api/createFile.js
CHANGED
|
@@ -16,6 +16,9 @@ export async function createFile(params) {
|
|
|
16
16
|
'Content-Type': 'application/json',
|
|
17
17
|
Authorization: `Bearer ${params.pk}`,
|
|
18
18
|
'X-Fency-Sdk-Version': getPackageVersion(),
|
|
19
|
+
...(params.request.clientSecret
|
|
20
|
+
? { 'X-Fency-Client-Secret': params.request.clientSecret }
|
|
21
|
+
: {}),
|
|
19
22
|
};
|
|
20
23
|
const response = await PubService.createFile({
|
|
21
24
|
streamId: params.request.streamId,
|
|
@@ -0,0 +1,16 @@
|
|
|
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>;
|
|
@@ -0,0 +1,36 @@
|
|
|
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 searchFiles(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.searchFiles(params.request.text);
|
|
22
|
+
return {
|
|
23
|
+
type: 'success',
|
|
24
|
+
results: response.results,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
return {
|
|
29
|
+
type: 'error',
|
|
30
|
+
error: {
|
|
31
|
+
code: 'UnknownError',
|
|
32
|
+
message: `Unknown error!\n${error ? `Error: ${error}\n` : ''}`.trim(),
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
package/lib/index.d.ts
CHANGED
|
@@ -5,23 +5,28 @@ export type { FencyInstance, FencyOptions } from './types';
|
|
|
5
5
|
export type { AnthropicModel } from './types/AnthropicModel';
|
|
6
6
|
export type { ChatCompletion, isChatCompletion } from './types/ChatCompletion';
|
|
7
7
|
export type { ChatCompletionMessage } from './types/ChatCompletionMessage';
|
|
8
|
-
export type {
|
|
8
|
+
export type { ClaudeChatCompletionMessage } from './types/ClaudeChatCompletionMessage';
|
|
9
9
|
export type { CreateChatCompletionRequest } from './types/CreateChatCompletionRequest';
|
|
10
|
+
export type { CreateClaudeChatCompletionRequestParams } from './types/CreateClaudeChatCompletionRequestParams';
|
|
10
11
|
export type { CreateGeminiChatCompletionRequestParams } from './types/CreateGeminiChatCompletionRequestParams';
|
|
11
12
|
export type { CreateOpenAiChatCompletionRequestParams } from './types/CreateOpenAiChatCompletionRequestParams';
|
|
12
13
|
export type { CreateStreamRequest } from './types/CreateStreamRequest';
|
|
13
14
|
export type { CreateStreamResponse } from './types/CreateStreamResponse';
|
|
14
15
|
export type { CreateWebsiteRequest } from './types/CreateWebsiteRequest';
|
|
15
16
|
export type { FencyFile } from './types/FencyFile';
|
|
17
|
+
export type { GeminiChatCompletionMessage } from './types/GeminiChatCompletionMessage';
|
|
16
18
|
export type { GeminiModel } from './types/GeminiModel';
|
|
17
19
|
export type { OpenAiModel } from './types/OpenAiModel';
|
|
18
20
|
export type { Stream } from './types/Stream';
|
|
19
21
|
export type { Website } from './types/Website';
|
|
20
|
-
export type { ClaudeChatCompletionMessage } from './types/ClaudeChatCompletionMessage';
|
|
21
|
-
export type { GeminiChatCompletionMessage } from './types/GeminiChatCompletionMessage';
|
|
22
22
|
export { createChatCompletion } from './api/createChatCompletion';
|
|
23
23
|
export type { CreateChatCompletionResponse } from './api/createChatCompletion';
|
|
24
|
+
export { searchFiles } from './api/searchFiles';
|
|
25
|
+
export type { FileSearchItem, FileSearchResponse } from './openapi';
|
|
26
|
+
export type { SearchFilesRequest } from './types/SearchFilesRequest';
|
|
27
|
+
export type { SearchFilesResponse } from './types/SearchFilesResponse';
|
|
24
28
|
export { createFile } from './api/createFile';
|
|
29
|
+
export type { S3PostRequestDto } from './openapi';
|
|
25
30
|
export type { CreateFileRequest } from './types/CreateFileRequest';
|
|
26
31
|
export type { CreateFileResponse } from './types/CreateFileResponse';
|
|
27
32
|
export { createStream } from './api/createStream';
|
package/lib/index.js
CHANGED
|
@@ -6,9 +6,11 @@ import { createStream } from './api/createStream';
|
|
|
6
6
|
import { loadFency } from './loadFency';
|
|
7
7
|
// create chat completion
|
|
8
8
|
export { createChatCompletion } from './api/createChatCompletion';
|
|
9
|
+
// search files
|
|
10
|
+
export { searchFiles } from './api/searchFiles';
|
|
9
11
|
// uploads
|
|
10
12
|
export { createFile } from './api/createFile';
|
|
11
|
-
// create chat completion
|
|
13
|
+
// create chat completion stre am
|
|
12
14
|
export { createStream } from './api/createStream';
|
|
13
15
|
// create website
|
|
14
16
|
export { createWebsite } from './api/createWebsite';
|
package/lib/openapi/index.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export type { CreateOpenAiChatCompletionDto } from './models/CreateOpenAiChatCom
|
|
|
15
15
|
export type { CreateOpenAiChatCompletionMessageDto } from './models/CreateOpenAiChatCompletionMessageDto';
|
|
16
16
|
export type { CreateStreamRequest } from './models/CreateStreamRequest';
|
|
17
17
|
export type { CreateWebsiteRequest } from './models/CreateWebsiteRequest';
|
|
18
|
+
export type { FileSearchItem } from './models/FileSearchItem';
|
|
19
|
+
export type { FileSearchResponse } from './models/FileSearchResponse';
|
|
18
20
|
export type { FileTextContentReadyEventDto } from './models/FileTextContentReadyEventDto';
|
|
19
21
|
export type { FileUploadCompletedEventDto } from './models/FileUploadCompletedEventDto';
|
|
20
22
|
export type { NewChatCompletionStreamChunkEventDto } from './models/NewChatCompletionStreamChunkEventDto';
|
|
@@ -6,6 +6,6 @@ export var ApiDtoType;
|
|
|
6
6
|
(function (ApiDtoType) {
|
|
7
7
|
ApiDtoType["CHAT_COMPLETION"] = "ChatCompletion";
|
|
8
8
|
ApiDtoType["STREAM"] = "Stream";
|
|
9
|
-
ApiDtoType["
|
|
9
|
+
ApiDtoType["SESSION"] = "Session";
|
|
10
10
|
ApiDtoType["USER"] = "User";
|
|
11
11
|
})(ApiDtoType || (ApiDtoType = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,6 +3,7 @@ import type { ChatCompletionStreamCompletedEventDto } from '../models/ChatComple
|
|
|
3
3
|
import type { CreateChatCompletionRequest } from '../models/CreateChatCompletionRequest';
|
|
4
4
|
import type { CreateStreamRequest } from '../models/CreateStreamRequest';
|
|
5
5
|
import type { CreateWebsiteRequest } from '../models/CreateWebsiteRequest';
|
|
6
|
+
import type { FileSearchResponse } from '../models/FileSearchResponse';
|
|
6
7
|
import type { FileTextContentReadyEventDto } from '../models/FileTextContentReadyEventDto';
|
|
7
8
|
import type { FileUploadCompletedEventDto } from '../models/FileUploadCompletedEventDto';
|
|
8
9
|
import type { NewChatCompletionStreamChunkEventDto } from '../models/NewChatCompletionStreamChunkEventDto';
|
|
@@ -30,6 +31,13 @@ export declare class PubService {
|
|
|
30
31
|
* @throws ApiError
|
|
31
32
|
*/
|
|
32
33
|
static createFile(requestBody: PubCreateFileRequest): CancelablePromise<PubFileDto>;
|
|
34
|
+
/**
|
|
35
|
+
* Search files
|
|
36
|
+
* @param text
|
|
37
|
+
* @returns FileSearchResponse OK
|
|
38
|
+
* @throws ApiError
|
|
39
|
+
*/
|
|
40
|
+
static searchFiles(text: string): CancelablePromise<FileSearchResponse>;
|
|
33
41
|
/**
|
|
34
42
|
* Create Chat Completion Stream
|
|
35
43
|
* @param requestBody
|
|
@@ -29,6 +29,21 @@ export class PubService {
|
|
|
29
29
|
mediaType: 'application/json',
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Search files
|
|
34
|
+
* @param text
|
|
35
|
+
* @returns FileSearchResponse OK
|
|
36
|
+
* @throws ApiError
|
|
37
|
+
*/
|
|
38
|
+
static searchFiles(text) {
|
|
39
|
+
return __request(OpenAPI, {
|
|
40
|
+
method: 'GET',
|
|
41
|
+
url: '/v1/pub/files/search',
|
|
42
|
+
query: {
|
|
43
|
+
'text': text,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
}
|
|
32
47
|
/**
|
|
33
48
|
* Create Chat Completion Stream
|
|
34
49
|
* @param requestBody
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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.58';
|
|
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.60",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "staklau <steinaageklaussen@gmail.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
13
|
"import": "./lib/index.js",
|
|
14
|
-
"types": "./lib/index.d.ts"
|
|
14
|
+
"types": "./lib/index.d.ts",
|
|
15
|
+
"default": "./lib/index.js"
|
|
15
16
|
}
|
|
16
17
|
},
|
|
17
18
|
"directories": {
|
|
@@ -41,5 +42,5 @@
|
|
|
41
42
|
"ts-jest": "^29.1.1",
|
|
42
43
|
"typescript": "^5.3.3"
|
|
43
44
|
},
|
|
44
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "75f1fd665a806dcaa11208084cbb55af65382567"
|
|
45
46
|
}
|