@fencyai/js 0.1.47 → 0.1.48

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 (31) hide show
  1. package/lib/api/createStream.js +4 -2
  2. package/lib/api/createWebsite.js +7 -2
  3. package/lib/index.d.ts +2 -2
  4. package/lib/openapi/index.d.ts +3 -0
  5. package/lib/openapi/models/CreateWebsiteRequest.d.ts +1 -0
  6. package/lib/openapi/models/FileTextContentReadyEventDto.d.ts +1 -1
  7. package/lib/openapi/models/PubWebsiteDto.d.ts +1 -1
  8. package/lib/openapi/models/StoredWebsiteId.d.ts +3 -0
  9. package/lib/openapi/models/StreamEventType.d.ts +3 -1
  10. package/lib/openapi/models/StreamEventType.js +2 -0
  11. package/lib/openapi/models/StreamType.d.ts +2 -1
  12. package/lib/openapi/models/StreamType.js +2 -1
  13. package/lib/openapi/models/WebsiteHtmlContentReadyEventDto.d.ts +10 -0
  14. package/lib/openapi/models/WebsiteTextContentReadyEventDto.d.ts +10 -0
  15. package/lib/openapi/models/WebsiteTextContentReadyEventDto.js +1 -0
  16. package/lib/openapi/services/PubService.d.ts +3 -1
  17. package/lib/types/CreateStreamRequest.d.ts +1 -1
  18. package/lib/types/CreateUploadResponse.d.ts +2 -2
  19. package/lib/types/CreateWebsiteRequest.d.ts +1 -0
  20. package/lib/types/CreateWebsiteResponse.d.ts +2 -2
  21. package/lib/types/FencyFile.d.ts +4 -3
  22. package/lib/types/StreamData.d.ts +15 -1
  23. package/lib/types/{FencyUpload.d.ts → Upload.d.ts} +1 -1
  24. package/lib/types/Upload.js +1 -0
  25. package/lib/types/Website.d.ts +7 -0
  26. package/lib/types/Website.js +1 -0
  27. package/lib/utils/version.js +1 -1
  28. package/package.json +2 -2
  29. package/lib/types/FencyWebsite.d.ts +0 -5
  30. /package/lib/{types/FencyUpload.js → openapi/models/StoredWebsiteId.js} +0 -0
  31. /package/lib/{types/FencyWebsite.js → openapi/models/WebsiteHtmlContentReadyEventDto.js} +0 -0
@@ -47,7 +47,9 @@ const mapTypeToStreamType = (type) => {
47
47
  switch (type) {
48
48
  case 'ChatCompletionStream':
49
49
  return StreamType.CHAT_COMPLETION_STREAM;
50
- case 'FileUploadStream':
51
- return StreamType.FILE_UPLOAD_STREAM;
50
+ case 'FileStream':
51
+ return StreamType.FILE_STREAM;
52
+ case 'WebsiteStream':
53
+ return StreamType.WEBSITE_STREAM;
52
54
  }
53
55
  };
@@ -17,13 +17,18 @@ export async function createWebsite(params) {
17
17
  Authorization: `Bearer ${params.pk}`,
18
18
  'X-Fency-Sdk-Version': getPackageVersion(),
19
19
  };
20
- const response = await PubService.createWebsite(params.request);
20
+ const response = await PubService.createWebsite({
21
+ url: params.request.url,
22
+ streamId: params.request.streamId,
23
+ });
21
24
  return {
22
25
  type: 'success',
23
26
  website: {
24
27
  id: response.id,
25
28
  createdAt: response.createdAt,
26
- content: response.content,
29
+ url: response.url,
30
+ content: null,
31
+ text: null,
27
32
  },
28
33
  };
29
34
  }
package/lib/index.d.ts CHANGED
@@ -12,8 +12,8 @@ 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 { FencyUpload } from './types/FencyUpload';
16
- export type { FencyWebsite } from './types/FencyWebsite';
15
+ export type { Upload } from './types/Upload';
16
+ export type { Website } from './types/Website';
17
17
  export type { GeminiModel } from './types/GeminiModel';
18
18
  export type { OpenAiModel } from './types/OpenAiModel';
19
19
  export type { Stream } from './types/Stream';
@@ -24,9 +24,12 @@ export type { StoredChatCompletionId } from './models/StoredChatCompletionId';
24
24
  export type { StoredFileId } from './models/StoredFileId';
25
25
  export type { StoredStreamId } from './models/StoredStreamId';
26
26
  export type { StoredUploadId } from './models/StoredUploadId';
27
+ export type { StoredWebsiteId } from './models/StoredWebsiteId';
27
28
  export type { StreamDto } from './models/StreamDto';
28
29
  export { StreamEventType } from './models/StreamEventType';
29
30
  export type { StreamNotFoundEventDto } from './models/StreamNotFoundEventDto';
30
31
  export type { StreamTimeoutEventDto } from './models/StreamTimeoutEventDto';
31
32
  export { StreamType } from './models/StreamType';
33
+ export type { WebsiteHtmlContentReadyEventDto } from './models/WebsiteHtmlContentReadyEventDto';
34
+ export type { WebsiteTextContentReadyEventDto } from './models/WebsiteTextContentReadyEventDto';
32
35
  export { PubService } from './services/PubService';
@@ -1,3 +1,4 @@
1
1
  export type CreateWebsiteRequest = {
2
2
  url: string;
3
+ streamId: string;
3
4
  };
@@ -7,6 +7,6 @@ export type FileTextContentReadyEventDto = {
7
7
  streamId: StoredStreamId;
8
8
  uploadId: StoredUploadId;
9
9
  fileId: StoredFileId;
10
- text: string;
10
+ textContent: string;
11
11
  timestamp: string;
12
12
  };
@@ -1,5 +1,5 @@
1
1
  export type PubWebsiteDto = {
2
2
  id: string;
3
3
  createdAt: string;
4
- content: string;
4
+ url: string;
5
5
  };
@@ -0,0 +1,3 @@
1
+ export type StoredWebsiteId = {
2
+ value: string;
3
+ };
@@ -4,5 +4,7 @@ export declare enum StreamEventType {
4
4
  STREAM_TIMEOUT = "StreamTimeout",
5
5
  STREAM_NOT_FOUND = "StreamNotFound",
6
6
  FILE_UPLOAD_COMPLETED = "FileUploadCompleted",
7
- FILE_TEXT_CONTENT_READY = "FileTextContentReady"
7
+ FILE_TEXT_CONTENT_READY = "FileTextContentReady",
8
+ WEBSITE_HTML_CONTENT_READY = "WebsiteHtmlContentReady",
9
+ WEBSITE_TEXT_CONTENT_READY = "WebsiteTextContentReady"
8
10
  }
@@ -10,4 +10,6 @@ export var StreamEventType;
10
10
  StreamEventType["STREAM_NOT_FOUND"] = "StreamNotFound";
11
11
  StreamEventType["FILE_UPLOAD_COMPLETED"] = "FileUploadCompleted";
12
12
  StreamEventType["FILE_TEXT_CONTENT_READY"] = "FileTextContentReady";
13
+ StreamEventType["WEBSITE_HTML_CONTENT_READY"] = "WebsiteHtmlContentReady";
14
+ StreamEventType["WEBSITE_TEXT_CONTENT_READY"] = "WebsiteTextContentReady";
13
15
  })(StreamEventType || (StreamEventType = {}));
@@ -1,4 +1,5 @@
1
1
  export declare enum StreamType {
2
2
  CHAT_COMPLETION_STREAM = "ChatCompletionStream",
3
- FILE_UPLOAD_STREAM = "FileUploadStream"
3
+ FILE_STREAM = "FileStream",
4
+ WEBSITE_STREAM = "WebsiteStream"
4
5
  }
@@ -5,5 +5,6 @@
5
5
  export var StreamType;
6
6
  (function (StreamType) {
7
7
  StreamType["CHAT_COMPLETION_STREAM"] = "ChatCompletionStream";
8
- StreamType["FILE_UPLOAD_STREAM"] = "FileUploadStream";
8
+ StreamType["FILE_STREAM"] = "FileStream";
9
+ StreamType["WEBSITE_STREAM"] = "WebsiteStream";
9
10
  })(StreamType || (StreamType = {}));
@@ -0,0 +1,10 @@
1
+ import type { StoredStreamId } from './StoredStreamId';
2
+ import type { StoredWebsiteId } from './StoredWebsiteId';
3
+ import type { StreamEventType } from './StreamEventType';
4
+ export type WebsiteHtmlContentReadyEventDto = {
5
+ type: StreamEventType;
6
+ streamId: StoredStreamId;
7
+ websiteId: StoredWebsiteId;
8
+ htmlContent: string;
9
+ timestamp: string;
10
+ };
@@ -0,0 +1,10 @@
1
+ import type { StoredStreamId } from './StoredStreamId';
2
+ import type { StoredWebsiteId } from './StoredWebsiteId';
3
+ import type { StreamEventType } from './StreamEventType';
4
+ export type WebsiteTextContentReadyEventDto = {
5
+ type: StreamEventType;
6
+ streamId: StoredStreamId;
7
+ websiteId: StoredWebsiteId;
8
+ textContent: string;
9
+ timestamp: string;
10
+ };
@@ -12,6 +12,8 @@ import type { PubWebsiteDto } from '../models/PubWebsiteDto';
12
12
  import type { StreamDto } from '../models/StreamDto';
13
13
  import type { StreamNotFoundEventDto } from '../models/StreamNotFoundEventDto';
14
14
  import type { StreamTimeoutEventDto } from '../models/StreamTimeoutEventDto';
15
+ import type { WebsiteHtmlContentReadyEventDto } from '../models/WebsiteHtmlContentReadyEventDto';
16
+ import type { WebsiteTextContentReadyEventDto } from '../models/WebsiteTextContentReadyEventDto';
15
17
  import type { CancelablePromise } from '../core/CancelablePromise';
16
18
  export declare class PubService {
17
19
  /**
@@ -33,7 +35,7 @@ export declare class PubService {
33
35
  * @returns any OK
34
36
  * @throws ApiError
35
37
  */
36
- static getPubTypes(): CancelablePromise<(StreamTimeoutEventDto | StreamNotFoundEventDto | NewChatCompletionStreamChunkEventDto | ChatCompletionStreamCompletedEventDto | FileUploadCompletedEventDto | FileTextContentReadyEventDto)>;
38
+ static getPubTypes(): CancelablePromise<(StreamTimeoutEventDto | StreamNotFoundEventDto | NewChatCompletionStreamChunkEventDto | ChatCompletionStreamCompletedEventDto | FileUploadCompletedEventDto | FileTextContentReadyEventDto | WebsiteHtmlContentReadyEventDto | WebsiteTextContentReadyEventDto)>;
37
39
  /**
38
40
  * Create Upload
39
41
  * @param requestBody
@@ -1,5 +1,5 @@
1
1
  export interface CreateStreamRequest {
2
- type: 'ChatCompletionStream' | 'FileUploadStream';
2
+ type: 'ChatCompletionStream' | 'FileStream' | 'WebsiteStream';
3
3
  chatCompletionStreamOptions?: {
4
4
  sessionClientSecret?: string;
5
5
  };
@@ -1,8 +1,8 @@
1
1
  import { ApiError } from './ApiError';
2
- import { FencyUpload } from './FencyUpload';
2
+ import { Upload } from './Upload';
3
3
  export type CreateUploadResponse = {
4
4
  type: 'success';
5
- upload: FencyUpload;
5
+ upload: Upload;
6
6
  } | {
7
7
  type: 'error';
8
8
  error: ApiError;
@@ -1,3 +1,4 @@
1
1
  export interface CreateWebsiteRequest {
2
2
  url: string;
3
+ streamId: string;
3
4
  }
@@ -1,8 +1,8 @@
1
1
  import { ApiError } from './ApiError';
2
- import { FencyWebsite } from './FencyWebsite';
2
+ import { Website } from './Website';
3
3
  export type CreateWebsiteResponse = {
4
4
  type: 'success';
5
- website: FencyWebsite;
5
+ website: Website;
6
6
  } | {
7
7
  type: 'error';
8
8
  error: ApiError;
@@ -1,8 +1,9 @@
1
1
  export interface FencyFile {
2
2
  id: string;
3
3
  createdAt: string;
4
+ size: number;
5
+ type: string;
6
+ name: string;
4
7
  content: string | null;
5
- size: number | null;
6
- type: string | null;
7
- name: string | null;
8
+ text: string | null;
8
9
  }
@@ -36,4 +36,18 @@ export type FileTextContentReady = {
36
36
  text: string;
37
37
  timestamp: string;
38
38
  };
39
- export type StreamData = NewChatCompletionStreamChunk | ChatCompletionStreamCompleted | StreamTimeout | StreamNotFound | FileUploadCompleted | FileTextContentReady;
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,5 +1,5 @@
1
1
  import { S3PostRequest } from './S3PostRequest';
2
- export interface FencyUpload {
2
+ export interface Upload {
3
3
  id: string;
4
4
  createdAt: string;
5
5
  s3PostRequest: S3PostRequest;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ export type Website = {
2
+ id: string;
3
+ createdAt: string;
4
+ url: string;
5
+ content: string | null;
6
+ text: string | null;
7
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -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.47';
4
+ const SDK_VERSION = '0.1.48';
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.47",
3
+ "version": "0.1.48",
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": "f86bd2ae856f0dfc51edbf434e62e63f4c86f79b"
44
+ "gitHead": "889ff241bad28cb096835f3e72389bfdcf1d51ee"
45
45
  }
@@ -1,5 +0,0 @@
1
- export type FencyWebsite = {
2
- id: string;
3
- createdAt: string;
4
- content: string;
5
- };