@hvedinich/utils 0.0.55 → 0.0.57

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/.eslintrc.js CHANGED
@@ -1,6 +1,14 @@
1
1
  module.exports = {
2
+ env: {
3
+ browser: true,
4
+ commonjs: true,
5
+ es2021: true,
6
+ },
2
7
  extends: ['airbnb-base', 'prettier'],
3
8
  plugins: ['prettier'],
9
+ parserOptions: {
10
+ ecmaVersion: 'latest',
11
+ },
4
12
  rules: {
5
13
  'arrow-body-style': 'off',
6
14
  'prefer-arrow-callback': 'off',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hvedinich/utils",
3
- "version": "0.0.55",
3
+ "version": "0.0.57",
4
4
  "description": "utils module",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -24,13 +24,16 @@
24
24
  "jsonwebtoken": "8.5.1"
25
25
  },
26
26
  "devDependencies": {
27
- "eslint": "5.16.0",
28
- "eslint-config-airbnb-base": "13.1.0",
29
- "eslint-config-prettier": "8.3.0",
30
- "eslint-plugin-graphql": "4.0.0",
31
- "eslint-plugin-import": "2.17.2",
32
- "eslint-plugin-prettier": "4.0.0",
33
- "prettier": "2.5.1"
27
+ "eslint": "^7.2.0",
28
+ "eslint-config-airbnb": "18.2.1",
29
+ "eslint-config-airbnb-base": "^15.0.0",
30
+ "eslint-config-prettier": "^8.3.0",
31
+ "eslint-plugin-graphql": "^4.0.0",
32
+ "eslint-plugin-import": "^2.26.0",
33
+ "eslint-plugin-prettier": "^4.0.0",
34
+ "husky": "^8.0.1",
35
+ "jest": "^29.1.2",
36
+ "prettier": "^2.5.1"
34
37
  },
35
38
  "publishConfig": {
36
39
  "access": "public"
@@ -18,56 +18,53 @@ class ServerError extends Error {
18
18
  }
19
19
 
20
20
  class Unauthorized extends ServerError {
21
- constructor({
22
- error, sanitized, ctx, message, code = 401,
23
- }) {
21
+ constructor({ error, sanitized, ctx, message, code = 401 }) {
24
22
  super(ctx, 'Unauthorized', 401, error, sanitized, message, code);
25
23
  }
26
24
  }
27
25
 
28
26
  class InternalServerError extends ServerError {
29
- constructor({
30
- error, sanitized, ctx, message, code = 500,
31
- }) {
27
+ constructor({ error, sanitized, ctx, message, code = 500 }) {
32
28
  super(ctx, 'InternalServerError', 500, error, sanitized, message, code);
33
29
  }
34
30
  }
35
31
 
36
32
  class NotFound extends ServerError {
37
- constructor({
38
- error, sanitized, ctx, message, code = 404,
39
- }) {
33
+ constructor({ error, sanitized, ctx, message, code = 404 }) {
40
34
  super(ctx, 'NotFound', 404, error, sanitized, message, code);
41
35
  }
42
36
  }
43
37
 
44
38
  class ValidationError extends ServerError {
45
- constructor({
46
- error, sanitized, ctx, message, code,
47
- }) {
39
+ constructor({ error, sanitized, ctx, message, code }) {
48
40
  super(ctx, 'ValidationError', 400, error, sanitized, message, code);
49
41
  }
50
42
  }
51
43
 
44
+ class PaymentError extends ServerError {
45
+ constructor({ error, sanitized, ctx, message, code = 402 }) {
46
+ super(ctx, 'PaymentError', 402, error, sanitized, message, code);
47
+ }
48
+ }
49
+
52
50
  class Forbidden extends ServerError {
53
- constructor({
54
- error, sanitized, ctx, message, code = 403,
55
- }) {
51
+ constructor({ error, sanitized, ctx, message, code = 403 }) {
56
52
  super(ctx, 'Forbidden', 403, error, sanitized, message, code);
57
53
  }
58
54
  }
59
55
 
60
56
  class TokenExpiredError extends ServerError {
61
- constructor({
62
- error,
63
- sanitized = 'Expired token',
64
- ctx,
65
- message = 'Expired token',
66
- }) {
57
+ constructor({ error, sanitized = 'Expired token', ctx, message = 'Expired token' }) {
67
58
  super(ctx, 'TokenExpiredError', 400, error, sanitized, message, 'EXPIRED');
68
59
  }
69
60
  }
70
61
 
71
62
  module.exports = {
72
- InternalServerError, Unauthorized, NotFound, ValidationError, TokenExpiredError, Forbidden,
63
+ InternalServerError,
64
+ Unauthorized,
65
+ NotFound,
66
+ ValidationError,
67
+ PaymentError,
68
+ TokenExpiredError,
69
+ Forbidden,
73
70
  };
@@ -20,6 +20,7 @@ const mapAddress = ({
20
20
  id,
21
21
  name,
22
22
  street,
23
+ zipCode,
23
24
  location: {
24
25
  longitude,
25
26
  latitude,
@@ -28,6 +29,7 @@ const mapAddress = ({
28
29
  id: id || `${longitude}-${latitude}`,
29
30
  name,
30
31
  street,
32
+ zipCode,
31
33
  location: longitude && latitude ? {
32
34
  type: 'Point',
33
35
  coordinates: [longitude, latitude],