@tblabs/storage 5.5.1 → 5.5.2

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,5 +1,5 @@
1
1
  import { Message } from "../MessageBus/Message";
2
2
  import { dir } from "../Types/dir";
3
3
  export declare class LoginUserQuery extends Message {
4
- constructor(Database: dir, Password: string);
4
+ constructor(Database: dir, Password: string, Login?: string);
5
5
  }
@@ -1,6 +1,6 @@
1
1
  import { Message } from "../MessageBus/Message";
2
2
  export class LoginUserQuery extends Message {
3
- constructor(Database, Password) {
4
- super("LoginUser", { Database, Password });
3
+ constructor(Database, Password, Login) {
4
+ super("LoginUser", { Database, Password, Login });
5
5
  }
6
6
  }
@@ -32,7 +32,10 @@ export declare class OnlineStorage {
32
32
  private IsBrowserEnvironment;
33
33
  private LoadUserFromLocalStorage;
34
34
  get User(): IStorageUser;
35
- Login(password: string): Promise<IStorageUser>;
35
+ Login(password: string, login?: string): Promise<IStorageUser>;
36
+ SetLoginPolicy(): void;
37
+ GetNextPassword(): void;
38
+ SetDefaultPrivileges(byRole: Record<string, IStorageUserPrivileges>): void;
36
39
  private SaveUserInLocalStorage;
37
40
  OnUserChange(handler: (user: IStorageUser, isAuthorized: boolean, appStart: boolean) => void): this;
38
41
  Logout(): this;
package/OnlineStorage.js CHANGED
@@ -108,8 +108,8 @@ export class OnlineStorage {
108
108
  get User() {
109
109
  return this.user;
110
110
  }
111
- async Login(password) {
112
- const result = await this._bus.SendMessage(new LoginUserQuery(this.DatabaseDir, password));
111
+ async Login(password, login) {
112
+ const result = await this._bus.SendMessage(new LoginUserQuery(this.DatabaseDir, password, login));
113
113
  if (!result.IsSuccess) {
114
114
  throw new Error(`Could not login: ${result.ErrorMessage}`);
115
115
  }
@@ -119,6 +119,12 @@ export class OnlineStorage {
119
119
  this.CallOnUserChanged(false);
120
120
  return this.user;
121
121
  }
122
+ SetLoginPolicy() {
123
+ }
124
+ GetNextPassword() {
125
+ }
126
+ SetDefaultPrivileges(byRole) {
127
+ }
122
128
  SaveUserInLocalStorage() {
123
129
  if (this.IsBrowserEnvironment()) {
124
130
  window.localStorage.setItem(this.USER_LOCAL_STORAGE_KEY, JSON.stringify(this.user));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tblabs/storage",
3
- "version": "5.5.1",
3
+ "version": "5.5.2",
4
4
  "description": "online storage module with auth",
5
5
  "license": "beerware",
6
6
  "main": "index.js",
Binary file
Binary file