@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.
@@ -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
- DeletePicture(id: string): Promise<void>;
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 DeletePicture(id) {
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
  }
@@ -0,0 +1,5 @@
1
+ import { Message } from '../MessageBus/Message';
2
+ import { dir } from '../Types/dir';
3
+ export declare class DropPicturesCommand extends Message {
4
+ constructor(Database: dir, Dataset: dir);
5
+ }
@@ -0,0 +1,6 @@
1
+ import { Message } from '../MessageBus/Message';
2
+ export class DropPicturesCommand extends Message {
3
+ constructor(Database, Dataset) {
4
+ super("DropPictures", { Database, Dataset });
5
+ }
6
+ }
@@ -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: PicsConfig): PicturesDataset;
40
+ GetPicturesDataset(datasetName: string, picsConfig?: PicsConfig): PicturesDataset;
41
41
  private IsBrowserEnvironment;
42
42
  private LoadUserFromLocalStorage;
43
43
  get User(): IStorageUser;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tblabs/storage",
3
- "version": "5.12.2",
3
+ "version": "5.12.3",
4
4
  "description": "online storage module with auth",
5
5
  "license": "beerware",
6
6
  "main": "index.js",
Binary file
Binary file