@tblabs/storage 5.12.2 → 5.12.3
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/Datasets/DatasetBase.d.ts +2 -0
- package/Datasets/PicturesDataset/PicturesDataset.d.ts +2 -1
- package/Datasets/PicturesDataset/PicturesDataset.js +8 -1
- package/Messages/DropPicturesCommand.d.ts +5 -0
- package/Messages/DropPicturesCommand.js +6 -0
- package/Services/OnlineStorage.d.ts +1 -1
- package/package.json +1 -1
- package/tblabs-storage-5.12.3.tgz +0 -0
- package/tblabs-storage-5.12.2.tgz +0 -0
|
@@ -7,6 +7,8 @@ export declare abstract class DatasetBase {
|
|
|
7
7
|
protected dataset: dir;
|
|
8
8
|
abstract Type: DatasetType;
|
|
9
9
|
abstract GetAllIds(): Promise<string[]>;
|
|
10
|
+
abstract Drop(): Promise<void>;
|
|
11
|
+
abstract Delete(id: string): Promise<void>;
|
|
10
12
|
constructor(_db: OnlineStorage, dataset: dir);
|
|
11
13
|
get Name(): string;
|
|
12
14
|
get Database(): OnlineStorage;
|
|
@@ -15,5 +15,6 @@ export declare class PicturesDataset extends DatasetBase {
|
|
|
15
15
|
GetPicture(id: string): Promise<PicturePack>;
|
|
16
16
|
GetAllPictures(): Promise<PicturePack[]>;
|
|
17
17
|
UploadPictures(files: File[]): Promise<PicturesUploadResult>;
|
|
18
|
-
|
|
18
|
+
Delete(id: string): Promise<void>;
|
|
19
|
+
Drop(): Promise<void>;
|
|
19
20
|
}
|
|
@@ -6,6 +6,7 @@ import { PicturesUploadResult } from "./PicturesUploadResult";
|
|
|
6
6
|
import { DatasetType } from "../../Services/DatasetType";
|
|
7
7
|
import { ListPicturesIdsQuery } from "../../Messages/ListPicturesIdsQuery";
|
|
8
8
|
import { GetPictureQuery } from "../../Messages/GetPictureQuery";
|
|
9
|
+
import { DropPicturesCommand } from "../../Messages/DropPicturesCommand";
|
|
9
10
|
export class PicturesDataset extends DatasetBase {
|
|
10
11
|
_db;
|
|
11
12
|
dataset;
|
|
@@ -64,10 +65,16 @@ export class PicturesDataset extends DatasetBase {
|
|
|
64
65
|
return PicturesUploadResult.Failure(`Can not upload: ${ex.message}`);
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
|
-
async
|
|
68
|
+
async Delete(id) {
|
|
68
69
|
const result = await this._db.Send(new DeletePictureCommand(this._db.DatabaseDir, this.dataset, id));
|
|
69
70
|
if (!result.IsSuccess) {
|
|
70
71
|
throw new Error("Failed to delete picture: " + result.ErrorMessage);
|
|
71
72
|
}
|
|
72
73
|
}
|
|
74
|
+
async Drop() {
|
|
75
|
+
const result = await this._db.Send(new DropPicturesCommand(this._db.DatabaseDir, this.dataset));
|
|
76
|
+
if (!result.IsSuccess) {
|
|
77
|
+
throw new Error("Failed to drop pictures: " + result.ErrorMessage);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
73
80
|
}
|
|
@@ -37,7 +37,7 @@ export declare class OnlineStorage {
|
|
|
37
37
|
DeleteUser(user: IStorageUser): Promise<void>;
|
|
38
38
|
GetDataset<T extends object>(datasetName: string, converter: IConverter<any, T>): Dataset<T>;
|
|
39
39
|
GetTextDataset(datasetName: string, converter?: ITextConverter<any>): TextDataset<any> | RawTextDataset;
|
|
40
|
-
GetPicturesDataset(datasetName: string, picsConfig
|
|
40
|
+
GetPicturesDataset(datasetName: string, picsConfig?: PicsConfig): PicturesDataset;
|
|
41
41
|
private IsBrowserEnvironment;
|
|
42
42
|
private LoadUserFromLocalStorage;
|
|
43
43
|
get User(): IStorageUser;
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|