@crewdle/web-sdk-types 1.0.11 → 1.0.13

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.
@@ -8,7 +8,7 @@ export interface IGenerativeAIContext {
8
8
  * @param prompt The prompt to start processing.
9
9
  * @returns The response from the AI service.
10
10
  */
11
- prompt(prompt: string): Promise<string>;
11
+ prompt(prompt: string): AsyncGenerator<string>;
12
12
  /**
13
13
  * Close the Generative AI Context.
14
14
  */
@@ -8,14 +8,21 @@ export interface IGenerativeAIWorkerConnector extends IJobWorkerConnector {
8
8
  * Initialize the machine learning model.
9
9
  * @param llmModel The path to the LLM model.
10
10
  * @param similarityModel The path to the similarity model.
11
+ * @returns A promise that resolves when the model has been initialized.
11
12
  */
12
- initialize(llmModel: string, similarityModel: string): Promise<void>;
13
+ initialize(llmModel?: string, similarityModel?: string): Promise<void>;
13
14
  /**
14
15
  * Add content to the machine learning model.
16
+ * @param name The name of the content.
15
17
  * @param content The content to add.
16
18
  * @returns A promise that resolves when the content has been added.
17
19
  */
18
- addContent(content: string): Promise<void>;
20
+ addContent(name: string, content: string): Promise<void>;
21
+ /**
22
+ * Remove content from the machine learning model.
23
+ * @param name The name of the content.
24
+ */
25
+ removeContent(name: string): void;
19
26
  /**
20
27
  * Process a job.
21
28
  * @param job The job to process.
@@ -14,4 +14,9 @@ export interface IVectorDatabaseConnector {
14
14
  * @param vectors The vectors to insert.
15
15
  */
16
16
  insert(vectors: number[][]): void;
17
+ /**
18
+ * Remove vectors from the database.
19
+ * @param ids The IDs of the vectors to remove.
20
+ */
21
+ remove(ids: number[]): void;
17
22
  }
@@ -2,7 +2,7 @@ import { IClusterEventEmitter } from '.';
2
2
  import { IGenerativeAIContext, IGenerativeAIWorker } from '../../ai';
3
3
  import { IKeyValueDatabase, IDatabaseLayout, ILayoutBuilder } from '../../key-value-database';
4
4
  import { ILocalMediaStream, ILocalDynamicMediaStream, IRemoteMediaStream, MediaStreamSource } from '../../media-stream';
5
- import { IObjectStoreBucket } from '../../object-storage';
5
+ import { IObjectStoreBucket, IObjectStoreBucketOptions } from '../../object-storage';
6
6
  import { IPubSubTopic } from '../../pubsub';
7
7
  import { LocalNode, Node } from '../node';
8
8
  /**
@@ -25,11 +25,12 @@ 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
29
  * @throws {@link SDKClientErrorCodes.ObjectStoreAlreadyExists} if the data stream is already open.
29
30
  * @throws {@link SDKClientErrorCodes.ObjectStoreNameNotString} if the name is not a string.
30
31
  * @returns A promise that resolves with the data stream.
31
32
  */
32
- openObjectStoreBucket(name: string): Promise<IObjectStoreBucket>;
33
+ openObjectStoreBucket(name: string, options?: IObjectStoreBucketOptions): Promise<IObjectStoreBucket>;
33
34
  /**
34
35
  * Open a key-value database.
35
36
  * @param name The name of the key-value database.
package/dist/job/Job.d.ts CHANGED
@@ -35,19 +35,23 @@ export declare enum JobStatus {
35
35
  /**
36
36
  * The job is pending.
37
37
  */
38
- Pending = "Pending",
38
+ Pending = "pending",
39
39
  /**
40
40
  * The job is processing.
41
41
  */
42
- Processing = "Processing",
42
+ Processing = "processing",
43
+ /**
44
+ * The job has partial results.
45
+ */
46
+ Partial = "partial",
43
47
  /**
44
48
  * The job is completed.
45
49
  */
46
- Completed = "Completed",
50
+ Completed = "completed",
47
51
  /**
48
52
  * The job has failed.
49
53
  */
50
- Failed = "Failed"
54
+ Failed = "failed"
51
55
  }
52
56
  /**
53
57
  * Base IJobParameters Interface
@@ -99,6 +103,7 @@ export interface IJobResult {
99
103
  export interface IJobResultAI {
100
104
  jobType: JobType.AI;
101
105
  output: string;
106
+ index?: number;
102
107
  }
103
108
  /**
104
109
  * JobResult Type
package/dist/job/Job.js CHANGED
@@ -18,17 +18,21 @@ export var JobStatus;
18
18
  /**
19
19
  * The job is pending.
20
20
  */
21
- JobStatus["Pending"] = "Pending";
21
+ JobStatus["Pending"] = "pending";
22
22
  /**
23
23
  * The job is processing.
24
24
  */
25
- JobStatus["Processing"] = "Processing";
25
+ JobStatus["Processing"] = "processing";
26
+ /**
27
+ * The job has partial results.
28
+ */
29
+ JobStatus["Partial"] = "partial";
26
30
  /**
27
31
  * The job is completed.
28
32
  */
29
- JobStatus["Completed"] = "Completed";
33
+ JobStatus["Completed"] = "completed";
30
34
  /**
31
35
  * The job has failed.
32
36
  */
33
- JobStatus["Failed"] = "Failed";
37
+ JobStatus["Failed"] = "failed";
34
38
  })(JobStatus || (JobStatus = {}));
@@ -1,4 +1,5 @@
1
- import { ObjectKind } from '.';
1
+ import { ObjectKind } from './';
2
+ import { FileStatus } from './FileStatus';
2
3
  /**
3
4
  * The file descriptor interface.
4
5
  * @category Object Storage
@@ -28,4 +29,13 @@ export interface IFileDescriptor {
28
29
  * The path name of the file (a combination of the path and the name).
29
30
  */
30
31
  pathName: string;
32
+ /**
33
+ * The absolute path name of the file (a combination of the path and the name).
34
+ */
35
+ absolutePathName?: string;
36
+ /**
37
+ * The status of the file.
38
+ *
39
+ */
40
+ status: FileStatus;
31
41
  }
@@ -16,4 +16,8 @@ export interface IFilePayload {
16
16
  * The path of the file.
17
17
  */
18
18
  path?: string;
19
+ /**
20
+ * The flag to skip encryption.
21
+ */
22
+ skipEncryption?: boolean;
19
23
  }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * File status enum
3
+ */
4
+ export declare enum FileStatus {
5
+ /**
6
+ * The file is pending, the content is not available.
7
+ */
8
+ Pending = "pending",
9
+ /**
10
+ * The file is syncing, the content is out of date.
11
+ */
12
+ Syncing = "syncing",
13
+ /**
14
+ * The file is synced, the content is available.
15
+ */
16
+ Synced = "synced"
17
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * File status enum
3
+ */
4
+ export var FileStatus;
5
+ (function (FileStatus) {
6
+ /**
7
+ * The file is pending, the content is not available.
8
+ */
9
+ FileStatus["Pending"] = "pending";
10
+ /**
11
+ * The file is syncing, the content is out of date.
12
+ */
13
+ FileStatus["Syncing"] = "syncing";
14
+ /**
15
+ * The file is synced, the content is available.
16
+ */
17
+ FileStatus["Synced"] = "synced";
18
+ })(FileStatus || (FileStatus = {}));
@@ -20,6 +20,10 @@ export interface IFolderDescriptor {
20
20
  * The path name of the folder (a combination of the path and the name).
21
21
  */
22
22
  pathName: string;
23
+ /**
24
+ * The absolute path name of the folder (a combination of the path and the name).
25
+ */
26
+ absolutePathName?: string;
23
27
  /**
24
28
  * The folder entries.
25
29
  */
@@ -1,6 +1,7 @@
1
1
  import { IDataStream } from '../core/stream';
2
2
  import { ObjectDescriptor, Payload } from '.';
3
3
  import { StorageEvent } from './event';
4
+ import { IObjectStoreListOptions } from './ObjectStoreListOptions';
4
5
  /**
5
6
  * The object store bucket interface.
6
7
  * @category Object Storage
@@ -51,5 +52,5 @@ export interface IObjectStoreBucket extends IDataStream {
51
52
  * @param recursive Whether to list the objects and folders recursively.
52
53
  * @returns The list of objects and folders.
53
54
  */
54
- list(path: string, recursive?: boolean): Promise<ObjectDescriptor[]>;
55
+ list(path: string, options?: IObjectStoreListOptions): Promise<ObjectDescriptor[]>;
55
56
  }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Options for creating an Object Store bucket.
3
+ * @category Object Storage
4
+ */
5
+ export interface IObjectStoreBucketOptions {
6
+ /**
7
+ * Whether to sync the content of the bucket.
8
+ */
9
+ syncContent?: boolean;
10
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,4 @@
1
- import { ObjectDescriptor, ObjectKind } from '.';
1
+ import { IFileDescriptor, IFolderDescriptor, ObjectDescriptor, ObjectKind } from '.';
2
2
  /**
3
3
  * The object store connector interface.
4
4
  * @category Connector
@@ -20,24 +20,28 @@ export interface IObjectStoreConnector {
20
20
  /**
21
21
  * Creates a folder.
22
22
  * @param path The path to the folder.
23
- * @returns A promise that resolves when the folder is created.
23
+ * @returns A promise that resolves with the folder descriptor.
24
24
  */
25
- createFolder(path: string): Promise<void>;
25
+ createFolder(path: string): Promise<IFolderDescriptor>;
26
26
  /**
27
27
  * Writes a file.
28
28
  * @param file The file to write.
29
29
  * @param path The path to write the file to.
30
+ * @param skipEncryption Whether to skip encryption.
31
+ * @returns A promise that resolves with the file descriptor.
30
32
  */
31
- writeFile(file: File, path?: string): Promise<void>;
33
+ writeFile(file: File, path?: string, skipEncryption?: boolean): Promise<IFileDescriptor>;
32
34
  /**
33
35
  * Moves an object.
34
36
  * @param path The path to the object.
35
37
  * @param newPath The path to move the object to.
38
+ * @returns A promise that resolves with the object kind.
36
39
  */
37
40
  moveObject(path: string, newPath: string): Promise<ObjectKind>;
38
41
  /**
39
42
  * Deletes an object.
40
43
  * @param path The path to the object.
44
+ * @returns A promise that resolves with the object kind.
41
45
  */
42
46
  deleteObject(path: string): Promise<ObjectKind>;
43
47
  /**
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Options for the list function on an Object Store Bucket
3
+ * @category Object Storage
4
+ */
5
+ export interface IObjectStoreListOptions {
6
+ /**
7
+ * List folders recursively.
8
+ */
9
+ recursive?: boolean;
10
+ /**
11
+ * List files that are not synced with the object store.
12
+ * i.e. the content of the file is not available.
13
+ */
14
+ includeSyncingFiles: boolean;
15
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,5 @@
1
1
  export * from './event';
2
+ export { FileStatus } from './FileStatus';
2
3
  export { IFileDescriptor } from './FileDescriptor';
3
4
  export { IFilePayload } from './FilePayload';
4
5
  export { IFolderDescriptor } from './FolderDescriptor';
@@ -7,7 +8,9 @@ export { IMovePayload } from './MovePayload';
7
8
  export { ObjectDescriptor } from './ObjectDescriptor';
8
9
  export { ObjectKind } from './ObjectKind';
9
10
  export { IObjectStoreBucket } from './ObjectStoreBucket';
11
+ export { IObjectStoreBucketOptions } from './ObjectStoreBucketOptions';
10
12
  export { IObjectStoreConnector } from './ObjectStoreConnector';
13
+ export { IObjectStoreListOptions } from './ObjectStoreListOptions';
11
14
  export { ObjectStoreConnectorConstructor } from './ObjectStoreConnectorConstructor';
12
15
  export { Payload } from './Payload';
13
16
  export { PayloadAction } from './PayloadAction';
@@ -1,3 +1,4 @@
1
1
  export * from './event';
2
+ export { FileStatus } from './FileStatus';
2
3
  export { ObjectKind } from './ObjectKind';
3
4
  export { PayloadAction } from './PayloadAction';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewdle/web-sdk-types",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
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",