@crewdle/web-sdk-types 1.0.16 → 1.0.17

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.
@@ -1,6 +1,7 @@
1
1
  import { IJobParameters, IJobResult } from '../job';
2
2
  /**
3
3
  * The AI prompt source Enum
4
+ * @category AI
4
5
  */
5
6
  export declare enum PromptSource {
6
7
  /**
@@ -15,7 +16,7 @@ export declare enum PromptSource {
15
16
  /**
16
17
  * The AI prompt history Interface
17
18
  * Represents the history of a prompt.
18
- * @ignore
19
+ * @category AI
19
20
  */
20
21
  export interface IPromptHistory {
21
22
  /**
@@ -30,7 +31,7 @@ export interface IPromptHistory {
30
31
  /**
31
32
  * The AI prompt options Interface
32
33
  * Represents the options for an AI prompt.
33
- * @ignore
34
+ * @category AI
34
35
  */
35
36
  export interface IPromptOptions {
36
37
  /**
@@ -73,7 +74,7 @@ export interface IPromptOptions {
73
74
  /**
74
75
  * The AI prompt result Interface
75
76
  * Represents the result of an AI prompt.
76
- * @ignore
77
+ * @category AI
77
78
  */
78
79
  export interface IPromptResult {
79
80
  /**
@@ -96,7 +97,7 @@ export interface IPromptResult {
96
97
  /**
97
98
  * The AI job parameters Interface
98
99
  * Parameters for AI job type.
99
- * @ignore
100
+ * @category AI
100
101
  */
101
102
  export interface IJobParametersAI extends IJobParameters, IPromptOptions {
102
103
  /**
@@ -107,7 +108,7 @@ export interface IJobParametersAI extends IJobParameters, IPromptOptions {
107
108
  /**
108
109
  * The AI job result Interface
109
110
  * Represents the result of an AI job.
110
- * @ignore
111
+ * @category AI
111
112
  */
112
113
  export interface IJobResultAI extends IJobResult, IPromptResult {
113
114
  /**
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * The AI prompt source Enum
3
+ * @category AI
3
4
  */
4
5
  export var PromptSource;
5
6
  (function (PromptSource) {
@@ -1,4 +1,5 @@
1
1
  import { IPromptOptions, IPromptResult } from '.';
2
+ import { GenerativeAIModelType } from './GenerativeAIModelType';
2
3
  /**
3
4
  * Represents a context for a Generative AI service.
4
5
  * @category AI
@@ -7,15 +8,29 @@ export interface IGenerativeAIContext {
7
8
  /**
8
9
  * Stream the response from the AI service.
9
10
  * @param prompt The prompt to start processing.
11
+ * @param options Optional parameters for the prompt.
10
12
  * @returns An async generator that yields the response.
11
13
  */
12
14
  stream(prompt: string, options?: IPromptOptions): AsyncGenerator<IPromptResult>;
13
15
  /**
14
16
  * Process the response from the AI service.
15
17
  * @param prompt The prompt to start processing.
18
+ * @param options Optional parameters for the prompt.
16
19
  * @returns A promise that resolves with the response.
17
20
  */
18
21
  prompt(prompt: string, options?: IPromptOptions): Promise<IPromptResult>;
22
+ /**
23
+ * Upload a model to the AI service.
24
+ * @param model The model file to upload.
25
+ * @returns A promise that resolves when the model is uploaded.
26
+ */
27
+ uploadModel(model: File, type?: GenerativeAIModelType): Promise<void>;
28
+ /**
29
+ * Delete a model from the AI service.
30
+ * @param modelId The optional ID of the model to delete.
31
+ * @returns A promise that resolves when the model is deleted.
32
+ */
33
+ deleteModel(modelId?: string): Promise<void>;
19
34
  /**
20
35
  * Close the Generative AI Context.
21
36
  */
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Represents the types of generative AI models.
3
+ * @category AI
4
+ */
5
+ export declare enum GenerativeAIModelType {
6
+ /**
7
+ * The main model to run with the inference engine.
8
+ */
9
+ Main = "main",
10
+ /**
11
+ * The simalirity model to run to build the vector database.
12
+ */
13
+ Similarity = "similarity"
14
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Represents the types of generative AI models.
3
+ * @category AI
4
+ */
5
+ export var GenerativeAIModelType;
6
+ (function (GenerativeAIModelType) {
7
+ /**
8
+ * The main model to run with the inference engine.
9
+ */
10
+ GenerativeAIModelType["Main"] = "main";
11
+ /**
12
+ * The simalirity model to run to build the vector database.
13
+ */
14
+ GenerativeAIModelType["Similarity"] = "similarity";
15
+ })(GenerativeAIModelType || (GenerativeAIModelType = {}));
@@ -1,5 +1,6 @@
1
1
  export * from './GenerativeAI';
2
2
  export * from './GenerativeAIContext';
3
+ export * from './GenerativeAIModelType';
3
4
  export * from './GenerativeAIWorker';
4
5
  export * from './GenerativeAIWorkerConnector';
5
6
  export * from './GenerativeAIWorkerConnectorConstructor';
package/dist/ai/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './GenerativeAI';
2
2
  export * from './GenerativeAIContext';
3
+ export * from './GenerativeAIModelType';
3
4
  export * from './GenerativeAIWorker';
4
5
  export * from './GenerativeAIWorkerConnector';
5
6
  export * from './GenerativeAIWorkerConnectorConstructor';
@@ -25,7 +25,7 @@ export interface ICluster extends IClusterEventEmitter {
25
25
  /**
26
26
  * Open a object store bucket.
27
27
  * @param name The name of the Object Store bucket.
28
- * @param syncContent Whether to sync the content of the object store.
28
+ * @param options The {@link IObjectStoreBucketOptions | options} of the Object Store bucket.
29
29
  * @throws {@link SDKClientErrorCodes.ObjectStoreAlreadyExists} if the data stream is already open.
30
30
  * @throws {@link SDKClientErrorCodes.ObjectStoreNameNotString} if the name is not a string.
31
31
  * @returns A promise that resolves with the data stream.
@@ -0,0 +1,43 @@
1
+ import { IReadableStream } from './ReadableStream';
2
+ /**
3
+ * Represents a file in the object storage.
4
+ * @category Object Storage
5
+ */
6
+ export interface IFile {
7
+ /**
8
+ * The name of the file.
9
+ */
10
+ name: string;
11
+ /**
12
+ * The size of the file in bytes.
13
+ */
14
+ size: number;
15
+ /**
16
+ * The MIME type of the file.
17
+ */
18
+ type: string;
19
+ /**
20
+ * The last modified timestamp of the file.
21
+ */
22
+ lastModified: number;
23
+ /**
24
+ * Returns a promise that resolves to an ArrayBuffer containing the file's data.
25
+ */
26
+ arrayBuffer(): Promise<ArrayBuffer>;
27
+ /**
28
+ * Returns a promise that resolves to a string containing the file's data.
29
+ */
30
+ text(): Promise<string>;
31
+ /**
32
+ * Returns a readable stream for streaming the file's data.
33
+ */
34
+ stream(): IReadableStream;
35
+ /**
36
+ * Returns a new Blob object that contains a subset of the file's data.
37
+ * @param start - The start position (inclusive) of the subset. Defaults to 0.
38
+ * @param end - The end position (exclusive) of the subset. Defaults to the end of the file.
39
+ * @param contentType - The MIME type of the subset. Defaults to the original file's type.
40
+ * @returns A Blob object representing the subset of the file's data.
41
+ */
42
+ slice(start?: number, end?: number, contentType?: string): Blob;
43
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Represents the options for reading or writing a file.
3
+ * @category Object Storage
4
+ */
5
+ export interface IFileOptions {
6
+ /**
7
+ * Specifies whether encryption should be skipped for the file.
8
+ */
9
+ skipEncryption?: boolean;
10
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * File status enum
3
+ * @category Object Storage
3
4
  */
4
5
  export declare enum FileStatus {
5
6
  /**
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * File status enum
3
+ * @category Object Storage
3
4
  */
4
5
  export var FileStatus;
5
6
  (function (FileStatus) {
@@ -1,5 +1,5 @@
1
1
  import { IDataStream } from '../core/stream';
2
- import { ObjectDescriptor, Payload } from '.';
2
+ import { IFile, IFileOptions, ObjectDescriptor, Payload } from '.';
3
3
  import { StorageEvent } from './event';
4
4
  import { IObjectStoreListOptions } from './ObjectStoreListOptions';
5
5
  /**
@@ -43,9 +43,10 @@ export interface IObjectStoreBucket extends IDataStream {
43
43
  /**
44
44
  * Get an object from the bucket.
45
45
  * @param path The path of the object.
46
+ * @param options The optional options for getting the object.
46
47
  * @returns The object.
47
48
  */
48
- get(path: string): Promise<File>;
49
+ get(path: string, options?: IFileOptions): Promise<IFile>;
49
50
  /**
50
51
  * List the objects and folders of the bucket.
51
52
  * @param path The path of the folder.
@@ -1,15 +1,16 @@
1
- import { IFileDescriptor, IFolderDescriptor, ObjectDescriptor, ObjectKind } from '.';
1
+ import { IFileDescriptor, IFolderDescriptor, IWritableStream, ObjectDescriptor, ObjectKind, IFileOptions, IFile } from '.';
2
2
  /**
3
- * The object store connector interface.
3
+ * Represents a connector for interacting with an object store.
4
4
  * @category Connector
5
5
  */
6
6
  export interface IObjectStoreConnector {
7
7
  /**
8
8
  * Gets a file.
9
9
  * @param path The path to the file.
10
+ * @param options The options for writing the file.
10
11
  * @returns A promise that resolves with the file.
11
12
  */
12
- get(path: string): Promise<File>;
13
+ get(path: string, options?: IFileOptions): Promise<IFile>;
13
14
  /**
14
15
  * Lists the objects in a folder.
15
16
  * @param path The path to the folder.
@@ -27,10 +28,17 @@ export interface IObjectStoreConnector {
27
28
  * Writes a file.
28
29
  * @param file The file to write.
29
30
  * @param path The path to write the file to.
30
- * @param skipEncryption Whether to skip encryption.
31
+ * @param options The options for writing the file.
31
32
  * @returns A promise that resolves with the file descriptor.
32
33
  */
33
- writeFile(file: File, path?: string, skipEncryption?: boolean): Promise<IFileDescriptor>;
34
+ writeFile(file: File, path?: string, options?: IFileOptions): Promise<IFileDescriptor>;
35
+ /**
36
+ * Creates a writable stream for a file.
37
+ * @param path The path to the file.
38
+ * @param options The options for creating the writable stream.
39
+ * @returns A promise that resolves with an {@link IWritableStream}.
40
+ */
41
+ createWritableStream(path: string, options?: IFileOptions): Promise<IWritableStream>;
34
42
  /**
35
43
  * Moves an object.
36
44
  * @param path The path to the object.
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Represents a readable stream that provides a way to read data asynchronously.
3
+ * @category Object Storage
4
+ */
5
+ export interface IReadableStream {
6
+ /**
7
+ * Reads the next chunk of data from the stream.
8
+ * @returns A promise that resolves to a Uint8Array containing the data read from the stream, or null if the end of the stream has been reached.
9
+ */
10
+ read(): Promise<Uint8Array | null>;
11
+ /**
12
+ * Closes the stream and releases any resources associated with it.
13
+ * @returns A promise that resolves when the stream is successfully closed.
14
+ */
15
+ close(): Promise<void>;
16
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Represents a writable stream.
3
+ * @category Object Storage
4
+ */
5
+ export interface IWritableStream {
6
+ /**
7
+ * Writes data to the stream.
8
+ * @param chunk The data to write as an ArrayBuffer.
9
+ */
10
+ write(chunk: ArrayBuffer): Promise<void>;
11
+ /**
12
+ * Closes the stream.
13
+ */
14
+ close(): Promise<void>;
15
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,8 @@
1
1
  import { StorageEventType } from '.';
2
+ /**
3
+ * The sync complete event.
4
+ * @category Object Storage
5
+ */
2
6
  export interface ISyncCompleteEvent {
3
7
  /**
4
8
  * The event type.
@@ -1,7 +1,9 @@
1
1
  export * from './event';
2
+ export { IFile } from './File';
2
3
  export { FileStatus } from './FileStatus';
3
4
  export { IFileDescriptor } from './FileDescriptor';
4
5
  export { IFilePayload } from './FilePayload';
6
+ export { IFileOptions } from './FileOptions';
5
7
  export { IFolderDescriptor } from './FolderDescriptor';
6
8
  export { IFolderPayload } from './FolderPayload';
7
9
  export { IMovePayload } from './MovePayload';
@@ -14,3 +16,5 @@ export { IObjectStoreListOptions } from './ObjectStoreListOptions';
14
16
  export { ObjectStoreConnectorConstructor } from './ObjectStoreConnectorConstructor';
15
17
  export { Payload } from './Payload';
16
18
  export { PayloadAction } from './PayloadAction';
19
+ export { IReadableStream } from './ReadableStream';
20
+ export { IWritableStream } from './WritableStream';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewdle/web-sdk-types",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "The Crewdle Mist Web SDK public types and interfaces",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",