@fencyai/js 0.1.84 → 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.
@@ -0,0 +1,8 @@
1
+ import { ListMemoriesRequest } from '../types/ListMemoriesRequest';
2
+ import { ListMemoriesResponse } from '../types/ListMemoriesResponse';
3
+ export declare function listMemories(params: {
4
+ pk: string;
5
+ clientSecret: string;
6
+ request: ListMemoriesRequest;
7
+ baseUrl: string;
8
+ }): Promise<ListMemoriesResponse>;
@@ -0,0 +1,54 @@
1
+ import { getPackageVersion } from '../utils/version';
2
+ export async function listMemories(params) {
3
+ try {
4
+ const response = await listMemoriesApi({
5
+ baseUrl: params.baseUrl,
6
+ pk: params.pk,
7
+ clientSecret: params.clientSecret,
8
+ nextPageToken: params.request.nextPageToken,
9
+ previousPageToken: params.request.previousPageToken,
10
+ limit: params.request.limit,
11
+ typeName: params.request.typeName,
12
+ title: params.request.title,
13
+ meta: params.request.meta,
14
+ });
15
+ return {
16
+ type: 'success',
17
+ items: response.items,
18
+ pagination: response.pagination,
19
+ };
20
+ }
21
+ catch (error) {
22
+ throw error;
23
+ }
24
+ }
25
+ async function listMemoriesApi(params) {
26
+ const queryParams = new URLSearchParams();
27
+ if (params.nextPageToken)
28
+ queryParams.append('nextPageToken', params.nextPageToken);
29
+ if (params.previousPageToken)
30
+ queryParams.append('previousPageToken', params.previousPageToken);
31
+ if (params.limit !== undefined)
32
+ queryParams.append('limit', params.limit.toString());
33
+ if (params.typeName)
34
+ queryParams.append('typeName', encodeURIComponent(params.typeName));
35
+ if (params.title)
36
+ queryParams.append('title', encodeURIComponent(params.title));
37
+ // Handle meta object - encode as key-value pairs
38
+ if (params.meta && Object.keys(params.meta).length > 0) {
39
+ Object.entries(params.meta).forEach(([key, value]) => {
40
+ queryParams.append(`meta_${encodeURIComponent(key)}`, value);
41
+ });
42
+ }
43
+ const queryString = queryParams.toString();
44
+ const response = await fetch(`${params.baseUrl}/v1/pub/memories?${queryString}`, {
45
+ method: 'GET',
46
+ headers: {
47
+ 'Content-Type': 'application/json',
48
+ Authorization: `Bearer ${params.pk}`,
49
+ 'X-Fency-Sdk-Version': getPackageVersion(),
50
+ 'X-Fency-Client-Secret': params.clientSecret,
51
+ },
52
+ });
53
+ return response.json();
54
+ }
package/lib/index.d.ts CHANGED
@@ -5,3 +5,4 @@ export type { ChatCompletionStreamCompletedEventDto, FileTextContentReadyEventDt
5
5
  export { createChatCompletion } from './api/createChatCompletion';
6
6
  export { createStream } from './api/createStream';
7
7
  export { listMemoryTypes } from './api/listMemoryTypes';
8
+ export { listMemories } from './api/listMemories';
package/lib/index.js CHANGED
@@ -4,3 +4,4 @@ export * from './types/index';
4
4
  export { createChatCompletion } from './api/createChatCompletion';
5
5
  export { createStream } from './api/createStream';
6
6
  export { listMemoryTypes } from './api/listMemoryTypes';
7
+ export { listMemories } from './api/listMemories';
@@ -15,11 +15,13 @@ export type { CreateStreamRequest } from './models/CreateStreamRequest';
15
15
  export type { FileSearchIndexReadyEventDto } from './models/FileSearchIndexReadyEventDto';
16
16
  export type { FileTextContentReadyEventDto } from './models/FileTextContentReadyEventDto';
17
17
  export type { FileUploadCompletedEventDto } from './models/FileUploadCompletedEventDto';
18
+ export type { ListMemoriesResponse } from './models/ListMemoriesResponse';
18
19
  export type { ListMemoryTypesResponse } from './models/ListMemoryTypesResponse';
19
20
  export type { NewChatCompletionStreamChunkEventDto } from './models/NewChatCompletionStreamChunkEventDto';
20
21
  export type { PaginationDto } from './models/PaginationDto';
21
22
  export type { PubChatCompletionDto } from './models/PubChatCompletionDto';
22
23
  export type { PubCreateChatCompletionRequest } from './models/PubCreateChatCompletionRequest';
24
+ export type { PubMemoryDto } from './models/PubMemoryDto';
23
25
  export type { PubMemoryTypeDto } from './models/PubMemoryTypeDto';
24
26
  export type { StreamDto } from './models/StreamDto';
25
27
  export { StreamEventType } from './models/StreamEventType';
@@ -0,0 +1,6 @@
1
+ import type { PaginationDto } from './PaginationDto';
2
+ import type { PubMemoryDto } from './PubMemoryDto';
3
+ export type ListMemoriesResponse = {
4
+ items: Array<PubMemoryDto>;
5
+ pagination: PaginationDto;
6
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export type PubMemoryDto = {
2
+ id: string;
3
+ createdAt: string;
4
+ title?: string | null;
5
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -3,6 +3,7 @@ import type { CreateStreamRequest } from '../models/CreateStreamRequest';
3
3
  import type { FileSearchIndexReadyEventDto } from '../models/FileSearchIndexReadyEventDto';
4
4
  import type { FileTextContentReadyEventDto } from '../models/FileTextContentReadyEventDto';
5
5
  import type { FileUploadCompletedEventDto } from '../models/FileUploadCompletedEventDto';
6
+ import type { ListMemoriesResponse } from '../models/ListMemoriesResponse';
6
7
  import type { ListMemoryTypesResponse } from '../models/ListMemoryTypesResponse';
7
8
  import type { NewChatCompletionStreamChunkEventDto } from '../models/NewChatCompletionStreamChunkEventDto';
8
9
  import type { PubChatCompletionDto } from '../models/PubChatCompletionDto';
@@ -21,6 +22,15 @@ export declare class PubService {
21
22
  * @throws ApiError
22
23
  */
23
24
  static createChatCompletion(requestBody: PubCreateChatCompletionRequest): CancelablePromise<PubChatCompletionDto>;
25
+ /**
26
+ * List Memories
27
+ * @param nextPageToken
28
+ * @param previousPageToken
29
+ * @param limit
30
+ * @returns ListMemoriesResponse OK
31
+ * @throws ApiError
32
+ */
33
+ static listMemories(nextPageToken?: string, previousPageToken?: string, limit?: number): CancelablePromise<ListMemoriesResponse>;
24
34
  /**
25
35
  * List Memory Types
26
36
  * @param nextPageToken
@@ -15,6 +15,25 @@ export class PubService {
15
15
  mediaType: 'application/json',
16
16
  });
17
17
  }
18
+ /**
19
+ * List Memories
20
+ * @param nextPageToken
21
+ * @param previousPageToken
22
+ * @param limit
23
+ * @returns ListMemoriesResponse OK
24
+ * @throws ApiError
25
+ */
26
+ static listMemories(nextPageToken, previousPageToken, limit) {
27
+ return __request(OpenAPI, {
28
+ method: 'GET',
29
+ url: '/v1/pub/memories',
30
+ query: {
31
+ 'nextPageToken': nextPageToken,
32
+ 'previousPageToken': previousPageToken,
33
+ 'limit': limit,
34
+ },
35
+ });
36
+ }
18
37
  /**
19
38
  * List Memory Types
20
39
  * @param nextPageToken
@@ -0,0 +1,8 @@
1
+ export interface ListMemoriesRequest {
2
+ typeName?: string;
3
+ title?: string;
4
+ meta: Record<string, string>;
5
+ nextPageToken?: string;
6
+ previousPageToken?: string;
7
+ limit?: number;
8
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import { PaginationDto, PubMemoryDto } from '../openapi';
2
+ import { ApiError } from './ApiError';
3
+ export type ListMemoriesResponse = {
4
+ type: 'success';
5
+ items: PubMemoryDto[];
6
+ pagination: PaginationDto;
7
+ } | {
8
+ type: 'error';
9
+ error: ApiError;
10
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -19,3 +19,5 @@ export type { ListMemoryTypesResponse } from './ListMemoryTypesResponse';
19
19
  export type { CreateChatCompletionResponse } from './CreateChatCompletionResponse';
20
20
  export type { FencyInstance } from './FencyInstance';
21
21
  export type { FencyOptions } from './FencyOptions';
22
+ export type { ListMemoriesResponse } from './ListMemoriesResponse';
23
+ export type { ListMemoriesRequest } from './ListMemoriesRequest';
@@ -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.82';
4
+ const SDK_VERSION = '0.1.83';
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.84",
3
+ "version": "0.1.85",
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": "2097d91c002c61a2dcfcaafbe0407458dbb88739"
45
+ "gitHead": "fc0cdc699f3b28db051eb93b868708763c7f7990"
46
46
  }