@guren/server 2.9.0 → 2.10.1
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/dist/DocsViewerServiceProvider-qFCaeiUv.js +77 -0
- package/dist/Hash-CzrwKeDp.js +133 -0
- package/dist/HttpException-BkS3euNG.js +161 -0
- package/dist/Job-BVT813DO.js +441 -0
- package/dist/McpServiceProvider-BoAN-UcD.js +367 -0
- package/dist/MessageSigner-Bd25ZJAV.js +93 -0
- package/dist/Random-DbIJ22KQ.js +191 -0
- package/dist/address-D0Iq-XIH.js +20 -0
- package/dist/auth/index.js +2 -122
- package/dist/auth-C7sVmYgc.js +1954 -0
- package/dist/authorization/index.js +2 -38
- package/dist/authorization-Dbcuc5ZK.js +610 -0
- package/dist/broadcasting/index.js +2 -26
- package/dist/broadcasting-Dw-FhyjN.js +1055 -0
- package/dist/cache/index.js +2 -17
- package/dist/cache/types.d.ts +4 -4
- package/dist/cache-BYnZf2FR.js +812 -0
- package/dist/client-Dd7vLcqp.js +27 -0
- package/dist/console/Output.d.ts +18 -18
- package/dist/discovery/AutoDiscovery.d.ts +8 -0
- package/dist/encryption/index.js +5 -96
- package/dist/encryption-fOWQaKqX.js +250 -0
- package/dist/endpoint-D-20PiHY.js +46 -0
- package/dist/endpoint-D6GIqOpe.js +31 -0
- package/dist/errors-quJOkkCn.js +81 -0
- package/dist/events/index.js +2 -28
- package/dist/events-aIH_bWRx.js +410 -0
- package/dist/health/index.js +2 -24
- package/dist/health-VWdWXRwh.js +345 -0
- package/dist/hot-disposables-WsTX2ySN.js +281 -0
- package/dist/hot-reload/testing.d.ts +1 -1
- package/dist/http/Application.d.ts +0 -1
- package/dist/i18n/index.js +2 -30
- package/dist/i18n-mcWi7LCd.js +617 -0
- package/dist/index.js +7496 -7281
- package/dist/lambda/index.js +114 -71
- package/dist/logging/index.js +2 -24
- package/dist/logging-CPaRMuPP.js +518 -0
- package/dist/loopback-guard-D0Kc7-xc.js +224 -0
- package/dist/mail/index.js +2 -27
- package/dist/mail-DfEfSQEr.js +699 -0
- package/dist/mcp/index.js +2 -10
- package/dist/notifications/index.js +2 -33
- package/dist/notifications-BGqmUNZ8.js +759 -0
- package/dist/queue/index.js +3 -42
- package/dist/queue-CXrRK85G.js +948 -0
- package/dist/redis/index.js +672 -642
- package/dist/rolldown-runtime-8H4AJuhK.js +14 -0
- package/dist/runtime/index.js +474 -604
- package/dist/scheduling/index.js +2 -29
- package/dist/scheduling-CPiEdtQd.js +839 -0
- package/dist/storage/index.js +2 -15
- package/dist/storage-tWHMv2H_.js +841 -0
- package/dist/support/expiry.js +69 -12
- package/dist/trim-slashes-ZJ_VsY5s.js +25 -0
- package/dist/vite/index.js +118 -181
- package/dist/vite/plugin.d.ts +1 -1
- package/dist/vite-dev-server-CpCUqmiC.js +131 -0
- package/package.json +6 -5
- package/dist/DocsViewerServiceProvider-RUYDFBMW.js +0 -75
- package/dist/McpServiceProvider-SL7DUZ4G.js +0 -8
- package/dist/chunk-2SC566CD.js +0 -376
- package/dist/chunk-2V3YID4H.js +0 -20
- package/dist/chunk-3KV5X2FL.js +0 -31
- package/dist/chunk-63SKW5PS.js +0 -457
- package/dist/chunk-6J6B5KOB.js +0 -425
- package/dist/chunk-A5JJ7XTH.js +0 -24
- package/dist/chunk-AZOYI43J.js +0 -18
- package/dist/chunk-B5E5VBDI.js +0 -115
- package/dist/chunk-DAQKYKLH.js +0 -182
- package/dist/chunk-DRNPVBAA.js +0 -1002
- package/dist/chunk-EI5GYMAT.js +0 -853
- package/dist/chunk-H3B23O6T.js +0 -271
- package/dist/chunk-HPET6XY5.js +0 -853
- package/dist/chunk-HR2KZ3WL.js +0 -616
- package/dist/chunk-IOTWFHZU.js +0 -558
- package/dist/chunk-K6CUBJX6.js +0 -642
- package/dist/chunk-KTNJG7R7.js +0 -911
- package/dist/chunk-LAJQCSSF.js +0 -355
- package/dist/chunk-LHR6OHI7.js +0 -189
- package/dist/chunk-N7PLD7MB.js +0 -729
- package/dist/chunk-O5XIXGYM.js +0 -274
- package/dist/chunk-Q2P6YLRR.js +0 -24
- package/dist/chunk-QQKTH5KX.js +0 -114
- package/dist/chunk-SFQP6O52.js +0 -126
- package/dist/chunk-SQR7277M.js +0 -911
- package/dist/chunk-T2FFUU6J.js +0 -484
- package/dist/chunk-TVV5YNEC.js +0 -1842
- package/dist/chunk-UY3AZSYL.js +0 -14
- package/dist/chunk-V4DNC2ER.js +0 -114
- package/dist/chunk-YSOJKAAU.js +0 -427
- package/dist/errors-PUNHAFL2.js +0 -34
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { r as ServiceProvider } from "./loopback-guard-D0Kc7-xc.js";
|
|
2
|
+
import { n as createDocsViewerAccessGuard, r as isDocsViewerEnabled, t as DOCS_VIEWER_PATH } from "./endpoint-D6GIqOpe.js";
|
|
3
|
+
import { createRequire } from "node:module";
|
|
4
|
+
import { createHash } from "node:crypto";
|
|
5
|
+
import { readFile } from "node:fs/promises";
|
|
6
|
+
import { join } from "node:path";
|
|
7
|
+
//#region src/docs-viewer/DocsViewerServiceProvider.ts
|
|
8
|
+
/**
|
|
9
|
+
* How long a built `data.json` payload answers subsequent requests.
|
|
10
|
+
* Comfortably longer than the UI's poll interval, so a visible tab does
|
|
11
|
+
* not rebuild the whole bundle every few seconds only to find the ETag
|
|
12
|
+
* unchanged — the build reads and renders every doc, which is real work
|
|
13
|
+
* inside the process serving the app under development.
|
|
14
|
+
*/
|
|
15
|
+
const DATA_CACHE_TTL_MS = 15e3;
|
|
16
|
+
/**
|
|
17
|
+
* Registers the docs viewer (RFC 0005) at /_guren/docs: a read-only,
|
|
18
|
+
* loopback-guarded UI that renders the OKF docs bundle as an
|
|
19
|
+
* interactive relation graph. Only active while `isDocsViewerEnabled()`
|
|
20
|
+
* holds. All routes are GET; the whole bundle ships as one payload, so
|
|
21
|
+
* no route takes a path parameter.
|
|
22
|
+
*/
|
|
23
|
+
var DocsViewerServiceProvider = class extends ServiceProvider {
|
|
24
|
+
register() {}
|
|
25
|
+
async boot() {
|
|
26
|
+
if (!isDocsViewerEnabled()) return;
|
|
27
|
+
const hono = this.container.make("app").hono;
|
|
28
|
+
const cwd = process.cwd();
|
|
29
|
+
const cli = await import("@guren/cli");
|
|
30
|
+
const guard = createDocsViewerAccessGuard();
|
|
31
|
+
hono.use(DOCS_VIEWER_PATH, guard);
|
|
32
|
+
hono.use(`${DOCS_VIEWER_PATH}/*`, guard);
|
|
33
|
+
let shell = null;
|
|
34
|
+
hono.get(DOCS_VIEWER_PATH, async (ctx) => {
|
|
35
|
+
shell ??= readFile(cli.docsViewerAssetPath(), "utf-8");
|
|
36
|
+
return ctx.html(await shell);
|
|
37
|
+
});
|
|
38
|
+
let cached = null;
|
|
39
|
+
const payload = () => {
|
|
40
|
+
if (!cached || Date.now() - cached.at > DATA_CACHE_TTL_MS) cached = {
|
|
41
|
+
at: Date.now(),
|
|
42
|
+
payload: cli.buildDocsViewerData(cwd).then((data) => {
|
|
43
|
+
const body = JSON.stringify(data);
|
|
44
|
+
return {
|
|
45
|
+
body,
|
|
46
|
+
etag: `"${createHash("sha1").update(body).digest("hex")}"`
|
|
47
|
+
};
|
|
48
|
+
})
|
|
49
|
+
};
|
|
50
|
+
return cached.payload;
|
|
51
|
+
};
|
|
52
|
+
hono.get(`${DOCS_VIEWER_PATH}/data.json`, async (ctx) => {
|
|
53
|
+
const { body, etag } = await payload();
|
|
54
|
+
if (ctx.req.header("if-none-match") === etag) return ctx.body(null, 304, { ETag: etag });
|
|
55
|
+
return ctx.body(body, 200, {
|
|
56
|
+
"Content-Type": "application/json",
|
|
57
|
+
ETag: etag
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
let mermaid = null;
|
|
61
|
+
hono.get(`${DOCS_VIEWER_PATH}/assets/mermaid.js`, async (ctx) => {
|
|
62
|
+
try {
|
|
63
|
+
mermaid ??= readFile(createRequire(join(cwd, "package.json")).resolve("mermaid/dist/mermaid.min.js"));
|
|
64
|
+
const source = await mermaid;
|
|
65
|
+
return ctx.body(new Uint8Array(source), 200, {
|
|
66
|
+
"Content-Type": "text/javascript",
|
|
67
|
+
"Cache-Control": "max-age=3600"
|
|
68
|
+
});
|
|
69
|
+
} catch {
|
|
70
|
+
mermaid = null;
|
|
71
|
+
return ctx.json({ message: "mermaid is not installed (bun add -d mermaid)" }, 404);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
//#endregion
|
|
77
|
+
export { DocsViewerServiceProvider };
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { createHash, createHmac, randomBytes, scrypt, timingSafeEqual } from "crypto";
|
|
2
|
+
import { promisify } from "util";
|
|
3
|
+
//#region src/encryption/Hash.ts
|
|
4
|
+
const scryptAsync = promisify(scrypt);
|
|
5
|
+
/**
|
|
6
|
+
* Hash a value using the specified algorithm.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* hash('hello') // SHA-256 by default
|
|
11
|
+
* hash('hello', 'sha512')
|
|
12
|
+
* hash('hello', 'md5')
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
function hash(value, algorithm = "sha256", encoding = "hex") {
|
|
16
|
+
return createHash(algorithm).update(value).digest(encoding);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Create an HMAC signature.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* hmac('message', 'secret-key')
|
|
24
|
+
* hmac('message', 'secret-key', { algorithm: 'sha512' })
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
function hmac(value, key, options = {}) {
|
|
28
|
+
const { algorithm = "sha256", encoding = "hex" } = options;
|
|
29
|
+
return createHmac(algorithm, key).update(value).digest(encoding);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Verify an HMAC signature.
|
|
33
|
+
*/
|
|
34
|
+
function verifyHmac(value, signature, key, options = {}) {
|
|
35
|
+
return secureCompare(signature, hmac(value, key, options));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Create a SHA-256 hash.
|
|
39
|
+
*/
|
|
40
|
+
function sha256(value) {
|
|
41
|
+
return hash(value, "sha256");
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Create a SHA-512 hash.
|
|
45
|
+
*/
|
|
46
|
+
function sha512(value) {
|
|
47
|
+
return hash(value, "sha512");
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Create an MD5 hash (not secure, use only for checksums).
|
|
51
|
+
*/
|
|
52
|
+
function md5(value) {
|
|
53
|
+
return hash(value, "md5");
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Hash a password using scrypt.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* const hashed = await hashPassword('mypassword')
|
|
61
|
+
* // Returns: $scrypt$N=16384,r=8,p=1$salt$hash
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
async function hashPassword(password, options = {}) {
|
|
65
|
+
const { cost = 16384, memory = 8, saltLength = 16, keyLength = 64 } = options;
|
|
66
|
+
const salt = randomBytes(saltLength);
|
|
67
|
+
const derived = await scryptAsync(password, salt, keyLength, {
|
|
68
|
+
N: cost,
|
|
69
|
+
r: memory,
|
|
70
|
+
p: 1
|
|
71
|
+
});
|
|
72
|
+
return `$scrypt$${`N=${cost},r=${memory},p=1`}$${salt.toString("base64")}$${derived.toString("base64")}`;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Verify a password against a hash.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```typescript
|
|
79
|
+
* const isValid = await verifyPassword('mypassword', hashedPassword)
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
async function verifyPassword(password, hash) {
|
|
83
|
+
if (!hash.startsWith("$scrypt$")) throw new Error("Invalid password hash format.");
|
|
84
|
+
const parts = hash.split("$");
|
|
85
|
+
if (parts.length !== 5) throw new Error("Invalid password hash format.");
|
|
86
|
+
const [, , paramsStr, saltB64, hashB64] = parts;
|
|
87
|
+
const params = {};
|
|
88
|
+
for (const param of paramsStr.split(",")) {
|
|
89
|
+
const [key, value] = param.split("=");
|
|
90
|
+
params[key] = parseInt(value, 10);
|
|
91
|
+
}
|
|
92
|
+
const salt = Buffer.from(saltB64, "base64");
|
|
93
|
+
const expectedHash = Buffer.from(hashB64, "base64");
|
|
94
|
+
const derived = await scryptAsync(password, salt, expectedHash.length, {
|
|
95
|
+
N: params.N,
|
|
96
|
+
r: params.r,
|
|
97
|
+
p: params.p ?? 1
|
|
98
|
+
});
|
|
99
|
+
return timingSafeEqual(derived, expectedHash);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Check if a password needs to be rehashed (parameters changed).
|
|
103
|
+
*/
|
|
104
|
+
function needsRehash(hash, options = {}) {
|
|
105
|
+
const { cost = 16384, memory = 8 } = options;
|
|
106
|
+
if (!hash.startsWith("$scrypt$")) return true;
|
|
107
|
+
const parts = hash.split("$");
|
|
108
|
+
if (parts.length !== 5) return true;
|
|
109
|
+
const paramsStr = parts[2];
|
|
110
|
+
const params = {};
|
|
111
|
+
for (const param of paramsStr.split(",")) {
|
|
112
|
+
const [key, value] = param.split("=");
|
|
113
|
+
params[key] = parseInt(value, 10);
|
|
114
|
+
}
|
|
115
|
+
return params.N !== cost || params.r !== memory;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Constant-time string comparison.
|
|
119
|
+
*/
|
|
120
|
+
function secureCompare(a, b) {
|
|
121
|
+
if (a.length !== b.length) return false;
|
|
122
|
+
const bufA = Buffer.from(a);
|
|
123
|
+
const bufB = Buffer.from(b);
|
|
124
|
+
return timingSafeEqual(bufA, bufB);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Check if a value matches a hash.
|
|
128
|
+
*/
|
|
129
|
+
function check(value, hash, algorithm = "sha256") {
|
|
130
|
+
return secureCompare(createHash(algorithm).update(value).digest("hex"), hash);
|
|
131
|
+
}
|
|
132
|
+
//#endregion
|
|
133
|
+
export { md5 as a, sha256 as c, verifyPassword as d, hmac as i, sha512 as l, hash as n, needsRehash as o, hashPassword as r, secureCompare as s, check as t, verifyHmac as u };
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
//#region src/errors/HttpException.ts
|
|
2
|
+
/**
|
|
3
|
+
* Base HTTP exception class.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* // Using factory methods
|
|
8
|
+
* throw HttpException.notFound('User not found')
|
|
9
|
+
* throw HttpException.unauthorized('Invalid credentials')
|
|
10
|
+
*
|
|
11
|
+
* // Custom status code
|
|
12
|
+
* throw new HttpException(418, "I'm a teapot")
|
|
13
|
+
*
|
|
14
|
+
* // With validation errors
|
|
15
|
+
* throw HttpException.unprocessable('Validation failed', {
|
|
16
|
+
* email: ['Email is required', 'Email must be valid'],
|
|
17
|
+
* password: ['Password is too short'],
|
|
18
|
+
* })
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
var HttpException = class HttpException extends Error {
|
|
22
|
+
/**
|
|
23
|
+
* HTTP status code.
|
|
24
|
+
*/
|
|
25
|
+
statusCode;
|
|
26
|
+
/**
|
|
27
|
+
* Validation or field-specific errors.
|
|
28
|
+
*/
|
|
29
|
+
errors;
|
|
30
|
+
/**
|
|
31
|
+
* Additional error data.
|
|
32
|
+
*/
|
|
33
|
+
data;
|
|
34
|
+
constructor(statusCode, message, errors, data) {
|
|
35
|
+
super(message);
|
|
36
|
+
this.name = this.constructor.name;
|
|
37
|
+
this.statusCode = statusCode;
|
|
38
|
+
this.errors = errors;
|
|
39
|
+
this.data = data;
|
|
40
|
+
if (Error.captureStackTrace) Error.captureStackTrace(this, this.constructor);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Convert to response format.
|
|
44
|
+
*/
|
|
45
|
+
toResponse(debug = false) {
|
|
46
|
+
const body = { message: this.message };
|
|
47
|
+
if (this.errors) body.errors = this.errors;
|
|
48
|
+
if (debug) {
|
|
49
|
+
body.exception = this.name;
|
|
50
|
+
body.stack = this.stack;
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
status: this.statusCode,
|
|
54
|
+
body
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Convert to JSON.
|
|
59
|
+
*/
|
|
60
|
+
toJSON() {
|
|
61
|
+
return {
|
|
62
|
+
name: this.name,
|
|
63
|
+
message: this.message,
|
|
64
|
+
statusCode: this.statusCode,
|
|
65
|
+
errors: this.errors,
|
|
66
|
+
data: this.data
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Create a 400 Bad Request exception.
|
|
71
|
+
*/
|
|
72
|
+
static badRequest(message = "Bad Request") {
|
|
73
|
+
return new HttpException(400, message);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Create a 401 Unauthorized exception.
|
|
77
|
+
*/
|
|
78
|
+
static unauthorized(message = "Unauthorized") {
|
|
79
|
+
return new HttpException(401, message);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Create a 403 Forbidden exception.
|
|
83
|
+
*/
|
|
84
|
+
static forbidden(message = "Forbidden") {
|
|
85
|
+
return new HttpException(403, message);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Create a 404 Not Found exception.
|
|
89
|
+
*/
|
|
90
|
+
static notFound(message = "Not Found") {
|
|
91
|
+
return new HttpException(404, message);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Create a 405 Method Not Allowed exception.
|
|
95
|
+
*/
|
|
96
|
+
static methodNotAllowed(message = "Method Not Allowed") {
|
|
97
|
+
return new HttpException(405, message);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Create a 409 Conflict exception.
|
|
101
|
+
*/
|
|
102
|
+
static conflict(message = "Conflict") {
|
|
103
|
+
return new HttpException(409, message);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Create a 410 Gone exception.
|
|
107
|
+
*/
|
|
108
|
+
static gone(message = "Gone") {
|
|
109
|
+
return new HttpException(410, message);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Create a 422 Unprocessable Entity exception.
|
|
113
|
+
*/
|
|
114
|
+
static unprocessable(message = "Unprocessable Entity", errors) {
|
|
115
|
+
return new HttpException(422, message, errors);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Create a 429 Too Many Requests exception.
|
|
119
|
+
*/
|
|
120
|
+
static tooManyRequests(message = "Too Many Requests") {
|
|
121
|
+
return new HttpException(429, message);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Create a 500 Internal Server Error exception.
|
|
125
|
+
*/
|
|
126
|
+
static internal(message = "Internal Server Error") {
|
|
127
|
+
return new HttpException(500, message);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Create a 501 Not Implemented exception.
|
|
131
|
+
*/
|
|
132
|
+
static notImplemented(message = "Not Implemented") {
|
|
133
|
+
return new HttpException(501, message);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Create a 502 Bad Gateway exception.
|
|
137
|
+
*/
|
|
138
|
+
static badGateway(message = "Bad Gateway") {
|
|
139
|
+
return new HttpException(502, message);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Create a 503 Service Unavailable exception.
|
|
143
|
+
*/
|
|
144
|
+
static serviceUnavailable(message = "Service Unavailable") {
|
|
145
|
+
return new HttpException(503, message);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Create a 504 Gateway Timeout exception.
|
|
149
|
+
*/
|
|
150
|
+
static gatewayTimeout(message = "Gateway Timeout") {
|
|
151
|
+
return new HttpException(504, message);
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Check if an error is an HTTP exception.
|
|
155
|
+
*/
|
|
156
|
+
static isHttpException(error) {
|
|
157
|
+
return error instanceof HttpException || typeof error === "object" && error !== null && "statusCode" in error && typeof error.statusCode === "number" && "toResponse" in error && typeof error.toResponse === "function";
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
//#endregion
|
|
161
|
+
export { HttpException as t };
|