@tblabs/storage 5.4.0 → 5.4.1

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.
@@ -0,0 +1,5 @@
1
+ import { Message } from '../MessageBus/Message';
2
+ import { dir } from '../Types/dir';
3
+ export declare class UserGetQuery extends Message {
4
+ constructor(Database: dir, UserId: string);
5
+ }
@@ -0,0 +1,6 @@
1
+ import { Message } from '../MessageBus/Message';
2
+ export class UserGetQuery extends Message {
3
+ constructor(Database, UserId) {
4
+ super("UserGet", { Database, UserId });
5
+ }
6
+ }
@@ -22,6 +22,7 @@ export declare class OnlineStorage {
22
22
  SetDatabase(database: dir): this;
23
23
  ListDatasets(): Promise<string[]>;
24
24
  ListUsers(): Promise<IStorageUser[]>;
25
+ GetUser(userId: string): Promise<IStorageUser>;
25
26
  AddUser(user: IStorageUser): Promise<void>;
26
27
  UpdateUser(user: IStorageUser): Promise<void>;
27
28
  DeleteUser(user: IStorageUser): Promise<void>;
package/OnlineStorage.js CHANGED
@@ -8,6 +8,7 @@ import { ListDatasetsQuery } from "./Messages/ListDatabasesQuery";
8
8
  import { UserUpdateCommand } from "./Messages/UserUpdateCommand";
9
9
  import { UserAddCommand } from "./Messages/UserAddCommand";
10
10
  import { UserDeleteCommand } from "./Messages/UserDeleteCommand";
11
+ import { UserGetQuery } from "./Messages/UserGetQuery";
11
12
  export class OnlineStorage {
12
13
  server;
13
14
  database;
@@ -55,6 +56,13 @@ export class OnlineStorage {
55
56
  }
56
57
  return result.Result;
57
58
  }
59
+ async GetUser(userId) {
60
+ const result = await this._bus.SendMessage(new UserGetQuery(this.DatabaseDir, userId));
61
+ if (!result.IsSuccess) {
62
+ throw new Error(`Could not get user: ${result.ErrorMessage}`);
63
+ }
64
+ return result.Result;
65
+ }
58
66
  async AddUser(user) {
59
67
  this.Log(`Adding user "${user.Id}"...`);
60
68
  await this._bus.SendMessage(new UserAddCommand(this.DatabaseDir, user));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tblabs/storage",
3
- "version": "5.4.0",
3
+ "version": "5.4.1",
4
4
  "description": "online storage module with auth",
5
5
  "license": "beerware",
6
6
  "main": "index.js",
Binary file
Binary file