@autofleet/zehut 1.2.3 → 1.2.5

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.
@@ -14,8 +14,12 @@ export default class ApiUser {
14
14
  emptyUser: boolean;
15
15
  constructor(id?: string);
16
16
  getUserPermissions(): Promise<UserPayload>;
17
+ get businessModels(): string[] | undefined;
18
+ get fleets(): string[] | undefined;
19
+ get demandSources(): string[] | undefined;
20
+ getUserProperty(key: any): string[] | undefined;
17
21
  get permissions(): UserPayload | undefined;
18
22
  getUserPermissionsLegacy(): Promise<any>;
19
- get permissionsLegacy(): UserPayload;
23
+ get permissionsLegacy(): any;
20
24
  }
21
25
  export {};
@@ -29,6 +29,21 @@ class ApiUser {
29
29
  return this.privatePermissions;
30
30
  });
31
31
  }
32
+ get businessModels() {
33
+ return this.getUserProperty('businessModels');
34
+ }
35
+ get fleets() {
36
+ return this.getUserProperty('fleets');
37
+ }
38
+ get demandSources() {
39
+ return this.getUserProperty('demandSources');
40
+ }
41
+ getUserProperty(key) {
42
+ if (!this.privatePermissions) {
43
+ throw new Error(`Cannot get ${key} without calling (async) getUserPermissions before`);
44
+ }
45
+ return Object.keys(this.privatePermissions[key] || {});
46
+ }
32
47
  get permissions() {
33
48
  if (!this.privatePermissions) {
34
49
  throw new Error('Cannot get permissions without calling (async) getUserPermissions before');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/zehut",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "description": "manage user's identity",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",