@autofleet/zehut 1.4.9 → 1.4.10-beta-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.
@@ -1,4 +1,5 @@
1
1
  export declare const checkFleetPermission: (fleetId: any) => any;
2
2
  export declare const checkBusinessModelPermission: (businessModelId: any) => any;
3
3
  export declare const checkDemandSourcePermission: (demandSourceId: any) => any;
4
+ export declare const getUser: () => any;
4
5
  export declare const isUserExist: () => boolean;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isUserExist = exports.checkDemandSourcePermission = exports.checkBusinessModelPermission = exports.checkFleetPermission = void 0;
3
+ exports.isUserExist = exports.getUser = exports.checkDemandSourcePermission = exports.checkBusinessModelPermission = exports.checkFleetPermission = void 0;
4
4
  const tracer_1 = require("./tracer");
5
5
  exports.checkFleetPermission = fleetId => {
6
6
  if (exports.isUserExist()) {
@@ -26,4 +26,5 @@ exports.checkDemandSourcePermission = demandSourceId => {
26
26
  }
27
27
  return true;
28
28
  };
29
- exports.isUserExist = () => { var _a, _b; return !!((_b = (_a = tracer_1.getCurrentTrace()) === null || _a === void 0 ? void 0 : _a.context) === null || _b === void 0 ? void 0 : _b.user); };
29
+ exports.getUser = () => { var _a, _b; return (_b = (_a = tracer_1.getCurrentTrace()) === null || _a === void 0 ? void 0 : _a.context) === null || _b === void 0 ? void 0 : _b.user; };
30
+ exports.isUserExist = () => !!exports.getUser();
@@ -0,0 +1,5 @@
1
+ import ApiUser from "./user";
2
+ export declare class UnauthorizedAccessError extends Error {
3
+ user: ApiUser;
4
+ constructor(user: any, ...params: any[]);
5
+ }
package/lib/errors.js ADDED
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnauthorizedAccessError = void 0;
4
+ class UnauthorizedAccessError extends Error {
5
+ constructor(user, ...params) {
6
+ super(...params);
7
+ this.user = user;
8
+ }
9
+ }
10
+ exports.UnauthorizedAccessError = UnauthorizedAccessError;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/zehut",
3
- "version": "1.4.9",
3
+ "version": "1.4.10-beta-1",
4
4
  "description": "manage user's identity",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",