@nr1e/commons 0.0.3-alpha.0 → 0.0.3-alpha.2
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/LICENSE +1 -1
- package/bitsnbytes/b64.d.ts +39 -0
- package/bitsnbytes/b64.js +137 -0
- package/bitsnbytes/b64.js.map +1 -0
- package/bitsnbytes/index.d.ts +1 -0
- package/bitsnbytes/index.js +18 -0
- package/bitsnbytes/index.js.map +1 -0
- package/errors/errors.d.ts +32 -16
- package/errors/errors.js +38 -44
- package/errors/errors.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +2 -1
- package/index.js.map +1 -1
- package/package.json +6 -5
package/LICENSE
CHANGED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export declare const BASE64_CHARS: Uint8Array;
|
|
2
|
+
export declare const URL_MODIFIED_BASE64_CHARS: Uint8Array;
|
|
3
|
+
export declare const YUI_BASE64_CHARS: Uint8Array;
|
|
4
|
+
export type Base64CharSet = 'b64' | 'url' | 'yui';
|
|
5
|
+
export interface Base64Options {
|
|
6
|
+
readonly fromIndex?: number;
|
|
7
|
+
readonly toIndex?: number;
|
|
8
|
+
readonly b64chars?: Uint8Array | Base64CharSet;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Returns a base64 character set and validates one if passed in.
|
|
12
|
+
*
|
|
13
|
+
* @param b64chars a base64 character set
|
|
14
|
+
*/
|
|
15
|
+
export declare function b64Charset(b64chars?: Uint8Array | Base64CharSet): Uint8Array;
|
|
16
|
+
/**
|
|
17
|
+
* Base64 encodes a series of bytes.
|
|
18
|
+
*
|
|
19
|
+
* @param buf Bytes to encode
|
|
20
|
+
* @param opts Encoding options
|
|
21
|
+
* @return a base64 string
|
|
22
|
+
*/
|
|
23
|
+
export declare function tob64(buf: Uint8Array, opts?: Base64Options): Uint8Array;
|
|
24
|
+
/**
|
|
25
|
+
* Base64 encodes a series of bytes to a string.
|
|
26
|
+
*
|
|
27
|
+
* @param buf Bytes to encode
|
|
28
|
+
* @param opts Encoding options
|
|
29
|
+
* @return a base64 string
|
|
30
|
+
*/
|
|
31
|
+
export declare function tob64s(buf: Uint8Array, opts?: Base64Options): string;
|
|
32
|
+
/**
|
|
33
|
+
* Base64 encodes a string to a string.
|
|
34
|
+
*
|
|
35
|
+
* @param str String to encode
|
|
36
|
+
* @param opts Encoding options
|
|
37
|
+
* @return a base64 string
|
|
38
|
+
*/
|
|
39
|
+
export declare function stob64s(str: string, opts?: Base64Options): string;
|
|
@@ -0,0 +1,137 @@
|
|
|
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");
|
|
5
|
+
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
|
6
|
+
const encoder = new TextEncoder();
|
|
7
|
+
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
|
8
|
+
const decoder = new TextDecoder();
|
|
9
|
+
exports.BASE64_CHARS = new Uint8Array([
|
|
10
|
+
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d,
|
|
11
|
+
0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a,
|
|
12
|
+
0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d,
|
|
13
|
+
0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a,
|
|
14
|
+
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x2b, 0x2f, 0x3d,
|
|
15
|
+
]);
|
|
16
|
+
// 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
|
|
17
|
+
// 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
|
|
18
|
+
// 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
|
|
19
|
+
// 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
|
|
20
|
+
// '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/', '='
|
|
21
|
+
exports.URL_MODIFIED_BASE64_CHARS = new Uint8Array([
|
|
22
|
+
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d,
|
|
23
|
+
0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a,
|
|
24
|
+
0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d,
|
|
25
|
+
0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a,
|
|
26
|
+
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x2d, 0x5f,
|
|
27
|
+
]);
|
|
28
|
+
// 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
|
|
29
|
+
// 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
|
|
30
|
+
// 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
|
|
31
|
+
// 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
|
|
32
|
+
// '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '_',
|
|
33
|
+
exports.YUI_BASE64_CHARS = new Uint8Array([
|
|
34
|
+
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d,
|
|
35
|
+
0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a,
|
|
36
|
+
0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d,
|
|
37
|
+
0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a,
|
|
38
|
+
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x2e, 0x5f, 0x2d,
|
|
39
|
+
]);
|
|
40
|
+
/**
|
|
41
|
+
* Returns a base64 character set and validates one if passed in.
|
|
42
|
+
*
|
|
43
|
+
* @param b64chars a base64 character set
|
|
44
|
+
*/
|
|
45
|
+
function b64Charset(b64chars) {
|
|
46
|
+
if (b64chars === undefined || b64chars === null) {
|
|
47
|
+
return exports.BASE64_CHARS;
|
|
48
|
+
}
|
|
49
|
+
if (b64chars instanceof Uint8Array) {
|
|
50
|
+
if (b64chars.length !== 65 && b64chars.length !== 64) {
|
|
51
|
+
throw new errors_1.IllegalArgumentError('b64chars', 'Base 64 character sets must be 64 or 65 characters.');
|
|
52
|
+
}
|
|
53
|
+
return b64chars;
|
|
54
|
+
}
|
|
55
|
+
switch (b64chars) {
|
|
56
|
+
case 'b64':
|
|
57
|
+
return exports.BASE64_CHARS;
|
|
58
|
+
case 'url':
|
|
59
|
+
return exports.URL_MODIFIED_BASE64_CHARS;
|
|
60
|
+
case 'yui':
|
|
61
|
+
return exports.YUI_BASE64_CHARS;
|
|
62
|
+
default:
|
|
63
|
+
throw new errors_1.IllegalArgumentError('b64chars', `Invalid base64 character set '${b64chars}'`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.b64Charset = b64Charset;
|
|
67
|
+
/**
|
|
68
|
+
* Base64 encodes a series of bytes.
|
|
69
|
+
*
|
|
70
|
+
* @param buf Bytes to encode
|
|
71
|
+
* @param opts Encoding options
|
|
72
|
+
* @return a base64 string
|
|
73
|
+
*/
|
|
74
|
+
function tob64(buf, opts) {
|
|
75
|
+
var _a, _b;
|
|
76
|
+
const b64chars = b64Charset(opts === null || opts === void 0 ? void 0 : opts.b64chars);
|
|
77
|
+
const toIndex = (_a = opts === null || opts === void 0 ? void 0 : opts.toIndex) !== null && _a !== void 0 ? _a : buf.length;
|
|
78
|
+
const fromIndex = (_b = opts === null || opts === void 0 ? void 0 : opts.fromIndex) !== null && _b !== void 0 ? _b : 0;
|
|
79
|
+
// every 3 bytes is 4 characters in padded base64 (6 bits per char)
|
|
80
|
+
const num = toIndex - fromIndex;
|
|
81
|
+
const numc = b64chars.length === 65
|
|
82
|
+
? ((num + 2 - ((num + 2) % 3)) / 3) * 4 // padded
|
|
83
|
+
: (num * 8) / 6 + ((num * 8) % 6 !== 0 ? 1 : 0); // not padded
|
|
84
|
+
const b64 = new Uint8Array(numc);
|
|
85
|
+
let n = 0;
|
|
86
|
+
for (let i = 0; i < toIndex; i += 3) {
|
|
87
|
+
const v = ((buf[i] & 0xff) << 16) |
|
|
88
|
+
(i + 1 < toIndex ? (buf[i + 1] & 0xff) << 8 : 0) |
|
|
89
|
+
(i + 2 < toIndex ? buf[i + 2] & 0xff : 0);
|
|
90
|
+
b64[n++] = b64chars[(v >>> 18) & 0x3f];
|
|
91
|
+
b64[n++] = b64chars[(v >>> 12) & 0x3f];
|
|
92
|
+
switch (toIndex - i // calculate bytes remaining to be processed
|
|
93
|
+
) {
|
|
94
|
+
case 1: // 0 bytes left to process
|
|
95
|
+
if (b64chars.length === 65) {
|
|
96
|
+
b64[n++] = b64chars[64];
|
|
97
|
+
b64[n++] = b64chars[64];
|
|
98
|
+
}
|
|
99
|
+
break;
|
|
100
|
+
case 2: // 1 byte left to process
|
|
101
|
+
b64[n++] = b64chars[(v >>> 6) & 0x3f];
|
|
102
|
+
if (b64chars.length === 65) {
|
|
103
|
+
b64[n++] = b64chars[64];
|
|
104
|
+
}
|
|
105
|
+
break;
|
|
106
|
+
default:
|
|
107
|
+
b64[n++] = b64chars[(v >>> 6) & 0x3f];
|
|
108
|
+
b64[n++] = b64chars[v & 0x3f];
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return b64;
|
|
113
|
+
}
|
|
114
|
+
exports.tob64 = tob64;
|
|
115
|
+
/**
|
|
116
|
+
* Base64 encodes a series of bytes to a string.
|
|
117
|
+
*
|
|
118
|
+
* @param buf Bytes to encode
|
|
119
|
+
* @param opts Encoding options
|
|
120
|
+
* @return a base64 string
|
|
121
|
+
*/
|
|
122
|
+
function tob64s(buf, opts) {
|
|
123
|
+
return decoder.decode(tob64(buf, opts));
|
|
124
|
+
}
|
|
125
|
+
exports.tob64s = tob64s;
|
|
126
|
+
/**
|
|
127
|
+
* Base64 encodes a string to a string.
|
|
128
|
+
*
|
|
129
|
+
* @param str String to encode
|
|
130
|
+
* @param opts Encoding options
|
|
131
|
+
* @return a base64 string
|
|
132
|
+
*/
|
|
133
|
+
function stob64s(str, opts) {
|
|
134
|
+
return tob64s(encoder.encode(str), opts);
|
|
135
|
+
}
|
|
136
|
+
exports.stob64s = stob64s;
|
|
137
|
+
//# sourceMappingURL=b64.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"b64.js","sourceRoot":"","sources":["b64.ts"],"names":[],"mappings":";;;AAAA,sCAA+C;AAE/C,sEAAsE;AACtE,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAClC,sEAAsE;AACtE,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAErB,QAAA,YAAY,GAAe,IAAI,UAAU,CAA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+
export * from './b64';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./b64"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB"}
|
package/errors/errors.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { HttpStatusCode } from '../http';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
statusCode?: HttpStatusCode | number;
|
|
7
|
-
}
|
|
2
|
+
/**
|
|
3
|
+
* An extended version of Error that includes an HttpStatusCode.
|
|
4
|
+
* This can be useful in middleware error handlers to determine http status codes to return to the client.
|
|
5
|
+
*/
|
|
8
6
|
export interface HttpError extends Error {
|
|
9
7
|
statusCode: HttpStatusCode | number;
|
|
10
8
|
}
|
|
@@ -13,13 +11,13 @@ export interface HttpError extends Error {
|
|
|
13
11
|
*
|
|
14
12
|
* @param e the parameter to check
|
|
15
13
|
*/
|
|
16
|
-
export declare function isHttpError(e?:
|
|
14
|
+
export declare function isHttpError(e?: unknown): e is HttpError;
|
|
17
15
|
/**
|
|
18
16
|
* Checks if the given parameter is a NotFoundError.
|
|
19
17
|
*
|
|
20
18
|
* @param e the parameter to check
|
|
21
19
|
*/
|
|
22
|
-
export declare function isNotFoundError(e?:
|
|
20
|
+
export declare function isNotFoundError(e?: unknown): e is NotFoundError;
|
|
23
21
|
/**
|
|
24
22
|
* Thrown when a resource cannot be found.
|
|
25
23
|
*/
|
|
@@ -32,7 +30,7 @@ export declare class NotFoundError extends Error implements HttpError {
|
|
|
32
30
|
*
|
|
33
31
|
* @param e the parameter to check
|
|
34
32
|
*/
|
|
35
|
-
export declare function isForbiddenError(e?:
|
|
33
|
+
export declare function isForbiddenError(e?: unknown): e is ForbiddenError;
|
|
36
34
|
/**
|
|
37
35
|
* Thrown when a requested operations is not allowed.
|
|
38
36
|
*/
|
|
@@ -45,7 +43,7 @@ export declare class ForbiddenError extends Error implements HttpError {
|
|
|
45
43
|
*
|
|
46
44
|
* @param e the variable to check
|
|
47
45
|
*/
|
|
48
|
-
export declare function isValidationError(e?:
|
|
46
|
+
export declare function isValidationError(e?: unknown): e is ValidationError;
|
|
49
47
|
/**
|
|
50
48
|
* Thrown when a validation error occurs.
|
|
51
49
|
*/
|
|
@@ -58,7 +56,7 @@ export declare class ValidationError extends Error implements HttpError {
|
|
|
58
56
|
*
|
|
59
57
|
* @param e the parameter to check
|
|
60
58
|
*/
|
|
61
|
-
export declare function isBadRequestError(e?:
|
|
59
|
+
export declare function isBadRequestError(e?: unknown): e is BadRequestError;
|
|
62
60
|
/**
|
|
63
61
|
* Thrown when a bad request is made.
|
|
64
62
|
*/
|
|
@@ -71,7 +69,7 @@ export declare class BadRequestError extends Error implements HttpError {
|
|
|
71
69
|
*
|
|
72
70
|
* @param e the parameter to check
|
|
73
71
|
*/
|
|
74
|
-
export declare function isInternalServerError(e?:
|
|
72
|
+
export declare function isInternalServerError(e?: unknown): e is InternalServerError;
|
|
75
73
|
/**
|
|
76
74
|
* Throws when an internal server error occurs.
|
|
77
75
|
*/
|
|
@@ -84,7 +82,7 @@ export declare class InternalServerError extends Error implements HttpError {
|
|
|
84
82
|
*
|
|
85
83
|
* @param e the parameter to check
|
|
86
84
|
*/
|
|
87
|
-
export declare function isConflictError(e?:
|
|
85
|
+
export declare function isConflictError(e?: unknown): e is ConflictError;
|
|
88
86
|
/**
|
|
89
87
|
* Thrown when a conflict occurs.
|
|
90
88
|
*/
|
|
@@ -97,7 +95,7 @@ export declare class ConflictError extends Error implements HttpError {
|
|
|
97
95
|
*
|
|
98
96
|
* @param e the parameter to check
|
|
99
97
|
*/
|
|
100
|
-
export declare function isUnsupportedMediaTypeError(e?:
|
|
98
|
+
export declare function isUnsupportedMediaTypeError(e?: unknown): e is UnsupportedMediaTypeError;
|
|
101
99
|
/**
|
|
102
100
|
* Thrown when a unsupported media type is used.
|
|
103
101
|
*/
|
|
@@ -110,7 +108,7 @@ export declare class UnsupportedMediaTypeError extends Error implements HttpErro
|
|
|
110
108
|
*
|
|
111
109
|
* @param e the parameter to check
|
|
112
110
|
*/
|
|
113
|
-
export declare function isNotImplementedError(e?:
|
|
111
|
+
export declare function isNotImplementedError(e?: unknown): e is NotImplementedError;
|
|
114
112
|
/**
|
|
115
113
|
* Thrown when a requested operation is not implemented.
|
|
116
114
|
*/
|
|
@@ -119,5 +117,23 @@ export declare class NotImplementedError extends Error implements HttpError {
|
|
|
119
117
|
readonly expose = true;
|
|
120
118
|
constructor(message?: string);
|
|
121
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* Checks if the given parameter is a IllegalArgumentError.
|
|
122
|
+
*
|
|
123
|
+
* @param e the parameter to check
|
|
124
|
+
*/
|
|
125
|
+
export declare function isIllegalArgumentError(e?: unknown): e is IllegalArgumentError;
|
|
126
|
+
/**
|
|
127
|
+
* Thrown when an illegal argument is passed to a function.
|
|
128
|
+
*/
|
|
129
|
+
export declare class IllegalArgumentError extends Error {
|
|
130
|
+
readonly argName: string;
|
|
131
|
+
constructor(argName: string, message?: string);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Converts the given parameter to an HttpError.
|
|
135
|
+
*
|
|
136
|
+
* @param code The HTTP status code
|
|
137
|
+
* @param message The error message
|
|
138
|
+
*/
|
|
122
139
|
export declare function toError(code: number | HttpStatusCode, message?: string): Error;
|
|
123
|
-
export {};
|
package/errors/errors.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toError = exports.NotImplementedError = exports.isNotImplementedError = exports.UnsupportedMediaTypeError = exports.isUnsupportedMediaTypeError = exports.ConflictError = exports.isConflictError = exports.InternalServerError = exports.isInternalServerError = exports.BadRequestError = exports.isBadRequestError = exports.ValidationError = exports.isValidationError = exports.ForbiddenError = exports.isForbiddenError = exports.NotFoundError = exports.isNotFoundError = exports.isHttpError = void 0;
|
|
3
|
+
exports.toError = exports.IllegalArgumentError = exports.isIllegalArgumentError = exports.NotImplementedError = exports.isNotImplementedError = exports.UnsupportedMediaTypeError = exports.isUnsupportedMediaTypeError = exports.ConflictError = exports.isConflictError = exports.InternalServerError = exports.isInternalServerError = exports.BadRequestError = exports.isBadRequestError = exports.ValidationError = exports.isValidationError = exports.ForbiddenError = exports.isForbiddenError = exports.NotFoundError = exports.isNotFoundError = exports.isHttpError = void 0;
|
|
4
4
|
const http_1 = require("../http");
|
|
5
|
+
const lang_1 = require("../lang");
|
|
5
6
|
/**
|
|
6
7
|
* Checks if the given parameter is an HttpError.
|
|
7
8
|
*
|
|
8
9
|
* @param e the parameter to check
|
|
9
10
|
*/
|
|
10
11
|
function isHttpError(e) {
|
|
11
|
-
return !!(e && e.stack && e.statusCode && e.message && e.name);
|
|
12
|
+
return (0, lang_1.isObject)(e) && !!(e && e.stack && e.statusCode && e.message && e.name);
|
|
12
13
|
}
|
|
13
14
|
exports.isHttpError = isHttpError;
|
|
14
15
|
/**
|
|
@@ -17,12 +18,7 @@ exports.isHttpError = isHttpError;
|
|
|
17
18
|
* @param e the parameter to check
|
|
18
19
|
*/
|
|
19
20
|
function isNotFoundError(e) {
|
|
20
|
-
return
|
|
21
|
-
e.stack &&
|
|
22
|
-
e.statusCode &&
|
|
23
|
-
e.message &&
|
|
24
|
-
e.name &&
|
|
25
|
-
e.name === 'NotFoundError');
|
|
21
|
+
return isHttpError(e) && e.name === 'NotFoundError';
|
|
26
22
|
}
|
|
27
23
|
exports.isNotFoundError = isNotFoundError;
|
|
28
24
|
/**
|
|
@@ -43,12 +39,7 @@ exports.NotFoundError = NotFoundError;
|
|
|
43
39
|
* @param e the parameter to check
|
|
44
40
|
*/
|
|
45
41
|
function isForbiddenError(e) {
|
|
46
|
-
return
|
|
47
|
-
e.stack &&
|
|
48
|
-
e.statusCode &&
|
|
49
|
-
e.message &&
|
|
50
|
-
e.name &&
|
|
51
|
-
e.name === 'ForbiddenError');
|
|
42
|
+
return isHttpError(e) && e.name === 'ForbiddenError';
|
|
52
43
|
}
|
|
53
44
|
exports.isForbiddenError = isForbiddenError;
|
|
54
45
|
/**
|
|
@@ -69,11 +60,7 @@ exports.ForbiddenError = ForbiddenError;
|
|
|
69
60
|
* @param e the variable to check
|
|
70
61
|
*/
|
|
71
62
|
function isValidationError(e) {
|
|
72
|
-
return
|
|
73
|
-
e.stack &&
|
|
74
|
-
e.statusCode &&
|
|
75
|
-
e.message &&
|
|
76
|
-
e.name === 'ValidationError');
|
|
63
|
+
return isHttpError(e) && e.name === 'ValidationError';
|
|
77
64
|
}
|
|
78
65
|
exports.isValidationError = isValidationError;
|
|
79
66
|
/**
|
|
@@ -94,11 +81,7 @@ exports.ValidationError = ValidationError;
|
|
|
94
81
|
* @param e the parameter to check
|
|
95
82
|
*/
|
|
96
83
|
function isBadRequestError(e) {
|
|
97
|
-
return
|
|
98
|
-
e.stack &&
|
|
99
|
-
e.statusCode &&
|
|
100
|
-
e.message &&
|
|
101
|
-
e.name === 'BadRequestError');
|
|
84
|
+
return isHttpError(e) && e.name === 'BadRequestError';
|
|
102
85
|
}
|
|
103
86
|
exports.isBadRequestError = isBadRequestError;
|
|
104
87
|
/**
|
|
@@ -119,11 +102,7 @@ exports.BadRequestError = BadRequestError;
|
|
|
119
102
|
* @param e the parameter to check
|
|
120
103
|
*/
|
|
121
104
|
function isInternalServerError(e) {
|
|
122
|
-
return
|
|
123
|
-
e.stack &&
|
|
124
|
-
e.statusCode &&
|
|
125
|
-
e.message &&
|
|
126
|
-
e.name === 'InternalServerError');
|
|
105
|
+
return isHttpError(e) && e.name === 'InternalServerError';
|
|
127
106
|
}
|
|
128
107
|
exports.isInternalServerError = isInternalServerError;
|
|
129
108
|
/**
|
|
@@ -144,11 +123,7 @@ exports.InternalServerError = InternalServerError;
|
|
|
144
123
|
* @param e the parameter to check
|
|
145
124
|
*/
|
|
146
125
|
function isConflictError(e) {
|
|
147
|
-
return
|
|
148
|
-
e.stack &&
|
|
149
|
-
e.statusCode &&
|
|
150
|
-
e.message &&
|
|
151
|
-
e.name === 'ConflictError');
|
|
126
|
+
return isHttpError(e) && e.name === 'ConflictError';
|
|
152
127
|
}
|
|
153
128
|
exports.isConflictError = isConflictError;
|
|
154
129
|
/**
|
|
@@ -169,11 +144,7 @@ exports.ConflictError = ConflictError;
|
|
|
169
144
|
* @param e the parameter to check
|
|
170
145
|
*/
|
|
171
146
|
function isUnsupportedMediaTypeError(e) {
|
|
172
|
-
return
|
|
173
|
-
e.stack &&
|
|
174
|
-
e.statusCode &&
|
|
175
|
-
e.message &&
|
|
176
|
-
e.name === 'UnsupportedMediaTypeError');
|
|
147
|
+
return isHttpError(e) && e.name === 'UnsupportedMediaTypeError';
|
|
177
148
|
}
|
|
178
149
|
exports.isUnsupportedMediaTypeError = isUnsupportedMediaTypeError;
|
|
179
150
|
/**
|
|
@@ -194,11 +165,7 @@ exports.UnsupportedMediaTypeError = UnsupportedMediaTypeError;
|
|
|
194
165
|
* @param e the parameter to check
|
|
195
166
|
*/
|
|
196
167
|
function isNotImplementedError(e) {
|
|
197
|
-
return
|
|
198
|
-
e.stack &&
|
|
199
|
-
e.statusCode &&
|
|
200
|
-
e.message &&
|
|
201
|
-
e.name === 'NotImplementedError');
|
|
168
|
+
return isHttpError(e) && e.name === 'NotImplementedError';
|
|
202
169
|
}
|
|
203
170
|
exports.isNotImplementedError = isNotImplementedError;
|
|
204
171
|
/**
|
|
@@ -214,6 +181,33 @@ class NotImplementedError extends Error {
|
|
|
214
181
|
}
|
|
215
182
|
}
|
|
216
183
|
exports.NotImplementedError = NotImplementedError;
|
|
184
|
+
/**
|
|
185
|
+
* Checks if the given parameter is a IllegalArgumentError.
|
|
186
|
+
*
|
|
187
|
+
* @param e the parameter to check
|
|
188
|
+
*/
|
|
189
|
+
function isIllegalArgumentError(e) {
|
|
190
|
+
return (0, lang_1.isError)(e) && e.name === 'IllegalArgumentError';
|
|
191
|
+
}
|
|
192
|
+
exports.isIllegalArgumentError = isIllegalArgumentError;
|
|
193
|
+
/**
|
|
194
|
+
* Thrown when an illegal argument is passed to a function.
|
|
195
|
+
*/
|
|
196
|
+
class IllegalArgumentError extends Error {
|
|
197
|
+
constructor(argName, message) {
|
|
198
|
+
message = message !== null && message !== void 0 ? message : `Illegal argument ${argName}`;
|
|
199
|
+
super(message);
|
|
200
|
+
this.argName = argName;
|
|
201
|
+
this.name = 'IllegalArgumentError';
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
exports.IllegalArgumentError = IllegalArgumentError;
|
|
205
|
+
/**
|
|
206
|
+
* Converts the given parameter to an HttpError.
|
|
207
|
+
*
|
|
208
|
+
* @param code The HTTP status code
|
|
209
|
+
* @param message The error message
|
|
210
|
+
*/
|
|
217
211
|
function toError(code, message) {
|
|
218
212
|
switch (code) {
|
|
219
213
|
case http_1.HttpStatusCode.NOT_FOUND:
|
package/errors/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["errors.ts"],"names":[],"mappings":";;;AAAA,kCAAuC;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["errors.ts"],"names":[],"mappings":";;;AAAA,kCAAuC;AACvC,kCAA0C;AAU1C;;;;GAIG;AACH,SAAgB,WAAW,CAAC,CAAW;IACrC,OAAO,IAAA,eAAQ,EAAC,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;AAFD,kCAEC;AAED;;;;GAIG;AACH,SAAgB,eAAe,CAAC,CAAW;IACzC,OAAO,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,eAAe,CAAC;AACtD,CAAC;AAFD,0CAEC;AAED;;GAEG;AACH,MAAa,aAAc,SAAQ,KAAK;IAEtC,YAAY,OAAgB;QAC1B,OAAO,GAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,WAAW,CAAC;QACjC,KAAK,CAAC,OAAO,CAAC,CAAC;QAHR,eAAU,GAAG,qBAAc,CAAC,SAAS,CAAC;QAI7C,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AAPD,sCAOC;AAED;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,CAAW;IAC1C,OAAO,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,gBAAgB,CAAC;AACvD,CAAC;AAFD,4CAEC;AAED;;GAEG;AACH,MAAa,cAAe,SAAQ,KAAK;IAEvC,YAAY,OAAgB;QAC1B,OAAO,GAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,WAAW,CAAC;QACjC,KAAK,CAAC,OAAO,CAAC,CAAC;QAHR,eAA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OAAO,CAAC,CAAC;QAC1C,KAAK,qBAAc,CAAC,QAAQ;YAC1B,OAAO,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC;QACpC,KAAK,qBAAc,CAAC,sBAAsB;YACxC,OAAO,IAAI,yBAAyB,CAAC,OAAO,CAAC,CAAC;QAChD,KAAK,qBAAc,CAAC,eAAe;YACjC,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAC;QAC1C;YACE,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;KAC7B;AACH,CAAC;AAtBD,0BAsBC"}
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.lang = exports.http = exports.errors = exports.validator = void 0;
|
|
3
|
+
exports.bitsnbytes = exports.lang = exports.http = exports.errors = exports.validator = void 0;
|
|
4
4
|
exports.validator = require("./validator");
|
|
5
5
|
exports.errors = require("./errors");
|
|
6
6
|
exports.http = require("./http");
|
|
7
7
|
exports.lang = require("./lang");
|
|
8
|
+
exports.bitsnbytes = require("./bitsnbytes");
|
|
8
9
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAAA,2CAAyC;AACzC,qCAAmC;AACnC,iCAA+B;AAC/B,iCAA+B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAAA,2CAAyC;AACzC,qCAAmC;AACnC,iCAA+B;AAC/B,iCAA+B;AAC/B,6CAA2C"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nr1e/commons",
|
|
3
3
|
"description": "Provides common patterns for validation",
|
|
4
|
-
"version": "0.0.3-alpha.
|
|
4
|
+
"version": "0.0.3-alpha.2",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
7
7
|
"author": "NR1E, Inc.",
|
|
@@ -30,11 +30,12 @@
|
|
|
30
30
|
},
|
|
31
31
|
"exports": {
|
|
32
32
|
".": "./index.js",
|
|
33
|
-
"./
|
|
34
|
-
"./http": "./http/index.js",
|
|
33
|
+
"./bitsnbytes": "./bitsnbytes/index.js",
|
|
35
34
|
"./errors": "./errors/index.js",
|
|
36
|
-
"./
|
|
37
|
-
"./lang": "./lang/index.js"
|
|
35
|
+
"./http": "./http/index.js",
|
|
36
|
+
"./lang": "./lang/index.js",
|
|
37
|
+
"./package.json": "./package.json",
|
|
38
|
+
"./validator": "./validator/index.js"
|
|
38
39
|
},
|
|
39
40
|
"scripts": {
|
|
40
41
|
"build": "tsc",
|