@adonisjs/http-server 8.0.0-next.1 → 8.0.0-next.10

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 (67) hide show
  1. package/build/chunk-2QM3D5BN.js +87 -0
  2. package/build/chunk-5PWHBE2E.js +128 -0
  3. package/build/chunk-QDK57QGB.js +1176 -0
  4. package/build/{chunk-HMYAZG76.js → chunk-YBLFT4O6.js} +1146 -1663
  5. package/build/factories/http_context.d.ts +2 -1
  6. package/build/factories/http_server.d.ts +7 -0
  7. package/build/factories/main.js +33 -5
  8. package/build/factories/qs_parser_factory.d.ts +3 -2
  9. package/build/factories/request.d.ts +1 -0
  10. package/build/factories/response.d.ts +1 -0
  11. package/build/factories/router.d.ts +1 -0
  12. package/build/factories/server_factory.d.ts +1 -0
  13. package/build/factories/url_builder_factory.d.ts +3 -2
  14. package/build/index.d.ts +4 -1
  15. package/build/index.js +97 -42
  16. package/build/src/client/helpers.d.ts +37 -0
  17. package/build/src/client/types.d.ts +203 -0
  18. package/build/src/client/url_builder.d.ts +15 -0
  19. package/build/src/client/url_builder.js +12 -0
  20. package/build/src/cookies/client.d.ts +61 -3
  21. package/build/src/cookies/drivers/encrypted.d.ts +13 -0
  22. package/build/src/cookies/drivers/plain.d.ts +9 -0
  23. package/build/src/cookies/drivers/signed.d.ts +13 -0
  24. package/build/src/cookies/parser.d.ts +18 -0
  25. package/build/src/cookies/serializer.d.ts +21 -2
  26. package/build/src/debug.d.ts +13 -0
  27. package/build/src/define_config.d.ts +20 -4
  28. package/build/src/define_middleware.d.ts +20 -4
  29. package/build/src/errors.d.ts +60 -5
  30. package/build/src/exception_handler.d.ts +93 -39
  31. package/build/src/helpers.d.ts +57 -0
  32. package/build/src/helpers.js +9 -1
  33. package/build/src/http_context/local_storage.d.ts +17 -0
  34. package/build/src/http_context/main.d.ts +68 -10
  35. package/build/src/qs.d.ts +30 -2
  36. package/build/src/redirect.d.ts +84 -12
  37. package/build/src/request.d.ts +118 -12
  38. package/build/src/response.d.ts +416 -203
  39. package/build/src/response_status.d.ts +14 -0
  40. package/build/src/router/brisk.d.ts +15 -4
  41. package/build/src/router/executor.d.ts +4 -0
  42. package/build/src/router/factories/use_return_value.d.ts +5 -0
  43. package/build/src/router/group.d.ts +18 -1
  44. package/build/src/router/legacy/url_builder.d.ts +14 -14
  45. package/build/src/router/main.d.ts +79 -22
  46. package/build/src/router/matchers.d.ts +3 -0
  47. package/build/src/router/resource.d.ts +34 -1
  48. package/build/src/router/route.d.ts +28 -3
  49. package/build/src/router/signed_url_builder.d.ts +4 -8
  50. package/build/src/router/store.d.ts +9 -0
  51. package/build/src/server/factories/middleware_handler.d.ts +10 -1
  52. package/build/src/server/factories/route_finder.d.ts +13 -3
  53. package/build/src/server/factories/write_response.d.ts +9 -2
  54. package/build/src/server/main.d.ts +77 -23
  55. package/build/src/tracing_channels.d.ts +4 -4
  56. package/build/src/types/middleware.d.ts +34 -9
  57. package/build/src/types/qs.d.ts +5 -0
  58. package/build/src/types/request.d.ts +1 -1
  59. package/build/src/types/response.d.ts +14 -6
  60. package/build/src/types/route.d.ts +42 -42
  61. package/build/src/types/server.d.ts +26 -11
  62. package/build/src/types/tracing_channels.d.ts +21 -3
  63. package/build/src/types/url_builder.d.ts +10 -135
  64. package/build/src/utils.d.ts +71 -6
  65. package/package.json +26 -22
  66. package/build/chunk-ASX56VAK.js +0 -76
  67. package/build/src/router/url_builder.d.ts +0 -14
@@ -15,10 +15,11 @@ export declare class HttpContextFactory {
15
15
  #private;
16
16
  /**
17
17
  * Merge factory params
18
+ * @param params - Partial factory parameters to merge
18
19
  */
19
20
  merge(params: Partial<FactoryParameters>): this;
20
21
  /**
21
- * Create request
22
+ * Create HTTP context instance
22
23
  */
23
24
  create(): HttpContext;
24
25
  }
@@ -1,5 +1,12 @@
1
1
  import { type IncomingMessage, type Server, type ServerResponse } from 'node:http';
2
+ /**
3
+ * HTTP server factory for testing purposes
4
+ */
2
5
  export declare const httpServer: {
6
+ /**
7
+ * Creates a new HTTP server for testing with automatic cleanup
8
+ * @param handler - The request handler function
9
+ */
3
10
  create(handler: (req: IncomingMessage, res: ServerResponse) => any | Promise<any>): Promise<{
4
11
  server: Server;
5
12
  url: string;
@@ -6,8 +6,10 @@ import {
6
6
  Router,
7
7
  Server,
8
8
  defineConfig
9
- } from "../chunk-HMYAZG76.js";
10
- import "../chunk-ASX56VAK.js";
9
+ } from "../chunk-YBLFT4O6.js";
10
+ import "../chunk-QDK57QGB.js";
11
+ import "../chunk-5PWHBE2E.js";
12
+ import "../chunk-2QM3D5BN.js";
11
13
 
12
14
  // factories/router.ts
13
15
  import { AppFactory } from "@adonisjs/application/factories";
@@ -15,6 +17,9 @@ import { EncryptionFactory } from "@adonisjs/encryption/factories";
15
17
 
16
18
  // factories/qs_parser_factory.ts
17
19
  var QsParserFactory = class {
20
+ /**
21
+ * Default configuration options for the QS parser
22
+ */
18
23
  #options = {
19
24
  parse: {
20
25
  depth: 5,
@@ -31,7 +36,8 @@ var QsParserFactory = class {
31
36
  }
32
37
  };
33
38
  /**
34
- * Merge encryption factory options
39
+ * Merge QS parser factory options
40
+ * @param options - Partial options to merge with existing configuration
35
41
  */
36
42
  merge(options) {
37
43
  Object.assign(this.#options.parse, options.parse);
@@ -39,7 +45,7 @@ var QsParserFactory = class {
39
45
  return this;
40
46
  }
41
47
  /**
42
- * Create instance of the logger class
48
+ * Create instance of the QS parser class
43
49
  */
44
50
  create() {
45
51
  return new Qs(this.#options);
@@ -48,6 +54,9 @@ var QsParserFactory = class {
48
54
 
49
55
  // factories/router.ts
50
56
  var RouterFactory = class {
57
+ /**
58
+ * Factory parameters for creating router instances
59
+ */
51
60
  #parameters = {};
52
61
  /**
53
62
  * Returns an instance of the application class
@@ -64,6 +73,7 @@ var RouterFactory = class {
64
73
  }
65
74
  /**
66
75
  * Merge factory params
76
+ * @param params - Partial factory parameters to merge
67
77
  */
68
78
  merge(params) {
69
79
  Object.assign(this.#parameters, params);
@@ -84,6 +94,9 @@ import { randomUUID } from "crypto";
84
94
  import { IncomingMessage, ServerResponse } from "http";
85
95
  import { EncryptionFactory as EncryptionFactory2 } from "@adonisjs/encryption/factories";
86
96
  var RequestFactory = class {
97
+ /**
98
+ * Factory parameters for creating request instances
99
+ */
87
100
  #parameters = {};
88
101
  /**
89
102
  * Returns the config for the request class
@@ -115,6 +128,7 @@ var RequestFactory = class {
115
128
  }
116
129
  /**
117
130
  * Returns the HTTP res object
131
+ * @param req - The incoming message request object
118
132
  */
119
133
  #createResponse(req) {
120
134
  return this.#parameters.res || new ServerResponse(req);
@@ -128,6 +142,7 @@ var RequestFactory = class {
128
142
  }
129
143
  /**
130
144
  * Merge factory params
145
+ * @param params - Partial factory parameters to merge
131
146
  */
132
147
  merge(params) {
133
148
  Object.assign(this.#parameters, params);
@@ -153,6 +168,9 @@ import { Socket as Socket2 } from "net";
153
168
  import { IncomingMessage as IncomingMessage2, ServerResponse as ServerResponse2 } from "http";
154
169
  import { EncryptionFactory as EncryptionFactory3 } from "@adonisjs/encryption/factories";
155
170
  var ResponseFactory = class {
171
+ /**
172
+ * Factory parameters for creating response instances
173
+ */
156
174
  #parameters = {};
157
175
  /**
158
176
  * Returns the config for the request class
@@ -185,6 +203,7 @@ var ResponseFactory = class {
185
203
  }
186
204
  /**
187
205
  * Returns the HTTP res object
206
+ * @param req - The incoming message request object
188
207
  */
189
208
  #createResponse(req) {
190
209
  return this.#parameters.res || new ServerResponse2(req);
@@ -198,6 +217,7 @@ var ResponseFactory = class {
198
217
  }
199
218
  /**
200
219
  * Merge factory params
220
+ * @param params - Partial factory parameters to merge
201
221
  */
202
222
  merge(params) {
203
223
  Object.assign(this.#parameters, params);
@@ -225,6 +245,9 @@ import { Emitter } from "@adonisjs/events";
225
245
  import { AppFactory as AppFactory2 } from "@adonisjs/application/factories";
226
246
  import { EncryptionFactory as EncryptionFactory4 } from "@adonisjs/encryption/factories";
227
247
  var ServerFactory = class {
248
+ /**
249
+ * Factory parameters for creating server instances
250
+ */
228
251
  #parameters = {};
229
252
  /**
230
253
  * Returns the emitter instance
@@ -259,6 +282,7 @@ var ServerFactory = class {
259
282
  }
260
283
  /**
261
284
  * Merge factory params
285
+ * @param params - Partial factory parameters to merge
262
286
  */
263
287
  merge(params) {
264
288
  Object.assign(this.#parameters, params);
@@ -282,6 +306,9 @@ var ServerFactory = class {
282
306
  import { Container } from "@adonisjs/fold";
283
307
  import { LoggerFactory } from "@adonisjs/logger/factories";
284
308
  var HttpContextFactory = class {
309
+ /**
310
+ * Factory parameters for creating HTTP context instances
311
+ */
285
312
  #parameters = {};
286
313
  /**
287
314
  * Returns the request class instance
@@ -303,13 +330,14 @@ var HttpContextFactory = class {
303
330
  }
304
331
  /**
305
332
  * Merge factory params
333
+ * @param params - Partial factory parameters to merge
306
334
  */
307
335
  merge(params) {
308
336
  Object.assign(this.#parameters, params);
309
337
  return this;
310
338
  }
311
339
  /**
312
- * Create request
340
+ * Create HTTP context instance
313
341
  */
314
342
  create() {
315
343
  return new HttpContext(
@@ -7,14 +7,15 @@ import type { QSParserConfig } from '../src/types/qs.ts';
7
7
  export declare class QsParserFactory {
8
8
  #private;
9
9
  /**
10
- * Merge encryption factory options
10
+ * Merge QS parser factory options
11
+ * @param options - Partial options to merge with existing configuration
11
12
  */
12
13
  merge(options: Partial<{
13
14
  parse: Partial<QSParserConfig['parse']>;
14
15
  stringify: Partial<QSParserConfig['stringify']>;
15
16
  }>): this;
16
17
  /**
17
- * Create instance of the logger class
18
+ * Create instance of the QS parser class
18
19
  */
19
20
  create(): Qs;
20
21
  }
@@ -18,6 +18,7 @@ export declare class RequestFactory {
18
18
  #private;
19
19
  /**
20
20
  * Merge factory params
21
+ * @param params - Partial factory parameters to merge
21
22
  */
22
23
  merge(params: Partial<FactoryParameters>): this;
23
24
  /**
@@ -18,6 +18,7 @@ export declare class ResponseFactory {
18
18
  #private;
19
19
  /**
20
20
  * Merge factory params
21
+ * @param params - Partial factory parameters to merge
21
22
  */
22
23
  merge(params: Partial<FactoryParameters>): this;
23
24
  /**
@@ -13,6 +13,7 @@ export declare class RouterFactory {
13
13
  #private;
14
14
  /**
15
15
  * Merge factory params
16
+ * @param params - Partial factory parameters to merge
16
17
  */
17
18
  merge(params: Partial<FactoryParameters>): this;
18
19
  /**
@@ -19,6 +19,7 @@ export declare class ServerFactory {
19
19
  #private;
20
20
  /**
21
21
  * Merge factory params
22
+ * @param params - Partial factory parameters to merge
22
23
  */
23
24
  merge(params: Partial<FactoryParameters>): this;
24
25
  /**
@@ -12,14 +12,15 @@ export declare class URLBuilderFactory<Routes extends LookupList> {
12
12
  #private;
13
13
  /**
14
14
  * Merge factory params
15
+ * @param params - Partial factory parameters to merge
15
16
  */
16
17
  merge(params: Partial<FactoryParameters>): this;
17
18
  /**
18
19
  * Create URL builder helpers
19
20
  */
20
21
  create(): {
21
- urlFor: import("../src/types/url_builder.ts").UrlFor<Routes>;
22
- signedUrlFor: import("../src/types/url_builder.ts").UrlFor<Routes, import("../src/types/url_builder.ts").SignedURLOptions>;
22
+ urlFor: import("../src/client/types.ts").UrlFor<Routes>;
23
+ signedUrlFor: import("../src/client/types.ts").UrlFor<Routes, import("../src/types/url_builder.ts").SignedURLOptions>;
23
24
  };
24
25
  }
25
26
  export {};
package/build/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export { Qs } from './src/qs.ts';
1
2
  export * as errors from './src/errors.ts';
2
3
  export { Request } from './src/request.ts';
3
4
  export { Response } from './src/response.ts';
@@ -9,8 +10,10 @@ export { BriskRoute } from './src/router/brisk.ts';
9
10
  export { RouteGroup } from './src/router/group.ts';
10
11
  export { defineConfig } from './src/define_config.ts';
11
12
  export { CookieClient } from './src/cookies/client.ts';
13
+ export { CookieParser } from './src/cookies/parser.ts';
12
14
  export { HttpContext } from './src/http_context/main.ts';
13
15
  export { RouteResource } from './src/router/resource.ts';
14
16
  export { ResponseStatus } from './src/response_status.ts';
15
- export { ExceptionHandler } from './src/exception_handler.ts';
16
17
  export * as tracingChannels from './src/tracing_channels.ts';
18
+ export { ExceptionHandler } from './src/exception_handler.ts';
19
+ export { CookieSerializer } from './src/cookies/serializer.ts';
package/build/index.js CHANGED
@@ -1,58 +1,68 @@
1
1
  import {
2
- BriskRoute,
3
2
  CookieClient,
3
+ CookieParser,
4
+ CookieSerializer,
4
5
  E_CANNOT_LOOKUP_ROUTE,
5
6
  E_HTTP_EXCEPTION,
6
7
  E_HTTP_REQUEST_ABORTED,
7
8
  E_ROUTE_NOT_FOUND,
8
9
  HttpContext,
10
+ Qs,
9
11
  Redirect,
10
12
  Request,
11
13
  Response,
12
14
  ResponseStatus,
15
+ Router,
16
+ Server,
17
+ defineConfig,
18
+ errors_exports
19
+ } from "./chunk-YBLFT4O6.js";
20
+ import {
21
+ BriskRoute,
13
22
  Route,
14
23
  RouteGroup,
15
24
  RouteResource,
16
- Router,
17
- Server,
18
25
  canWriteResponseBody,
19
- defineConfig,
20
- errors_exports,
21
26
  parseRange,
22
27
  tracing_channels_exports
23
- } from "./chunk-HMYAZG76.js";
24
- import "./chunk-ASX56VAK.js";
28
+ } from "./chunk-QDK57QGB.js";
29
+ import "./chunk-5PWHBE2E.js";
30
+ import "./chunk-2QM3D5BN.js";
25
31
 
26
32
  // src/exception_handler.ts
27
33
  import is from "@sindresorhus/is";
28
34
  import Macroable from "@poppinss/macroable";
29
35
  var ExceptionHandler = class extends Macroable {
30
36
  /**
31
- * Computed from the status pages property
37
+ * Cached expanded status pages mapping individual status codes to their renderers
38
+ * Computed from the statusPages property when first accessed
32
39
  */
33
40
  #expandedStatusPages;
34
41
  /**
35
- * Whether or not to render debug info. When set to true, the errors
36
- * will have the complete error stack.
42
+ * Controls whether to include debug information in error responses
43
+ * When enabled, errors include complete stack traces and detailed debugging info
44
+ * Defaults to true in non-production environments
37
45
  */
38
46
  debug = process.env.NODE_ENV !== "production";
39
47
  /**
40
- * Whether or not to render status pages. When set to true, the unhandled
41
- * errors with matching status codes will be rendered using a status
42
- * page.
48
+ * Controls whether to render custom status pages for unhandled errors
49
+ * When enabled, errors with matching status codes use configured status page renderers
50
+ * Defaults to true in production environments
43
51
  */
44
52
  renderStatusPages = process.env.NODE_ENV === "production";
45
53
  /**
46
- * A collection of error status code range and the view to render.
54
+ * Mapping of HTTP status code ranges to their corresponding page renderers
55
+ * Supports ranges like '400-499' or individual codes like '404'
47
56
  */
48
57
  statusPages = {};
49
58
  /**
50
- * Enable/disable errors reporting
59
+ * Controls whether errors should be reported to logging systems
60
+ * When disabled, errors are handled but not logged or reported
51
61
  */
52
62
  reportErrors = true;
53
63
  /**
54
- * An array of exception classes to ignore when
55
- * reporting an error
64
+ * Array of exception class constructors to exclude from error reporting
65
+ * These exceptions are handled but not logged or reported to external systems
56
66
  */
57
67
  ignoreExceptions = [
58
68
  E_HTTP_EXCEPTION,
@@ -61,17 +71,19 @@ var ExceptionHandler = class extends Macroable {
61
71
  E_HTTP_REQUEST_ABORTED
62
72
  ];
63
73
  /**
64
- * An array of HTTP status codes to ignore when reporting
65
- * an error
74
+ * Array of HTTP status codes to exclude from error reporting
75
+ * Errors with these status codes are handled but not logged
66
76
  */
67
77
  ignoreStatuses = [400, 422, 401];
68
78
  /**
69
- * An array of error codes to ignore when reporting
70
- * an error
79
+ * Array of custom error codes to exclude from error reporting
80
+ * Errors with these codes are handled but not logged
71
81
  */
72
82
  ignoreCodes = [];
73
83
  /**
74
- * Expands status pages
84
+ * Expands status page ranges into individual status code mappings
85
+ * Creates a cached lookup table for faster status page resolution
86
+ * @returns Mapping of status codes to renderers
75
87
  */
76
88
  #expandStatusPages() {
77
89
  if (!this.#expandedStatusPages) {
@@ -87,8 +99,10 @@ var ExceptionHandler = class extends Macroable {
87
99
  return this.#expandedStatusPages;
88
100
  }
89
101
  /**
90
- * Forcefully tweaking the type of the error object to
91
- * have known properties.
102
+ * Normalizes any thrown value into a standardized HttpError object
103
+ * Ensures the error has required properties like message and status
104
+ * @param error - Any thrown value (Error, string, object, etc.)
105
+ * @returns {HttpError} Normalized error object with status and message
92
106
  */
93
107
  #toHttpError(error) {
94
108
  const httpError = is.object(error) ? error : new Error(String(error));
@@ -101,7 +115,10 @@ var ExceptionHandler = class extends Macroable {
101
115
  return httpError;
102
116
  }
103
117
  /**
104
- * Error reporting context
118
+ * Provides additional context information for error reporting
119
+ * Includes request ID when available for correlation across logs
120
+ * @param ctx - HTTP context containing request information
121
+ * @returns Additional context data for error reporting
105
122
  */
106
123
  context(ctx) {
107
124
  const requestId = ctx.request.id();
@@ -110,8 +127,10 @@ var ExceptionHandler = class extends Macroable {
110
127
  } : {};
111
128
  }
112
129
  /**
113
- * Returns the log level for an error based upon the error
114
- * status code.
130
+ * Determines the appropriate log level based on HTTP status code
131
+ * 5xx errors are logged as 'error', 4xx as 'warn', others as 'info'
132
+ * @param error - HTTP error object with status code
133
+ * @returns {Level} Appropriate logging level for the error
115
134
  */
116
135
  getErrorLogLevel(error) {
117
136
  if (error.status >= 500) {
@@ -123,14 +142,19 @@ var ExceptionHandler = class extends Macroable {
123
142
  return "info";
124
143
  }
125
144
  /**
126
- * A boolean to control if errors should be rendered with
127
- * all the available debugging info.
145
+ * Determines whether debug information should be included in error responses
146
+ * Override this method to implement context-specific debug control
147
+ * @param _ - HTTP context (unused in base implementation)
148
+ * @returns {boolean} True if debugging should be enabled
128
149
  */
129
150
  isDebuggingEnabled(_) {
130
151
  return this.debug;
131
152
  }
132
153
  /**
133
- * Returns a boolean by checking if an error should be reported.
154
+ * Determines whether an error should be reported to logging systems
155
+ * Checks against ignore lists for exceptions, status codes, and error codes
156
+ * @param error - HTTP error to evaluate for reporting
157
+ * @returns {boolean} True if the error should be reported
134
158
  */
135
159
  shouldReport(error) {
136
160
  if (this.reportErrors === false) {
@@ -148,7 +172,10 @@ var ExceptionHandler = class extends Macroable {
148
172
  return true;
149
173
  }
150
174
  /**
151
- * Renders an error to JSON response
175
+ * Renders an error as a JSON response
176
+ * In debug mode, includes full stack trace using Youch
177
+ * @param error - HTTP error to render
178
+ * @param ctx - HTTP context for the request
152
179
  */
153
180
  async renderErrorAsJSON(error, ctx) {
154
181
  if (this.isDebuggingEnabled(ctx)) {
@@ -160,7 +187,10 @@ var ExceptionHandler = class extends Macroable {
160
187
  ctx.response.status(error.status).send({ message: error.message });
161
188
  }
162
189
  /**
163
- * Renders an error to JSON API response
190
+ * Renders an error as a JSON API compliant response
191
+ * Follows JSON API specification for error objects
192
+ * @param error - HTTP error to render
193
+ * @param ctx - HTTP context for the request
164
194
  */
165
195
  async renderErrorAsJSONAPI(error, ctx) {
166
196
  if (this.isDebuggingEnabled(ctx)) {
@@ -180,7 +210,10 @@ var ExceptionHandler = class extends Macroable {
180
210
  });
181
211
  }
182
212
  /**
183
- * Renders an error to HTML response
213
+ * Renders an error as an HTML response
214
+ * Uses status pages if configured, otherwise shows debug info or simple message
215
+ * @param error - HTTP error to render
216
+ * @param ctx - HTTP context for the request
184
217
  */
185
218
  async renderErrorAsHTML(error, ctx) {
186
219
  const statusPages = this.#expandStatusPages();
@@ -203,8 +236,10 @@ var ExceptionHandler = class extends Macroable {
203
236
  ctx.response.status(error.status).send(`<p> ${error.message} </p>`);
204
237
  }
205
238
  /**
206
- * Renders the validation error message to a JSON
207
- * response
239
+ * Renders validation error messages as a JSON response
240
+ * Returns errors in a simple format with field-specific messages
241
+ * @param error - Validation error containing messages array
242
+ * @param ctx - HTTP context for the request
208
243
  */
209
244
  async renderValidationErrorAsJSON(error, ctx) {
210
245
  ctx.response.status(error.status).send({
@@ -212,8 +247,10 @@ var ExceptionHandler = class extends Macroable {
212
247
  });
213
248
  }
214
249
  /**
215
- * Renders the validation error message as per JSON API
216
- * spec
250
+ * Renders validation error messages as JSON API compliant response
251
+ * Transforms validation messages to JSON API error object format
252
+ * @param error - Validation error containing messages array
253
+ * @param ctx - HTTP context for the request
217
254
  */
218
255
  async renderValidationErrorAsJSONAPI(error, ctx) {
219
256
  ctx.response.status(error.status).send({
@@ -230,7 +267,10 @@ var ExceptionHandler = class extends Macroable {
230
267
  });
231
268
  }
232
269
  /**
233
- * Renders the validation error as an HTML string
270
+ * Renders validation error messages as an HTML response
271
+ * Creates simple HTML list of field errors separated by line breaks
272
+ * @param error - Validation error containing messages array
273
+ * @param ctx - HTTP context for the request
234
274
  */
235
275
  async renderValidationErrorAsHTML(error, ctx) {
236
276
  ctx.response.status(error.status).type("html").send(
@@ -240,7 +280,10 @@ var ExceptionHandler = class extends Macroable {
240
280
  );
241
281
  }
242
282
  /**
243
- * Renders the error to response
283
+ * Renders an error to the appropriate response format based on content negotiation
284
+ * Supports HTML, JSON API, and JSON formats based on Accept headers
285
+ * @param error - HTTP error to render
286
+ * @param ctx - HTTP context for the request
244
287
  */
245
288
  renderError(error, ctx) {
246
289
  switch (ctx.request.accepts(["html", "application/vnd.api+json", "json"])) {
@@ -254,7 +297,10 @@ var ExceptionHandler = class extends Macroable {
254
297
  }
255
298
  }
256
299
  /**
257
- * Renders the validation error to response
300
+ * Renders validation errors to the appropriate response format based on content negotiation
301
+ * Supports HTML, JSON API, and JSON formats for validation error messages
302
+ * @param error - Validation error to render
303
+ * @param ctx - HTTP context for the request
258
304
  */
259
305
  renderValidationError(error, ctx) {
260
306
  switch (ctx.request.accepts(["html", "application/vnd.api+json", "json"])) {
@@ -268,7 +314,10 @@ var ExceptionHandler = class extends Macroable {
268
314
  }
269
315
  }
270
316
  /**
271
- * Reports an error during an HTTP request
317
+ * Reports an error to logging systems if reporting is enabled
318
+ * Allows errors to self-report via their own report method if available
319
+ * @param error - Any error object to report
320
+ * @param ctx - HTTP context for additional reporting context
272
321
  */
273
322
  async report(error, ctx) {
274
323
  const httpError = this.#toHttpError(error);
@@ -290,7 +339,10 @@ var ExceptionHandler = class extends Macroable {
290
339
  );
291
340
  }
292
341
  /**
293
- * Handles the error during the HTTP request.
342
+ * Handles errors during HTTP request processing
343
+ * Delegates to error's own handle method if available, otherwise renders response
344
+ * @param error - Any error object to handle
345
+ * @param ctx - HTTP context for error handling
294
346
  */
295
347
  async handle(error, ctx) {
296
348
  const httpError = this.#toHttpError(error);
@@ -306,8 +358,11 @@ var ExceptionHandler = class extends Macroable {
306
358
  export {
307
359
  BriskRoute,
308
360
  CookieClient,
361
+ CookieParser,
362
+ CookieSerializer,
309
363
  ExceptionHandler,
310
364
  HttpContext,
365
+ Qs,
311
366
  Redirect,
312
367
  Request,
313
368
  Response,
@@ -0,0 +1,37 @@
1
+ import { type ClientRouteMatchItTokens, type ClientRouteJSON, type URLOptions } from './types.ts';
2
+ /**
3
+ * Finds a route by its identifier across domains.
4
+ *
5
+ * Searches for routes by name, pattern, or controller reference. When no domain
6
+ * is specified, searches across all domains. Supports legacy lookup strategies
7
+ * for backwards compatibility.
8
+ *
9
+ * @param domainsRoutes - Object mapping domain names to route arrays
10
+ * @param routeIdentifier - Route name, pattern, or controller reference to find
11
+ * @param domain - Optional domain to limit search scope
12
+ * @param method - Optional HTTP method to filter routes
13
+ * @param disableLegacyLookup - Whether to disable pattern and controller lookup
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * const route = findRoute(routes, 'users.show', 'api', 'GET')
18
+ * const route2 = findRoute(routes, '/users/:id', undefined, 'GET')
19
+ * ```
20
+ */
21
+ export declare function findRoute<Route extends ClientRouteJSON>(domainsRoutes: {
22
+ [domain: string]: Route[];
23
+ }, routeIdentifier: string, domain?: string, method?: string, disableLegacyLookup?: boolean): null | Route;
24
+ /**
25
+ * Makes URL for a given route pattern using its parsed tokens. The
26
+ * tokens could be generated using the "parseRoute" method.
27
+ *
28
+ * @param pattern - The route pattern
29
+ * @param tokens - Array of parsed route tokens
30
+ * @param searchParamsStringifier - Function to stringify query parameters
31
+ * @param params - Route parameters as array or object
32
+ * @param options - URL options
33
+ * @returns {string} The generated URL
34
+ */
35
+ export declare function createURL(pattern: string, tokens: Pick<ClientRouteMatchItTokens, 'val' | 'type' | 'end'>[], searchParamsStringifier: (qs: Record<string, any>) => string, params?: any[] | {
36
+ [param: string]: any;
37
+ }, options?: URLOptions): string;