@hvedinich/utils 0.0.66 → 0.0.68

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.66",
3
+ "version": "0.0.68",
4
4
  "description": "utils module",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -35,5 +35,5 @@ module.exports = {
35
35
  guestCtx,
36
36
  token,
37
37
  auth,
38
- regExp
38
+ regExp,
39
39
  };
@@ -59,6 +59,20 @@ class TokenExpiredError extends ServerError {
59
59
  }
60
60
  }
61
61
 
62
+ class MissingControllerError extends ServerError {
63
+ constructor({ name, slug, ctx }) {
64
+ super(
65
+ ctx,
66
+ 'MissingControllerError',
67
+ 404,
68
+ {},
69
+ `Method ${name} not found in ${slug}Controller`,
70
+ `Method ${name} not found in ${slug}Controller`,
71
+ 'MISSING_INTEGRATION_CONTROLLER',
72
+ );
73
+ }
74
+ }
75
+
62
76
  module.exports = {
63
77
  InternalServerError,
64
78
  Unauthorized,
@@ -67,4 +81,5 @@ module.exports = {
67
81
  PaymentError,
68
82
  TokenExpiredError,
69
83
  Forbidden,
84
+ MissingControllerError,
70
85
  };
@@ -41,6 +41,7 @@ const defaultContext = async ({ req }) => {
41
41
  uid: req.headers['x-yoda-uid'],
42
42
  permission: req.headers['x-yoda-permission'],
43
43
  city: req.headers['x-yoda-city'],
44
+ tenantId: req.headers['x-yoda-tenant-id'],
44
45
  };
45
46
  }
46
47
  return guestCtx;
@@ -1,6 +1,7 @@
1
1
  const constKeys = {
2
2
  'x-yoda-uid': 'uid',
3
3
  'x-yoda-city': 'city',
4
+ 'x-yoda-tenant-id': 'tenantId',
4
5
  };
5
6
  const defaultContext = ({ req }) => {
6
7
  const res = {};