@fencyai/js 0.1.99 → 0.1.100

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.
@@ -16,7 +16,7 @@ export async function createAgentTask(params) {
16
16
  id: response.id,
17
17
  createdAt: response.createdAt,
18
18
  status: response.status,
19
- response: response.response,
19
+ response: response.response ?? undefined,
20
20
  },
21
21
  };
22
22
  }
@@ -0,0 +1,8 @@
1
+ import { GetFileDownloadLinkRequest } from '../types/GetFileDownloadLinkRequest';
2
+ import { GetFileDownloadLinkResponse } from '../types/GetFileDownloadLinkResponse';
3
+ export declare function getFileDownloadLink(params: {
4
+ pk: string;
5
+ clientSecret: string;
6
+ request: GetFileDownloadLinkRequest;
7
+ baseUrl: string;
8
+ }): Promise<GetFileDownloadLinkResponse>;
@@ -0,0 +1,33 @@
1
+ import { getPackageVersion } from '../utils/version';
2
+ export async function getFileDownloadLink(params) {
3
+ try {
4
+ const response = await getFileDownloadLinkApi({
5
+ baseUrl: params.baseUrl,
6
+ pk: params.pk,
7
+ clientSecret: params.clientSecret,
8
+ fileId: params.request.fileId,
9
+ });
10
+ return {
11
+ type: 'success',
12
+ downloadLink: response.downloadLink,
13
+ };
14
+ }
15
+ catch (error) {
16
+ throw error;
17
+ }
18
+ }
19
+ async function getFileDownloadLinkApi(params) {
20
+ const response = await fetch(`${params.baseUrl}/v1/pub/files/${encodeURIComponent(params.fileId)}`, {
21
+ method: 'GET',
22
+ headers: {
23
+ 'Content-Type': 'application/json',
24
+ Authorization: `Bearer ${params.pk}`,
25
+ 'X-Fency-Sdk-Version': getPackageVersion(),
26
+ 'X-Fency-Client-Secret': params.clientSecret,
27
+ },
28
+ });
29
+ if (!response.ok) {
30
+ throw new Error(`Failed to get file download link: ${response.statusText}`);
31
+ }
32
+ return response.json();
33
+ }
package/lib/index.d.ts CHANGED
@@ -8,3 +8,4 @@ export { createChatCompletion } from './api/createChatCompletion';
8
8
  export { createStream } from './api/createStream';
9
9
  export { listMemoryTypes } from './api/listMemoryTypes';
10
10
  export { listMemories } from './api/listMemories';
11
+ export { getFileDownloadLink } from './api/getFileDownloadLink';
package/lib/index.js CHANGED
@@ -7,3 +7,4 @@ export { createChatCompletion } from './api/createChatCompletion';
7
7
  export { createStream } from './api/createStream';
8
8
  export { listMemoryTypes } from './api/listMemoryTypes';
9
9
  export { listMemories } from './api/listMemories';
10
+ export { getFileDownloadLink } from './api/getFileDownloadLink';
@@ -24,6 +24,7 @@ export type { PubAgentTaskDto } from './models/PubAgentTaskDto';
24
24
  export type { PubChatCompletionDto } from './models/PubChatCompletionDto';
25
25
  export type { PubCreateAgentTaskRequest } from './models/PubCreateAgentTaskRequest';
26
26
  export type { PubCreateChatCompletionRequest } from './models/PubCreateChatCompletionRequest';
27
+ export type { PubGetFileDownloadLinkResponse } from './models/PubGetFileDownloadLinkResponse';
27
28
  export type { PubMemoryDto } from './models/PubMemoryDto';
28
29
  export type { PubMemoryTypeDto } from './models/PubMemoryTypeDto';
29
30
  export type { StreamDto } from './models/StreamDto';
@@ -3,5 +3,5 @@ export type PubAgentTaskDto = {
3
3
  id: string;
4
4
  createdAt: string;
5
5
  status: AgentTaskStatusDto;
6
- response?: Record<string, any>;
6
+ response?: string | null;
7
7
  };
@@ -0,0 +1,3 @@
1
+ export type PubGetFileDownloadLinkResponse = {
2
+ downloadLink: string;
3
+ };
@@ -10,6 +10,7 @@ import type { PubAgentTaskDto } from '../models/PubAgentTaskDto';
10
10
  import type { PubChatCompletionDto } from '../models/PubChatCompletionDto';
11
11
  import type { PubCreateAgentTaskRequest } from '../models/PubCreateAgentTaskRequest';
12
12
  import type { PubCreateChatCompletionRequest } from '../models/PubCreateChatCompletionRequest';
13
+ import type { PubGetFileDownloadLinkResponse } from '../models/PubGetFileDownloadLinkResponse';
13
14
  import type { StreamDto } from '../models/StreamDto';
14
15
  import type { StreamNotFoundEventDto } from '../models/StreamNotFoundEventDto';
15
16
  import type { StreamTimeoutEventDto } from '../models/StreamTimeoutEventDto';
@@ -31,6 +32,13 @@ export declare class PubService {
31
32
  * @throws ApiError
32
33
  */
33
34
  static createChatCompletion(requestBody: PubCreateChatCompletionRequest): CancelablePromise<PubChatCompletionDto>;
35
+ /**
36
+ * Get File Download Link
37
+ * @param fileId
38
+ * @returns PubGetFileDownloadLinkResponse OK
39
+ * @throws ApiError
40
+ */
41
+ static getFileDownloadLink(fileId: string): CancelablePromise<PubGetFileDownloadLinkResponse>;
34
42
  /**
35
43
  * List Memories
36
44
  * @param nextPageToken
@@ -29,6 +29,21 @@ export class PubService {
29
29
  mediaType: 'application/json',
30
30
  });
31
31
  }
32
+ /**
33
+ * Get File Download Link
34
+ * @param fileId
35
+ * @returns PubGetFileDownloadLinkResponse OK
36
+ * @throws ApiError
37
+ */
38
+ static getFileDownloadLink(fileId) {
39
+ return __request(OpenAPI, {
40
+ method: 'GET',
41
+ url: '/v1/pub/files/{fileId}',
42
+ path: {
43
+ 'fileId': fileId,
44
+ },
45
+ });
46
+ }
32
47
  /**
33
48
  * List Memories
34
49
  * @param nextPageToken
@@ -2,7 +2,7 @@ import { AgentTaskStatusDto } from "../openapi";
2
2
  export type AgentTask = {
3
3
  id: string;
4
4
  status: AgentTaskStatusDto;
5
- response?: Record<string, any>;
5
+ response?: string;
6
6
  createdAt: string;
7
7
  };
8
8
  export declare const isAgentTask: (data: any) => data is AgentTask;
@@ -0,0 +1,3 @@
1
+ export interface GetFileDownloadLinkRequest {
2
+ fileId: string;
3
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export interface GetFileDownloadLinkResponse {
2
+ type: 'success';
3
+ downloadLink: string;
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -24,3 +24,5 @@ export type { FencyInstance } from './FencyInstance';
24
24
  export type { FencyOptions } from './FencyOptions';
25
25
  export type { ListMemoriesResponse } from './ListMemoriesResponse';
26
26
  export type { ListMemoriesRequest } from './ListMemoriesRequest';
27
+ export type { GetFileDownloadLinkRequest } from './GetFileDownloadLinkRequest';
28
+ export type { GetFileDownloadLinkResponse } from './GetFileDownloadLinkResponse';
@@ -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.97';
4
+ const SDK_VERSION = '0.1.98';
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.99",
3
+ "version": "0.1.100",
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": "982cdf11451b24fd0b968fdc83e0f7df296d3989"
45
+ "gitHead": "50b979bbb5fe85344a5e80a8b8b5c18d41508b9b"
46
46
  }