@raiyyan/brisk 0.0.0-stage → 0.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/AGENTS.md +467 -0
- package/LICENSE +21 -0
- package/README.md +1417 -2
- package/dist/bin/brisk.d.ts +3 -0
- package/dist/bin/brisk.d.ts.map +1 -0
- package/dist/bin/brisk.js +13 -0
- package/dist/bin/brisk.js.map +1 -0
- package/dist/src/cli/agents.d.ts +7 -0
- package/dist/src/cli/agents.d.ts.map +1 -0
- package/dist/src/cli/agents.js +55 -0
- package/dist/src/cli/agents.js.map +1 -0
- package/dist/src/cli/cli.d.ts +5 -0
- package/dist/src/cli/cli.d.ts.map +1 -0
- package/dist/src/cli/cli.js +127 -0
- package/dist/src/cli/cli.js.map +1 -0
- package/dist/src/cli/client.d.ts +12 -0
- package/dist/src/cli/client.d.ts.map +1 -0
- package/dist/src/cli/client.js +76 -0
- package/dist/src/cli/client.js.map +1 -0
- package/dist/src/cli/generate.d.ts +9 -0
- package/dist/src/cli/generate.d.ts.map +1 -0
- package/dist/src/cli/generate.js +39 -0
- package/dist/src/cli/generate.js.map +1 -0
- package/dist/src/cli/init.d.ts +19 -0
- package/dist/src/cli/init.d.ts.map +1 -0
- package/dist/src/cli/init.js +125 -0
- package/dist/src/cli/init.js.map +1 -0
- package/dist/src/cli/names.d.ts +14 -0
- package/dist/src/cli/names.d.ts.map +1 -0
- package/dist/src/cli/names.js +25 -0
- package/dist/src/cli/names.js.map +1 -0
- package/dist/src/cli/system.d.ts +35 -0
- package/dist/src/cli/system.d.ts.map +1 -0
- package/dist/src/cli/system.js +83 -0
- package/dist/src/cli/system.js.map +1 -0
- package/dist/src/cli/templates/auth.d.ts +4 -0
- package/dist/src/cli/templates/auth.d.ts.map +1 -0
- package/dist/src/cli/templates/auth.js +90 -0
- package/dist/src/cli/templates/auth.js.map +1 -0
- package/dist/src/cli/templates/database.d.ts +4 -0
- package/dist/src/cli/templates/database.d.ts.map +1 -0
- package/dist/src/cli/templates/database.js +107 -0
- package/dist/src/cli/templates/database.js.map +1 -0
- package/dist/src/cli/templates/docker.d.ts +4 -0
- package/dist/src/cli/templates/docker.d.ts.map +1 -0
- package/dist/src/cli/templates/docker.js +102 -0
- package/dist/src/cli/templates/docker.js.map +1 -0
- package/dist/src/cli/templates/feature.d.ts +8 -0
- package/dist/src/cli/templates/feature.d.ts.map +1 -0
- package/dist/src/cli/templates/feature.js +145 -0
- package/dist/src/cli/templates/feature.js.map +1 -0
- package/dist/src/cli/templates/project.d.ts +24 -0
- package/dist/src/cli/templates/project.d.ts.map +1 -0
- package/dist/src/cli/templates/project.js +166 -0
- package/dist/src/cli/templates/project.js.map +1 -0
- package/dist/src/client/client.d.ts +64 -0
- package/dist/src/client/client.d.ts.map +1 -0
- package/dist/src/client/client.js +143 -0
- package/dist/src/client/client.js.map +1 -0
- package/dist/src/client/index.d.ts +8 -0
- package/dist/src/client/index.d.ts.map +1 -0
- package/dist/src/client/index.js +7 -0
- package/dist/src/client/index.js.map +1 -0
- package/dist/src/config/env.d.ts +28 -0
- package/dist/src/config/env.d.ts.map +1 -0
- package/dist/src/config/env.js +35 -0
- package/dist/src/config/env.js.map +1 -0
- package/dist/src/config/logger.d.ts +32 -0
- package/dist/src/config/logger.d.ts.map +1 -0
- package/dist/src/config/logger.js +31 -0
- package/dist/src/config/logger.js.map +1 -0
- package/dist/src/di/container.d.ts +186 -0
- package/dist/src/di/container.d.ts.map +1 -0
- package/dist/src/di/container.js +208 -0
- package/dist/src/di/container.js.map +1 -0
- package/dist/src/di/index.d.ts +8 -0
- package/dist/src/di/index.d.ts.map +1 -0
- package/dist/src/di/index.js +8 -0
- package/dist/src/di/index.js.map +1 -0
- package/dist/src/errors/http-errors.d.ts +295 -0
- package/dist/src/errors/http-errors.d.ts.map +1 -0
- package/dist/src/errors/http-errors.js +311 -0
- package/dist/src/errors/http-errors.js.map +1 -0
- package/dist/src/errors/index.d.ts +8 -0
- package/dist/src/errors/index.d.ts.map +1 -0
- package/dist/src/errors/index.js +8 -0
- package/dist/src/errors/index.js.map +1 -0
- package/dist/src/http/app.d.ts +200 -0
- package/dist/src/http/app.d.ts.map +1 -0
- package/dist/src/http/app.js +45 -0
- package/dist/src/http/app.js.map +1 -0
- package/dist/src/http/context.d.ts +66 -0
- package/dist/src/http/context.d.ts.map +1 -0
- package/dist/src/http/context.js +96 -0
- package/dist/src/http/context.js.map +1 -0
- package/dist/src/http/controller.d.ts +178 -0
- package/dist/src/http/controller.d.ts.map +1 -0
- package/dist/src/http/controller.js +317 -0
- package/dist/src/http/controller.js.map +1 -0
- package/dist/src/http/error-handler.d.ts +59 -0
- package/dist/src/http/error-handler.d.ts.map +1 -0
- package/dist/src/http/error-handler.js +124 -0
- package/dist/src/http/error-handler.js.map +1 -0
- package/dist/src/http/instance.d.ts +14 -0
- package/dist/src/http/instance.d.ts.map +1 -0
- package/dist/src/http/instance.js +309 -0
- package/dist/src/http/instance.js.map +1 -0
- package/dist/src/http/middleware.d.ts +54 -0
- package/dist/src/http/middleware.d.ts.map +1 -0
- package/dist/src/http/middleware.js +101 -0
- package/dist/src/http/middleware.js.map +1 -0
- package/dist/src/http/openapi.d.ts +34 -0
- package/dist/src/http/openapi.d.ts.map +1 -0
- package/dist/src/http/openapi.js +123 -0
- package/dist/src/http/openapi.js.map +1 -0
- package/dist/src/http/path-params.d.ts +24 -0
- package/dist/src/http/path-params.d.ts.map +1 -0
- package/dist/src/http/path-params.js +2 -0
- package/dist/src/http/path-params.js.map +1 -0
- package/dist/src/http/routes.d.ts +119 -0
- package/dist/src/http/routes.d.ts.map +1 -0
- package/dist/src/http/routes.js +2 -0
- package/dist/src/http/routes.js.map +1 -0
- package/dist/src/http/server.d.ts +23 -0
- package/dist/src/http/server.d.ts.map +1 -0
- package/dist/src/http/server.js +22 -0
- package/dist/src/http/server.js.map +1 -0
- package/dist/src/index.d.ts +22 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +19 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/testing/index.d.ts +7 -0
- package/dist/src/testing/index.d.ts.map +1 -0
- package/dist/src/testing/index.js +7 -0
- package/dist/src/testing/index.js.map +1 -0
- package/dist/src/testing/test-client.d.ts +65 -0
- package/dist/src/testing/test-client.d.ts.map +1 -0
- package/dist/src/testing/test-client.js +77 -0
- package/dist/src/testing/test-client.js.map +1 -0
- package/package.json +88 -3
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
/** Options every error class accepts. */
|
|
3
|
+
export interface HttpErrorOptions {
|
|
4
|
+
/** Machine-readable code for clients. Default: derived from the status, such as `NOT_FOUND`. */
|
|
5
|
+
code?: string;
|
|
6
|
+
/** Extra data sent to the client under `error.details`. */
|
|
7
|
+
details?: unknown;
|
|
8
|
+
/** The underlying error; logged with its stack, never sent to the client. */
|
|
9
|
+
cause?: unknown;
|
|
10
|
+
/** Response headers sent with the error, such as `Retry-After`. */
|
|
11
|
+
headers?: Readonly<Record<string, string>>;
|
|
12
|
+
}
|
|
13
|
+
/** Options for {@link TooManyRequestsError} and {@link ServiceUnavailableError}. */
|
|
14
|
+
export interface RetryableErrorOptions extends HttpErrorOptions {
|
|
15
|
+
/** Seconds the client should wait before retrying; sent as `Retry-After`. */
|
|
16
|
+
retryAfter?: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The base of every error a client should see. Throw it, or a subclass, from anywhere: a handler, a service,
|
|
20
|
+
* a repository, a middleware. The app logs it and sends an {@link ErrorResponse}. Its message always reaches
|
|
21
|
+
* the client, so keep internals in `cause`. Domain errors read best as subclasses of the status classes.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* throw new HttpError(418, "I'm a teapot", { code: "TEAPOT" });
|
|
26
|
+
*
|
|
27
|
+
* export class EmailTakenError extends ConflictError {
|
|
28
|
+
* constructor(email: string) {
|
|
29
|
+
* super("Email already registered", { code: "EMAIL_TAKEN", details: { email } });
|
|
30
|
+
* }
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare class HttpError extends Error {
|
|
35
|
+
readonly status: number;
|
|
36
|
+
readonly code: string;
|
|
37
|
+
readonly details: unknown;
|
|
38
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
39
|
+
constructor(status: number, message: string, options?: HttpErrorOptions);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* 400 Bad Request. The request is malformed, or breaks a rule the client can fix.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* throw new BadRequestError("Start date must be before end date", { code: "INVALID_RANGE" });
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare class BadRequestError extends HttpError {
|
|
50
|
+
constructor(message?: string, options?: HttpErrorOptions);
|
|
51
|
+
}
|
|
52
|
+
/** Options for {@link UnauthorizedError}. */
|
|
53
|
+
export interface UnauthorizedErrorOptions extends HttpErrorOptions {
|
|
54
|
+
/** Authentication scheme the client should use, sent as `WWW-Authenticate`, such as `Bearer`. */
|
|
55
|
+
challenge?: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* 401 Unauthorized. Credentials are missing or invalid. `challenge` is sent as `WWW-Authenticate`.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* throw new UnauthorizedError("Login required", { challenge: "Bearer" });
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export declare class UnauthorizedError extends HttpError {
|
|
66
|
+
constructor(message?: string, { challenge, ...options }?: UnauthorizedErrorOptions);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* 403 Forbidden. The caller is known but may not do this.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* if (user.role !== "admin") throw new ForbiddenError("Admins only");
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export declare class ForbiddenError extends HttpError {
|
|
77
|
+
constructor(message?: string, options?: HttpErrorOptions);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* 404 Not Found. The resource does not exist, or the caller may not know that it does.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```ts
|
|
84
|
+
* if (!user) throw new NotFoundError("User not found", { details: { id } });
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
export declare class NotFoundError extends HttpError {
|
|
88
|
+
constructor(message?: string, options?: HttpErrorOptions);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* 405 Method Not Allowed. The path exists, but not for this method; sends `Allow`. brisk raises it for you.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```ts
|
|
95
|
+
* throw new MethodNotAllowedError(["GET", "HEAD"]);
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
export declare class MethodNotAllowedError extends HttpError {
|
|
99
|
+
constructor(allowed: readonly string[], message?: string, options?: HttpErrorOptions);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* 406 Not Acceptable. Nothing matches the request's `Accept` header.
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```ts
|
|
106
|
+
* if (!req.accepts("json")) throw new NotAcceptableError();
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
export declare class NotAcceptableError extends HttpError {
|
|
110
|
+
constructor(message?: string, options?: HttpErrorOptions);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* 408 Request Timeout. The client took too long to send the request.
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```ts
|
|
117
|
+
* throw new RequestTimeoutError();
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
export declare class RequestTimeoutError extends HttpError {
|
|
121
|
+
constructor(message?: string, options?: HttpErrorOptions);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* 409 Conflict. The request conflicts with the current state, such as a duplicate. Subclass it for domain errors.
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```ts
|
|
128
|
+
* throw new ConflictError("Email already registered", { code: "EMAIL_TAKEN" });
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
export declare class ConflictError extends HttpError {
|
|
132
|
+
constructor(message?: string, options?: HttpErrorOptions);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* 410 Gone. The resource existed and was removed for good.
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```ts
|
|
139
|
+
* throw new GoneError("This invite has expired");
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
export declare class GoneError extends HttpError {
|
|
143
|
+
constructor(message?: string, options?: HttpErrorOptions);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* 412 Precondition Failed. Optimistic concurrency failed: the client's `If-Match` version is stale.
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```ts
|
|
150
|
+
* if (req.get("if-match") !== doc.etag) throw new PreconditionFailedError();
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
export declare class PreconditionFailedError extends HttpError {
|
|
154
|
+
constructor(message?: string, options?: HttpErrorOptions);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* 413 Payload Too Large. The body is over the limit. brisk raises it for JSON over `http.bodyLimit`.
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```ts
|
|
161
|
+
* if (file.size > MAX_UPLOAD) throw new PayloadTooLargeError("Files are limited to 10 MB");
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
export declare class PayloadTooLargeError extends HttpError {
|
|
165
|
+
constructor(message?: string, options?: HttpErrorOptions);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* 415 Unsupported Media Type. No parser accepts the body's type. brisk raises it on routes with a `body` schema.
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```ts
|
|
172
|
+
* throw new UnsupportedMediaTypeError("Send JSON or CSV");
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
export declare class UnsupportedMediaTypeError extends HttpError {
|
|
176
|
+
constructor(message?: string, options?: HttpErrorOptions);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* 422 Unprocessable Entity. The input is well formed but cannot be acted on, such as an impossible state change.
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* ```ts
|
|
183
|
+
* throw new UnprocessableEntityError("A shipped order cannot be cancelled");
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
export declare class UnprocessableEntityError extends HttpError {
|
|
187
|
+
constructor(message?: string, options?: HttpErrorOptions);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* 429 Too Many Requests. The client is rate limited. `retryAfter` is sent as `Retry-After`, in seconds.
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* ```ts
|
|
194
|
+
* throw new TooManyRequestsError("Slow down", { retryAfter: 30 });
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
export declare class TooManyRequestsError extends HttpError {
|
|
198
|
+
constructor(message?: string, options?: RetryableErrorOptions);
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* 500 Internal Server Error, on purpose. Its message reaches the client: keep it generic and put the reason in `cause`.
|
|
202
|
+
*
|
|
203
|
+
* @example
|
|
204
|
+
* ```ts
|
|
205
|
+
* throw new InternalServerError("Could not generate the report", { cause: error });
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
|
+
export declare class InternalServerError extends HttpError {
|
|
209
|
+
constructor(message?: string, options?: HttpErrorOptions);
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* 501 Not Implemented. The server does not support this yet.
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* ```ts
|
|
216
|
+
* throw new NotImplementedError("Exports are coming soon");
|
|
217
|
+
* ```
|
|
218
|
+
*/
|
|
219
|
+
export declare class NotImplementedError extends HttpError {
|
|
220
|
+
constructor(message?: string, options?: HttpErrorOptions);
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* 502 Bad Gateway. An upstream service answered badly. `cause` is logged, never sent.
|
|
224
|
+
*
|
|
225
|
+
* @example
|
|
226
|
+
* ```ts
|
|
227
|
+
* throw new BadGatewayError("Payment provider failed", { cause: error });
|
|
228
|
+
* ```
|
|
229
|
+
*/
|
|
230
|
+
export declare class BadGatewayError extends HttpError {
|
|
231
|
+
constructor(message?: string, options?: HttpErrorOptions);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* 503 Service Unavailable. Temporarily unavailable, such as during maintenance. `retryAfter` is sent as `Retry-After`.
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* ```ts
|
|
238
|
+
* throw new ServiceUnavailableError("Down for maintenance", { retryAfter: 120 });
|
|
239
|
+
* ```
|
|
240
|
+
*/
|
|
241
|
+
export declare class ServiceUnavailableError extends HttpError {
|
|
242
|
+
constructor(message?: string, options?: RetryableErrorOptions);
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* 504 Gateway Timeout. An upstream service did not answer in time.
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* ```ts
|
|
249
|
+
* throw new GatewayTimeoutError("Search did not answer in time", { cause: error });
|
|
250
|
+
* ```
|
|
251
|
+
*/
|
|
252
|
+
export declare class GatewayTimeoutError extends HttpError {
|
|
253
|
+
constructor(message?: string, options?: HttpErrorOptions);
|
|
254
|
+
}
|
|
255
|
+
/** One failed check, in a shape clients can map straight onto form fields. */
|
|
256
|
+
export interface ValidationIssue {
|
|
257
|
+
/** Dot path to the offending field, such as `address.zip` or `items.0.qty`; empty for the root. */
|
|
258
|
+
path: string;
|
|
259
|
+
message: string;
|
|
260
|
+
/** Zod issue code, such as `invalid_type` or `too_small`, or your own code for custom checks. */
|
|
261
|
+
code: string;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* `details` of a {@link ValidationError}: where the input failed and every issue found.
|
|
265
|
+
*/
|
|
266
|
+
export interface ValidationDetails {
|
|
267
|
+
/** Which part of the request failed: `params`, `query`, `body`, `headers`, or `input` for a parse in app code. */
|
|
268
|
+
location: string;
|
|
269
|
+
issues: ValidationIssue[];
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* 400 `VALIDATION_FAILED`. brisk throws it for input that breaks a route's schemas; throw one yourself for checks
|
|
273
|
+
* a schema cannot express, so clients get the same field-level shape.
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* ```ts
|
|
277
|
+
* throw new ValidationError("body", [{ path: "endsAt", message: "Must be after startsAt", code: "custom" }]);
|
|
278
|
+
* throw ValidationError.fromZod(result.error, "input");
|
|
279
|
+
* ```
|
|
280
|
+
*/
|
|
281
|
+
export declare class ValidationError extends HttpError {
|
|
282
|
+
readonly details: ValidationDetails;
|
|
283
|
+
constructor(location: string, issues: ValidationIssue[]);
|
|
284
|
+
static fromZod(error: z.ZodError, location: string): ValidationError;
|
|
285
|
+
}
|
|
286
|
+
/** The body of every error response. */
|
|
287
|
+
export interface ErrorResponse {
|
|
288
|
+
error: {
|
|
289
|
+
code: string;
|
|
290
|
+
message: string;
|
|
291
|
+
details?: unknown;
|
|
292
|
+
requestId: string;
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
//# sourceMappingURL=http-errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-errors.d.ts","sourceRoot":"","sources":["../../../src/errors/http-errors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,yCAAyC;AACzC,MAAM,WAAW,gBAAgB;IAC/B,gGAAgG;IAChG,IAAI,CAA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Q,EAAE,QAAQ,EAAE,MAAM,GAAG,eAAe,CAKnE;CACF;AAED,wCAAwC;AACxC,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH"}
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import { STATUS_CODES } from "node:http";
|
|
2
|
+
/**
|
|
3
|
+
* The base of every error a client should see. Throw it, or a subclass, from anywhere: a handler, a service,
|
|
4
|
+
* a repository, a middleware. The app logs it and sends an {@link ErrorResponse}. Its message always reaches
|
|
5
|
+
* the client, so keep internals in `cause`. Domain errors read best as subclasses of the status classes.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* throw new HttpError(418, "I'm a teapot", { code: "TEAPOT" });
|
|
10
|
+
*
|
|
11
|
+
* export class EmailTakenError extends ConflictError {
|
|
12
|
+
* constructor(email: string) {
|
|
13
|
+
* super("Email already registered", { code: "EMAIL_TAKEN", details: { email } });
|
|
14
|
+
* }
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export class HttpError extends Error {
|
|
19
|
+
status;
|
|
20
|
+
code;
|
|
21
|
+
details;
|
|
22
|
+
headers;
|
|
23
|
+
constructor(status, message, options = {}) {
|
|
24
|
+
super(message, { cause: options.cause });
|
|
25
|
+
this.name = new.target.name;
|
|
26
|
+
this.status = status;
|
|
27
|
+
this.code = options.code ?? codeFor(status);
|
|
28
|
+
this.details = options.details;
|
|
29
|
+
this.headers = options.headers ?? {};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 400 Bad Request. The request is malformed, or breaks a rule the client can fix.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* throw new BadRequestError("Start date must be before end date", { code: "INVALID_RANGE" });
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export class BadRequestError extends HttpError {
|
|
41
|
+
constructor(message = "Bad request", options) {
|
|
42
|
+
super(400, message, options);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* 401 Unauthorized. Credentials are missing or invalid. `challenge` is sent as `WWW-Authenticate`.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* throw new UnauthorizedError("Login required", { challenge: "Bearer" });
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export class UnauthorizedError extends HttpError {
|
|
54
|
+
constructor(message = "Unauthorized", { challenge, ...options } = {}) {
|
|
55
|
+
super(401, message, withHeaders(options, challenge === undefined ? {} : { "www-authenticate": challenge }));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* 403 Forbidden. The caller is known but may not do this.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* if (user.role !== "admin") throw new ForbiddenError("Admins only");
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export class ForbiddenError extends HttpError {
|
|
67
|
+
constructor(message = "Forbidden", options) {
|
|
68
|
+
super(403, message, options);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* 404 Not Found. The resource does not exist, or the caller may not know that it does.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* if (!user) throw new NotFoundError("User not found", { details: { id } });
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
export class NotFoundError extends HttpError {
|
|
80
|
+
constructor(message = "Not found", options) {
|
|
81
|
+
super(404, message, options);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* 405 Method Not Allowed. The path exists, but not for this method; sends `Allow`. brisk raises it for you.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* throw new MethodNotAllowedError(["GET", "HEAD"]);
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
export class MethodNotAllowedError extends HttpError {
|
|
93
|
+
constructor(allowed, message = "Method not allowed", options) {
|
|
94
|
+
super(405, message, withHeaders(options, { allow: allowed.join(", ") }));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* 406 Not Acceptable. Nothing matches the request's `Accept` header.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```ts
|
|
102
|
+
* if (!req.accepts("json")) throw new NotAcceptableError();
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
export class NotAcceptableError extends HttpError {
|
|
106
|
+
constructor(message = "Not acceptable", options) {
|
|
107
|
+
super(406, message, options);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* 408 Request Timeout. The client took too long to send the request.
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```ts
|
|
115
|
+
* throw new RequestTimeoutError();
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
export class RequestTimeoutError extends HttpError {
|
|
119
|
+
constructor(message = "Request timeout", options) {
|
|
120
|
+
super(408, message, options);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* 409 Conflict. The request conflicts with the current state, such as a duplicate. Subclass it for domain errors.
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```ts
|
|
128
|
+
* throw new ConflictError("Email already registered", { code: "EMAIL_TAKEN" });
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
export class ConflictError extends HttpError {
|
|
132
|
+
constructor(message = "Conflict", options) {
|
|
133
|
+
super(409, message, options);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* 410 Gone. The resource existed and was removed for good.
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```ts
|
|
141
|
+
* throw new GoneError("This invite has expired");
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
export class GoneError extends HttpError {
|
|
145
|
+
constructor(message = "Gone", options) {
|
|
146
|
+
super(410, message, options);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* 412 Precondition Failed. Optimistic concurrency failed: the client's `If-Match` version is stale.
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```ts
|
|
154
|
+
* if (req.get("if-match") !== doc.etag) throw new PreconditionFailedError();
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
export class PreconditionFailedError extends HttpError {
|
|
158
|
+
constructor(message = "Precondition failed", options) {
|
|
159
|
+
super(412, message, options);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* 413 Payload Too Large. The body is over the limit. brisk raises it for JSON over `http.bodyLimit`.
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```ts
|
|
167
|
+
* if (file.size > MAX_UPLOAD) throw new PayloadTooLargeError("Files are limited to 10 MB");
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
export class PayloadTooLargeError extends HttpError {
|
|
171
|
+
constructor(message = "Payload too large", options) {
|
|
172
|
+
super(413, message, options);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* 415 Unsupported Media Type. No parser accepts the body's type. brisk raises it on routes with a `body` schema.
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```ts
|
|
180
|
+
* throw new UnsupportedMediaTypeError("Send JSON or CSV");
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
export class UnsupportedMediaTypeError extends HttpError {
|
|
184
|
+
constructor(message = "Unsupported media type", options) {
|
|
185
|
+
super(415, message, options);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* 422 Unprocessable Entity. The input is well formed but cannot be acted on, such as an impossible state change.
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* ```ts
|
|
193
|
+
* throw new UnprocessableEntityError("A shipped order cannot be cancelled");
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
export class UnprocessableEntityError extends HttpError {
|
|
197
|
+
constructor(message = "Unprocessable entity", options) {
|
|
198
|
+
super(422, message, options);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* 429 Too Many Requests. The client is rate limited. `retryAfter` is sent as `Retry-After`, in seconds.
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* ```ts
|
|
206
|
+
* throw new TooManyRequestsError("Slow down", { retryAfter: 30 });
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
export class TooManyRequestsError extends HttpError {
|
|
210
|
+
constructor(message = "Too many requests", options) {
|
|
211
|
+
super(429, message, retryable(options));
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* 500 Internal Server Error, on purpose. Its message reaches the client: keep it generic and put the reason in `cause`.
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* ```ts
|
|
219
|
+
* throw new InternalServerError("Could not generate the report", { cause: error });
|
|
220
|
+
* ```
|
|
221
|
+
*/
|
|
222
|
+
export class InternalServerError extends HttpError {
|
|
223
|
+
constructor(message = "Internal server error", options) {
|
|
224
|
+
super(500, message, options);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* 501 Not Implemented. The server does not support this yet.
|
|
229
|
+
*
|
|
230
|
+
* @example
|
|
231
|
+
* ```ts
|
|
232
|
+
* throw new NotImplementedError("Exports are coming soon");
|
|
233
|
+
* ```
|
|
234
|
+
*/
|
|
235
|
+
export class NotImplementedError extends HttpError {
|
|
236
|
+
constructor(message = "Not implemented", options) {
|
|
237
|
+
super(501, message, options);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* 502 Bad Gateway. An upstream service answered badly. `cause` is logged, never sent.
|
|
242
|
+
*
|
|
243
|
+
* @example
|
|
244
|
+
* ```ts
|
|
245
|
+
* throw new BadGatewayError("Payment provider failed", { cause: error });
|
|
246
|
+
* ```
|
|
247
|
+
*/
|
|
248
|
+
export class BadGatewayError extends HttpError {
|
|
249
|
+
constructor(message = "Bad gateway", options) {
|
|
250
|
+
super(502, message, options);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* 503 Service Unavailable. Temporarily unavailable, such as during maintenance. `retryAfter` is sent as `Retry-After`.
|
|
255
|
+
*
|
|
256
|
+
* @example
|
|
257
|
+
* ```ts
|
|
258
|
+
* throw new ServiceUnavailableError("Down for maintenance", { retryAfter: 120 });
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
export class ServiceUnavailableError extends HttpError {
|
|
262
|
+
constructor(message = "Service unavailable", options) {
|
|
263
|
+
super(503, message, retryable(options));
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* 504 Gateway Timeout. An upstream service did not answer in time.
|
|
268
|
+
*
|
|
269
|
+
* @example
|
|
270
|
+
* ```ts
|
|
271
|
+
* throw new GatewayTimeoutError("Search did not answer in time", { cause: error });
|
|
272
|
+
* ```
|
|
273
|
+
*/
|
|
274
|
+
export class GatewayTimeoutError extends HttpError {
|
|
275
|
+
constructor(message = "Gateway timeout", options) {
|
|
276
|
+
super(504, message, options);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* 400 `VALIDATION_FAILED`. brisk throws it for input that breaks a route's schemas; throw one yourself for checks
|
|
281
|
+
* a schema cannot express, so clients get the same field-level shape.
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* ```ts
|
|
285
|
+
* throw new ValidationError("body", [{ path: "endsAt", message: "Must be after startsAt", code: "custom" }]);
|
|
286
|
+
* throw ValidationError.fromZod(result.error, "input");
|
|
287
|
+
* ```
|
|
288
|
+
*/
|
|
289
|
+
export class ValidationError extends HttpError {
|
|
290
|
+
details;
|
|
291
|
+
constructor(location, issues) {
|
|
292
|
+
const details = { location, issues };
|
|
293
|
+
super(400, `Invalid request ${location}`, { code: "VALIDATION_FAILED", details });
|
|
294
|
+
this.details = details;
|
|
295
|
+
}
|
|
296
|
+
static fromZod(error, location) {
|
|
297
|
+
return new ValidationError(location, error.issues.map((issue) => ({ path: issue.path.join("."), message: issue.message, code: issue.code })));
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
/** `404` gives `NOT_FOUND`, `413` gives `PAYLOAD_TOO_LARGE`. */
|
|
301
|
+
function codeFor(status) {
|
|
302
|
+
const phrase = STATUS_CODES[status];
|
|
303
|
+
return phrase ? phrase.toUpperCase().replace(/[^A-Z0-9]+/g, "_") : "HTTP_ERROR";
|
|
304
|
+
}
|
|
305
|
+
function withHeaders(options = {}, headers) {
|
|
306
|
+
return { ...options, headers: { ...headers, ...options.headers } };
|
|
307
|
+
}
|
|
308
|
+
function retryable({ retryAfter, ...options } = {}) {
|
|
309
|
+
return withHeaders(options, retryAfter === undefined ? {} : { "retry-after": String(Math.ceil(retryAfter)) });
|
|
310
|
+
}
|
|
311
|
+
//# sourceMappingURL=http-errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-errors.js","sourceRoot":"","sources":["../../../src/errors/http-errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAqBzC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,SAAU,SAAQ,KAAK;IACzB,MAAM,CAAS;IACf,IAAI,CAAS;IACb,OAAO,CAAU;IACjB,OAAO,CAAmC;IAEnD,YAAY,MAA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AC,MAAM,CAAC,CAAC;IACpC,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC;AAClF,CAAC;AAED,SAAS,WAAW,CAAC,OAAO,GAAqB,EAAE,EAAE,OAA+B;IAClF,OAAO,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;AACrE,CAAC;AAED,SAAS,SAAS,CAAC,EAAE,UAAU,EAAE,GAAG,OAAO,EAAE,GAA0B,EAAE;IACvE,OAAO,WAAW,CAChB,OAAO,EACP,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,EAAE,CACjF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/errors/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/errors/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,kBAAkB,CAAC"}
|