@hvedinich/utils 0.0.68 → 0.0.70

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hvedinich/utils",
3
- "version": "0.0.68",
3
+ "version": "0.0.70",
4
4
  "description": "utils module",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -3,6 +3,22 @@ const regExp = require('./regExp');
3
3
 
4
4
  const SYSTEM_USER = 'SYSTEM_USER';
5
5
  const TRIAL = 'TRIAL';
6
+ const OWNER = 'OWNER';
7
+ const MANAGER = 'MANAGER';
8
+
9
+ const BILLING = 'BILLING';
10
+ const SHARE_ACCESS = 'SHARE_ACCESS';
11
+
12
+ const roles = {
13
+ OWNER,
14
+ MANAGER,
15
+ };
16
+
17
+ const allProfilePermission = [BILLING, SHARE_ACCESS];
18
+
19
+ const rolePermission = {
20
+ OWNER: [BILLING, SHARE_ACCESS],
21
+ };
6
22
 
7
23
  const serverCtx = {
8
24
  uid: SYSTEM_USER, // ENV VER
@@ -25,11 +41,17 @@ const auth = {
25
41
  permission: {
26
42
  SYSTEM_USER,
27
43
  TRIAL,
44
+
45
+ BILLING,
46
+ SHARE_ACCESS,
28
47
  },
29
48
  defaultPermission: [TRIAL],
30
49
  };
31
50
 
32
51
  module.exports = {
52
+ roles,
53
+ rolePermission,
54
+ allProfilePermission,
33
55
  healthCheckStatuses,
34
56
  serverCtx,
35
57
  guestCtx,
@@ -111,7 +111,9 @@ class Server {
111
111
 
112
112
  addEndpoints(endpoints) {
113
113
  endpoints.forEach(({ path, method, handler, proxy }) => {
114
- if (proxy) {
114
+ if (path && method && handler && proxy) {
115
+ this.app[method](path, proxy, handler);
116
+ } else if (proxy) {
115
117
  this.app.use(path, proxy);
116
118
  } else {
117
119
  this.app[method](path, handler);