@adonisjs/http-server 7.0.0-0 → 7.0.0-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.
Files changed (107) hide show
  1. package/build/factories/http_context.d.ts +25 -0
  2. package/build/factories/http_context.js +51 -0
  3. package/build/factories/http_server.d.ts +8 -0
  4. package/build/factories/http_server.js +26 -0
  5. package/build/factories/main.d.ts +6 -149
  6. package/build/factories/main.js +14 -331
  7. package/build/factories/qs_parser_factory.d.ts +20 -0
  8. package/build/factories/qs_parser_factory.js +44 -0
  9. package/build/factories/request.d.ts +29 -0
  10. package/build/factories/request.js +73 -0
  11. package/build/factories/response.d.ts +29 -0
  12. package/build/factories/response.js +77 -0
  13. package/build/factories/router.d.ts +23 -0
  14. package/build/factories/router.js +45 -0
  15. package/build/factories/server_factory.d.ts +29 -0
  16. package/build/factories/server_factory.js +65 -0
  17. package/build/index.d.ts +14 -272
  18. package/build/index.js +22 -308
  19. package/build/src/cookies/client.d.ts +37 -0
  20. package/build/src/cookies/client.js +84 -0
  21. package/build/src/cookies/drivers/encrypted.d.ts +16 -0
  22. package/build/src/cookies/drivers/encrypted.js +36 -0
  23. package/build/src/cookies/drivers/plain.d.ts +15 -0
  24. package/build/src/cookies/drivers/plain.js +33 -0
  25. package/build/src/cookies/drivers/signed.d.ts +16 -0
  26. package/build/src/cookies/drivers/signed.js +36 -0
  27. package/build/src/cookies/parser.d.ts +37 -0
  28. package/build/src/cookies/parser.js +167 -0
  29. package/build/src/cookies/serializer.d.ts +33 -0
  30. package/build/src/cookies/serializer.js +79 -0
  31. package/build/src/debug.d.ts +3 -0
  32. package/build/src/debug.js +10 -0
  33. package/build/src/define_config.d.ts +9 -0
  34. package/build/src/define_config.js +68 -0
  35. package/build/src/define_middleware.d.ts +11 -0
  36. package/build/src/define_middleware.js +35 -0
  37. package/build/src/exception_handler.d.ts +113 -0
  38. package/build/src/exception_handler.js +306 -0
  39. package/build/src/exceptions.d.ts +84 -0
  40. package/build/src/exceptions.js +38 -0
  41. package/build/src/helpers.d.ts +23 -0
  42. package/build/src/helpers.js +105 -0
  43. package/build/src/http_context/local_storage.d.ts +12 -0
  44. package/build/src/http_context/local_storage.js +39 -0
  45. package/build/src/http_context/main.d.ts +58 -0
  46. package/build/src/http_context/main.js +105 -0
  47. package/build/src/qs.d.ts +11 -0
  48. package/build/src/qs.js +25 -0
  49. package/build/src/redirect.d.ts +42 -0
  50. package/build/src/redirect.js +140 -0
  51. package/build/src/request.d.ts +565 -0
  52. package/build/src/request.js +865 -0
  53. package/build/src/response.d.ts +620 -0
  54. package/build/src/response.js +1208 -0
  55. package/build/src/router/brisk.d.ts +42 -0
  56. package/build/src/router/brisk.js +85 -0
  57. package/build/src/router/executor.d.ts +9 -0
  58. package/build/src/router/executor.js +30 -0
  59. package/build/src/router/factories/use_return_value.d.ts +6 -0
  60. package/build/src/router/factories/use_return_value.js +22 -0
  61. package/build/src/router/group.d.ts +65 -0
  62. package/build/src/router/group.js +207 -0
  63. package/build/src/router/lookup_store/main.d.ts +49 -0
  64. package/build/src/router/lookup_store/main.js +86 -0
  65. package/build/src/router/lookup_store/route_finder.d.ts +21 -0
  66. package/build/src/router/lookup_store/route_finder.js +49 -0
  67. package/build/src/router/lookup_store/url_builder.d.ts +52 -0
  68. package/build/src/router/lookup_store/url_builder.js +209 -0
  69. package/build/src/router/main.d.ts +128 -0
  70. package/build/src/router/main.js +316 -0
  71. package/build/src/router/matchers.d.ts +27 -0
  72. package/build/src/router/matchers.js +36 -0
  73. package/build/src/router/parser.d.ts +5 -0
  74. package/build/src/router/parser.js +17 -0
  75. package/build/src/router/resource.d.ts +54 -0
  76. package/build/src/router/resource.js +216 -0
  77. package/build/src/router/route.d.ts +92 -0
  78. package/build/src/router/route.js +293 -0
  79. package/build/src/router/store.d.ts +66 -0
  80. package/build/src/router/store.js +195 -0
  81. package/build/src/server/factories/final_handler.d.ts +10 -0
  82. package/build/src/server/factories/final_handler.js +30 -0
  83. package/build/src/server/factories/middleware_handler.d.ts +8 -0
  84. package/build/src/server/factories/middleware_handler.js +16 -0
  85. package/build/src/server/factories/write_response.d.ts +6 -0
  86. package/build/src/server/factories/write_response.js +24 -0
  87. package/build/{main-29eaaee4.d.ts → src/server/main.d.ts} +18 -13
  88. package/build/src/server/main.js +292 -0
  89. package/build/src/types/base.d.ts +19 -0
  90. package/build/src/types/base.js +9 -0
  91. package/build/src/types/main.d.ts +7 -14
  92. package/build/src/types/main.js +15 -0
  93. package/build/src/types/middleware.d.ts +35 -0
  94. package/build/src/types/middleware.js +9 -0
  95. package/build/src/types/qs.d.ts +68 -0
  96. package/build/src/types/qs.js +9 -0
  97. package/build/src/types/request.d.ts +39 -0
  98. package/build/src/types/request.js +9 -0
  99. package/build/src/types/response.d.ts +45 -0
  100. package/build/src/types/response.js +9 -0
  101. package/build/src/types/route.d.ts +166 -0
  102. package/build/src/types/route.js +9 -0
  103. package/build/src/types/server.d.ts +72 -0
  104. package/build/src/types/server.js +9 -0
  105. package/package.json +6 -3
  106. package/build/chunk-XX72ATFY.js +0 -4388
  107. package/build/main-e5b46c83.d.ts +0 -2210
@@ -0,0 +1,73 @@
1
+ /*
2
+ * @adonisjs/http-server
3
+ *
4
+ * (c) AdonisJS
5
+ *
6
+ * For the full copyright and license information, please view the LICENSE
7
+ * file that was distributed with this source code.
8
+ */
9
+ import { Socket } from 'node:net';
10
+ import proxyAddr from 'proxy-addr';
11
+ import { IncomingMessage, ServerResponse } from 'node:http';
12
+ import { EncryptionFactory } from '@adonisjs/encryption/factories';
13
+ import { Request } from '../src/request.js';
14
+ import { QsParserFactory } from './qs_parser_factory.js';
15
+ /**
16
+ * Request factory is used to generate request class instances for
17
+ * testing
18
+ */
19
+ export class RequestFactory {
20
+ #parameters = {};
21
+ /**
22
+ * Returns the config for the request class
23
+ */
24
+ #getConfig() {
25
+ return {
26
+ allowMethodSpoofing: false,
27
+ trustProxy: proxyAddr.compile('loopback'),
28
+ subdomainOffset: 2,
29
+ generateRequestId: false,
30
+ ...this.#parameters.config,
31
+ };
32
+ }
33
+ /**
34
+ * Returns the HTTP req object
35
+ */
36
+ #createRequest() {
37
+ const req = this.#parameters.req || new IncomingMessage(new Socket());
38
+ if (this.#parameters.url) {
39
+ req.url = this.#parameters.url;
40
+ }
41
+ if (this.#parameters.method) {
42
+ req.method = this.#parameters.method;
43
+ }
44
+ return req;
45
+ }
46
+ /**
47
+ * Returns the HTTP res object
48
+ */
49
+ #createResponse(req) {
50
+ return this.#parameters.res || new ServerResponse(req);
51
+ }
52
+ /**
53
+ * Returns an instance of the encryptor to encrypt
54
+ * signed URLs
55
+ */
56
+ #createEncryption() {
57
+ return this.#parameters.encryption || new EncryptionFactory().create();
58
+ }
59
+ /**
60
+ * Merge factory params
61
+ */
62
+ merge(params) {
63
+ Object.assign(this.#parameters, params);
64
+ return this;
65
+ }
66
+ /**
67
+ * Create request
68
+ */
69
+ create() {
70
+ const req = this.#createRequest();
71
+ return new Request(req, this.#createResponse(req), this.#createEncryption(), this.#getConfig(), new QsParserFactory().create());
72
+ }
73
+ }
@@ -0,0 +1,29 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import type { Encryption } from '@adonisjs/encryption';
3
+ import { IncomingMessage, ServerResponse } from 'node:http';
4
+ import { Response } from '../src/response.js';
5
+ import { Router } from '../src/router/main.js';
6
+ import { ResponseConfig } from '../src/types/response.js';
7
+ type FactoryParameters = {
8
+ req: IncomingMessage;
9
+ res: ServerResponse;
10
+ encryption: Encryption;
11
+ config: Partial<ResponseConfig>;
12
+ router: Router;
13
+ };
14
+ /**
15
+ * Response factory is used to generate response class instances for
16
+ * testing
17
+ */
18
+ export declare class ResponseFactory {
19
+ #private;
20
+ /**
21
+ * Merge factory params
22
+ */
23
+ merge(params: Partial<FactoryParameters>): this;
24
+ /**
25
+ * Create response class instance
26
+ */
27
+ create(): Response;
28
+ }
29
+ export {};
@@ -0,0 +1,77 @@
1
+ /*
2
+ * @adonisjs/http-server
3
+ *
4
+ * (c) AdonisJS
5
+ *
6
+ * For the full copyright and license information, please view the LICENSE
7
+ * file that was distributed with this source code.
8
+ */
9
+ import { Socket } from 'node:net';
10
+ import { IncomingMessage, ServerResponse } from 'node:http';
11
+ import { EncryptionFactory } from '@adonisjs/encryption/factories';
12
+ import { RouterFactory } from './router.js';
13
+ import { Response } from '../src/response.js';
14
+ import { QsParserFactory } from './qs_parser_factory.js';
15
+ /**
16
+ * Response factory is used to generate response class instances for
17
+ * testing
18
+ */
19
+ export class ResponseFactory {
20
+ #parameters = {};
21
+ /**
22
+ * Returns the config for the request class
23
+ */
24
+ #getConfig() {
25
+ return {
26
+ etag: false,
27
+ jsonpCallbackName: 'callback',
28
+ cookie: {
29
+ maxAge: 90,
30
+ path: '/',
31
+ httpOnly: true,
32
+ sameSite: false,
33
+ secure: false,
34
+ },
35
+ ...this.#parameters.config,
36
+ };
37
+ }
38
+ /**
39
+ * Returns the HTTP req object
40
+ */
41
+ #createRequest() {
42
+ return this.#parameters.req || new IncomingMessage(new Socket());
43
+ }
44
+ /**
45
+ * Returns an instance of the router
46
+ */
47
+ #createRouter() {
48
+ return this.#parameters.router || new RouterFactory().create();
49
+ }
50
+ /**
51
+ * Returns the HTTP res object
52
+ */
53
+ #createResponse(req) {
54
+ return this.#parameters.res || new ServerResponse(req);
55
+ }
56
+ /**
57
+ * Returns an instance of the encryptor to encrypt
58
+ * signed URLs
59
+ */
60
+ #createEncryption() {
61
+ return this.#parameters.encryption || new EncryptionFactory().create();
62
+ }
63
+ /**
64
+ * Merge factory params
65
+ */
66
+ merge(params) {
67
+ Object.assign(this.#parameters, params);
68
+ return this;
69
+ }
70
+ /**
71
+ * Create response class instance
72
+ */
73
+ create() {
74
+ const req = this.#createRequest();
75
+ return new Response(req, this.#createResponse(req), this.#createEncryption(), this.#getConfig(), this.#createRouter(), new QsParserFactory().create());
76
+ }
77
+ }
@@ -0,0 +1,23 @@
1
+ import type { Encryption } from '@adonisjs/encryption';
2
+ import type { Application } from '@adonisjs/application';
3
+ import { Router } from '../src/router/main.js';
4
+ type FactoryParameters = {
5
+ app: Application<any>;
6
+ encryption: Encryption;
7
+ };
8
+ /**
9
+ * Router factory is used to generate router class instances for
10
+ * testing
11
+ */
12
+ export declare class RouterFactory {
13
+ #private;
14
+ /**
15
+ * Merge factory params
16
+ */
17
+ merge(params: Partial<FactoryParameters>): this;
18
+ /**
19
+ * Create router instance
20
+ */
21
+ create(): Router;
22
+ }
23
+ export {};
@@ -0,0 +1,45 @@
1
+ /*
2
+ * @adonisjs/http-server
3
+ *
4
+ * (c) AdonisJS
5
+ *
6
+ * For the full copyright and license information, please view the LICENSE
7
+ * file that was distributed with this source code.
8
+ */
9
+ import { AppFactory } from '@adonisjs/application/factories';
10
+ import { EncryptionFactory } from '@adonisjs/encryption/factories';
11
+ import { Router } from '../src/router/main.js';
12
+ import { QsParserFactory } from './qs_parser_factory.js';
13
+ /**
14
+ * Router factory is used to generate router class instances for
15
+ * testing
16
+ */
17
+ export class RouterFactory {
18
+ #parameters = {};
19
+ /**
20
+ * Returns an instance of the application class
21
+ */
22
+ #getApp() {
23
+ return (this.#parameters.app || new AppFactory().create(new URL('./app/', import.meta.url), () => { }));
24
+ }
25
+ /**
26
+ * Returns an instance of the encryptor to encrypt
27
+ * signed URLs
28
+ */
29
+ #createEncryption() {
30
+ return this.#parameters.encryption || new EncryptionFactory().create();
31
+ }
32
+ /**
33
+ * Merge factory params
34
+ */
35
+ merge(params) {
36
+ Object.assign(this.#parameters, params);
37
+ return this;
38
+ }
39
+ /**
40
+ * Create router instance
41
+ */
42
+ create() {
43
+ return new Router(this.#getApp(), this.#createEncryption(), new QsParserFactory().create());
44
+ }
45
+ }
@@ -0,0 +1,29 @@
1
+ import { Logger } from '@adonisjs/logger';
2
+ import { Emitter } from '@adonisjs/events';
3
+ import type { Encryption } from '@adonisjs/encryption';
4
+ import type { Application } from '@adonisjs/application';
5
+ import { Server } from '../src/server/main.js';
6
+ import type { ServerConfig } from '../src/types/server.js';
7
+ type FactoryParameters = {
8
+ app: Application<any>;
9
+ logger: Logger;
10
+ encryption: Encryption;
11
+ emitter: Emitter<any>;
12
+ config: Partial<ServerConfig>;
13
+ };
14
+ /**
15
+ * Server factory is used to generate server class instances for
16
+ * testing
17
+ */
18
+ export declare class ServerFactory {
19
+ #private;
20
+ /**
21
+ * Merge factory params
22
+ */
23
+ merge(params: Partial<FactoryParameters>): this;
24
+ /**
25
+ * Create server instance
26
+ */
27
+ create(): Server;
28
+ }
29
+ export {};
@@ -0,0 +1,65 @@
1
+ /*
2
+ * @adonisjs/http-server
3
+ *
4
+ * (c) AdonisJS
5
+ *
6
+ * For the full copyright and license information, please view the LICENSE
7
+ * file that was distributed with this source code.
8
+ */
9
+ import { Logger } from '@adonisjs/logger';
10
+ import { Emitter } from '@adonisjs/events';
11
+ import { AppFactory } from '@adonisjs/application/factories';
12
+ import { EncryptionFactory } from '@adonisjs/encryption/factories';
13
+ import { Server } from '../src/server/main.js';
14
+ import { defineConfig } from '../src/define_config.js';
15
+ /**
16
+ * Server factory is used to generate server class instances for
17
+ * testing
18
+ */
19
+ export class ServerFactory {
20
+ #parameters = {};
21
+ /**
22
+ * Returns the emitter instance
23
+ */
24
+ #getEmitter() {
25
+ return this.#parameters.emitter || new Emitter(this.#getApp());
26
+ }
27
+ /**
28
+ * Returns the logger instance
29
+ */
30
+ #getLogger() {
31
+ return this.#parameters.logger || new Logger({ enabled: false });
32
+ }
33
+ /**
34
+ * Returns the config for the server class
35
+ */
36
+ #getConfig() {
37
+ return defineConfig(this.#parameters.config || {});
38
+ }
39
+ /**
40
+ * Returns an instance of the application class
41
+ */
42
+ #getApp() {
43
+ return (this.#parameters.app || new AppFactory().create(new URL('./app/', import.meta.url), () => { }));
44
+ }
45
+ /**
46
+ * Returns an instance of the encryptor to encrypt
47
+ * signed URLs
48
+ */
49
+ #createEncryption() {
50
+ return this.#parameters.encryption || new EncryptionFactory().create();
51
+ }
52
+ /**
53
+ * Merge factory params
54
+ */
55
+ merge(params) {
56
+ Object.assign(this.#parameters, params);
57
+ return this;
58
+ }
59
+ /**
60
+ * Create server instance
61
+ */
62
+ create() {
63
+ return new Server(this.#getApp(), this.#createEncryption(), this.#getEmitter(), this.#getLogger(), this.#getConfig());
64
+ }
65
+ }
package/build/index.d.ts CHANGED
@@ -1,272 +1,14 @@
1
- import { H as HttpContext, S as ServerConfig, c as StatusPageRange, d as StatusPageRenderer, e as HttpError } from './main-e5b46c83.js';
2
- export { B as BriskRoute, f as Redirect, a as Request, b as Response, g as Route, h as RouteGroup, i as RouteResource, R as Router } from './main-e5b46c83.js';
3
- export { S as Server } from './main-29eaaee4.js';
4
- import { Exception } from '@poppinss/utils';
5
- import { Encryption } from '@adonisjs/encryption';
6
- import Macroable from '@poppinss/macroable';
7
- import { Level } from '@adonisjs/logger/types';
8
- import '@adonisjs/fold';
9
- import '@adonisjs/logger';
10
- import 'node:url';
11
- import 'node:http';
12
- import 'qs';
13
- import 'http';
14
- import 'stream';
15
- import '@poppinss/middleware';
16
- import '@poppinss/middleware/types';
17
- import 'node:stream';
18
- import '@adonisjs/application';
19
- import '@adonisjs/events';
20
- import 'node:https';
21
-
22
- declare const E_ROUTE_NOT_FOUND: new (args: [method: string, url: string], options?: ErrorOptions | undefined) => Exception;
23
- declare const E_CANNOT_LOOKUP_ROUTE: new (args: [routeIdentifier: string], options?: ErrorOptions | undefined) => Exception;
24
- declare const E_HTTP_EXCEPTION: {
25
- new (message?: string | undefined, options?: (ErrorOptions & {
26
- code?: string | undefined;
27
- status?: number | undefined;
28
- }) | undefined): {
29
- body: any;
30
- name: string;
31
- help?: string | undefined;
32
- code?: string | undefined;
33
- status: number;
34
- toString(): string;
35
- readonly [Symbol.toStringTag]: string;
36
- message: string;
37
- stack?: string | undefined;
38
- cause?: unknown;
39
- };
40
- code: string;
41
- /**
42
- * This method returns an instance of the exception class
43
- */
44
- invoke(body: any, status: number, code?: string): {
45
- body: any;
46
- name: string;
47
- help?: string | undefined;
48
- code?: string | undefined;
49
- status: number;
50
- toString(): string;
51
- readonly [Symbol.toStringTag]: string;
52
- message: string;
53
- stack?: string | undefined;
54
- cause?: unknown;
55
- };
56
- help?: string | undefined;
57
- status?: number | undefined;
58
- message?: string | undefined;
59
- captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
60
- prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
61
- stackTraceLimit: number;
62
- };
63
- declare const E_HTTP_REQUEST_ABORTED: {
64
- new (message?: string | undefined, options?: (ErrorOptions & {
65
- code?: string | undefined;
66
- status?: number | undefined;
67
- }) | undefined): {
68
- handle(error: any, ctx: HttpContext): void;
69
- body: any;
70
- name: string;
71
- help?: string | undefined;
72
- code?: string | undefined;
73
- status: number;
74
- toString(): string;
75
- readonly [Symbol.toStringTag]: string;
76
- message: string;
77
- stack?: string | undefined;
78
- cause?: unknown;
79
- };
80
- code: string;
81
- /**
82
- * This method returns an instance of the exception class
83
- */
84
- invoke(body: any, status: number, code?: string): {
85
- body: any;
86
- name: string;
87
- help?: string | undefined;
88
- code?: string | undefined;
89
- status: number;
90
- toString(): string;
91
- readonly [Symbol.toStringTag]: string;
92
- message: string;
93
- stack?: string | undefined;
94
- cause?: unknown;
95
- };
96
- help?: string | undefined;
97
- status?: number | undefined;
98
- message?: string | undefined;
99
- captureStackTrace(targetObject: object, constructorOpt?: Function | undefined): void;
100
- prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
101
- stackTraceLimit: number;
102
- };
103
-
104
- declare const exceptions_E_CANNOT_LOOKUP_ROUTE: typeof E_CANNOT_LOOKUP_ROUTE;
105
- declare const exceptions_E_HTTP_EXCEPTION: typeof E_HTTP_EXCEPTION;
106
- declare const exceptions_E_HTTP_REQUEST_ABORTED: typeof E_HTTP_REQUEST_ABORTED;
107
- declare const exceptions_E_ROUTE_NOT_FOUND: typeof E_ROUTE_NOT_FOUND;
108
- declare namespace exceptions {
109
- export {
110
- exceptions_E_CANNOT_LOOKUP_ROUTE as E_CANNOT_LOOKUP_ROUTE,
111
- exceptions_E_HTTP_EXCEPTION as E_HTTP_EXCEPTION,
112
- exceptions_E_HTTP_REQUEST_ABORTED as E_HTTP_REQUEST_ABORTED,
113
- exceptions_E_ROUTE_NOT_FOUND as E_ROUTE_NOT_FOUND,
114
- };
115
- }
116
-
117
- type UserDefinedServerConfig = Partial<Omit<ServerConfig, 'trustProxy'> & {
118
- trustProxy: ((address: string, distance: number) => boolean) | boolean | string;
119
- }>;
120
- /**
121
- * Define configuration for the HTTP server
122
- */
123
- declare function defineConfig(config: UserDefinedServerConfig): ServerConfig;
124
-
125
- /**
126
- * Cookie client exposes the API to parse/set AdonisJS cookies
127
- * as a client.
128
- */
129
- declare class CookieClient {
130
- #private;
131
- constructor(encryption: Encryption);
132
- /**
133
- * Encrypt a key value pair to be sent in the cookie header
134
- */
135
- encrypt(key: string, value: any): string | null;
136
- /**
137
- * Sign a key value pair to be sent in the cookie header
138
- */
139
- sign(key: string, value: any): string | null;
140
- /**
141
- * Encode a key value pair to be sent in the cookie header
142
- */
143
- encode(_: string, value: any): string | null;
144
- /**
145
- * Unsign a signed cookie value
146
- */
147
- unsign(key: string, value: string): any;
148
- /**
149
- * Decrypt an encrypted cookie value
150
- */
151
- decrypt(key: string, value: string): any;
152
- /**
153
- * Decode an encoded cookie value
154
- */
155
- decode(_: string, value: string): any;
156
- /**
157
- * Parse response cookie
158
- */
159
- parse(key: string, value: any): any;
160
- }
161
-
162
- /**
163
- * The base HTTP exception handler one can inherit from to handle
164
- * HTTP exceptions.
165
- *
166
- * The HTTP exception handler has support for
167
- *
168
- * - Ability to render exceptions by calling the render method on the exception.
169
- * - Rendering status pages
170
- * - Pretty printing errors during development
171
- * - Transforming errors to JSON or HTML using content negotiation
172
- * - Reporting errors
173
- */
174
- declare class ExceptionHandler extends Macroable {
175
- #private;
176
- /**
177
- * Whether or not to render debug info. When set to true, the errors
178
- * will have the complete error stack.
179
- */
180
- protected debug: boolean;
181
- /**
182
- * Whether or not to render status pages. When set to true, the unhandled
183
- * errors with matching status codes will be rendered using a status
184
- * page.
185
- */
186
- protected renderStatusPages: boolean;
187
- /**
188
- * A collection of error status code range and the view to render.
189
- */
190
- protected statusPages: Record<StatusPageRange, StatusPageRenderer>;
191
- /**
192
- * Enable/disable errors reporting
193
- */
194
- protected reportErrors: boolean;
195
- /**
196
- * An array of exception classes to ignore when
197
- * reporting an error
198
- */
199
- protected ignoreExceptions: any[];
200
- /**
201
- * An array of HTTP status codes to ignore when reporting
202
- * an error
203
- */
204
- protected ignoreStatuses: number[];
205
- /**
206
- * An array of error codes to ignore when reporting
207
- * an error
208
- */
209
- protected ignoreCodes: string[];
210
- /**
211
- * Error reporting context
212
- */
213
- protected context(ctx: HttpContext): any;
214
- /**
215
- * Returns the log level for an error based upon the error
216
- * status code.
217
- */
218
- protected getErrorLogLevel(error: HttpError): Level;
219
- /**
220
- * A boolean to control if errors should be rendered with
221
- * all the available debugging info.
222
- */
223
- protected isDebuggingEnabled(_: HttpContext): boolean;
224
- /**
225
- * Returns a boolean by checking if an error should be reported.
226
- */
227
- protected shouldReport(error: HttpError): boolean;
228
- /**
229
- * Renders an error to JSON response
230
- */
231
- renderErrorAsJSON(error: HttpError, ctx: HttpContext): Promise<void>;
232
- /**
233
- * Renders an error to JSON API response
234
- */
235
- renderErrorAsJSONAPI(error: HttpError, ctx: HttpContext): Promise<void>;
236
- /**
237
- * Renders an error to HTML response
238
- */
239
- renderErrorAsHTML(error: HttpError, ctx: HttpContext): Promise<void>;
240
- /**
241
- * Renders the validation error message to a JSON
242
- * response
243
- */
244
- renderValidationErrorAsJSON(error: HttpError, ctx: HttpContext): Promise<void>;
245
- /**
246
- * Renders the validation error message as per JSON API
247
- * spec
248
- */
249
- renderValidationErrorAsJSONAPI(error: HttpError, ctx: HttpContext): Promise<void>;
250
- /**
251
- * Renders the validation error as an HTML string
252
- */
253
- renderValidationErrorAsHTML(error: HttpError, ctx: HttpContext): Promise<void>;
254
- /**
255
- * Renders the error to response
256
- */
257
- renderError(error: HttpError, ctx: HttpContext): Promise<void>;
258
- /**
259
- * Renders the validation error to response
260
- */
261
- renderValidationError(error: HttpError, ctx: HttpContext): Promise<void>;
262
- /**
263
- * Reports an error during an HTTP request
264
- */
265
- report(error: unknown, ctx: HttpContext): Promise<void>;
266
- /**
267
- * Handles the error during the HTTP request.
268
- */
269
- handle(error: unknown, ctx: HttpContext): Promise<any>;
270
- }
271
-
272
- export { CookieClient, ExceptionHandler, HttpContext, defineConfig, exceptions as errors };
1
+ export { Request } from './src/request.js';
2
+ export { Response } from './src/response.js';
3
+ export { Redirect } from './src/redirect.js';
4
+ export { Server } from './src/server/main.js';
5
+ export { Router } from './src/router/main.js';
6
+ export { Route } from './src/router/route.js';
7
+ export * as errors from './src/exceptions.js';
8
+ export { BriskRoute } from './src/router/brisk.js';
9
+ export { RouteGroup } from './src/router/group.js';
10
+ export { defineConfig } from './src/define_config.js';
11
+ export { CookieClient } from './src/cookies/client.js';
12
+ export { HttpContext } from './src/http_context/main.js';
13
+ export { RouteResource } from './src/router/resource.js';
14
+ export { ExceptionHandler } from './src/exception_handler.js';