@guren/server 1.0.0-rc.9 → 1.1.0
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/{Application-DtWDHXr1.d.ts → Application-BnsyCKXY.d.ts} +79 -8
- package/dist/AuthManager-SfhCNkAU.d.ts +79 -0
- package/dist/{BroadcastManager-AkIWUGJo.d.ts → BroadcastManager-CGWl9rUO.d.ts} +5 -0
- package/dist/{ConsoleKernel-CqCVrdZs.d.ts → ConsoleKernel-BDtBETjm.d.ts} +1 -1
- package/dist/{Gate-CNkBYf8m.d.ts → Gate-CynjZCtS.d.ts} +5 -0
- package/dist/{I18nManager-Dtgzsf5n.d.ts → I18nManager-BiSoczfV.d.ts} +6 -1
- package/dist/McpServiceProvider-JW6PDVMD.js +7 -0
- package/dist/api-token-BSSCLlFW.d.ts +541 -0
- package/dist/auth/index.d.ts +9 -327
- package/dist/auth/index.js +59 -6684
- package/dist/authorization/index.d.ts +2 -2
- package/dist/authorization/index.js +19 -604
- package/dist/broadcasting/index.d.ts +2 -2
- package/dist/broadcasting/index.js +12 -895
- package/dist/cache/index.js +8 -809
- package/dist/chunk-2T6JN4VR.js +1563 -0
- package/dist/chunk-44F7JQ7I.js +950 -0
- package/dist/chunk-74HTZG3V.js +331 -0
- package/dist/chunk-A3ISJVEV.js +598 -0
- package/dist/chunk-CSDKWLFD.js +652 -0
- package/dist/chunk-CSRQTEQA.js +839 -0
- package/dist/chunk-DAQKYKLH.js +182 -0
- package/dist/chunk-EDRGAM6G.js +647 -0
- package/dist/chunk-EGU5KB7V.js +818 -0
- package/dist/chunk-H32L2NE3.js +372 -0
- package/dist/chunk-HKQSAFSN.js +837 -0
- package/dist/chunk-IOTWFHZU.js +558 -0
- package/dist/chunk-ONSDE37A.js +125 -0
- package/dist/chunk-QH4NUKSV.js +255 -0
- package/dist/chunk-QQKTH5KX.js +114 -0
- package/dist/chunk-R2TCP7D7.js +409 -0
- package/dist/chunk-SIP34GBE.js +380 -0
- package/dist/chunk-THSX7OOR.js +454 -0
- package/dist/chunk-UY3AZSYL.js +14 -0
- package/dist/chunk-VT5KRDPH.js +134 -0
- package/dist/chunk-WJJ5CTNI.js +907 -0
- package/dist/chunk-WVY45EIW.js +359 -0
- package/dist/chunk-ZRBLZY3M.js +462 -0
- package/dist/client-CKXJLsTe.d.ts +232 -0
- package/dist/email-verification-CAeArjui.d.ts +327 -0
- package/dist/encryption/index.js +48 -556
- package/dist/errors-JOOPDDQ6.js +34 -0
- package/dist/events/index.js +14 -316
- package/dist/health/index.js +12 -367
- package/dist/i18n/index.d.ts +2 -2
- package/dist/i18n/index.js +14 -583
- package/dist/index.d.ts +37 -239
- package/dist/index.js +2931 -19222
- package/dist/lambda/index.d.ts +9 -7
- package/dist/lambda/index.js +4 -9
- package/dist/logging/index.js +12 -545
- package/dist/mail/index.d.ts +29 -1
- package/dist/mail/index.js +15 -684
- package/dist/mcp/index.d.ts +7 -5
- package/dist/mcp/index.js +5 -378
- package/dist/notifications/index.d.ts +8 -6
- package/dist/notifications/index.js +13 -730
- package/dist/queue/index.d.ts +37 -7
- package/dist/queue/index.js +22 -940
- package/dist/redis/index.d.ts +366 -0
- package/dist/redis/index.js +597 -0
- package/dist/runtime/index.d.ts +8 -6
- package/dist/runtime/index.js +26 -244
- package/dist/scheduling/index.js +14 -822
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/index.js +6 -824
- package/dist/vite/index.d.ts +2 -2
- package/dist/vite/index.js +5 -1
- package/package.json +15 -7
- package/dist/api-token-JOif2CtG.d.ts +0 -1792
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
// src/errors/HttpException.ts
|
|
2
|
+
var HttpException = class _HttpException extends Error {
|
|
3
|
+
/**
|
|
4
|
+
* HTTP status code.
|
|
5
|
+
*/
|
|
6
|
+
statusCode;
|
|
7
|
+
/**
|
|
8
|
+
* Validation or field-specific errors.
|
|
9
|
+
*/
|
|
10
|
+
errors;
|
|
11
|
+
/**
|
|
12
|
+
* Additional error data.
|
|
13
|
+
*/
|
|
14
|
+
data;
|
|
15
|
+
constructor(statusCode, message, errors, data) {
|
|
16
|
+
super(message);
|
|
17
|
+
this.name = this.constructor.name;
|
|
18
|
+
this.statusCode = statusCode;
|
|
19
|
+
this.errors = errors;
|
|
20
|
+
this.data = data;
|
|
21
|
+
if (Error.captureStackTrace) {
|
|
22
|
+
Error.captureStackTrace(this, this.constructor);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Convert to response format.
|
|
27
|
+
*/
|
|
28
|
+
toResponse(debug = false) {
|
|
29
|
+
const body = {
|
|
30
|
+
message: this.message
|
|
31
|
+
};
|
|
32
|
+
if (this.errors) {
|
|
33
|
+
body.errors = this.errors;
|
|
34
|
+
}
|
|
35
|
+
if (debug) {
|
|
36
|
+
body.exception = this.name;
|
|
37
|
+
body.stack = this.stack;
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
status: this.statusCode,
|
|
41
|
+
body
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Convert to JSON.
|
|
46
|
+
*/
|
|
47
|
+
toJSON() {
|
|
48
|
+
return {
|
|
49
|
+
name: this.name,
|
|
50
|
+
message: this.message,
|
|
51
|
+
statusCode: this.statusCode,
|
|
52
|
+
errors: this.errors,
|
|
53
|
+
data: this.data
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
// Factory methods
|
|
57
|
+
/**
|
|
58
|
+
* Create a 400 Bad Request exception.
|
|
59
|
+
*/
|
|
60
|
+
static badRequest(message = "Bad Request") {
|
|
61
|
+
return new _HttpException(400, message);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Create a 401 Unauthorized exception.
|
|
65
|
+
*/
|
|
66
|
+
static unauthorized(message = "Unauthorized") {
|
|
67
|
+
return new _HttpException(401, message);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Create a 403 Forbidden exception.
|
|
71
|
+
*/
|
|
72
|
+
static forbidden(message = "Forbidden") {
|
|
73
|
+
return new _HttpException(403, message);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Create a 404 Not Found exception.
|
|
77
|
+
*/
|
|
78
|
+
static notFound(message = "Not Found") {
|
|
79
|
+
return new _HttpException(404, message);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Create a 405 Method Not Allowed exception.
|
|
83
|
+
*/
|
|
84
|
+
static methodNotAllowed(message = "Method Not Allowed") {
|
|
85
|
+
return new _HttpException(405, message);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Create a 409 Conflict exception.
|
|
89
|
+
*/
|
|
90
|
+
static conflict(message = "Conflict") {
|
|
91
|
+
return new _HttpException(409, message);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Create a 410 Gone exception.
|
|
95
|
+
*/
|
|
96
|
+
static gone(message = "Gone") {
|
|
97
|
+
return new _HttpException(410, message);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Create a 422 Unprocessable Entity exception.
|
|
101
|
+
*/
|
|
102
|
+
static unprocessable(message = "Unprocessable Entity", errors) {
|
|
103
|
+
return new _HttpException(422, message, errors);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Create a 429 Too Many Requests exception.
|
|
107
|
+
*/
|
|
108
|
+
static tooManyRequests(message = "Too Many Requests") {
|
|
109
|
+
return new _HttpException(429, message);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Create a 500 Internal Server Error exception.
|
|
113
|
+
*/
|
|
114
|
+
static internal(message = "Internal Server Error") {
|
|
115
|
+
return new _HttpException(500, message);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Create a 501 Not Implemented exception.
|
|
119
|
+
*/
|
|
120
|
+
static notImplemented(message = "Not Implemented") {
|
|
121
|
+
return new _HttpException(501, message);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Create a 502 Bad Gateway exception.
|
|
125
|
+
*/
|
|
126
|
+
static badGateway(message = "Bad Gateway") {
|
|
127
|
+
return new _HttpException(502, message);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Create a 503 Service Unavailable exception.
|
|
131
|
+
*/
|
|
132
|
+
static serviceUnavailable(message = "Service Unavailable") {
|
|
133
|
+
return new _HttpException(503, message);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Create a 504 Gateway Timeout exception.
|
|
137
|
+
*/
|
|
138
|
+
static gatewayTimeout(message = "Gateway Timeout") {
|
|
139
|
+
return new _HttpException(504, message);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Check if an error is an HTTP exception.
|
|
143
|
+
*/
|
|
144
|
+
static isHttpException(error) {
|
|
145
|
+
return error instanceof _HttpException || typeof error === "object" && error !== null && "statusCode" in error && typeof error.statusCode === "number" && "toResponse" in error && typeof error.toResponse === "function";
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
// src/errors/exceptions/AuthenticationException.ts
|
|
150
|
+
var AuthenticationException = class _AuthenticationException extends HttpException {
|
|
151
|
+
/**
|
|
152
|
+
* The guard that threw the exception.
|
|
153
|
+
*/
|
|
154
|
+
guard;
|
|
155
|
+
/**
|
|
156
|
+
* URL to redirect to for authentication.
|
|
157
|
+
*/
|
|
158
|
+
redirectTo;
|
|
159
|
+
constructor(message = "Unauthenticated.", guard, redirectTo) {
|
|
160
|
+
super(401, message);
|
|
161
|
+
this.name = "AuthenticationException";
|
|
162
|
+
this.guard = guard;
|
|
163
|
+
this.redirectTo = redirectTo;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Create exception with redirect URL.
|
|
167
|
+
*/
|
|
168
|
+
static withRedirect(redirectTo, message) {
|
|
169
|
+
return new _AuthenticationException(message, void 0, redirectTo);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Create exception for a specific guard.
|
|
173
|
+
*/
|
|
174
|
+
static forGuard(guard, message) {
|
|
175
|
+
return new _AuthenticationException(message, guard);
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
export {
|
|
180
|
+
HttpException,
|
|
181
|
+
AuthenticationException
|
|
182
|
+
};
|