@fencyai/js 0.1.48 → 0.1.49
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/{createUpload.d.ts → createFile.d.ts} +5 -5
- package/lib/api/{createUpload.js → createFile.js} +8 -3
- package/lib/index.d.ts +6 -7
- package/lib/index.js +1 -1
- package/lib/openapi/index.d.ts +2 -3
- package/lib/openapi/models/FileTextContentReadyEventDto.d.ts +0 -2
- package/lib/openapi/models/FileUploadCompletedEventDto.d.ts +0 -2
- package/lib/openapi/models/{PubCreateUploadRequest.d.ts → PubCreateFileRequest.d.ts} +1 -1
- package/lib/openapi/models/{PubUploadDto.d.ts → PubFileDto.d.ts} +4 -1
- package/lib/openapi/services/PubService.d.ts +9 -9
- package/lib/openapi/services/PubService.js +14 -14
- package/lib/types/{CreateUploadRequest.d.ts → CreateFileRequest.d.ts} +1 -1
- package/lib/types/{CreateUploadResponse.d.ts → CreateFileResponse.d.ts} +3 -3
- package/lib/types/FencyFile.d.ts +2 -0
- package/lib/utils/version.js +1 -1
- package/package.json +2 -2
- package/lib/openapi/models/StoredUploadId.d.ts +0 -3
- package/lib/types/CreateUploadResponse.js +0 -1
- package/lib/types/StreamData.d.ts +0 -53
- package/lib/types/StreamData.js +0 -1
- package/lib/types/Upload.d.ts +0 -6
- package/lib/types/Upload.js +0 -1
- /package/lib/openapi/models/{PubCreateUploadRequest.js → PubCreateFileRequest.js} +0 -0
- /package/lib/openapi/models/{PubUploadDto.js → PubFileDto.js} +0 -0
- /package/lib/{openapi/models/StoredUploadId.js → types/CreateFileRequest.js} +0 -0
- /package/lib/types/{CreateUploadRequest.js → CreateFileResponse.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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
|
|
12
|
+
export declare function createFile(params: {
|
|
13
13
|
pk: string;
|
|
14
|
-
request:
|
|
14
|
+
request: CreateFileRequest;
|
|
15
15
|
baseUrl: string;
|
|
16
|
-
}): Promise<
|
|
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
|
|
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.
|
|
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
|
-
|
|
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 {
|
|
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 {
|
|
23
|
-
export type {
|
|
24
|
-
export type {
|
|
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 {
|
|
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 {
|
|
10
|
+
export { createFile } from './api/createFile';
|
|
11
11
|
// create chat completion stream
|
|
12
12
|
export { createStream } from './api/createStream';
|
|
13
13
|
// create website
|
package/lib/openapi/index.d.ts
CHANGED
|
@@ -16,14 +16,13 @@ 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 {
|
|
20
|
-
export type {
|
|
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
23
|
export type { StoredChatCompletionId } from './models/StoredChatCompletionId';
|
|
24
24
|
export type { StoredFileId } from './models/StoredFileId';
|
|
25
25
|
export type { StoredStreamId } from './models/StoredStreamId';
|
|
26
|
-
export type { StoredUploadId } from './models/StoredUploadId';
|
|
27
26
|
export type { StoredWebsiteId } from './models/StoredWebsiteId';
|
|
28
27
|
export type { StreamDto } from './models/StreamDto';
|
|
29
28
|
export { StreamEventType } from './models/StreamEventType';
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import type { StoredFileId } from './StoredFileId';
|
|
2
2
|
import type { StoredStreamId } from './StoredStreamId';
|
|
3
|
-
import type { StoredUploadId } from './StoredUploadId';
|
|
4
3
|
import type { StreamEventType } from './StreamEventType';
|
|
5
4
|
export type FileTextContentReadyEventDto = {
|
|
6
5
|
type: StreamEventType;
|
|
7
6
|
streamId: StoredStreamId;
|
|
8
|
-
uploadId: StoredUploadId;
|
|
9
7
|
fileId: StoredFileId;
|
|
10
8
|
textContent: string;
|
|
11
9
|
timestamp: string;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import type { StoredFileId } from './StoredFileId';
|
|
2
2
|
import type { StoredStreamId } from './StoredStreamId';
|
|
3
|
-
import type { StoredUploadId } from './StoredUploadId';
|
|
4
3
|
import type { StreamEventType } from './StreamEventType';
|
|
5
4
|
export type FileUploadCompletedEventDto = {
|
|
6
5
|
type: StreamEventType;
|
|
7
6
|
streamId: StoredStreamId;
|
|
8
|
-
uploadId: StoredUploadId;
|
|
9
7
|
fileId: StoredFileId;
|
|
10
8
|
timestamp: string;
|
|
11
9
|
};
|
|
@@ -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 {
|
|
10
|
-
import type {
|
|
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,8 +1,8 @@
|
|
|
1
1
|
import { ApiError } from './ApiError';
|
|
2
|
-
import {
|
|
3
|
-
export type
|
|
2
|
+
import { FencyFile } from './FencyFile';
|
|
3
|
+
export type CreateFileResponse = {
|
|
4
4
|
type: 'success';
|
|
5
|
-
|
|
5
|
+
file: FencyFile;
|
|
6
6
|
} | {
|
|
7
7
|
type: 'error';
|
|
8
8
|
error: ApiError;
|
package/lib/types/FencyFile.d.ts
CHANGED
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.49';
|
|
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.49",
|
|
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": "
|
|
44
|
+
"gitHead": "68078f631c0f2ea5530ecbf46c3922dba402ac59"
|
|
45
45
|
}
|
|
@@ -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;
|
package/lib/types/StreamData.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/types/Upload.d.ts
DELETED
package/lib/types/Upload.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|