@fencyai/js 0.1.48 → 0.1.50

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 (40) hide show
  1. package/lib/api/{createUpload.d.ts → createFile.d.ts} +5 -5
  2. package/lib/api/{createUpload.js → createFile.js} +8 -3
  3. package/lib/index.d.ts +6 -7
  4. package/lib/index.js +1 -1
  5. package/lib/openapi/index.d.ts +2 -7
  6. package/lib/openapi/models/ChatCompletionStreamCompletedEventDto.d.ts +2 -4
  7. package/lib/openapi/models/FileTextContentReadyEventDto.d.ts +2 -6
  8. package/lib/openapi/models/FileUploadCompletedEventDto.d.ts +2 -6
  9. package/lib/openapi/models/NewChatCompletionStreamChunkEventDto.d.ts +2 -4
  10. package/lib/openapi/models/{PubCreateUploadRequest.d.ts → PubCreateFileRequest.d.ts} +1 -1
  11. package/lib/openapi/models/{PubUploadDto.d.ts → PubFileDto.d.ts} +4 -1
  12. package/lib/openapi/models/StreamNotFoundEventDto.d.ts +1 -2
  13. package/lib/openapi/models/StreamTimeoutEventDto.d.ts +1 -2
  14. package/lib/openapi/models/WebsiteHtmlContentReadyEventDto.d.ts +2 -4
  15. package/lib/openapi/models/WebsiteTextContentReadyEventDto.d.ts +2 -4
  16. package/lib/openapi/services/PubService.d.ts +9 -9
  17. package/lib/openapi/services/PubService.js +14 -14
  18. package/lib/types/{CreateUploadRequest.d.ts → CreateFileRequest.d.ts} +1 -1
  19. package/lib/types/{CreateUploadResponse.d.ts → CreateFileResponse.d.ts} +3 -3
  20. package/lib/types/FencyFile.d.ts +2 -0
  21. package/lib/utils/version.js +1 -1
  22. package/package.json +2 -2
  23. package/lib/openapi/models/StoredChatCompletionId.d.ts +0 -3
  24. package/lib/openapi/models/StoredFileId.d.ts +0 -3
  25. package/lib/openapi/models/StoredStreamId.d.ts +0 -3
  26. package/lib/openapi/models/StoredStreamId.js +0 -1
  27. package/lib/openapi/models/StoredUploadId.d.ts +0 -3
  28. package/lib/openapi/models/StoredUploadId.js +0 -1
  29. package/lib/openapi/models/StoredWebsiteId.d.ts +0 -3
  30. package/lib/openapi/models/StoredWebsiteId.js +0 -1
  31. package/lib/types/CreateUploadRequest.js +0 -1
  32. package/lib/types/CreateUploadResponse.js +0 -1
  33. package/lib/types/StreamData.d.ts +0 -53
  34. package/lib/types/StreamData.js +0 -1
  35. package/lib/types/Upload.d.ts +0 -6
  36. package/lib/types/Upload.js +0 -1
  37. /package/lib/openapi/models/{PubCreateUploadRequest.js → PubCreateFileRequest.js} +0 -0
  38. /package/lib/openapi/models/{PubUploadDto.js → PubFileDto.js} +0 -0
  39. /package/lib/{openapi/models/StoredChatCompletionId.js → types/CreateFileRequest.js} +0 -0
  40. /package/lib/{openapi/models/StoredFileId.js → types/CreateFileResponse.js} +0 -0
@@ -1,5 +1,5 @@
1
- import { CreateUploadRequest } from '../types/CreateUploadRequest';
2
- import { CreateUploadResponse } from '../types/CreateUploadResponse';
1
+ import { CreateFileRequest } from '../types/CreateFileRequest';
2
+ import { CreateFileResponse } from '../types/CreateFileResponse';
3
3
  /**
4
4
  * Creates a website by making a POST request to the Fency API.
5
5
  *
@@ -9,8 +9,8 @@ import { CreateUploadResponse } from '../types/CreateUploadResponse';
9
9
  * @returns A promise that resolves to a CreateWebsiteResponse
10
10
  * @throws Error if the request fails or the response is invalid
11
11
  */
12
- export declare function createUpload(params: {
12
+ export declare function createFile(params: {
13
13
  pk: string;
14
- request: CreateUploadRequest;
14
+ request: CreateFileRequest;
15
15
  baseUrl: string;
16
- }): Promise<CreateUploadResponse>;
16
+ }): Promise<CreateFileResponse>;
@@ -9,7 +9,7 @@ import { getPackageVersion } from '../utils/version';
9
9
  * @returns A promise that resolves to a CreateWebsiteResponse
10
10
  * @throws Error if the request fails or the response is invalid
11
11
  */
12
- export async function createUpload(params) {
12
+ export async function createFile(params) {
13
13
  try {
14
14
  OpenAPI.BASE = params.baseUrl;
15
15
  OpenAPI.HEADERS = {
@@ -17,7 +17,7 @@ export async function createUpload(params) {
17
17
  Authorization: `Bearer ${params.pk}`,
18
18
  'X-Fency-Sdk-Version': getPackageVersion(),
19
19
  };
20
- const response = await PubService.createUpload({
20
+ const response = await PubService.createFile({
21
21
  streamId: params.request.streamId,
22
22
  fileName: params.request.fileName,
23
23
  mimeType: params.request.fileType,
@@ -25,9 +25,14 @@ export async function createUpload(params) {
25
25
  });
26
26
  return {
27
27
  type: 'success',
28
- upload: {
28
+ file: {
29
29
  id: response.id,
30
30
  createdAt: response.createdAt,
31
+ size: response.size,
32
+ type: response.type,
33
+ name: response.name,
34
+ content: null,
35
+ text: null,
31
36
  s3PostRequest: {
32
37
  xAmzDate: response.s3PostRequest.amzDate,
33
38
  xAmzSignature: response.s3PostRequest.amzSignature,
package/lib/index.d.ts CHANGED
@@ -12,19 +12,18 @@ export type { CreateOpenAiChatCompletionParams } from './types/CreateOpenAiChatC
12
12
  export type { CreateStreamRequest } from './types/CreateStreamRequest';
13
13
  export type { CreateStreamResponse } from './types/CreateStreamResponse';
14
14
  export type { CreateWebsiteRequest } from './types/CreateWebsiteRequest';
15
- export type { Upload } from './types/Upload';
16
- export type { Website } from './types/Website';
15
+ export type { FencyFile } from './types/FencyFile';
17
16
  export type { GeminiModel } from './types/GeminiModel';
18
17
  export type { OpenAiModel } from './types/OpenAiModel';
19
18
  export type { Stream } from './types/Stream';
19
+ export type { Website } from './types/Website';
20
20
  export { createChatCompletion } from './api/createChatCompletion';
21
21
  export type { CreateChatCompletionResponse } from './api/createChatCompletion';
22
- export { createUpload } from './api/createUpload';
23
- export type { CreateUploadRequest } from './types/CreateUploadRequest';
24
- export type { CreateUploadResponse } from './types/CreateUploadResponse';
25
- export type { FencyFile } from './types/FencyFile';
22
+ export { createFile } from './api/createFile';
23
+ export type { CreateFileRequest } from './types/CreateFileRequest';
24
+ export type { CreateFileResponse } from './types/CreateFileResponse';
26
25
  export { createStream } from './api/createStream';
27
- export type { ChatCompletionStreamCompleted, FileUploadCompleted, NewChatCompletionStreamChunk, StreamData, StreamNotFound, StreamTimeout, FileTextContentReady, } from './types/StreamData';
26
+ export type { ChatCompletionStreamCompletedEventDto, FileTextContentReadyEventDto, FileUploadCompletedEventDto, NewChatCompletionStreamChunkEventDto, StreamNotFoundEventDto, StreamTimeoutEventDto, WebsiteHtmlContentReadyEventDto, WebsiteTextContentReadyEventDto, } from './openapi';
28
27
  export { createWebsite } from './api/createWebsite';
29
28
  export type { CreateWebsiteResponse } from './types/CreateWebsiteResponse';
30
29
  export { loadFency } from './loadFency';
package/lib/index.js CHANGED
@@ -7,7 +7,7 @@ import { loadFency } from './loadFency';
7
7
  // create chat completion
8
8
  export { createChatCompletion } from './api/createChatCompletion';
9
9
  // uploads
10
- export { createUpload } from './api/createUpload';
10
+ export { createFile } from './api/createFile';
11
11
  // create chat completion stream
12
12
  export { createStream } from './api/createStream';
13
13
  // create website
@@ -16,15 +16,10 @@ export type { CreateWebsiteRequest } from './models/CreateWebsiteRequest';
16
16
  export type { FileTextContentReadyEventDto } from './models/FileTextContentReadyEventDto';
17
17
  export type { FileUploadCompletedEventDto } from './models/FileUploadCompletedEventDto';
18
18
  export type { NewChatCompletionStreamChunkEventDto } from './models/NewChatCompletionStreamChunkEventDto';
19
- export type { PubCreateUploadRequest } from './models/PubCreateUploadRequest';
20
- export type { PubUploadDto } from './models/PubUploadDto';
19
+ export type { PubCreateFileRequest } from './models/PubCreateFileRequest';
20
+ export type { PubFileDto } from './models/PubFileDto';
21
21
  export type { PubWebsiteDto } from './models/PubWebsiteDto';
22
22
  export type { S3PostRequestDto } from './models/S3PostRequestDto';
23
- export type { StoredChatCompletionId } from './models/StoredChatCompletionId';
24
- export type { StoredFileId } from './models/StoredFileId';
25
- export type { StoredStreamId } from './models/StoredStreamId';
26
- export type { StoredUploadId } from './models/StoredUploadId';
27
- export type { StoredWebsiteId } from './models/StoredWebsiteId';
28
23
  export type { StreamDto } from './models/StreamDto';
29
24
  export { StreamEventType } from './models/StreamEventType';
30
25
  export type { StreamNotFoundEventDto } from './models/StreamNotFoundEventDto';
@@ -1,9 +1,7 @@
1
- import type { StoredChatCompletionId } from './StoredChatCompletionId';
2
- import type { StoredStreamId } from './StoredStreamId';
3
1
  import type { StreamEventType } from './StreamEventType';
4
2
  export type ChatCompletionStreamCompletedEventDto = {
5
3
  type: StreamEventType;
6
- streamId: StoredStreamId;
7
- chatCompletionId: StoredChatCompletionId;
4
+ streamId: string;
5
+ chatCompletionId: string;
8
6
  timestamp: string;
9
7
  };
@@ -1,12 +1,8 @@
1
- import type { StoredFileId } from './StoredFileId';
2
- import type { StoredStreamId } from './StoredStreamId';
3
- import type { StoredUploadId } from './StoredUploadId';
4
1
  import type { StreamEventType } from './StreamEventType';
5
2
  export type FileTextContentReadyEventDto = {
6
3
  type: StreamEventType;
7
- streamId: StoredStreamId;
8
- uploadId: StoredUploadId;
9
- fileId: StoredFileId;
4
+ streamId: string;
5
+ fileId: string;
10
6
  textContent: string;
11
7
  timestamp: string;
12
8
  };
@@ -1,11 +1,7 @@
1
- import type { StoredFileId } from './StoredFileId';
2
- import type { StoredStreamId } from './StoredStreamId';
3
- import type { StoredUploadId } from './StoredUploadId';
4
1
  import type { StreamEventType } from './StreamEventType';
5
2
  export type FileUploadCompletedEventDto = {
6
3
  type: StreamEventType;
7
- streamId: StoredStreamId;
8
- uploadId: StoredUploadId;
9
- fileId: StoredFileId;
4
+ streamId: string;
5
+ fileId: string;
10
6
  timestamp: string;
11
7
  };
@@ -1,10 +1,8 @@
1
- import type { StoredChatCompletionId } from './StoredChatCompletionId';
2
- import type { StoredStreamId } from './StoredStreamId';
3
1
  import type { StreamEventType } from './StreamEventType';
4
2
  export type NewChatCompletionStreamChunkEventDto = {
5
3
  type: StreamEventType;
6
- streamId: StoredStreamId;
7
- chatCompletionId: StoredChatCompletionId;
4
+ streamId: string;
5
+ chatCompletionId: string;
8
6
  timestamp: string;
9
7
  content: string;
10
8
  };
@@ -1,4 +1,4 @@
1
- export type PubCreateUploadRequest = {
1
+ export type PubCreateFileRequest = {
2
2
  streamId: string;
3
3
  fileName: string;
4
4
  mimeType: string;
@@ -1,6 +1,9 @@
1
1
  import type { S3PostRequestDto } from './S3PostRequestDto';
2
- export type PubUploadDto = {
2
+ export type PubFileDto = {
3
3
  id: string;
4
4
  createdAt: string;
5
+ size: number;
6
+ type: string;
7
+ name: string;
5
8
  s3PostRequest: S3PostRequestDto;
6
9
  };
@@ -1,7 +1,6 @@
1
- import type { StoredStreamId } from './StoredStreamId';
2
1
  import type { StreamEventType } from './StreamEventType';
3
2
  export type StreamNotFoundEventDto = {
4
3
  type: StreamEventType;
5
- streamId: StoredStreamId;
4
+ streamId: string;
6
5
  timestamp: string;
7
6
  };
@@ -1,7 +1,6 @@
1
- import type { StoredStreamId } from './StoredStreamId';
2
1
  import type { StreamEventType } from './StreamEventType';
3
2
  export type StreamTimeoutEventDto = {
4
3
  type: StreamEventType;
5
- streamId: StoredStreamId;
4
+ streamId: string;
6
5
  timestamp: string;
7
6
  };
@@ -1,10 +1,8 @@
1
- import type { StoredStreamId } from './StoredStreamId';
2
- import type { StoredWebsiteId } from './StoredWebsiteId';
3
1
  import type { StreamEventType } from './StreamEventType';
4
2
  export type WebsiteHtmlContentReadyEventDto = {
5
3
  type: StreamEventType;
6
- streamId: StoredStreamId;
7
- websiteId: StoredWebsiteId;
4
+ streamId: string;
5
+ websiteId: string;
8
6
  htmlContent: string;
9
7
  timestamp: string;
10
8
  };
@@ -1,10 +1,8 @@
1
- import type { StoredStreamId } from './StoredStreamId';
2
- import type { StoredWebsiteId } from './StoredWebsiteId';
3
1
  import type { StreamEventType } from './StreamEventType';
4
2
  export type WebsiteTextContentReadyEventDto = {
5
3
  type: StreamEventType;
6
- streamId: StoredStreamId;
7
- websiteId: StoredWebsiteId;
4
+ streamId: string;
5
+ websiteId: string;
8
6
  textContent: string;
9
7
  timestamp: string;
10
8
  };
@@ -6,8 +6,8 @@ import type { CreateWebsiteRequest } from '../models/CreateWebsiteRequest';
6
6
  import type { FileTextContentReadyEventDto } from '../models/FileTextContentReadyEventDto';
7
7
  import type { FileUploadCompletedEventDto } from '../models/FileUploadCompletedEventDto';
8
8
  import type { NewChatCompletionStreamChunkEventDto } from '../models/NewChatCompletionStreamChunkEventDto';
9
- import type { PubCreateUploadRequest } from '../models/PubCreateUploadRequest';
10
- import type { PubUploadDto } from '../models/PubUploadDto';
9
+ import type { PubCreateFileRequest } from '../models/PubCreateFileRequest';
10
+ import type { PubFileDto } from '../models/PubFileDto';
11
11
  import type { PubWebsiteDto } from '../models/PubWebsiteDto';
12
12
  import type { StreamDto } from '../models/StreamDto';
13
13
  import type { StreamNotFoundEventDto } from '../models/StreamNotFoundEventDto';
@@ -23,6 +23,13 @@ export declare class PubService {
23
23
  * @throws ApiError
24
24
  */
25
25
  static createChatCompletion(requestBody: CreateChatCompletionRequest): CancelablePromise<ChatCompletionDto>;
26
+ /**
27
+ * Create File
28
+ * @param requestBody
29
+ * @returns PubFileDto Created
30
+ * @throws ApiError
31
+ */
32
+ static createFile(requestBody: PubCreateFileRequest): CancelablePromise<PubFileDto>;
26
33
  /**
27
34
  * Create Chat Completion Stream
28
35
  * @param requestBody
@@ -36,13 +43,6 @@ export declare class PubService {
36
43
  * @throws ApiError
37
44
  */
38
45
  static getPubTypes(): CancelablePromise<(StreamTimeoutEventDto | StreamNotFoundEventDto | NewChatCompletionStreamChunkEventDto | ChatCompletionStreamCompletedEventDto | FileUploadCompletedEventDto | FileTextContentReadyEventDto | WebsiteHtmlContentReadyEventDto | WebsiteTextContentReadyEventDto)>;
39
- /**
40
- * Create Upload
41
- * @param requestBody
42
- * @returns PubUploadDto Created
43
- * @throws ApiError
44
- */
45
- static createUpload(requestBody: PubCreateUploadRequest): CancelablePromise<PubUploadDto>;
46
46
  /**
47
47
  * Create Website
48
48
  * @param requestBody
@@ -15,6 +15,20 @@ export class PubService {
15
15
  mediaType: 'application/json',
16
16
  });
17
17
  }
18
+ /**
19
+ * Create File
20
+ * @param requestBody
21
+ * @returns PubFileDto Created
22
+ * @throws ApiError
23
+ */
24
+ static createFile(requestBody) {
25
+ return __request(OpenAPI, {
26
+ method: 'POST',
27
+ url: '/v1/pub/files',
28
+ body: requestBody,
29
+ mediaType: 'application/json',
30
+ });
31
+ }
18
32
  /**
19
33
  * Create Chat Completion Stream
20
34
  * @param requestBody
@@ -40,20 +54,6 @@ export class PubService {
40
54
  url: '/v1/pub/types',
41
55
  });
42
56
  }
43
- /**
44
- * Create Upload
45
- * @param requestBody
46
- * @returns PubUploadDto Created
47
- * @throws ApiError
48
- */
49
- static createUpload(requestBody) {
50
- return __request(OpenAPI, {
51
- method: 'POST',
52
- url: '/v1/pub/uploads',
53
- body: requestBody,
54
- mediaType: 'application/json',
55
- });
56
- }
57
57
  /**
58
58
  * Create Website
59
59
  * @param requestBody
@@ -1,4 +1,4 @@
1
- export interface CreateUploadRequest {
1
+ export interface CreateFileRequest {
2
2
  streamId: string;
3
3
  fileName: string;
4
4
  fileType: string;
@@ -1,8 +1,8 @@
1
1
  import { ApiError } from './ApiError';
2
- import { Upload } from './Upload';
3
- export type CreateUploadResponse = {
2
+ import { FencyFile } from './FencyFile';
3
+ export type CreateFileResponse = {
4
4
  type: 'success';
5
- upload: Upload;
5
+ file: FencyFile;
6
6
  } | {
7
7
  type: 'error';
8
8
  error: ApiError;
@@ -1,3 +1,4 @@
1
+ import { S3PostRequest } from "./S3PostRequest";
1
2
  export interface FencyFile {
2
3
  id: string;
3
4
  createdAt: string;
@@ -6,4 +7,5 @@ export interface FencyFile {
6
7
  name: string;
7
8
  content: string | null;
8
9
  text: string | null;
10
+ s3PostRequest: S3PostRequest;
9
11
  }
@@ -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.48';
4
+ const SDK_VERSION = '0.1.50';
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.48",
3
+ "version": "0.1.50",
4
4
  "description": "> TODO: description",
5
5
  "author": "staklau <steinaageklaussen@gmail.com>",
6
6
  "homepage": "",
@@ -41,5 +41,5 @@
41
41
  "ts-jest": "^29.1.1",
42
42
  "typescript": "^5.3.3"
43
43
  },
44
- "gitHead": "889ff241bad28cb096835f3e72389bfdcf1d51ee"
44
+ "gitHead": "d1be8f911659567ce9fb76fa130397a8ae8d38f3"
45
45
  }
@@ -1,3 +0,0 @@
1
- export type StoredChatCompletionId = {
2
- value: string;
3
- };
@@ -1,3 +0,0 @@
1
- export type StoredFileId = {
2
- value: string;
3
- };
@@ -1,3 +0,0 @@
1
- export type StoredStreamId = {
2
- value: string;
3
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- export type StoredUploadId = {
2
- value: string;
3
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- export type StoredWebsiteId = {
2
- value: string;
3
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,53 +0,0 @@
1
- export type NewChatCompletionStreamChunk = {
2
- type: 'NewChatCompletionStreamChunk';
3
- streamId: string;
4
- chatCompletionId: string;
5
- timestamp: string;
6
- content: string;
7
- };
8
- export type ChatCompletionStreamCompleted = {
9
- type: 'ChatCompletionStreamCompleted';
10
- streamId: string;
11
- chatCompletionId: string;
12
- timestamp: string;
13
- };
14
- export type StreamTimeout = {
15
- type: 'StreamTimeout';
16
- streamId: string;
17
- timestamp: string;
18
- };
19
- export type StreamNotFound = {
20
- type: 'StreamNotFound';
21
- streamId: string;
22
- timestamp: string;
23
- };
24
- export type FileUploadCompleted = {
25
- type: 'FileUploadCompleted';
26
- streamId: string;
27
- uploadId: string;
28
- fileId: string;
29
- timestamp: string;
30
- };
31
- export type FileTextContentReady = {
32
- type: 'FileTextContentReady';
33
- streamId: string;
34
- uploadId: string;
35
- fileId: string;
36
- text: string;
37
- timestamp: string;
38
- };
39
- export type WebsiteHtmlContentReady = {
40
- type: 'WebsiteHtmlContentReady';
41
- streamId: string;
42
- websiteId: string;
43
- htmlContent: string;
44
- timestamp: string;
45
- };
46
- export type WebsiteTextContentReady = {
47
- type: 'WebsiteTextContentReady';
48
- streamId: string;
49
- websiteId: string;
50
- textContent: string;
51
- timestamp: string;
52
- };
53
- export type StreamData = NewChatCompletionStreamChunk | ChatCompletionStreamCompleted | StreamTimeout | StreamNotFound | FileUploadCompleted | FileTextContentReady | WebsiteHtmlContentReady | WebsiteTextContentReady;
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- import { S3PostRequest } from './S3PostRequest';
2
- export interface Upload {
3
- id: string;
4
- createdAt: string;
5
- s3PostRequest: S3PostRequest;
6
- }
@@ -1 +0,0 @@
1
- export {};