@nr1e/commons 0.0.3-alpha.1 → 0.0.3-alpha.11

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.
Files changed (64) hide show
  1. package/LICENSE +1 -1
  2. package/{bitsnbytes → dist/bitsnbytes}/b64.js +14 -21
  3. package/dist/bitsnbytes/b64.js.map +1 -0
  4. package/dist/bitsnbytes/index.js +2 -0
  5. package/dist/bitsnbytes/index.js.map +1 -0
  6. package/{errors → dist/errors}/errors.d.ts +59 -40
  7. package/dist/errors/errors.js +230 -0
  8. package/dist/errors/errors.js.map +1 -0
  9. package/dist/errors/index.js +2 -0
  10. package/dist/errors/index.js.map +1 -0
  11. package/{http → dist/http}/http-method.js +2 -5
  12. package/dist/http/http-method.js.map +1 -0
  13. package/{http → dist/http}/http-status-code.js +2 -5
  14. package/dist/http/http-status-code.js.map +1 -0
  15. package/dist/http/index.js +3 -0
  16. package/dist/http/index.js.map +1 -0
  17. package/dist/index.d.ts +5 -0
  18. package/dist/index.js +6 -0
  19. package/dist/index.js.map +1 -0
  20. package/{lang → dist/lang}/index.d.ts +1 -0
  21. package/dist/lang/index.js +3 -0
  22. package/dist/lang/index.js.map +1 -0
  23. package/dist/lang/sleep.d.ts +6 -0
  24. package/dist/lang/sleep.js +9 -0
  25. package/dist/lang/sleep.js.map +1 -0
  26. package/dist/lang/type-functions.js +10 -0
  27. package/dist/lang/type-functions.js.map +1 -0
  28. package/dist/validator/index.js +2 -0
  29. package/dist/validator/index.js.map +1 -0
  30. package/{validator → dist/validator}/validators.js +37 -64
  31. package/dist/validator/validators.js.map +1 -0
  32. package/package.json +18 -13
  33. package/.prettierrc.js +0 -3
  34. package/bitsnbytes/b64.js.map +0 -1
  35. package/bitsnbytes/index.js +0 -18
  36. package/bitsnbytes/index.js.map +0 -1
  37. package/errors/errors.js +0 -263
  38. package/errors/errors.js.map +0 -1
  39. package/errors/index.js +0 -18
  40. package/errors/index.js.map +0 -1
  41. package/http/http-method.js.map +0 -1
  42. package/http/http-status-code.js.map +0 -1
  43. package/http/index.js +0 -19
  44. package/http/index.js.map +0 -1
  45. package/index.d.ts +0 -5
  46. package/index.js +0 -9
  47. package/index.js.map +0 -1
  48. package/jest.config.js +0 -8
  49. package/lang/index.js +0 -18
  50. package/lang/index.js.map +0 -1
  51. package/lang/type-functions.js +0 -16
  52. package/lang/type-functions.js.map +0 -1
  53. package/validator/index.js +0 -18
  54. package/validator/index.js.map +0 -1
  55. package/validator/validators.js.map +0 -1
  56. /package/{bitsnbytes → dist/bitsnbytes}/b64.d.ts +0 -0
  57. /package/{bitsnbytes → dist/bitsnbytes}/index.d.ts +0 -0
  58. /package/{errors → dist/errors}/index.d.ts +0 -0
  59. /package/{http → dist/http}/http-method.d.ts +0 -0
  60. /package/{http → dist/http}/http-status-code.d.ts +0 -0
  61. /package/{http → dist/http}/index.d.ts +0 -0
  62. /package/{lang → dist/lang}/type-functions.d.ts +0 -0
  63. /package/{validator → dist/validator}/index.d.ts +0 -0
  64. /package/{validator → dist/validator}/validators.d.ts +0 -0
package/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2023 NR1E, Inc.
1
+ Copyright 2023-2024 NR1E, Inc.
2
2
 
3
3
  Redistribution and use in source and binary forms, with or without
4
4
  modification, are permitted provided that the following conditions are met:
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stob64s = exports.tob64s = exports.tob64 = exports.b64Charset = exports.YUI_BASE64_CHARS = exports.URL_MODIFIED_BASE64_CHARS = exports.BASE64_CHARS = void 0;
4
- const errors_1 = require("../errors");
1
+ import { IllegalArgumentError } from '../errors';
5
2
  // eslint-disable-next-line node/no-unsupported-features/node-builtins
6
3
  const encoder = new TextEncoder();
7
4
  // eslint-disable-next-line node/no-unsupported-features/node-builtins
8
5
  const decoder = new TextDecoder();
9
- exports.BASE64_CHARS = new Uint8Array([
6
+ export const BASE64_CHARS = new Uint8Array([
10
7
  0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d,
11
8
  0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a,
12
9
  0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d,
@@ -18,7 +15,7 @@ exports.BASE64_CHARS = new Uint8Array([
18
15
  // 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
19
16
  // 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
20
17
  // '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/', '='
21
- exports.URL_MODIFIED_BASE64_CHARS = new Uint8Array([
18
+ export const URL_MODIFIED_BASE64_CHARS = new Uint8Array([
22
19
  0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d,
23
20
  0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a,
24
21
  0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d,
@@ -30,7 +27,7 @@ exports.URL_MODIFIED_BASE64_CHARS = new Uint8Array([
30
27
  // 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
31
28
  // 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
32
29
  // '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '_',
33
- exports.YUI_BASE64_CHARS = new Uint8Array([
30
+ export const YUI_BASE64_CHARS = new Uint8Array([
34
31
  0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d,
35
32
  0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a,
36
33
  0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d,
@@ -42,28 +39,27 @@ exports.YUI_BASE64_CHARS = new Uint8Array([
42
39
  *
43
40
  * @param b64chars a base64 character set
44
41
  */
45
- function b64Charset(b64chars) {
42
+ export function b64Charset(b64chars) {
46
43
  if (b64chars === undefined || b64chars === null) {
47
- return exports.BASE64_CHARS;
44
+ return BASE64_CHARS;
48
45
  }
49
46
  if (b64chars instanceof Uint8Array) {
50
47
  if (b64chars.length !== 65 && b64chars.length !== 64) {
51
- throw new errors_1.IllegalArgumentError('b64chars', 'Base 64 character sets must be 64 or 65 characters.');
48
+ throw new IllegalArgumentError('b64chars', 'Base 64 character sets must be 64 or 65 characters.');
52
49
  }
53
50
  return b64chars;
54
51
  }
55
52
  switch (b64chars) {
56
53
  case 'b64':
57
- return exports.BASE64_CHARS;
54
+ return BASE64_CHARS;
58
55
  case 'url':
59
- return exports.URL_MODIFIED_BASE64_CHARS;
56
+ return URL_MODIFIED_BASE64_CHARS;
60
57
  case 'yui':
61
- return exports.YUI_BASE64_CHARS;
58
+ return YUI_BASE64_CHARS;
62
59
  default:
63
- throw new errors_1.IllegalArgumentError('b64chars', `Invalid base64 character set '${b64chars}'`);
60
+ throw new IllegalArgumentError('b64chars', `Invalid base64 character set '${b64chars}'`);
64
61
  }
65
62
  }
66
- exports.b64Charset = b64Charset;
67
63
  /**
68
64
  * Base64 encodes a series of bytes.
69
65
  *
@@ -71,7 +67,7 @@ exports.b64Charset = b64Charset;
71
67
  * @param opts Encoding options
72
68
  * @return a base64 string
73
69
  */
74
- function tob64(buf, opts) {
70
+ export function tob64(buf, opts) {
75
71
  var _a, _b;
76
72
  const b64chars = b64Charset(opts === null || opts === void 0 ? void 0 : opts.b64chars);
77
73
  const toIndex = (_a = opts === null || opts === void 0 ? void 0 : opts.toIndex) !== null && _a !== void 0 ? _a : buf.length;
@@ -111,7 +107,6 @@ function tob64(buf, opts) {
111
107
  }
112
108
  return b64;
113
109
  }
114
- exports.tob64 = tob64;
115
110
  /**
116
111
  * Base64 encodes a series of bytes to a string.
117
112
  *
@@ -119,10 +114,9 @@ exports.tob64 = tob64;
119
114
  * @param opts Encoding options
120
115
  * @return a base64 string
121
116
  */
122
- function tob64s(buf, opts) {
117
+ export function tob64s(buf, opts) {
123
118
  return decoder.decode(tob64(buf, opts));
124
119
  }
125
- exports.tob64s = tob64s;
126
120
  /**
127
121
  * Base64 encodes a string to a string.
128
122
  *
@@ -130,8 +124,7 @@ exports.tob64s = tob64s;
130
124
  * @param opts Encoding options
131
125
  * @return a base64 string
132
126
  */
133
- function stob64s(str, opts) {
127
+ export function stob64s(str, opts) {
134
128
  return tob64s(encoder.encode(str), opts);
135
129
  }
136
- exports.stob64s = stob64s;
137
130
  //# sourceMappingURL=b64.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"b64.js","sourceRoot":"","sources":["../../src/bitsnbytes/b64.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,WAAW,CAAC;AAE/C,sEAAsE;AACtE,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAClC,sEAAsE;AACtE,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAElC,MAAM,CAAC,MAAM,YAAY,GAAe,IAAI,UAAU,CAAC;IACrD,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;IAC5E,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,I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AAC,EAAE,CAAC,CAAC;iBACzB;gBACD,MAAM;YACR,KAAK,CAAC,EAAE,yBAAyB;gBAC/B,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;gBACtC,IAAI,QAAQ,CAAC,MAAM,KAAK,EAAE,EAAE;oBAC1B,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;iBACzB;gBACD,MAAM;YACR;gBACE,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;gBACtC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;gBAC9B,MAAM;SACT;KACF;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,MAAM,CAAC,GAAe,EAAE,IAAoB;IAC1D,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;AAC1C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,OAAO,CAAC,GAAW,EAAE,IAAoB;IACvD,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './b64';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bitsnbytes/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC"}
@@ -1,56 +1,64 @@
1
1
  import { HttpStatusCode } from '../http';
2
- interface IError {
3
- stack?: string;
4
- name?: string;
5
- argName?: string;
6
- message?: string;
7
- statusCode?: HttpStatusCode | number;
8
- }
2
+ export { isError } from '../lang';
9
3
  /**
10
4
  * An extended version of Error that includes an HttpStatusCode.
11
5
  * This can be useful in middleware error handlers to determine http status codes to return to the client.
12
6
  */
13
7
  export interface HttpError extends Error {
8
+ /**
9
+ * The HTTP status code.
10
+ */
14
11
  statusCode: HttpStatusCode | number;
15
12
  }
16
13
  /**
17
14
  * Checks if the given parameter is an HttpError.
18
15
  *
19
- * @param e the parameter to check
16
+ * @param e The parameter to check
17
+ */
18
+ export declare function isHttpError(e?: unknown): e is HttpError;
19
+ /**
20
+ * Thrown when a resource cannot be found.
20
21
  */
21
- export declare function isHttpError(e?: IError | null): e is HttpError;
22
+ export declare class NotFoundError extends Error implements HttpError {
23
+ readonly statusCode = HttpStatusCode.NOT_FOUND;
24
+ /**
25
+ * The max-age value to set in the Cache-Control header if used in a middleware.
26
+ */
27
+ readonly maxAge?: number;
28
+ constructor(message?: string, maxAge?: number);
29
+ }
22
30
  /**
23
31
  * Checks if the given parameter is a NotFoundError.
24
32
  *
25
- * @param e the parameter to check
33
+ * @param e The parameter to check
26
34
  */
27
- export declare function isNotFoundError(e?: IError | null): e is NotFoundError;
35
+ export declare function isNotFoundError(e?: unknown): e is NotFoundError;
28
36
  /**
29
- * Thrown when a resource cannot be found.
37
+ * Thrown when a request is missing authentication credentials.
30
38
  */
31
- export declare class NotFoundError extends Error implements HttpError {
32
- readonly statusCode = HttpStatusCode.NOT_FOUND;
39
+ export declare class UnauthorizedError extends Error implements HttpError {
40
+ readonly statusCode = HttpStatusCode.UNAUTHORIZED;
33
41
  constructor(message?: string);
34
42
  }
35
43
  /**
36
- * Checks if the given parameter is a ForbiddenError.
44
+ * Checks if the given parameter is a UnauthorizedError.
37
45
  *
38
- * @param e the parameter to check
46
+ * @param e The parameter to check
39
47
  */
40
- export declare function isForbiddenError(e?: IError | null): e is ForbiddenError;
48
+ export declare function isUnauthorizedError(e?: unknown): e is UnauthorizedError;
41
49
  /**
42
- * Thrown when a requested operations is not allowed.
50
+ * Thrown when credentials are present, but the requested operations is not allowed.
43
51
  */
44
52
  export declare class ForbiddenError extends Error implements HttpError {
45
53
  readonly statusCode = HttpStatusCode.FORBIDDEN;
46
54
  constructor(message?: string);
47
55
  }
48
56
  /**
49
- * Checks if the given variable is a ValidationError.
57
+ * Checks if the given parameter is a ForbiddenError.
50
58
  *
51
- * @param e the variable to check
59
+ * @param e The parameter to check
52
60
  */
53
- export declare function isValidationError(e?: IError | null): e is ValidationError;
61
+ export declare function isForbiddenError(e?: unknown): e is ForbiddenError;
54
62
  /**
55
63
  * Thrown when a validation error occurs.
56
64
  */
@@ -59,11 +67,11 @@ export declare class ValidationError extends Error implements HttpError {
59
67
  constructor(message?: string);
60
68
  }
61
69
  /**
62
- * Checks if the given parameter is a BadRequestError.
70
+ * Checks if the given variable is a ValidationError.
63
71
  *
64
- * @param e the parameter to check
72
+ * @param e The variable to check
65
73
  */
66
- export declare function isBadRequestError(e?: IError | null): e is BadRequestError;
74
+ export declare function isValidationError(e?: unknown): e is ValidationError;
67
75
  /**
68
76
  * Thrown when a bad request is made.
69
77
  */
@@ -72,11 +80,11 @@ export declare class BadRequestError extends Error implements HttpError {
72
80
  constructor(message?: string);
73
81
  }
74
82
  /**
75
- * Checks if the given parameter is a InternalServerError.
83
+ * Checks if the given parameter is a BadRequestError.
76
84
  *
77
- * @param e the parameter to check
85
+ * @param e The parameter to check
78
86
  */
79
- export declare function isInternalServerError(e?: IError | null): e is InternalServerError;
87
+ export declare function isBadRequestError(e?: unknown): e is BadRequestError;
80
88
  /**
81
89
  * Throws when an internal server error occurs.
82
90
  */
@@ -85,11 +93,11 @@ export declare class InternalServerError extends Error implements HttpError {
85
93
  constructor(message?: string);
86
94
  }
87
95
  /**
88
- * Checks if the given parameter is a ConflictError.
96
+ * Checks if the given parameter is a InternalServerError.
89
97
  *
90
- * @param e the parameter to check
98
+ * @param e The parameter to check
91
99
  */
92
- export declare function isConflictError(e?: IError | null): e is ConflictError;
100
+ export declare function isInternalServerError(e?: unknown): e is InternalServerError;
93
101
  /**
94
102
  * Thrown when a conflict occurs.
95
103
  */
@@ -98,11 +106,11 @@ export declare class ConflictError extends Error implements HttpError {
98
106
  constructor(message?: string);
99
107
  }
100
108
  /**
101
- * Checks if the given parameter is a UnsupportedMediaTypeError.
109
+ * Checks if the given parameter is a ConflictError.
102
110
  *
103
- * @param e the parameter to check
111
+ * @param e The parameter to check
104
112
  */
105
- export declare function isUnsupportedMediaTypeError(e?: IError | null): e is UnsupportedMediaTypeError;
113
+ export declare function isConflictError(e?: unknown): e is ConflictError;
106
114
  /**
107
115
  * Thrown when a unsupported media type is used.
108
116
  */
@@ -111,11 +119,11 @@ export declare class UnsupportedMediaTypeError extends Error implements HttpErro
111
119
  constructor(message?: string);
112
120
  }
113
121
  /**
114
- * Checks if the given parameter is a NotImplementedError.
122
+ * Checks if the given parameter is a UnsupportedMediaTypeError.
115
123
  *
116
- * @param e the parameter to check
124
+ * @param e The parameter to check
117
125
  */
118
- export declare function isNotImplementedError(e?: IError | null): e is NotImplementedError;
126
+ export declare function isUnsupportedMediaTypeError(e?: unknown): e is UnsupportedMediaTypeError;
119
127
  /**
120
128
  * Thrown when a requested operation is not implemented.
121
129
  */
@@ -125,11 +133,11 @@ export declare class NotImplementedError extends Error implements HttpError {
125
133
  constructor(message?: string);
126
134
  }
127
135
  /**
128
- * Checks if the given parameter is a IllegalArgumentError.
136
+ * Checks if the given parameter is a NotImplementedError.
129
137
  *
130
- * @param e the parameter to check
138
+ * @param e The parameter to check
131
139
  */
132
- export declare function isIllegalArgumentError(e?: IError | null): e is IllegalArgumentError;
140
+ export declare function isNotImplementedError(e?: unknown): e is NotImplementedError;
133
141
  /**
134
142
  * Thrown when an illegal argument is passed to a function.
135
143
  */
@@ -137,5 +145,16 @@ export declare class IllegalArgumentError extends Error {
137
145
  readonly argName: string;
138
146
  constructor(argName: string, message?: string);
139
147
  }
148
+ /**
149
+ * Checks if the given parameter is a IllegalArgumentError.
150
+ *
151
+ * @param e The parameter to check
152
+ */
153
+ export declare function isIllegalArgumentError(e?: unknown): e is IllegalArgumentError;
154
+ /**
155
+ * Converts the given parameter to an HttpError.
156
+ *
157
+ * @param code The HTTP status code
158
+ * @param message The error message
159
+ */
140
160
  export declare function toError(code: number | HttpStatusCode, message?: string): Error;
141
- export {};
@@ -0,0 +1,230 @@
1
+ import { HttpStatusCode } from '../http';
2
+ import { isError, isObject } from '../lang';
3
+ export { isError } from '../lang';
4
+ /**
5
+ * Checks if the given parameter is an HttpError.
6
+ *
7
+ * @param e The parameter to check
8
+ */
9
+ export function isHttpError(e) {
10
+ return isObject(e) && !!(e && e.stack && e.statusCode && e.message && e.name);
11
+ }
12
+ /**
13
+ * Thrown when a resource cannot be found.
14
+ */
15
+ export class NotFoundError extends Error {
16
+ constructor(message, maxAge) {
17
+ message = message !== null && message !== void 0 ? message : 'Not found';
18
+ super(message);
19
+ this.statusCode = HttpStatusCode.NOT_FOUND;
20
+ this.name = 'NotFoundError';
21
+ this.maxAge = maxAge;
22
+ }
23
+ }
24
+ /**
25
+ * Checks if the given parameter is a NotFoundError.
26
+ *
27
+ * @param e The parameter to check
28
+ */
29
+ export function isNotFoundError(e) {
30
+ return isHttpError(e) && e.name === 'NotFoundError';
31
+ }
32
+ /**
33
+ * Thrown when a request is missing authentication credentials.
34
+ */
35
+ export class UnauthorizedError extends Error {
36
+ constructor(message) {
37
+ message = message !== null && message !== void 0 ? message : 'Unauthorized';
38
+ super(message);
39
+ this.statusCode = HttpStatusCode.UNAUTHORIZED;
40
+ this.name = 'UnauthorizedError';
41
+ }
42
+ }
43
+ /**
44
+ * Checks if the given parameter is a UnauthorizedError.
45
+ *
46
+ * @param e The parameter to check
47
+ */
48
+ export function isUnauthorizedError(e) {
49
+ return isHttpError(e) && e.name === 'UnauthorizedError';
50
+ }
51
+ /**
52
+ * Thrown when credentials are present, but the requested operations is not allowed.
53
+ */
54
+ export class ForbiddenError extends Error {
55
+ constructor(message) {
56
+ message = message !== null && message !== void 0 ? message : 'Forbidden';
57
+ super(message);
58
+ this.statusCode = HttpStatusCode.FORBIDDEN;
59
+ this.name = 'ForbiddenError';
60
+ }
61
+ }
62
+ /**
63
+ * Checks if the given parameter is a ForbiddenError.
64
+ *
65
+ * @param e The parameter to check
66
+ */
67
+ export function isForbiddenError(e) {
68
+ return isHttpError(e) && e.name === 'ForbiddenError';
69
+ }
70
+ /**
71
+ * Thrown when a validation error occurs.
72
+ */
73
+ export class ValidationError extends Error {
74
+ constructor(message) {
75
+ message = message !== null && message !== void 0 ? message : 'Validation error';
76
+ super(message);
77
+ this.statusCode = HttpStatusCode.BAD_REQUEST;
78
+ this.name = 'ValidationError';
79
+ }
80
+ }
81
+ /**
82
+ * Checks if the given variable is a ValidationError.
83
+ *
84
+ * @param e The variable to check
85
+ */
86
+ export function isValidationError(e) {
87
+ return isHttpError(e) && e.name === 'ValidationError';
88
+ }
89
+ /**
90
+ * Thrown when a bad request is made.
91
+ */
92
+ export class BadRequestError extends Error {
93
+ constructor(message) {
94
+ message = message !== null && message !== void 0 ? message : 'Bad request';
95
+ super(message !== null && message !== void 0 ? message : 'Bad request');
96
+ this.statusCode = HttpStatusCode.BAD_REQUEST;
97
+ this.name = 'BadRequestError';
98
+ }
99
+ }
100
+ /**
101
+ * Checks if the given parameter is a BadRequestError.
102
+ *
103
+ * @param e The parameter to check
104
+ */
105
+ export function isBadRequestError(e) {
106
+ return isHttpError(e) && e.name === 'BadRequestError';
107
+ }
108
+ /**
109
+ * Throws when an internal server error occurs.
110
+ */
111
+ export class InternalServerError extends Error {
112
+ constructor(message) {
113
+ message = message !== null && message !== void 0 ? message : 'Internal server error';
114
+ super(message);
115
+ this.statusCode = HttpStatusCode.INTERNAL_SERVER_ERROR;
116
+ this.name = 'InternalServerError';
117
+ }
118
+ }
119
+ /**
120
+ * Checks if the given parameter is a InternalServerError.
121
+ *
122
+ * @param e The parameter to check
123
+ */
124
+ export function isInternalServerError(e) {
125
+ return isHttpError(e) && e.name === 'InternalServerError';
126
+ }
127
+ /**
128
+ * Thrown when a conflict occurs.
129
+ */
130
+ export class ConflictError extends Error {
131
+ constructor(message) {
132
+ message = message !== null && message !== void 0 ? message : 'Conflict';
133
+ super(message);
134
+ this.statusCode = HttpStatusCode.CONFLICT;
135
+ this.name = 'ConflictError';
136
+ }
137
+ }
138
+ /**
139
+ * Checks if the given parameter is a ConflictError.
140
+ *
141
+ * @param e The parameter to check
142
+ */
143
+ export function isConflictError(e) {
144
+ return isHttpError(e) && e.name === 'ConflictError';
145
+ }
146
+ /**
147
+ * Thrown when a unsupported media type is used.
148
+ */
149
+ export class UnsupportedMediaTypeError extends Error {
150
+ constructor(message) {
151
+ message = message !== null && message !== void 0 ? message : 'Unsupported media type';
152
+ super(message);
153
+ this.statusCode = HttpStatusCode.UNSUPPORTED_MEDIA_TYPE;
154
+ this.name = 'UnsupportedMediaTypeError';
155
+ }
156
+ }
157
+ /**
158
+ * Checks if the given parameter is a UnsupportedMediaTypeError.
159
+ *
160
+ * @param e The parameter to check
161
+ */
162
+ export function isUnsupportedMediaTypeError(e) {
163
+ return isHttpError(e) && e.name === 'UnsupportedMediaTypeError';
164
+ }
165
+ /**
166
+ * Thrown when a requested operation is not implemented.
167
+ */
168
+ export class NotImplementedError extends Error {
169
+ constructor(message) {
170
+ message = message !== null && message !== void 0 ? message : 'Not implemented';
171
+ super(message);
172
+ this.statusCode = HttpStatusCode.NOT_IMPLEMENTED;
173
+ this.expose = true;
174
+ this.name = 'NotImplementedError';
175
+ }
176
+ }
177
+ /**
178
+ * Checks if the given parameter is a NotImplementedError.
179
+ *
180
+ * @param e The parameter to check
181
+ */
182
+ export function isNotImplementedError(e) {
183
+ return isHttpError(e) && e.name === 'NotImplementedError';
184
+ }
185
+ /**
186
+ * Thrown when an illegal argument is passed to a function.
187
+ */
188
+ export class IllegalArgumentError extends Error {
189
+ constructor(argName, message) {
190
+ message = message !== null && message !== void 0 ? message : `Illegal argument ${argName}`;
191
+ super(message);
192
+ this.argName = argName;
193
+ this.name = 'IllegalArgumentError';
194
+ }
195
+ }
196
+ /**
197
+ * Checks if the given parameter is a IllegalArgumentError.
198
+ *
199
+ * @param e The parameter to check
200
+ */
201
+ export function isIllegalArgumentError(e) {
202
+ return isError(e) && e.name === 'IllegalArgumentError';
203
+ }
204
+ /**
205
+ * Converts the given parameter to an HttpError.
206
+ *
207
+ * @param code The HTTP status code
208
+ * @param message The error message
209
+ */
210
+ export function toError(code, message) {
211
+ switch (code) {
212
+ case HttpStatusCode.NOT_FOUND:
213
+ return new NotFoundError(message);
214
+ case HttpStatusCode.FORBIDDEN:
215
+ return new ForbiddenError(message);
216
+ case HttpStatusCode.BAD_REQUEST:
217
+ return new BadRequestError(message);
218
+ case HttpStatusCode.INTERNAL_SERVER_ERROR:
219
+ return new InternalServerError(message);
220
+ case HttpStatusCode.CONFLICT:
221
+ return new ConflictError(message);
222
+ case HttpStatusCode.UNSUPPORTED_MEDIA_TYPE:
223
+ return new UnsupportedMediaTypeError(message);
224
+ case HttpStatusCode.NOT_IMPLEMENTED:
225
+ return new NotImplementedError(message);
226
+ default:
227
+ return new Error(message);
228
+ }
229
+ }
230
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,SAAS,CAAC;AACvC,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAC,OAAO,EAAC,MAAM,SAAS,CAAC;AAahC;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,CAAW;IACrC,OAAO,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;AAChF,CAAC;AAED;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ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AChD,KAAK,cAAc,CAAC,eAAe;YACjC,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAC;QAC1C;YACE,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;KAC7B;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './errors';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HttpMethod = void 0;
4
- var HttpMethod;
1
+ export var HttpMethod;
5
2
  (function (HttpMethod) {
6
3
  HttpMethod["GET"] = "GET";
7
4
  HttpMethod["POST"] = "POST";
@@ -10,5 +7,5 @@ var HttpMethod;
10
7
  HttpMethod["DELETE"] = "DELETE";
11
8
  HttpMethod["HEAD"] = "HEAD";
12
9
  HttpMethod["OPTIONS"] = "OPTIONS";
13
- })(HttpMethod || (exports.HttpMethod = HttpMethod = {}));
10
+ })(HttpMethod || (HttpMethod = {}));
14
11
  //# sourceMappingURL=http-method.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-method.js","sourceRoot":"","sources":["../../src/http/http-method.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,UAQX;AARD,WAAY,UAAU;IACpB,yBAAW,CAAA;IACX,2BAAa,CAAA;IACb,yBAAW,CAAA;IACX,6BAAe,CAAA;IACf,+BAAiB,CAAA;IACjB,2BAAa,CAAA;IACb,iCAAmB,CAAA;AACrB,CAAC,EARW,UAAU,KAAV,UAAU,QAQrB"}
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HttpStatusCode = void 0;
4
- var HttpStatusCode;
1
+ export var HttpStatusCode;
5
2
  (function (HttpStatusCode) {
6
3
  HttpStatusCode[HttpStatusCode["CONTINUE"] = 100] = "CONTINUE";
7
4
  HttpStatusCode[HttpStatusCode["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
@@ -43,5 +40,5 @@ var HttpStatusCode;
43
40
  HttpStatusCode[HttpStatusCode["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
44
41
  HttpStatusCode[HttpStatusCode["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
45
42
  HttpStatusCode[HttpStatusCode["HTTP_VERSION_NOT_SUPPORTED"] = 505] = "HTTP_VERSION_NOT_SUPPORTED";
46
- })(HttpStatusCode || (exports.HttpStatusCode = HttpStatusCode = {}));
43
+ })(HttpStatusCode || (HttpStatusCode = {}));
47
44
  //# sourceMappingURL=http-status-code.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-status-code.js","sourceRoot":"","sources":["../../src/http/http-status-code.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,cAyCX;AAzCD,WAAY,cAAc;IACxB,6DAAc,CAAA;IACd,mFAAyB,CAAA;IACzB,iDAAQ,CAAA;IACR,2DAAa,CAAA;IACb,6DAAc,CAAA;IACd,uGAAmC,CAAA;IACnC,iEAAgB,CAAA;IAChB,uEAAmB,CAAA;IACnB,2EAAqB,CAAA;IACrB,6EAAsB,CAAA;IACtB,iFAAwB,CAAA;IACxB,uDAAW,CAAA;IACX,+DAAe,CAAA;IACf,qEAAkB,CAAA;IAClB,+DAAe,CAAA;IACf,iFAAwB,CAAA;IACxB,mEAAiB,CAAA;IACjB,qEAAkB,CAAA;IAClB,6EAAsB,CAAA;IACtB,+DAAe,CAAA;IACf,+DAAe,CAAA;IACf,iFAAwB,CAAA;IACxB,yEAAoB,CAAA;IACpB,uGAAmC,CAAA;IACnC,2EAAqB,CAAA;IACrB,6DAAc,CAAA;IACd,qDAAU,CAAA;IACV,2EAAqB,CAAA;IACrB,mFAAyB,CAAA;IACzB,6FAA8B,CAAA;IAC9B,qFAA0B,CAAA;IAC1B,yFAA4B,CAAA;IAC5B,uFAA2B,CAAA;IAC3B,iFAAwB,CAAA;IACxB,uFAA2B,CAAA;IAC3B,2EAAqB,CAAA;IACrB,mEAAiB,CAAA;IACjB,mFAAyB,CAAA;IACzB,2EAAqB,CAAA;IACrB,iGAAgC,CAAA;AAClC,CAAC,EAzCW,cAAc,KAAd,cAAc,QAyCzB"}
@@ -0,0 +1,3 @@
1
+ export * from './http-status-code';
2
+ export * from './http-method';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/http/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from './bitsnbytes';
2
+ export * from './errors';
3
+ export * from './http';
4
+ export * from './lang';
5
+ export * from './validator';
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ export * from './bitsnbytes';
2
+ export * from './errors';
3
+ export * from './http';
4
+ export * from './lang';
5
+ export * from './validator';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC"}
@@ -1 +1,2 @@
1
1
  export * from './type-functions';
2
+ export * from './sleep';
@@ -0,0 +1,3 @@
1
+ export * from './type-functions';
2
+ export * from './sleep';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lang/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC"}